From d065f25e2b55f85ad24202a39977b183207d8946 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 3 Jul 2025 13:09:13 +0300 Subject: [PATCH 1/7] PHPStan > Update baseline (#34679) Co-authored-by: Dolibot --- dev/build/phpstan/phpstan-baseline.neon | 48 ------------------------- 1 file changed, 48 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index eb215259415..19fcdb5d3c3 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -9390,54 +9390,6 @@ parameters: count: 1 path: ../../../htdocs/core/lib/files.lib.php - - - message: '#^Parameter \#1 \$ftp of function ftp_cdup expects FTP\\Connection, resource given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/lib/ftp.lib.php - - - - message: '#^Parameter \#1 \$ftp of function ftp_chdir expects FTP\\Connection, resource given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/lib/ftp.lib.php - - - - message: '#^Parameter \#1 \$ftp of function ftp_close expects FTP\\Connection, resource given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/lib/ftp.lib.php - - - - message: '#^Parameter \#1 \$ftp of function ftp_delete expects FTP\\Connection, resource given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/lib/ftp.lib.php - - - - message: '#^Parameter \#1 \$ftp of function ftp_get expects FTP\\Connection, resource given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/lib/ftp.lib.php - - - - message: '#^Parameter \#1 \$ftp of function ftp_mkdir expects FTP\\Connection, resource given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/lib/ftp.lib.php - - - - message: '#^Parameter \#1 \$ftp of function ftp_put expects FTP\\Connection, resource given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/lib/ftp.lib.php - - - - message: '#^Parameter \#1 \$ftp of function ftp_rmdir expects FTP\\Connection, resource given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/lib/ftp.lib.php - - message: '#^Call to function is_array\(\) with array\ will always evaluate to true\.$#' identifier: function.alreadyNarrowedType From b506f03c62424d1281df560df5f99db78b0c6c19 Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Fri, 4 Jul 2025 08:54:01 +0200 Subject: [PATCH 2/7] Improve error messages returned by getURLContent (#34689) * enhance getURLContent error messages * fix CI --- htdocs/admin/remotestore/class/externalModules.class.php | 4 ++-- htdocs/core/class/conf.class.php | 2 +- htdocs/core/lib/geturl.lib.php | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/remotestore/class/externalModules.class.php b/htdocs/admin/remotestore/class/externalModules.class.php index 6869d9357a4..4657a3a1e68 100644 --- a/htdocs/admin/remotestore/class/externalModules.class.php +++ b/htdocs/admin/remotestore/class/externalModules.class.php @@ -778,8 +778,8 @@ class ExternalModules } } - if (!empty($request['response']['curl_error_msg'])) { - $error_message .= ' - ' . $request['response']['curl_error_msg']; + if (!empty($request['curl_error_msg'])) { + $error_message .= ' - ' . $request['curl_error_msg']; } // Return the formatted error message diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 77598f5b200..cf0e5b886a5 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -1293,7 +1293,7 @@ class Conf extends stdClass $this->global->MAIN_MODULE_DOLISTORE_API_SRV = 'https://www.dolistore.com/api/'; } if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) { - $this->global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567'; + $this->global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorepublicapi'; } // Enable by default the CSRF protection by token. diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index e36744e50cb..83563401120 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -178,7 +178,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = do { if ($maxRedirection < 1) { - break; + return array('http_code' => 400, 'content' => 'Maximum number of redirections reached', 'curl_error_no' => 1, 'curl_error_msg' => 'Maximum number of redirections reached'); } curl_setopt($ch, CURLOPT_URL, $newUrl); @@ -192,7 +192,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = if (in_array($hosttocheck, array('metadata.google.internal'))) { $info['http_code'] = 400; $info['content'] = 'Error bad hostname '.$hosttocheck.' (Used by Google metadata). This value for hostname is not allowed.'; - break; + return array('http_code' => 400, 'content' => $info['content'], 'curl_error_no' => 1, 'curl_error_msg' => $info['content']); } // Clean host name $hosttocheck to convert it into an IP $iptocheck @@ -220,7 +220,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = if ($tmpresult) { $info['http_code'] = 400; $info['content'] = $tmpresult; - break; + return array('http_code' => 400, 'content' => $tmpresult, 'curl_error_no' => 1, 'curl_error_msg' => $tmpresult); } } From 8772306b60b87aa6b0319bbc6cc22a10d54d2044 Mon Sep 17 00:00:00 2001 From: Alain Rihs Date: Fri, 4 Jul 2025 08:56:07 +0200 Subject: [PATCH 3/7] Update card.php (#34677) Since the improvement of the Prospect/Client/Supplier selection, the THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT variable is no longer taken into account. This code restores this functionality when creating a new third party. --- htdocs/societe/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 4d5361f9f49..eb9f28c26fc 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1449,8 +1449,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Prospect/Customer/Supplier $selected = $object->client; - $selectedcustomer = 0; - $selectedprospect = 0; + $selectedcustomer = (getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==1 || getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==3 ? 1 : 0); + $selectedprospect = (getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==2 || getDolGlobalInt('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')==3 ? 1 : 0); switch ($selected) { case 1: $selectedcustomer = 1; From 6c6846ed6e41199f21dab532c1a5abce716bfb58 Mon Sep 17 00:00:00 2001 From: atm-corentin <165782689+atm-corentin@users.noreply.github.com> Date: Fri, 4 Jul 2025 19:00:31 +0200 Subject: [PATCH 4/7] fix fatal when u try to add a newline on expensereport object we try to do a explode on Translate object (#34697) --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 13db338951e..963d5d861a7 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1259,7 +1259,7 @@ if (empty($reshook)) { $newlang = $tmpuser->lang; } if (empty($newlang)) { - $newlang = $langs; + $newlang = $langs->defaultlang; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); From 6608e972aba77d531d52ecf2b87e53691f80ee3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= <81741011+altairis-noe@users.noreply.github.com> Date: Fri, 4 Jul 2025 19:05:34 +0200 Subject: [PATCH 5/7] FIX: Trigger should be the same for same action (#34698) --- htdocs/expedition/card.php | 4 ++-- htdocs/expedition/shipment.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 565e20ced65..ff48e5e66f0 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -213,7 +213,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } - $result = $object->setValueFrom('ref_customer', GETPOST('ref_customer', 'alpha'), '', null, 'text', '', $user, 'SHIPMENT_MODIFY'); + $result = $object->setValueFrom('ref_customer', GETPOST('ref_customer', 'alpha'), '', null, 'text', '', $user, 'SHIPPING_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $action = 'editref_customer'; @@ -236,7 +236,7 @@ if (empty($reshook)) { if (!$error) { // Actions on extra fields - $result = $object->updateExtraField($attribute_name, 'SHIPMENT_MODIFY'); + $result = $object->updateExtraField($attribute_name, 'SHIPPING_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 4dd45ab12a9..26f8cdeb4f8 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -209,7 +209,7 @@ if (empty($reshook)) { } if (!$error) { - $result = $object->updateExtraField($attribute_name, 'SHIPMENT_MODIFY'); + $result = $object->updateExtraField($attribute_name, 'SHIPPING_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; From 31517fdc9c3726e51182cca8a3af76f1fd5c29e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 4 Jul 2025 19:07:03 +0200 Subject: [PATCH 6/7] situation_counter is nullable (#34693) * situation_counter is nullable * Update phpstan-baseline.neon --- dev/build/phpstan/phpstan-baseline.neon | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 19fcdb5d3c3..9d8572699e5 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -13401,7 +13401,7 @@ parameters: - message: '#^Result of && is always false\.$#' identifier: booleanAnd.alwaysFalse - count: 2 + count: 3 path: ../../../htdocs/expensereport/card.php - diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b53a12edfcf..d2ad124f7eb 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -213,7 +213,7 @@ class Facture extends CommonInvoice public $situation_cycle_ref; /** - * @var int Situation counter inside the cycle + * @var ?int Situation counter inside the cycle */ public $situation_counter; From 7b8601d4851be762a5a9c2abda22a4154d8471ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jul 2025 20:29:29 +0300 Subject: [PATCH 7/7] Update card.php --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 963d5d861a7..15ecd11df68 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2089,7 +2089,7 @@ if ($action == 'create') { print ''.$langs->trans("AmountExpected").':'.price($object->total_ttc).''; print ''.$langs->trans("RemainderToPay").':'; - print ''.price($resteapayeraffiche).''; + print ''.price($resteapayeraffiche).''; $db->free($resql); } else {