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:
Laurent Destailleur
2019-01-21 23:41:06 +01:00
committed by GitHub
2 changed files with 8 additions and 8 deletions

View File

@@ -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]);
}
}
// 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);