N°1827 fix freeze on object creation when changing dependant field, if object has hidden TagSet field

This commit is contained in:
Pierre Goiffon
2018-12-11 15:09:21 +01:00
parent 44b7821015
commit b4a6d378ab
2 changed files with 13 additions and 1 deletions

View File

@@ -176,7 +176,15 @@ class WizardHelper
}
else if ($oAttDef instanceof AttributeTagSet) // AttributeDate is derived from AttributeDateTime
{
$value = json_decode($value, true);
if (is_null($value))
{
// happens if field is hidden (see N°1827)
$value = array();
}
else
{
$value = json_decode($value, true);
}
$oTagSet = new ormTagSet(get_class($oObj), $sAttCode, $oAttDef->GetMaxItems());
$oTagSet->SetValues($value['orig_value']);
$oTagSet->ApplyDelta($value);

View File

@@ -49,6 +49,10 @@ final class ormTagSet extends ormSet
*/
public function SetValues($aTagCodes)
{
if (is_null($aTagCodes))
{
$aTagCodes = array();
}
if (!is_array($aTagCodes))
{
throw new CoreUnexpectedValue("Wrong value {$aTagCodes} for {$this->sClass}:{$this->sAttCode}");