Skip to content

Commit

Permalink
Update "submitted only" module options
Browse files Browse the repository at this point in the history
Don't update to the null value options absent from the posted parameters.
  • Loading branch information
simicar29 committed Jan 24, 2020
1 parent 12b4909 commit 65cc120
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions htdocs/core/actions_setmoduleoptions.inc.php
Expand Up @@ -34,11 +34,15 @@
$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;
}
}
}

Expand Down

0 comments on commit 65cc120

Please sign in to comment.