When printing a quote to PDF, everything seems fine at the line items, if I use the default English language, but many users use Brazilian Portuguese language and when printing any quote to PDF, somehow the discount column displays only the amount format, not the percentage format, with the symbol %. So, if I enter a 10% discount for a product, in the detail view I can see the correct value: 10%, but when I print it to PDF, it shows 10.00. When I log into the system with the English language, the same quote shows me 10% in detail view and 10% in the PDF. To me, it doesn’t make sense, so I’m a little lost on how to mitigate this. Any help would be appreciated.
Hi,
It is likely that $app_strings[‘LBL_PERCENTAGE_SYMBOL’] is not defined in your Brazilian Portuguese translation
Hi! Thanks for the reply!
I did a search for ‘LBL_PERCENTAGE_SYMBOL’ and it showed up in the folder include/language:
include/language/pt_BR.lang.php:1524: ‘LBL_PERCENTAGE_SYMBOL’ => ‘%’,
include/language/en_us.lang.php:1597: ‘LBL_PERCENTAGE_SYMBOL’ => ‘%’,
Shouldn’t that be enough for the system to use it globally? Or do I need to change something in modules/AOS_PDF_Templates?
The problem might be in modules/AOS_PDF_Templates/ templateParser.php in that line:
if ($isValidator->isPercentageField($repl_arr[‘aos_products_quotes_discount’])) {
in your case, $repl_arr[‘aos_products_quotes_discount’] is the Brazilian translation for $app_list_strings[‘discount_list’][‘Percentage’]
and I guess isPercentageField probably does not recognize that as a percentage:
strpos(strtolower($fieldname), ‘pct’) !== false ||
strpos(strtolower($fieldname), ‘percent’) !== false ||
strpos(strtolower($fieldname), ‘percentage’) !== false) {
That’s right! I searched for ‘Percentage’ at include/language/pt_BR.lang.php and found this line:
$app_list_strings['discount_list']['Percentage'] = 'Perc';
I looked at the file include/language/en_us.lang.php and it shows like this:
$app_list_strings['discount_list']['Percentage'] = 'Pct';
So I changed ‘Perc’ to ‘Pct’ and it worked! Thank you!
Would it work like this?
strpos(strtolower($fieldname), ‘pct’) !== false ||
strpos(strtolower($fieldname), ‘percent’) !== false ||
strpos(strtolower($fieldname), ‘percentage’) !== false ||
strpos(strtolower($fieldname), $app_list_strings['discount_list']['Percentage']) !== false) {
This would be a fix for all languages…
@pqr,
Yes, it would certainly be better. (make sure you add global $app_list_strings