From cbefb5a2d844bfee2d1dd92b8042562a89a6bfff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 9 Jan 2025 18:18:23 +0100 Subject: [PATCH] fix phpstan --- dev/build/phpstan/phpstan-baseline.neon | 42 ------- htdocs/core/modules/modExpedition.class.php | 126 ++++++++++---------- htdocs/public/payment/paymentok.php | 3 +- 3 files changed, 65 insertions(+), 106 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 385915e280d..57b375b7e58 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -13776,48 +13776,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/modEventOrganization.class.php - - - message: '#^Property DolibarrModules\:\:\$const \(array\, 5\?\: string, 6\?\: int\<0, 1\>\}\>\) does not accept non\-empty\-array\, 5\?\: string, 6\?\: int\<0, 1\>\}\>\.$#' - identifier: assign.propertyType - count: 1 - path: ../../../htdocs/core/modules/modExpedition.class.php - - - - message: '#^Property DolibarrModules\:\:\$const \(array\, 5\?\: string, 6\?\: int\<0, 1\>\}\>\) does not accept non\-empty\-array\, 5\?\: string, 6\?\: int\<0, 1\>\}\>\.$#' - identifier: assign.propertyType - count: 1 - path: ../../../htdocs/core/modules/modExpedition.class.php - - - - message: '#^Property DolibarrModules\:\:\$const \(array\, 5\?\: string, 6\?\: int\<0, 1\>\}\>\) does not accept non\-empty\-array\, 5\?\: string, 6\?\: int\<0, 1\>\}\>\.$#' - identifier: assign.propertyType - count: 1 - path: ../../../htdocs/core/modules/modExpedition.class.php - - - - message: '#^Property DolibarrModules\:\:\$const \(array\, 5\?\: string, 6\?\: int\<0, 1\>\}\>\) does not accept non\-empty\-array\, 5\?\: string, 6\?\: int\<0, 1\>\}\>\.$#' - identifier: assign.propertyType - count: 1 - path: ../../../htdocs/core/modules/modExpedition.class.php - - - - message: '#^Property DolibarrModules\:\:\$const \(array\, 5\?\: string, 6\?\: int\<0, 1\>\}\>\) does not accept non\-empty\-array\, 5\?\: string, 6\?\: int\<0, 1\>\}\>\.$#' - identifier: assign.propertyType - count: 2 - path: ../../../htdocs/core/modules/modExpedition.class.php - - - - message: '#^Property DolibarrModules\:\:\$const \(array\, 5\?\: string, 6\?\: int\<0, 1\>\}\>\) does not accept non\-empty\-array\, 5\?\: string, 6\?\: int\<0, 1\>\}\>\.$#' - identifier: assign.propertyType - count: 1 - path: ../../../htdocs/core/modules/modExpedition.class.php - - - - message: '#^Property DolibarrModules\:\:\$const \(array\, 5\?\: string, 6\?\: int\<0, 1\>\}\>\) does not accept non\-empty\-array\, 5\?\: string, 6\?\: int\<0, 1\>\}\>\.$#' - identifier: assign.propertyType - count: 7 - path: ../../../htdocs/core/modules/modExpedition.class.php - - message: '#^Variable \$user in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index cfe141b56eb..9860dc3d086 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,14 +62,15 @@ class modExpedition extends DolibarrModules $this->picto = "dolly"; // Data directories to create when module is enabled - $this->dirs = array("/expedition/temp", - "/expedition/sending", - "/expedition/sending/temp", - "/expedition/receipt", - "/expedition/receipt/temp", - "/doctemplates/shipments", - "/doctemplates/deliveries" - ); + $this->dirs = array( + "/expedition/temp", + "/expedition/sending", + "/expedition/sending/temp", + "/expedition/receipt", + "/expedition/receipt/temp", + "/doctemplates/shipments", + "/doctemplates/deliveries", + ); // Config pages $this->config_page_url = array("expedition.php"); @@ -81,66 +82,65 @@ class modExpedition extends DolibarrModules $this->langfiles = array('deliveries', 'sendings'); // Constants - $this->const = array(); - $r = 0; - - $this->const[$r][0] = "EXPEDITION_ADDON_PDF"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "espadon"; - $this->const[$r][3] = 'Nom du gestionnaire de generation des bons expeditions en PDF'; - $this->const[$r][4] = 0; - $r++; - - $this->const[$r][0] = "EXPEDITION_ADDON_NUMBER"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "mod_expedition_safor"; - $this->const[$r][3] = 'Name for numbering manager for shipments'; - $this->const[$r][4] = 0; - $r++; - - $this->const[$r][0] = "EXPEDITION_ADDON_PDF_ODT_PATH"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/shipments"; - $this->const[$r][3] = ""; - $this->const[$r][4] = 0; - $r++; - - $this->const[$r][0] = "DELIVERY_ADDON_PDF"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "storm"; - $this->const[$r][3] = 'Nom du gestionnaire de generation des bons de reception en PDF'; - $this->const[$r][4] = 0; - $r++; - - $this->const[$r][0] = "DELIVERY_ADDON_NUMBER"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "mod_delivery_jade"; - $this->const[$r][3] = 'Nom du gestionnaire de numerotation des bons de reception'; - $this->const[$r][4] = 0; - $r++; - - $this->const[$r][0] = "DELIVERY_ADDON_PDF_ODT_PATH"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/deliveries"; - $this->const[$r][3] = ""; - $this->const[$r][4] = 0; - $r++; - - $this->const[$r][0] = "MAIN_SUBMODULE_EXPEDITION"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "1"; - $this->const[$r][3] = "Enable delivery receipts"; - $this->const[$r][4] = 0; - $r++; - + $this->const = [ + [ + "EXPEDITION_ADDON_PDF", + "chaine", + "espadon", + 'Nom du gestionnaire de generation des bons expeditions en PDF', + 0, + ], + [ + "EXPEDITION_ADDON_NUMBER", + "chaine", + "mod_expedition_safor", + 'Name for numbering manager for shipments', + 0, + ], + [ + "EXPEDITION_ADDON_PDF_ODT_PATH", + "chaine", + "DOL_DATA_ROOT/doctemplates/shipments", + "", + 0, + ], + [ + "DELIVERY_ADDON_PDF", + "chaine", + "storm", + 'Nom du gestionnaire de generation des bons de reception en PDF', + 0, + ], + [ + "DELIVERY_ADDON_NUMBER", + "chaine", + "mod_delivery_jade", + 'Nom du gestionnaire de numerotation des bons de reception', + 0, + ], + [ + "DELIVERY_ADDON_PDF_ODT_PATH", + "chaine", + "DOL_DATA_ROOT/doctemplates/deliveries", + "", + 0, + ], + [ + "MAIN_SUBMODULE_EXPEDITION", + "chaine", + "1", + "Enable delivery receipts", + 0, + ], + ]; // Boxes $this->boxes = array( - 0=>array('file'=>'box_shipments.php', 'enabledbydefaulton'=>'Home'), + 0 => array('file'=>'box_shipments.php', 'enabledbydefaulton'=>'Home'), ); // Permissions - $this->rights = array(); $this->rights_class = 'expedition'; + $this->rights = array(); $r = 0; $r++; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index b70871bdf2d..dc3f59c86c6 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -5,7 +5,7 @@ * Copyright (C) 2021-2023 Waël Almoman * Copyright (C) 2021 Maxime Demarest * Copyright (C) 2021 Dorian Vabre - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -174,6 +174,7 @@ $error = 0; // Check if we have redirtodomain to do. $ws_virtuelhost = null; +$doactionsthenredirect = 0; if ($ws) { $doactionsthenredirect = 1; include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';