From ded570e23ab3c71ebc35d4bf2f7d66e6f1cb82d5 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Sat, 22 Jun 2024 19:30:35 +0200 Subject: [PATCH] qual: use getDolGlobalString() for product/list.php (#30111) * qual: use getDolGlobalString() for product/list.php * fix phan warning Avoid function calls in a FOR loop test part --- htdocs/product/list.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 6a4eb772ef7..d7c09a7b180 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -208,9 +208,9 @@ if (isModEnabled('barcode')) { $fieldstosearchall['p.barcode'] = 'Gencod'; $fieldstosearchall['pfp.barcode'] = 'GencodBuyPrice'; } -// Personalized search criteria. Example: $conf->global->PRODUCT_QUICKSEARCH_ON_FIELDS = 'p.ref=ProductRef;p.label=ProductLabel;p.description=Description;p.note=Note;' +// Personalized search criteria. Example: getDolGlobalString('PRODUCT_QUICKSEARCH_ON_FIELDS') = 'p.ref=ProductRef;p.label=ProductLabel;p.description=Description;p.note=Note;' if (getDolGlobalString('PRODUCT_QUICKSEARCH_ON_FIELDS')) { - $fieldstosearchall = dolExplodeIntoArray($conf->global->PRODUCT_QUICKSEARCH_ON_FIELDS); + $fieldstosearchall = dolExplodeIntoArray(getDolGlobalString('PRODUCT_QUICKSEARCH_ON_FIELDS')); } if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { @@ -293,10 +293,11 @@ $arrayfields = array( // MultiPrices if (getDolGlobalString('PRODUIT_MULTIPRICES')) { - for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { + $produit_multiprices_limit = getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT'); + for ($i = 1; $i <= $produit_multiprices_limit; $i++) { $keyforlabel = 'PRODUIT_MULTIPRICES_LABEL'.$i; - if (!empty($conf->global->$keyforlabel)) { - $labelp = $i.' - '.$langs->transnoentitiesnoconv($conf->global->$keyforlabel); + if (!empty(getDolGlobalString('$keyforlabel'))) { + $labelp = $i.' - '.$langs->transnoentitiesnoconv(getDolGlobalString('$keyforlabel')); } else { $labelp = $langs->transnoentitiesnoconv("SellingPrice")." ".$i; }