From badbc14c621c1c2dbab04366d1d8bac494c20d7a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 4 Dec 2024 09:39:03 +0100 Subject: [PATCH 1/4] FIX wrong param entity value --- htdocs/core/modules/oauth/generic_oauthcallback.php | 2 +- htdocs/core/modules/oauth/google_oauthcallback.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/oauth/generic_oauthcallback.php b/htdocs/core/modules/oauth/generic_oauthcallback.php index 72acdace030..20a6fa1e41c 100644 --- a/htdocs/core/modules/oauth/generic_oauthcallback.php +++ b/htdocs/core/modules/oauth/generic_oauthcallback.php @@ -340,7 +340,7 @@ if (!GETPOST('code') && !GETPOST('error')) { $storage->clearToken($genericstring); // Delete the token called ("Generic-".$storage->keyforprovider) $tmpuser = new User($db); - $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, 0, 1); // Load user. Can load with email_oauth2. + $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, -1, 1); // Load user. Can load with email_oauth2. if ($res > 0) { $username = $tmpuser->login; diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index 474f2724843..d9e823081d8 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -330,7 +330,7 @@ if (!GETPOST('code')) { $storage->clearToken('Google'); // Delete the token called ("Google-".$storage->keyforprovider) $tmpuser = new User($db); - $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, 0, 1); // Load user. Can load with email_oauth2. + $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, -1, 1); // Load user. Can load with email_oauth2. if ($res > 0) { $username = $tmpuser->login; From 87dd68a6050252e8ca1d14cfa35f31cec1340274 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 4 Dec 2024 10:03:11 +0100 Subject: [PATCH 2/4] FIX try to fix phpstan error --- htdocs/bom/bom_net_needs.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index b29e53743a3..75c06444f63 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -201,6 +201,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $object->fetch_product(); $manufacturedvalued = ''; if (!empty($object->product)) { + global $mysoc; $tmparray = $object->product->getSellPrice($mysoc, $mysoc); $manufacturedvalued = $tmparray['pu_ht'] * $object->qty; } From 0f50c8e1e8a82d6e20d335dc299e96b25a8a1a5a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 4 Dec 2024 10:22:28 +0100 Subject: [PATCH 3/4] Revert "FIX wrong param entity value" This reverts commit badbc14c621c1c2dbab04366d1d8bac494c20d7a. --- htdocs/core/modules/oauth/generic_oauthcallback.php | 2 +- htdocs/core/modules/oauth/google_oauthcallback.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/oauth/generic_oauthcallback.php b/htdocs/core/modules/oauth/generic_oauthcallback.php index 20a6fa1e41c..72acdace030 100644 --- a/htdocs/core/modules/oauth/generic_oauthcallback.php +++ b/htdocs/core/modules/oauth/generic_oauthcallback.php @@ -340,7 +340,7 @@ if (!GETPOST('code') && !GETPOST('error')) { $storage->clearToken($genericstring); // Delete the token called ("Generic-".$storage->keyforprovider) $tmpuser = new User($db); - $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, -1, 1); // Load user. Can load with email_oauth2. + $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, 0, 1); // Load user. Can load with email_oauth2. if ($res > 0) { $username = $tmpuser->login; diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index d9e823081d8..474f2724843 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -330,7 +330,7 @@ if (!GETPOST('code')) { $storage->clearToken('Google'); // Delete the token called ("Google-".$storage->keyforprovider) $tmpuser = new User($db); - $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, -1, 1); // Load user. Can load with email_oauth2. + $res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, 0, 1); // Load user. Can load with email_oauth2. if ($res > 0) { $username = $tmpuser->login; From 9aa4ce7ac56f8b31ba8ebd904e16f6efad2258ea Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 4 Dec 2024 10:31:48 +0100 Subject: [PATCH 4/4] FIX use GETPOST instead GETPOSTINT --- htdocs/core/login/functions_googleoauth.php | 2 +- htdocs/core/modules/oauth/generic_oauthcallback.php | 2 +- htdocs/core/modules/oauth/google_oauthcallback.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/login/functions_googleoauth.php b/htdocs/core/login/functions_googleoauth.php index c0a77655f29..f4e540b7447 100644 --- a/htdocs/core/login/functions_googleoauth.php +++ b/htdocs/core/login/functions_googleoauth.php @@ -53,7 +53,7 @@ function check_user_password_googleoauth($usertotest, $passwordtotest, $entityto // We save data of form into a variable $_SESSION['datafromloginform'] = array( - 'entity'=>GETPOSTINT('entity'), + 'entity'=>GETPOST('entity', 'int'), // avoid to return 0 if entity var not exists 'backtopage'=>GETPOST('backtopage'), 'tz'=>GETPOST('tz'), 'tz_string'=>GETPOST('tz_string'), diff --git a/htdocs/core/modules/oauth/generic_oauthcallback.php b/htdocs/core/modules/oauth/generic_oauthcallback.php index 72acdace030..2b47b7f798e 100644 --- a/htdocs/core/modules/oauth/generic_oauthcallback.php +++ b/htdocs/core/modules/oauth/generic_oauthcallback.php @@ -334,7 +334,7 @@ if (!GETPOST('code') && !GETPOST('error')) { dol_syslog("we received the login/email to log to, it is ".$useremail); $tmparray = (empty($_SESSION['datafromloginform']) ? array() : $_SESSION['datafromloginform']); - $entitytosearchuser = (isset($tmparray['entity']) ? $tmparray['entity'] : -1); + $entitytosearchuser = ((isset($tmparray['entity']) && $tmparray['entity'] != '') ? $tmparray['entity'] : -1); // Delete the old token $storage->clearToken($genericstring); // Delete the token called ("Generic-".$storage->keyforprovider) diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index 474f2724843..924b78bc07f 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -324,7 +324,7 @@ if (!GETPOST('code')) { dol_syslog("we received the login/email to log to, it is ".$useremail); $tmparray = (empty($_SESSION['datafromloginform']) ? array() : $_SESSION['datafromloginform']); - $entitytosearchuser = (isset($tmparray['entity']) ? $tmparray['entity'] : -1); + $entitytosearchuser = ((isset($tmparray['entity']) && $tmparray['entity'] != '') ? $tmparray['entity'] : -1); // Delete the old token $storage->clearToken('Google'); // Delete the token called ("Google-".$storage->keyforprovider)