2
0
forked from Wavyzz/dolibarr
This commit is contained in:
Laurent Destailleur
2017-10-09 10:43:19 +02:00
parent 67c33840cf
commit 3e0ccd6312
3 changed files with 16 additions and 5 deletions

View File

@@ -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);

View File

@@ -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.

View File

@@ -992,7 +992,7 @@ else
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="private" value='.$object->particulier.'>';
print '<input type="hidden" name="type" value='.GETPOST("type").'>';
print '<input type="hidden" name="type" value='.GETPOST("type",'alpha').'>';
print '<input type="hidden" name="LastName" value="'.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName').'">';
print '<input type="hidden" name="ThirdPartyName" value="'.$langs->trans('ThirdPartyName').'">';
if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print '<input type="hidden" name="code_auto" value="1">';
@@ -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');