Hi,
I need some Extrafields and these are floats and I need 2,4 or 6 decimals. However Dolibarr will only display 2 decimals (it uses the price format for floats).
Is there a way to show more decimals?
regards,
Frans
Hi,
I need some Extrafields and these are floats and I need 2,4 or 6 decimals. However Dolibarr will only display 2 decimals (it uses the price format for floats).
Is there a way to show more decimals?
regards,
Frans
Hello,
Normally float extrafields are not limited to 2 decimals.
What is your configuration ?
Hi,
thank you for your fast reply.
I can store the needed decimals, but on display on the card it uses the price function with the defaults for the currency. In my case this is 2 decimals. It seems that it ignores the size definition in the field definition.
regards,
Frans
I did get it to work somehow:
In module core/actions_extrafields_inc.php
alter line 30: $extrasize=GETPOST(‘size’,‘int’);
to
$extrasize=GETPOST(‘size’,‘intcomma’);
otherwise a float will always have length 24,8
in module core/class/extrafields.class.php:
alter line 1543:
if (!empty($value)) {
$value=price($value);
to
if (!empty($value)) {
// $value=price($value);
$sizeparts = explode(",",$size);
$number_decimals = $sizeparts[1];
$value=price($value, 0, $langs, 0, 0, $number_decimals, ‘’);
I’m not very good in php, hope this is right and can be merged into the core.
regards,
Frans