Check $showOnlyThisFields before setting defaults BT#12641

remotes/angel/1.11.x
jmontoyaa 8 years ago
parent 3c97672b52
commit 205587f9ed
  1. 13
      main/inc/lib/extra_field.lib.php

@ -476,7 +476,18 @@ class ExtraField extends Model
$extraData = self::get_handler_extra_data($itemId);
if ($form) {
$form->setDefaults($extraData);
if (!empty($showOnlyThisFields)) {
$setData = [];
foreach ($showOnlyThisFields as $variable) {
$extraName = 'extra_'.$variable;
if (in_array($extraName, array_keys($extraData))) {
$setData[$extraName] = $extraData[$extraName];
};
}
$form->setDefaults($setData);
} else {
$form->setDefaults($extraData);
}
}
}

Loading…
Cancel
Save