diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0d3ab9162dd..3781d66b0db 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6635,7 +6635,8 @@ abstract class CommonObject $perms = dol_eval($extrafields->attributes[$this->table_element]['perms'][$key], 1); } - if (($mode == 'create' || $mode == 'edit') && abs($visibility) != 1 && abs($visibility) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list + if (($mode == 'create') && abs($visibility) != 1 && abs($visibility) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list + elseif (($mode == 'edit') && abs($visibility) != 1 && abs($visibility) != 3 && abs($visibility) != 4) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list and <> 4 = not visible at the creation elseif ($mode == 'view' && empty($visibility)) continue; if (empty($perms)) continue; // Load language if required @@ -6663,9 +6664,11 @@ abstract class CommonObject case "view": $value = $this->array_options["options_".$key.$keysuffix]; break; - case "edit": - $getposttemp = GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none'); // GETPOST can get value from GET, POST or setup of default values. - // GETPOST("options_" . $key) can be 'abc' or array(0=>'abc') + case "create": + case "edit": + + $getposttemp = GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none'); // GETPOST can get value from GET, POST or setup of default values. + // GETPOST("options_" . $key) can be 'abc' or array(0=>'abc') if (is_array($getposttemp) || $getposttemp != '' || GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) { if (is_array($getposttemp)) { @@ -6769,7 +6772,8 @@ abstract class CommonObject case "view": $out .= $extrafields->showOutputField($key, $value); break; - case "edit": + case "create": + case "edit": $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element); break; } diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index ecf137adb04..a48cf36c117 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -127,7 +127,7 @@ class FormTicket * @param int $withdolfichehead With dol_fiche_head * @return void */ - public function showForm($withdolfichehead = 0) + public function showForm($withdolfichehead = 0, $mode = 'edit') { global $conf, $langs, $user, $hookmanager; @@ -414,7 +414,7 @@ class FormTicket $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $ticketstat, $this->action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { - print $ticketstat->showOptionals($extrafields, 'edit'); + print $ticketstat->showOptionals($extrafields, 'create'); } print ''; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 1ef3ef07255..e6cbad245d9 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -73,7 +73,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] //print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'
'."\n"; if (empty($enabled)) continue; // 0 = Never visible field - if (abs($enabled) != 1 && abs($enabled) != 3 && abs($enabled) != 5) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list + if (abs($enabled) != 1 && abs($enabled) != 3 && abs($enabled) != 5 && abs($enabled) != 4) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list <> 4 = not visible at the creation if (empty($perms)) continue; // 0 = Not visible // Load language if required diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 8ca8bd22bfe..d59581fa914 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -637,7 +637,7 @@ if ($action == 'create' || $action == 'presend') $defaultref = ''; } - $formticket->showForm(1); + $formticket->showForm(1, 'create'); } if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen'