Skip to content

Commit

Permalink
Show extrafields only when enabled
Browse files Browse the repository at this point in the history
Show extrafields only in context where they are enabled (especially in edit mode that uses the showOptionals function).
  • Loading branch information
simicar29 committed Feb 10, 2020
1 parent 342d55a commit 8bce409
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion htdocs/core/class/commonobject.class.php
Expand Up @@ -6624,7 +6624,12 @@ public function showOptionals($extrafields, $mode = 'view', $params = null, $key
if (is_array($params) && array_key_exists('onlykey', $params) && $key != $params['onlykey']) continue;

// @todo Add test also on 'enabled' (different than 'list' that is 'visibility')
//$enabled = 1;
$enabled = 1;
if ($enabled && isset($extrafields->attributes[$this->table_element]['enabled'][$key]))
{
$enabled = dol_eval($extrafields->attributes[$this->table_element]['enabled'][$key], 1);
}
if (empty($enabled)) continue;

$visibility = 1;
if ($visibility && isset($extrafields->attributes[$this->table_element]['list'][$key]))
Expand Down

0 comments on commit 8bce409

Please sign in to comment.