2
0
forked from Wavyzz/dolibarr

init array_options in current object if we don't have record for it (#29689)

* init array_options in current object   if we don't have record for it

* pre-commit

* change '' to null

* change comment

---------

Co-authored-by: jpb <jean-pascal.boudet@atm-consulting>
This commit is contained in:
boudet jean pascal
2024-05-15 19:10:14 +02:00
committed by GitHub
parent 82b3fd0739
commit bdfe5d0afd

View File

@@ -6385,6 +6385,16 @@ abstract class CommonObject
}
}
}
} else {
/**
We are in a situation where the current object has no values in its extra fields.
We want to initialize all the values to null so that the array_option is accessible in other contexts (especially in document generation).
**/
if (is_array($extrafields->attributes[$this->table_element]['label'])) {
foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
$this->array_options['options_' . $key] = null;
}
}
}
// If field is a computed field, value must become result of compute (regardless of whether a row exists