-->
Welcome, Guest
Username: Password: Remember me
You can also tweak your setup of Dolibarr by setting hidden configurations found in Dolibarr Setup Other

TOPIC: Extrafields Float format more decimals

Extrafields Float format more decimals 3 months 1 week ago #37475

  • fbosman
  • fbosman's Avatar
  • OFFLINE
  • Newcomer
  • Posts: 6
  • Karma: 0
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
The administrator has disabled public write access.

Extrafields Float format more decimals 3 months 1 week ago #37478

  • ksar
  • ksar's Avatar
  • OFFLINE
  • Moderator
  • Posts: 322
  • Thank you received: 86
  • Karma: 14
Hello,

Normally float extrafields are not limited to 2 decimals.
What is your configuration ?
The administrator has disabled public write access.

Extrafields Float format more decimals 3 months 1 week ago #37479

  • fbosman
  • fbosman's Avatar
  • OFFLINE
  • Newcomer
  • Posts: 6
  • Karma: 0
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
The administrator has disabled public write access.

Extrafields Float format more decimals 3 months 1 week ago #37487

  • fbosman
  • fbosman's Avatar
  • OFFLINE
  • Newcomer
  • Posts: 6
  • Karma: 0
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
The administrator has disabled public write access.
Time to create page: 0.065 seconds