round currency fields to 0.05 (Swiss Francs)

Just fishing for ideas here.

I’ve been using custom fields and before_save logic hooks to round and store relevant currency fields as needed in Swiss Francs.
The smallest unit in CHF is 5 Rappens, i.e. 0.05.

I’m just wondering if there is a more SuiteCRM-inherent way to do this. Maybe the build-in currency unitilities could handle this in a global way?

I saw there’s a config-setting default_currency_significant_digits, but that won’t take care of rounding to 0.05 of course.

Any experience with this? Any ideas?

John, I have a similar issue to yours which is having the currency go from 2 significant figures, instead of 6. Have you been able to resolve this?

I’m not sure what you mean.

As far as I’ve seen the currency fields are always saved in the database with 6 decimal points, but by default are rendered with 2 decimal points in the CRM frontend.

What are you trying to achieve?

As mentioned there’s a config parameter called default_currency_significant_digits (change via config_override.php) that might be of interest?

As I posted here - https://suitecrm.com/forum/suitecrm-7-0-discussion/13217-currency-signficant-digits-for-email-template, I’m trying to show only 2 decimal points for currency that is pulled from an invoice template.

I’m using a variable for my template, but it displays as 100.000000 & I want it to display as 100.00.

Do you think I can accomplish this with the config_override.php? I found config_override.php, but how would I override the significant digits on invoice currencies? Where can I find documentation on using it?

Not sure about this. My experience has been that all currency fields are rendered correctly automatically… seems like a bug of some sorts?

I’ve never had my currencies show with more than 2 digits after the decimal point. in frontend, Emailtemplates or PDF-Templates.

If you want to futz around with it yourself you should be able to easily do your php magic in /modules/AOS_PDF_Templates/templateParser.php. Just add your own code in the section below:

foreach ($repl_arr as $name => $value) {
(around line 79)

Hello @John - EZS Thank you very muck ! This your comment enlightened me, i’ve found /templateParser.php and had a great solution for me.

My case - remove 2 zero digits behind (123.456,00) - if you need this : https://suitecrm.com/suitecrm/forum/suitecrm-7-0-discussion/27612-how-can-i-change-currency-significant-digits-for-pdf-generator#90002

1 Like