From 4fe942985fb93af06dc11fb749d662c2d74998c4 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 cbe6eab542a..75ec35cccf2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7421,7 +7421,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) @@ -7433,7 +7433,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); @@ -7463,7 +7465,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);