Update "submitted only" module options

Don't update to the null value options absent from the posted parameters.
This commit is contained in:
simicar29 2020-01-24 09:23:08 +01:00 committed by GitHub
parent 12b4909c45
commit 65cc1202ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,11 +34,15 @@ if ($action == 'update' && is_array($arrayofparameters))
$ok=true;
foreach($arrayofparameters as $key => $val)
{
$result=dolibarr_set_const($db, $key, GETPOST($key, 'alpha'), 'chaine', 0, '', $conf->entity);
if ($result < 0)
// Modify constant only if key was posted (avoid resetting key to the null value)
if (GETPOSTISSET($key))
{
$ok=false;
break;
$result=dolibarr_set_const($db, $key, GETPOST($key, 'alpha'), 'chaine', 0, '', $conf->entity);
if ($result < 0)
{
$ok=false;
break;
}
}
}