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
This commit is contained in:
thibdrev 2024-06-22 15:33:32 +02:00 committed by GitHub
parent c78a74edde
commit 075083159a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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');
}
}