diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f2b173f60585c..a85fbb38bd43e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8232,7 +8232,8 @@ public function showOptionals($extrafields, $mode = 'view', $params = null, $key // Output value of the current field if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { - $extrafields_collapse_num = ''; + $extrafields_collapse_num = $key; + /* $extrafield_param = $extrafields->attributes[$this->table_element]['param'][$key]; if (!empty($extrafield_param) && is_array($extrafield_param)) { $extrafield_param_list = array_keys($extrafield_param['options']); @@ -8245,10 +8246,15 @@ public function showOptionals($extrafields, $mode = 'view', $params = null, $key } } } + */ // if colspan=0 or 1, the second column is not extended, so the separator must be on 2 columns $out .= $extrafields->showSeparator($key, $this, ($colspan ? $colspan + 1 : 2), $display_type, $mode); + + $lastseparatorkeyfound = $key; } else { + $collapse_group = $extrafields_collapse_num.(!empty($this->id) ? '_'.$this->id : ''); + $class = (!empty($extrafields->attributes[$this->table_element]['hidden'][$key]) ? 'hideobject ' : ''); $csstyle = ''; if (is_array($params) && count($params) > 0) { @@ -8319,13 +8325,13 @@ public function showOptionals($extrafields, $mode = 'view', $params = null, $key $helptoshow = $langs->trans($extrafields->attributes[$this->table_element]['help'][$key]); if ($display_type == 'card') { - $out .= ''; + $out .= ''; if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && ($action == 'view' || $action == 'valid' || $action == 'editline' || $action == 'confirm_valid' || $action == 'confirm_cancel')) { $out .= ''; } $out .= ''; + $out .= '
'; $out .= '
table_element.'_extrafields_'.$key]) || GETPOST('ignorecollapsesetup', 'int')) ? (empty($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) ? false : true) : ($extrafield_collapse_display_value == 2 ? false : true)); } + // SPE KOESIO TK2501-3511: BACKPORT FROM 18.0 + $disabledcookiewrite = 0; if ($mode == 'create') { - $extrafield_collapse_display_value = 0; + // On create mode, force separator group to not be collapsable + $extrafield_collapse_display_value = 1; + $expand_display = true; // We force group to be shown expanded + $disabledcookiewrite = 1; // We keep status of group unchanged into the cookie } + // END SPE KOESIO TK2501-3511: BACKPORT FROM 18.0 $out = '<'.$tagtype.' id="trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'" class="trextrafieldseparator trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'">'; $out .= '<'.$tagtype_dyn.' '.(!empty($colspan)?'colspan="' . $colspan . '"':'').'>'; @@ -2015,19 +2021,23 @@ public function showSeparator($key, $object, $colspan = 2, $display_type = 'card // Set the collapse_display status to cookie in priority or if ignorecollapsesetup is 1, if cookie and ignorecollapsesetup not defined, use the setup. $this->expand_display[$collapse_group] = $expand_display; - if (!empty($conf->use_javascript_ajax) && $mode != 'create') { + // SPE KOESIO TK2501-3511: BACKPORT FROM 18.0 + if (!empty($conf->use_javascript_ajax)) { $out .= ''."\n"; - $out .= '