From 075083159a9e7f93339926bceec6fd2fbd85c9a3 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Sat, 22 Jun 2024 15:33:32 +0200 Subject: [PATCH] qual: use getDolGlobalString() for product/class/product.class.php (#30106) * qual: use getDolGlobalString() for product/class/product.class.php * better fix * fix phan warning Avoid function calls in a FOR loop test part --- htdocs/product/class/product.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 3486a962ee6..8bb7a61876a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1035,7 +1035,7 @@ class Product extends CommonObject // phpcs:enable global $conf; if (isModEnabled('barcode') && getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) { - $module = strtolower($conf->global->BARCODE_PRODUCT_ADDON_NUM); + $module = strtolower(getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')); $dirsociete = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']); foreach ($dirsociete as $dirroot) { @@ -2750,7 +2750,8 @@ class Product extends CommonObject // Load multiprices array if (getDolGlobalString('PRODUIT_MULTIPRICES') && empty($ignore_price_load)) { // prices per segment - for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { + $produit_multiprices_limit = getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT'); + for ($i = 1; $i <= $produit_multiprices_limit; $i++) { $sql = "SELECT price, price_ttc, price_min, price_min_ttc,"; $sql .= " price_base_type, tva_tx, default_vat_code, tosell, price_by_qty, rowid, recuperableonly"; $sql .= " ,price_label"; @@ -2866,7 +2867,8 @@ class Product extends CommonObject return -1; } } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') && empty($ignore_price_load)) { // prices per customer and quantity - for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { + $produit_multiprices_limit = getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT'); + for ($i = 1; $i <= $produit_multiprices_limit; $i++) { $sql = "SELECT price, price_ttc, price_min, price_min_ttc,"; $sql .= " price_base_type, tva_tx, default_vat_code, tosell, price_by_qty, rowid, recuperableonly"; $sql .= " FROM ".$this->db->prefix()."product_price"; @@ -5922,7 +5924,7 @@ class Product extends CommonObject $stock_sending_client = $this->stats_expedition['qty']; } if (isModEnabled("supplier_order")) { - $filterStatus = !getDolGlobalString('SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK') ? '3,4' : $conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK; + $filterStatus = getDolGlobalString('SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK', '3,4'); if (isset($includedraftpoforvirtual)) { $filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them } @@ -6481,7 +6483,7 @@ class Product extends CommonObject } } - $maxpricesupplier *= $conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE; + $maxpricesupplier *= getDolGlobalString('PRODUCT_MINIMUM_RECOMMENDED_PRICE'); } }