Single template for standard/paid/overdue invoices

I already made this suggestion here: Single template for standard/paid/overdue but I think that I was misunderstood. I was not asking HOW to do it… I was asking if devs agree that this could become the standard form InvoicePlane.

How about use conditionals to merge this three templates in only one file?

example:
if the invoice is overdue a simple “if” will add overdue class to the html/pdf
if the invoice is paid another “if” will add payment text to the html/pdf
etc

In this way changing one file will reflect changes in all the templates without have to mirror changes on three files.

Last Update: 18.12.2017

It’s not about some if statements, it’s about maintaining a base that is easy to customize for as many users as possible. Merging everything into one template may lead to unnecessary bloat.
I prefer small, separated files instead of one monolithic file with 5000 lines of code. The next logical step would be to split the files into more separate ones where they can share parts of their templates.

Take the templates in IP: normal, paid, overdue. All three could have a single line of code like {{include 'contact.php'}} and the contact.php file would contain the client address, company address and the logo because they are the same across all three templates.
In my opinion this makes way more sense.

1 Like