From 4f7be362496bcb3de295a9dcd1ae11ef1dde6446 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Wed, 7 Nov 2018 09:14:29 +0100 Subject: [PATCH 1/3] fix extrafield hidden --- htdocs/core/class/commonobject.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 88386521079..67e06ea59f3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6142,7 +6142,7 @@ abstract class CommonObject if (! is_object($form)) $form=new Form($db); $out = ''; - + if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0) { $out .= "\n"; @@ -6152,6 +6152,10 @@ abstract class CommonObject $e = 0; foreach($extrafields->attributes[$this->table_element]['label'] as $key=>$label) { + if(empty($extrafields->attribute_list[$key]) && $mode == 'view'){ + continue; + } + $enabled = 1; if ($enabled && isset($extrafields->attributes[$this->table_element]['list'][$key])) { From 500bb7bc96ad53080389559277163db8fb30afee Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 13 Nov 2018 10:20:34 +0100 Subject: [PATCH 2/3] best conditions testing --- htdocs/core/class/commonobject.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 67e06ea59f3..870de68948f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6152,7 +6152,8 @@ abstract class CommonObject $e = 0; foreach($extrafields->attributes[$this->table_element]['label'] as $key=>$label) { - if(empty($extrafields->attribute_list[$key]) && $mode == 'view'){ + if (isset($extrafields->attributes[$this->table_element]['list'][$key]) + && empty($extrafields->attributes[$this->table_element]['list'][$key]) && $mode == 'view'){ continue; } From 129034ba766b449c05ad57703a09e4a70d2d596e Mon Sep 17 00:00:00 2001 From: atm-ph Date: Mon, 19 Nov 2018 15:46:30 +0100 Subject: [PATCH 3/3] Fix new params has been added not optional --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 88386521079..6e8edf4e3e8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5053,7 +5053,7 @@ abstract class CommonObject * @return int -1=error, O=did nothing, 1=OK * @see setValueFrom, insertExtraFields */ - function updateExtraField($key, $trigger, $userused) + function updateExtraField($key, $trigger=null, $userused=null) { global $conf,$langs,$user;