From fc63d7366d0b9b9b5437e9573b78d9bb532de31a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Jan 2020 22:22:59 +0100 Subject: [PATCH] FIX Mandatory fields must stay mandatory if create/update submit fails --- htdocs/core/lib/functions.lib.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2e86e88460d..60b19fed58f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7417,7 +7417,7 @@ function printCommonFooter($zone = 'private') if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'), '/').'/', '', $relativepathstring); $relativepathstring = preg_replace('/^\//', '', $relativepathstring); $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); - $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING'])); + //$tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING'])); if (!empty($user->default_values[$relativepathstring]['focus'])) { foreach ($user->default_values[$relativepathstring]['focus'] as $defkey => $defval) @@ -7429,7 +7429,9 @@ function printCommonFooter($zone = 'private') $foundintru = 0; foreach ($tmpqueryarraytohave as $tmpquerytohave) { - if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru = 1; + $tmpquerytohaveparam = explode('=', $tmpquerytohave); + //print "console.log('".$tmpquerytohaveparam[0]." ".$tmpquerytohaveparam[1]." ".GETPOST($tmpquerytohaveparam[0])."');"; + if (!GETPOSTISSET($tmpquerytohaveparam[0]) || ($tmpquerytohaveparam[1] != GETPOST($tmpquerytohaveparam[0]))) $foundintru = 1; } if (!$foundintru) $qualified = 1; //var_dump($defkey.'-'.$qualified); @@ -7459,7 +7461,9 @@ function printCommonFooter($zone = 'private') $foundintru = 0; foreach ($tmpqueryarraytohave as $tmpquerytohave) { - if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru = 1; + $tmpquerytohaveparam = explode('=', $tmpquerytohave); + //print "console.log('".$tmpquerytohaveparam[0]." ".$tmpquerytohaveparam[1]." ".GETPOST($tmpquerytohaveparam[0])."');"; + if (!GETPOSTISSET($tmpquerytohaveparam[0]) || ($tmpquerytohaveparam[1] != GETPOST($tmpquerytohaveparam[0]))) $foundintru = 1; } if (!$foundintru) $qualified = 1; //var_dump($defkey.'-'.$qualified);