1 / 4
Apr 2021

Hello all, (@hadi.nategh),

while playing around with the im-/export I recognized, that the convert function in “class.importexport_export_csv.inc.php” field-type float won’t be triggered for regular fields also as for costum fields.
Depending what is set in common preferences number format.

error description, to verify: (@StefanU)
select in common settings number format “1234,56”.
create a custom field of type float, fill it with a comma value
for example fill in pm the planned budget with a comma value
make a csv export where the custom field from above is included.
no matter what settings are set in common settings number format, there will always be a point as decimal separator.

For the import the same is true, a comma is not converted to a point, the float value is not imported, is not saved.
can anyone confirm this?

For custom fields I fixed it by adding the following case in “class.importexport_export_csv.inc.php” line 247 :

switch($c_field['type']) {
case 'float' : 
   $fields['float'][] = $name;
   break;
case 'date':

And for regular fileds it could be fixed in the app specific export class.
For example in pm “class.projectmanager_export_projects_csv.inc.php” line 23

// Used in conversions
static $types = array(
  'float' => array('pm_planned_budget', ........),
  'select-account' => array('pm_creator','pm_modifier'),
  'date-time' => array('pm_modified','pm_created'),

If my solution is correct, I would be pleased if this is included in the next fix.

greetings
Jürgen

  • created

    Apr '21
  • last reply

    Apr '21
  • 3

    replies

  • 1.2k

    views

  • 3

    users

Not all the fields exported are directly from the database, some are calculated. Custom field information does come from the definitions, it just wasn’t being passed along for floats.
Jürgen’s fix was the simplest way to deal with it, and matches what we have.

Thanks Jürgen, I’ve made the changes.