From 7422fd9b07aa974df13e21cb2b9abee0512f7c53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Mar 2022 18:20:09 +0200 Subject: [PATCH] css on separators --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/core/class/extrafields.class.php | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3bb84eac492..f9bbb9ed879 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7860,7 +7860,7 @@ abstract class CommonObject } // 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); + $out .= $extrafields->showSeparator($key, $this, ($colspan ? $colspan + 1 : 2), $display_type, $mode); } else { $class = (!empty($extrafields->attributes[$this->table_element]['hidden'][$key]) ? 'hideobject ' : ''); $csstyle = ''; @@ -7993,7 +7993,7 @@ abstract class CommonObject $out .= $this->getJSListDependancies(); } - $out .= ' '."\n"; + $out .= ' '."\n"; } } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 08e4503748f..85f0de5de90 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1856,9 +1856,10 @@ class ExtraFields * @param string $object Object * @param int $colspan Value of colspan to use (it must includes the first column with title) * @param string $display_type "card" for form display, "line" for document line display (extrafields on propal line, order line, etc...) + * @param string $mode Show output ('view') or input ('create' or 'edit') for extrafield * @return string HTML code with line for separator */ - public function showSeparator($key, $object, $colspan = 2, $display_type = 'card') + public function showSeparator($key, $object, $colspan = 2, $display_type = 'card', $mode = '') { global $conf, $langs; @@ -1882,11 +1883,16 @@ class ExtraFields $extrafield_collapse_display_value = intval($extrafield_param_list[0]); $expand_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) || GETPOST('ignorecollapsesetup', 'int')) ? ($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key] ? true : false) : ($extrafield_collapse_display_value == 2 ? false : true)); } + if ($mode == 'create') { + $extrafield_collapse_display_value = 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 . '"':'').'>'; // Some js code will be injected here to manage the collapsing of extrafields - $out .= ' '; + // Output the picto + $out .= ''; + $out .= ' '; $out .= ''; $out .= $langs->trans($this->attributes[$object->table_element]['label'][$key]); $out .= ''; @@ -1900,7 +1906,7 @@ class ExtraFields // 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)) { + if (!empty($conf->use_javascript_ajax) && $mode != 'create') { $out .= ''."\n"; $out .= '