Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending export controler / adding calculated values to pdf.twig export template #3

Open
apiening opened this issue Sep 9, 2020 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@apiening
Copy link

apiening commented Sep 9, 2020

I have created a copy of an already existing PDF template and saved it unter var/export/myexport.pdf.twig. I modified it to my needs and this worked pretty well.

Now I want to add custom rounding to the duration field where some math is implied. Since I was not able to achieve this just with twig filters, I would like to add an extra field like duration_rounded and do the calculation of this value in PHP.

What would be the best / update safe way to implement this?
Is it possible to register to a hook or extend the controller?

@kevinpapst
Copy link
Member

I think using your own plugin with a simple Twig filter should be sufficient.

@apiening
Copy link
Author

Thank you.
I was able to do the rounding in my template with a few set var = <calculation> steps in between.

I'm still wondering, if I would like to add a custom twig filter, would this be possible to be done update proof like it is possible with Invoice templates placed under /var/export/ so that they don't get overwritten?

@kevinpapst
Copy link
Member

Plugins will never be overwritten during updates.
A plugin is more complex to setup though, but thats what this repository is made for.

@kevinpapst kevinpapst added the documentation Improvements or additions to documentation label May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants