I’m currently working on implementing a Swiss QR-Bill template in v5. To make it as dynamic as possible, I have to work with custom fields.
I come across a weird problem when switching the currency formats between Symbol and Code (ref Client with CHF, currency not shown - Self-Hosted | v5 - Discourse).
When using “Code” as Currency Format, the amounts contain the currency name (e.g. CHF) inside the variable. You can see this very good when I use the fields $amount
, $total
and $balance
in the template:
<p>Amount is: $amount</p>
<p>Total is: $total</p>
<p>Balance is: $balance</p>
When I switch to “Symbol”, the fields only contain the sum without any currency text:
This is what I need to create the Swiss QR Bill template. If the $amount contains anything different than a float, the creation of the Swiss QR Bill payment slip fails. So far so good, but now the currency is missing in the “totals” section of the invoice.
I can currently work around with this using the $balance_due_raw
field (in hope that this value correctly represents the invoice amount to be paid), but IMHO the fields $amount
, $total
and $balance
should only contain the float number and never the currency as additional text. The currency can still be read using the $client.currency
field.