From 32da192db44a043b6d8e32f1b3339c5f9964289b Mon Sep 17 00:00:00 2001 From: hystepik Date: Tue, 24 Jan 2023 14:32:20 +0100 Subject: [PATCH] fix : php 8.1 warnings --- htdocs/compta/localtax/card.php | 5 ++++- htdocs/contrat/services_list.php | 3 +++ htdocs/loan/card.php | 5 +++-- htdocs/loan/list.php | 2 ++ htdocs/product/card.php | 2 +- htdocs/product/reassort.php | 2 +- htdocs/reception/contact.php | 2 +- htdocs/salaries/payments.php | 9 ++++++++- 8 files changed, 23 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index 8b6119db13a..ad80b6d1b6d 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -144,9 +144,12 @@ $form = new Form($db); $title = $langs->trans("LT".$object->ltt)." - ".$langs->trans("Card"); $help_url = ''; -llxHeader('', $title, $helpurl); +llxHeader('', $title, $help_url); if ($action == 'create') { + $datev = dol_mktime(12, 0, 0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear")); + $datep = dol_mktime(12, 0, 0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear")); + print load_fiche_titre($langs->transcountry($lttype == 2 ? "newLT2Payment" : "newLT1Payment", $mysoc->country_code)); print '
'."\n"; diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index fb50283991b..d42dc70f49a 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -822,6 +822,9 @@ while ($i < min($num, $limit)) { if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'cd.qty'; } + if (!$i) { + $totalarray['val']['cd.qty'] = $obj->qty; + } $totalarray['val']['cd.qty'] += $obj->qty; } if (!empty($arrayfields['cd.total_ht']['checked'])) { diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index a45577b6608..afa7aa5eaa8 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -66,6 +66,7 @@ $error = 0; * Actions */ +$parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -291,13 +292,13 @@ if ($action == 'create') { // Date Start print ""; print ''.$langs->trans("DateStart").''; - print $form->selectDate($datestart ? $datestart : -1, 'start', '', '', '', 'add', 1, 1); + print $form->selectDate(!empty($datestart) ? $datestart : -1, 'start', '', '', '', 'add', 1, 1); print ''; // Date End print ""; print ''.$langs->trans("DateEnd").''; - print $form->selectDate($dateend ? $dateend : -1, 'end', '', '', '', 'add', 1, 1); + print $form->selectDate(!empty($dateend) ? $dateend : -1, 'end', '', '', '', 'add', 1, 1); print ''; // Number of terms diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index 1225f5304be..b664d784e7e 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -42,6 +42,7 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +$massaction = GETPOST('massaction', 'alpha'); if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action @@ -148,6 +149,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { } $db->free($resql); } +$arrayfields = array(); // Complete request and execute it with limit $sql .= $db->order($sortfield, $sortorder); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 8a5aecf1513..ac465b16bd7 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1485,7 +1485,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } } - if ($type == 1 && $conf->workstation->enabled) { + if ($type == 1 && isModEnabled("workstation")) { // Default workstation print ''.$langs->trans("DefaultWorkstation").''; print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"'); diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 10581d19b7c..9946e7a9077 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -133,7 +133,7 @@ $helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; $form = new Form($db); $htmlother = new FormOther($db); -if ($objp->stock_physique < 0) { print ''; } +if (!empty($objp->stock_physique) && $objp->stock_physique < 0) { print ''; } $sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; $sql .= ' p.fk_product_type, p.tms as datem,'; diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index 02cbc9af957..11ab664c6c0 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -72,7 +72,7 @@ if ($origin == 'reception') { } else { if ($origin == 'supplierorder' || $origin == 'order_supplier') { $result = restrictedArea($user, 'fournisseur', $origin_id, 'commande_fournisseur', 'commande'); - } elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) { + } elseif (empty($user->hasRight($origin, "lire")) && empty($user->hasRight($origin, "read"))) { accessforbidden(); } } diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index 5a5ccb08bf6..7bf61f3021f 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -97,6 +97,7 @@ $search_chq_number = GETPOST('search_chq_number', 'int'); $filtre = GETPOST("filtre", 'restricthtml'); +$search_type_id = ''; if (!GETPOST('search_type_id', 'int')) { $newfiltre = str_replace('filtre=', '', $filtre); $filterarray = explode('-', $newfiltre); @@ -532,6 +533,7 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar $i = 0; $total = 0; $totalarray = array(); +$totalarray['nbfield'] = 0; while ($i < ($limit ? min($num, $limit) : $num)) { $obj = $db->fetch_object($resql); if (empty($obj)) { @@ -697,7 +699,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; } - $totalarray['val']['totalttcfield'] += $obj->amount; + if (!$i) { + $totalarray['val']['totalttcfield'] = $obj->amount; + } else { + $totalarray['val']['totalttcfield'] += $obj->amount; + } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';