From aec5e41656af8c091ab5bab47351f4420504660f Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller Date: Sat, 23 Oct 2021 19:09:23 +0200 Subject: [PATCH 1/3] Fix : fix php 8.0 warnings --- htdocs/contact/card.php | 2 ++ htdocs/core/class/html.form.class.php | 7 ++++--- htdocs/product/card.php | 10 ++++++---- htdocs/product/list.php | 4 ++-- htdocs/product/reassort.php | 1 + htdocs/product/reassortlot.php | 1 + htdocs/product/stats/card.php | 1 + htdocs/societe/list.php | 1 + 8 files changed, 18 insertions(+), 9 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 8493fd03f3c..8011b4aa678 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -548,6 +548,8 @@ $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans(" if ($socid > 0) { $objsoc = new Societe($db); $objsoc->fetch($socid); +} else { + $objsoc = 0; } if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3c544357ad7..35155f0eb61 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1005,6 +1005,7 @@ class Form $langs->load("dict"); $out = ''; + $moreattrib = ''; $incotermArray = array(); $sql = "SELECT rowid, code"; @@ -1444,7 +1445,7 @@ class Form $label .= ' ('.$obj->name_alias.')'; } - if ($conf->global->SOCIETE_SHOW_VAT_IN_LIST && !empty($obj->tva_intra)) { + if (!empty($conf->global->SOCIETE_SHOW_VAT_IN_LIST) && !empty($obj->tva_intra)) { $label .= ' - '.$obj->tva_intra.''; } @@ -8088,7 +8089,7 @@ class Form } } else { // There is no list of fields already customized for user foreach ($array as $key => $val) { - if ($array[$key]['checked'] < 0) { + if (!empty($array[$key]['checked']) && $array[$key]['checked'] < 0) { $array[$key]['checked'] = 0; } } @@ -8116,7 +8117,7 @@ class Form } // Note: $val['checked'] <> 0 means we must show the field into the combo list - $listoffieldsforselection .= '
  • '; + $listoffieldsforselection .= '
  • '; $listcheckedstring .= (empty($val['checked']) ? '' : $key.','); } } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 28c7b0d1d5d..6bc98f273dc 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1172,8 +1172,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $tooltip .= '
    '.$langs->trans("GenericMaskCodes3"); $tooltip .= '
    '.$langs->trans("GenericMaskCodes4a", $langs->transnoentities("Batch"), $langs->transnoentities("Batch")); $tooltip .= '
    '.$langs->trans("GenericMaskCodes5"); - if (($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') - || ($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced')) { + if ((!empty($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') + || (!empty($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS) && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced')) { print ''.$langs->trans("ManageLotMask").''; $inherited_mask_lot = $conf->global->LOT_ADVANCED_MASK; $inherited_mask_sn = $conf->global->SN_ADVANCED_MASK; @@ -1221,10 +1221,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($showbarcode) { print ''.$langs->trans('BarcodeType').''; if (GETPOSTISSET('fk_barcode_type')) { - $fk_barcode_type = GETPOST('fk_barcode_type'); + $fk_barcode_type = GETPOST('fk_barcode_type')?:0; } else { if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) { - $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; + $fk_barcode_type = getDolGlobalInt("PRODUIT_DEFAULT_BARCODE_TYPE"); + } else { + $fk_barcode_type=0; } } require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index aaf9903aa85..8ec03d408f3 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -256,7 +256,7 @@ $arrayfields = array( // MultiPrices -if ($conf->global->PRODUIT_MULTIPRICES) { +if (!empty($conf->global->PRODUIT_MULTIPRICES)) { for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { $keyforlabel = 'PRODUIT_MULTIPRICES_LABEL'.$i; if (!empty($conf->global->$keyforlabel)) { @@ -405,7 +405,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields as ef on (p.rowid = ef.fk_object)"; } if (!empty($searchCategoryProductList) || !empty($catid)) { diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index c327b24e8f0..b0a1ce87ddd 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -46,6 +46,7 @@ $toolowstock = GETPOST('toolowstock'); $tosell = GETPOST("tosell"); $tobuy = GETPOST("tobuy"); $fourn_id = GETPOST("fourn_id", 'int'); +$sbarcode = GETPOST("sbarcode", 'int'); $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index c8eae99d7cf..e75d1504267 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -50,6 +50,7 @@ $toolowstock = GETPOST('toolowstock'); $tosell = GETPOST("tosell"); $tobuy = GETPOST("tobuy"); $fourn_id = GETPOST("fourn_id", 'int'); +$sbarcode = GETPOST("sbarcode", 'int'); $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 9232dc419b4..7e5c566f94c 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -67,6 +67,7 @@ $currentyear = $tmp['year']; if (empty($search_year)) { $search_year = $currentyear; } +$moreforfilter = ""; $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 7013acdae56..5f6238554d8 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1363,6 +1363,7 @@ print "\n"; $i = 0; $totalarray = array(); +$totalarray['nbfield'] = 0; while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); From bc353c19a95a449586d2f32bcd6ec5bbe75148df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Oct 2021 19:22:41 +0200 Subject: [PATCH 2/3] Update card.php --- htdocs/contact/card.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 8011b4aa678..b77e47beaa4 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -545,11 +545,9 @@ $formcompany = new FormCompany($db); $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; +$objsoc = new Societe($db); if ($socid > 0) { - $objsoc = new Societe($db); $objsoc->fetch($socid); -} else { - $objsoc = 0; } if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { From 06c1d79c05edeb1647352c1fc6068593a8fef8d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Oct 2021 22:36:55 +0200 Subject: [PATCH 3/3] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 35155f0eb61..68bba0e04b5 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8117,7 +8117,7 @@ class Form } // Note: $val['checked'] <> 0 means we must show the field into the combo list - $listoffieldsforselection .= '
  • '; + $listoffieldsforselection .= '
  • '; $listcheckedstring .= (empty($val['checked']) ? '' : $key.','); } }