Merge pull request #10376 from atm-maxime/fix_extrafields_computed
Compute value of computed extrafield on fetch, not on show
This commit is contained in:
commit
eba8a8f34d
@ -4901,6 +4901,14 @@ abstract class CommonObject
|
|||||||
//var_dump('key '.$key.' '.$value.' type='.$extrafields->attributes[$this->table_element]['type'][$key].' '.$this->array_options["options_".$key]);
|
//var_dump('key '.$key.' '.$value.' type='.$extrafields->attributes[$this->table_element]['type'][$key].' '.$this->array_options["options_".$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If field is a computed field, value must become result of compute
|
||||||
|
foreach ($tab as $key => $value) {
|
||||||
|
if (! empty($extrafields) && !empty($extrafields->attributes[$this->table_element]['computed'][$key]))
|
||||||
|
{
|
||||||
|
$this->array_options["options_".$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|||||||
@ -1547,14 +1547,6 @@ class ExtraFields
|
|||||||
|
|
||||||
if ($hidden) return ''; // This is a protection. If field is hidden, we should just not call this method.
|
if ($hidden) return ''; // This is a protection. If field is hidden, we should just not call this method.
|
||||||
|
|
||||||
// If field is a computed field, value must become result of compute
|
|
||||||
if ($computed)
|
|
||||||
{
|
|
||||||
// Make the eval of compute string
|
|
||||||
//var_dump($computed);
|
|
||||||
$value = dol_eval($computed, 1, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
$showsize=0;
|
$showsize=0;
|
||||||
if ($type == 'date')
|
if ($type == 'date')
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user