The problem is that in the pdf model, it is printed with too many decimals.
While the currency fields are limited according to the settings, here I can’t format it with only 2 decimals.
Can anyone give me a suggestion?
I had a look at the code but unfortunately I couldn’t get to the spot that is producing that output, I’d have to spend more time on it, which I am afraid I don’t have…
Are you using a debugger? Can you step through the code until you get there?
modules/AOS_PDF_Templates/templateParser.php
you see the field types being handled, like enum, radio. you can add decimal here and change the format or strip the extra zeros. In order to make it upgrade safe, you have to move the generatePDF.php to custom directory first and then the templateParser.php
If this can be fixed in templateParser.php and the fix is to respect the decimals specified in the field definition, then we should just fix this for everyone and make the fix in core. That way you wouldn’t have to worry about being upgrade-safe.
Hi,
adding if ($ field_def ['type'] == 'decimal') {
in templateParser is correct and the pdf is formatted as desired.
However, to make safe changes in custom it is not enough to edit the generatepdf file here require_once ('custom / modules / AOS_PDF_Templates / templateParser.php');
Evidently it is called in other places in the code and therefore it is necessary to make more changes to make it work.
At the moment I don’t know where else is called.