FIX array for arrayofkeyval is lost in module builder edit of property

This commit is contained in:
ldestailleur 2025-08-05 01:04:22 +02:00
parent 86f5db7aa9
commit ecf73afe86
2 changed files with 6 additions and 9 deletions

View file

@ -828,13 +828,12 @@ function GETPOSTISARRAY($paramname, $method = 0)
* @param string $check Type of check
* '' or 'none'=no check (deprecated)
* 'password'=allow characters for a password
* 'email'=allow characters for an email
* 'email'=allow characters for an email "email@domain.com"
* 'array', 'array:restricthtml' or 'array:aZ09' to check it's an array
* 'int'=check it's numeric (integer or float)
* 'intcomma'=check it's integer+comma ('1,2,3,4...')
* 'alpha'=Same than alphanohtml
* 'alphawithlgt'=alpha with lgt
* 'alphanohtml'=check there is no html content and no " and no ../
* 'alphanohtml'=check there is no html content and no " and no ../ ('alpha' is an alias of 'alphanohtml')
* 'alphawithlgt'=alpha with lgt and no " and no ../ (Can be used for email string like "Name <email@domain.com>")
* 'aZ'=check it's a-z only
* 'aZ09'=check it's simple alpha string (recommended for keys)
* 'aZ09arobase'=check it's a string for an element type ('myobject@mymodule')
@ -1190,7 +1189,6 @@ function GETPOSTINT($paramname, $method = 0)
return (int) GETPOST($paramname, 'int', $method, null, null, 0);
}
/**
* Return the value of a $_GET or $_POST supervariable, converted into float.
*
@ -1205,7 +1203,6 @@ function GETPOSTFLOAT($paramname, $rounding = '')
return (float) price2num(GETPOST($paramname), $rounding, 2);
}
/**
* Helper function that combines values of a dolibarr DatePicker (such as Form::selectDate) for year, month, day (and
* optionally hour, minute, second) fields to return a timestamp.
@ -1353,7 +1350,7 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options
}
break;
case 'alpha': // No html and no ../ and "
case 'alphanohtml': // Recommended for most scalar parameters and search parameters
case 'alphanohtml': // Recommended for most scalar parameters and search parameters. Not valid for json string.
if (!is_array($out)) {
$out = trim($out);
do {
@ -1392,7 +1389,7 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options
} while ($oldstringtoclean != $out);
}
break;
case 'nohtml': // No html
case 'nohtml': // No html. Valid for JSON strings.
$out = dol_string_nohtmltag($out, 0);
break;
case 'restricthtmlnolink':

View file

@ -1856,7 +1856,7 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
'name' => GETPOST('propname', 'aZ09'),
'label' => GETPOST('proplabel', 'alpha'),
'type' => strtolower(GETPOST('proptype', 'alpha')),
'arrayofkeyval' => GETPOST('proparrayofkeyval', 'alphawithlgt'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
'arrayofkeyval' => GETPOST('proparrayofkeyval', 'nohtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
'visible' => GETPOST('propvisible', 'alphanohtml'),
'enabled' => GETPOST('propenabled', 'alphanohtml'),
'position' => GETPOSTINT('propposition'),