diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a09ae3722d4..3631a6509ee 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4604,7 +4604,7 @@ abstract class CommonObject */ function showOptionals($extrafields, $mode='view', $params=null, $keyprefix='') { - global $_POST, $conf, $langs; + global $_POST, $conf, $langs, $action; $out = ''; @@ -4633,9 +4633,10 @@ abstract class CommonObject $value=$this->array_options["options_".$key]; break; case "edit": - // GETPOST("options_" . $key) can be 'abc' or array(0=>'abc') $getposttemp = GETPOST('options_'.$key, 'none'); // GETPOST can get value from GET, POST or setup of default values. - if (isset($getposttemp)) { + // GETPOST("options_" . $key) can be 'abc' or array(0=>'abc') + if (is_array($getposttemp) || $getposttemp != '' || GETPOSTISSET('options_'.$key)) + { if (is_array($getposttemp)) { // $getposttemp is an array but following code expects a comma separated string $value = implode(",", $getposttemp); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 552b030e88f..dcba7e20739 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -240,6 +240,16 @@ function dol_shutdown() dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth)?' (Warn: db disconnection forced, transaction depth was '.$depth.')':''), (($disconnectdone && $depth)?LOG_WARNING:LOG_INFO)); } +/** + * Return true if we are in a context of submitting a parameter + * + * @param string $paramname Name or parameter to test + * @return boolean True if we have just submit a POST or GET request with the parameter provided (even if param is empty) + */ +function GETPOSTISSET($paramname) +{ + return (isset($_POST['name']) || isset($_GET['name'])); +} /** * Return value of a param into GET or POST supervariable. diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 1d447a9ad0f..b08a8b7db1b 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -992,7 +992,7 @@ else print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print ''; @@ -1402,7 +1402,7 @@ else $object->oldcopy = clone $object; - if (GETPOST('name')) + if (GETPOSTISSET('name')) { // We overwrite with values if posted $object->name = GETPOST('name', 'alpha');