Fix timesheet merge into spreadsheet lost numbers

This commit is contained in:
nathan 2024-11-29 08:55:19 -07:00
parent eb3ae5c887
commit 6bf48819bd
2 changed files with 8 additions and 5 deletions

View File

@ -1427,6 +1427,12 @@ abstract class Merge
foreach($this->numeric_fields as $fieldname)
{
$names[] = preg_quote($fieldname, '/');
$raw_placeholder = $this->prefix("", $fieldname . '_-raw-', '$');
if(!array_key_exists($raw_placeholder, $replacements))
{
$replacements[$raw_placeholder] = $replacements[$this->prefix("", $fieldname, '$')];
$replacements[$this->prefix("", $fieldname, '$')] = self::number_format($replacements[$raw_placeholder], 2, $this->mimetype);
}
}
$this->format_spreadsheet_numbers($content, $names, $mimetype . $mso_application_progid);
}

View File

@ -39,7 +39,8 @@ class timesheet_merge extends Api\Storage\Merge
'$$ts_duration$$',
'$$ts_paused$$',
'$$ts_quantity$$',
'$$ts_unitprice$$'
'$$ts_unitprice$$',
'$$ts_total$$'
);
/**
@ -133,10 +134,6 @@ class timesheet_merge extends Api\Storage\Merge
$array = $record->get_record_array();
$array['ts_total'] = $array['ts_quantity'] * $array['ts_unitprice'];
foreach(array('ts_duration','ts_paused','ts_quantity','ts_unitprice','ts_total') as $key)
{
$array[$key] = self::number_format($array[$key],2,$this->mimetype);
}
// Set any missing custom fields, or the marker will stay
foreach(array_keys($this->bo->customfields) as $name)