kraft icon indicating copy to clipboard operation
kraft copied to clipboard

Looking for a list of available template variables

Open Moini opened this issue 4 years ago • 3 comments

Hi again, @dragotin :)

Where can I find a complete list of all available template variables provided by kraft for the new, html-based template type?

I found https://volle-kraft-voraus.de/Main/TemplateVariables - but those look quite different from those used in, e.g. https://github.com/dragotin/kraft/blob/master/reports/invoice_kfg.gtmpl and https://github.com/dragotin/kraft/blob/master/reports/invoice.gtmpl .
Are the example files that are included 'complete', i.e. do they contain all available variables or are there any others hidden somewhere? How can I find those? (I'm fine with finding a list in the source code).

Of special interest to me: if a document is a follow-up document, I would like to have the numbers of the previous documents available.

Are they accessible as variables (i.e. in an order confirmation (Auftragsbestätigung), can I access the offer number (Angebotsnummer))?

Moini avatar Nov 10 '21 01:11 Moini

Indeed the predecessor number was not yet added to the weasyprint template variables. Done in commit 41e10028cce5d9c3a9009687dbb68cab180b8c9d

Keeping this open for the list of available variables.

dragotin avatar Nov 10 '21 20:11 dragotin

Meanwhile, here are pointers to the sources which variables exist:

Document attributes: https://github.com/dragotin/kraft/blob/master/src/archdoc.h#L75 Item attributes and sums: https://github.com/dragotin/kraft/blob/master/src/archdocposition.h#L105 Translated labels: https://github.com/dragotin/kraft/blob/master/src/documenttemplate.cpp#L112

Not very convenient, but maybe that helps you out for now ;-)

Thanks for your reports!

dragotin avatar Nov 10 '21 20:11 dragotin

Thank you very much, that will help a lot!

Moini avatar Nov 10 '21 21:11 Moini