From aaa65ddf6baffcd21327851cfe2a0d074d858743 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 12 Sep 2024 21:10:01 +0200 Subject: [PATCH] Fix v20 php8 patch001 (#30932) * Fix PHP 8 notices, warninngs, fatal * precommit --- htdocs/core/lib/company.lib.php | 2 +- .../modules/expedition/mod_expedition_ribera.php | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 77d24c891b5..411fe6d0663 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2233,7 +2233,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr foreach ($histo as $key => $value) { $actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo - $actionstatic->type_picto = $histo[$key]['apicto']; + $actionstatic->type_picto = $histo[$key]['apicto'] ?? ''; $actionstatic->type_code = $histo[$key]['acode']; $out .= ''; diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php index 7874672bb82..dc5bcb320cc 100644 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -98,13 +98,21 @@ class mod_expedition_ribera extends ModelNumRefExpedition */ public function getExample() { - global $langs, $mysoc; + global $langs, $mysoc, $db; $old_code_client = $mysoc->code_client; $old_code_type = $mysoc->typent_code; $mysoc->code_client = 'CCCCCCCCCC'; $mysoc->typent_code = 'TTTTTTTTTT'; - $numExample = $this->getNextValue($mysoc, ''); + + + if (!class_exists('Expedition')) { + require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; + } + + $expedition = new Expedition($db); + + $numExample = $this->getNextValue($mysoc, $expedition); $mysoc->code_client = $old_code_client; $mysoc->typent_code = $old_code_type; @@ -134,7 +142,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition return 0; } - $date = $shipment->date_expedition; + $date = $shipment->date_shipping; $numFinal = get_next_value($db, $mask, 'expedition', 'ref', '', $objsoc, $date);