Merge pull request #24149 from ATM-Consulting/FIX_17.0_invalid_argument_log

FIX 17.0 PHP Warning invalid argument supplied for foreach
This commit is contained in:
Laurent Destailleur 2023-03-10 19:16:23 +01:00 committed by GitHub
commit fdfd87cd11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6090,13 +6090,15 @@ abstract class CommonObject
// If field is a computed field, value must become result of compute (regardless of whether a row exists
// in the element's extrafields table)
foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) {
//var_dump($conf->disable_compute);
if (empty($conf->disable_compute)) {
global $objectoffield; // We set a global variable to $objectoffield so
$objectoffield = $this; // we can use it inside computed formula
$this->array_options["options_".$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '');
if (is_array($extrafields->attributes[$this->table_element]['label'])){
foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) {
//var_dump($conf->disable_compute);
if (empty($conf->disable_compute)) {
global $objectoffield; // We set a global variable to $objectoffield so
$objectoffield = $this; // we can use it inside computed formula
$this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '');
}
}
}
}