FIX #19014 - the properties of some fields are not updated when you submit the form

+ reformatting (one line per array item)
This commit is contained in:
atm-florian 2021-10-21 18:24:03 +02:00
parent 136807645d
commit 2468c0e120

View File

@ -1296,19 +1296,31 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
}
if (!$error) {
$addfieldentry = array(
'name'=>GETPOST('propname', 'aZ09'), 'label'=>GETPOST('proplabel', 'alpha'), 'type'=>GETPOST('proptype', 'alpha'),
'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
'visible'=>GETPOST('propvisible', 'int'), 'enabled'=>GETPOST('propenabled', 'int'),
'position'=>GETPOST('propposition', 'int'), 'notnull'=>GETPOST('propnotnull', 'int'), 'index'=>GETPOST('propindex', 'int'), 'searchall'=>GETPOST('propsearchall', 'int'),
'isameasure'=>GETPOST('propisameasure', 'int'), 'comment'=>GETPOST('propcomment', 'alpha'), 'help'=>GETPOST('prophelp', 'alpha'),
'css'=>GETPOST('propcss', 'aZ09'), 'cssview'=>GETPOST('propcssview', 'aZ09'), 'csslist'=>GETPOST('propcsslist', 'aZ09')
);
}
if (!$error) {
$addfieldentry = array(
'name'=>GETPOST('propname', 'aZ09'),
'label'=>GETPOST('proplabel', 'alpha'),
'type'=>GETPOST('proptype', 'alpha'),
'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
'visible'=>GETPOST('propvisible', 'int'),
'enabled'=>GETPOST('propenabled', 'int'),
'position'=>GETPOST('propposition', 'int'),
'notnull'=>GETPOST('propnotnull', 'int'),
'index'=>GETPOST('propindex', 'int'),
'searchall'=>GETPOST('propsearchall', 'int'),
'isameasure'=>GETPOST('propisameasure', 'int'),
'comment'=>GETPOST('propcomment', 'alpha'),
'help'=>GETPOST('prophelp', 'alpha'),
'css'=>GETPOST('propcss', 'aZ09'),
'cssview'=>GETPOST('propcssview', 'aZ09'),
'csslist'=>GETPOST('propcsslist', 'aZ09'),
'default'=>GETPOST('propdefault', 'restricthtml'),
'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
);
if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
$addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
}
if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
$addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
}
}
@ -2800,7 +2812,7 @@ if ($module == 'initmodule') {
print '<input class="center" name="propvisible" size="2" value="'.dol_escape_htmltag($propvisible).'">';
print '</td>';
print '<td>';
print '<input class="center" name="propnoeditable" size="2" value="'.dol_escape_htmltag($propnoteditable).'">';
print '<input class="center" name="propnoteditable" size="2" value="'.dol_escape_htmltag($propnoteditable).'">';
print '</td>';
print '<td>';
print '<input class="center" name="propsearchall" size="2" value="'.dol_escape_htmltag($propsearchall).'">';