FIX 11.0 Ticket Module - Visibility 4, don't display extrafields at the creation

This commit is contained in:
atm-lena 2020-04-03 14:24:59 +02:00
parent ee29125579
commit bc0d98b91c
4 changed files with 13 additions and 9 deletions

View File

@ -6634,7 +6634,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;
@ -6661,9 +6662,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)) {
@ -6768,7 +6771,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;
}

View File

@ -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 '</table>';

View File

@ -73,7 +73,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
//print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'<br>'."\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

View File

@ -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'