From e75186f6bc37370eb04008821c0fc84cc3bf6474 Mon Sep 17 00:00:00 2001 From: hystepik Date: Tue, 21 Feb 2023 16:14:14 +0100 Subject: [PATCH] Fix : php 8.0 warnings --- htdocs/contrat/list.php | 4 +++- htdocs/core/lib/company.lib.php | 11 +++++++---- htdocs/core/tpl/card_presend.tpl.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/product/stock/class/entrepot.class.php | 4 ++-- htdocs/product/stock/replenish.php | 1 + htdocs/projet/card.php | 1 + htdocs/projet/list.php | 14 +++++++++++--- htdocs/projet/tasks.php | 3 ++- 9 files changed, 29 insertions(+), 13 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 560b83175fb..03e65e18988 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -149,7 +149,9 @@ $reshook = $hookmanager->executeHooks('completeFieldsToSearchAll', $parameters, if ($reshook > 0) { $fieldstosearchall = $hookmanager->resArray['fieldstosearchall']; } elseif ($reshook == 0) { - $fieldstosearchall = array_merge($fieldstosearchall, $hookmanager->resArray['fieldstosearchall']); + if (!empty($hookmanager->resArray['fieldstosearchall'])) { + $fieldstosearchall = array_merge($fieldstosearchall, $hookmanager->resArray['fieldstosearchall']); + } } $arrayfields = array( diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index c433f4d90db..a560f5e34f7 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1121,8 +1121,11 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl if ($search_note_private != '') { $param .= '&search_note_private='.urlencode($search_note_private); } - if ($search_birthday != '') { - $param .= '&search_birthday='.urlencode($search_birthday); + if ($search_birthday_dtstart != '') { + $param .= '&search_birthday_dtstart='.urlencode($search_birthday_dtstart); + } + if ($search_birthday_dtend != '') { + $param .= '&search_birthday_dtend='.urlencode($search_birthday_dtend); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); @@ -2233,10 +2236,10 @@ function addOtherFilterSQL(&$sql, $donetodo, $now, $filters) } elseif ($donetodo == 'done') { $sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; } - if (is_array($filters) && $filters['search_agenda_label']) { + if (is_array($filters) && !empty($filters['search_agenda_label'])) { $sql .= natural_search('a.label', $filters['search_agenda_label']); } - if (is_array($filters) && $filters['search_rowid']) { + if (is_array($filters) && !empty($filters['search_rowid'])) { $sql .= natural_search('a.id', $filters['search_rowid'], 1); } diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 2393524e572..48458c036b1 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -108,7 +108,7 @@ if ($action == 'presend') { $fileparams = dol_most_recent_file($diroutput.'/'.$ref, preg_quote($ref, '/').'[^\-]+'); } - $file = $fileparams['fullname']; + $file = isset($fileparams['fullname'])?$fileparams['fullname']:null; } } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 2ae74dae103..34af6f4cbda 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2740,7 +2740,7 @@ class FactureFournisseur extends CommonInvoice $alreadypaid = $this->alreadypaid; } - $$datas['picto'] .= ' '.$this->getLibStatut(5, $alreadypaid); + $datas['picto'] .= ' '.$this->getLibStatut(5, $alreadypaid); } if ($moretitle) { $datas['picto'] .= ' - '.$moretitle; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index a165bf79038..006eb353a6c 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -706,9 +706,9 @@ class Entrepot extends CommonObject if (isset($this->statut)) { $datas['picto'] .= ' '.$this->getLibStatut(5); } - $datas['ref'] .= '
'.$langs->trans('Ref').': '.(empty($this->ref) ? $this->label : $this->ref); + $datas['ref'] = '
'.$langs->trans('Ref').': '.(empty($this->ref) ? $this->label : $this->ref); if (!empty($this->lieu)) { - $datas['locationsummary'] .= '
'.$langs->trans('LocationSummary').': '.$this->lieu; + $datas['locationsummary'] = '
'.$langs->trans('LocationSummary').': '.$this->lieu; } return $datas; diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 2520eb8f559..cf6d6b8352d 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -146,6 +146,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $includeproductswithoutdesiredqty = ''; $draftorder = ''; } +$draftchecked = ""; if ($draftorder == 'on') { $draftchecked = "checked"; } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 3ae98980c1d..42d5404f3c9 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -52,6 +52,7 @@ $backtopagejsfields = GETPOST('backtopagejsfields', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'aZ09'); +$dol_openinpopup = 0; if (!empty($backtopagejsfields)) { $tmpbacktopagejsfields = explode(':', $backtopagejsfields); $dol_openinpopup = $tmpbacktopagejsfields[0]; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index ea2d27936b1..abb07d36480 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1408,7 +1408,7 @@ while ($i < $imaxinloop) { $object->opp_percent = $obj->opp_percent; $object->opp_status = $obj->fk_opp_status; $object->opp_status_code = $obj->opp_status_code; - $object->opp_amount = $obj->opp_ammount; + $object->opp_amount = !empty($obj->opp_ammount) ? $obj->opp_ammount : ""; $object->opp_weighted_amount = $obj->opp_weighted_amount; $object->budget_amount = $obj->budget_amount; $object->usage_opportunity = $obj->usage_opportunity; @@ -1646,7 +1646,11 @@ while ($i < $imaxinloop) { //if ($obj->opp_status_code) if (strcmp($obj->opp_amount, '')) { print ''.price($obj->opp_amount, 1, $langs, 1, -1, -1, '').''; - $totalarray['val']['p.opp_amount'] += $obj->opp_amount; + if (!isset($totalarray['val']['p.opp_amount'])) { + $totalarray['val']['p.opp_amount'] = $obj->opp_amount; + } else { + $totalarray['val']['p.opp_amount'] += $obj->opp_amount; + } } print ''; if (!$i) { @@ -1690,7 +1694,11 @@ while ($i < $imaxinloop) { print ''; if ($obj->budget_amount != '') { print ''.price($obj->budget_amount, 1, $langs, 1, -1, -1).''; - $totalarray['val']['p.budget_amount'] += $obj->budget_amount; + if (!isset($totalarray['val']['p.budget_amount'])) { + $totalarray['val']['p.budget_amount'] = $obj->budget_amount; + } else { + $totalarray['val']['p.budget_amount'] += $obj->budget_amount; + } } print ''; if (!$i) { diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index ec10af0f884..e50855047d2 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -770,7 +770,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third if (is_array($contactsofproject) && count($contactsofproject)) { print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, '', 'maxwidth300'); } else { - if ($projectid > 0 || $object->id > 0) { + if ((isset($projectid) && $projectid > 0) || $object->id > 0) { print ''.$langs->trans("NoUserAssignedToTheProject").''; } else { print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); @@ -805,6 +805,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third // WYSIWYG editor include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_SOCIETE) ? $conf->global->FCKEDITOR_ENABLE_SOCIETE : 0); + $nbrows = 0; if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; }