From 31b548291a720ae50d84cf474fd56938d6b60ff5 Mon Sep 17 00:00:00 2001 From: Roger Dueck Date: Mon, 29 May 2023 10:17:22 -0600 Subject: [PATCH] Fix undefined and invalid access issues --- htdocs/projet/element.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 9dc6090c3d776..a4d847c50236d 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1164,7 +1164,7 @@ for ($i = 0; $i < $num; $i++) { $tmp = explode('_', $elementarray[$i]); $idofelement = $tmp[0]; - $idofelementuser = $tmp[1]; + $idofelementuser = $tmp[1] ?? null; $element->fetch($idofelement); if ($idofelementuser) { @@ -1192,7 +1192,7 @@ $total_ht_by_third = 0; $total_ttc_by_third = 0; } - $saved_third_id = $element->thirdparty->id; + $saved_third_id = $element->thirdparty->id ?? null; $qualifiedfortotal = true; if ($key == 'invoice') { @@ -1239,7 +1239,8 @@ $element_doc = $element->element; $filename = dol_sanitizeFileName($element->ref); - $filedir = $conf->{$element_doc}->multidir_output[$element->entity].'/'.dol_sanitizeFileName($element->ref); + $path = $conf?->{$element_doc}?->multidir_output[$element->entity] ?? null; + $filedir = $path.'/'.dol_sanitizeFileName($element->ref); if ($element_doc === 'order_supplier') { $element_doc = 'commande_fournisseur'; @@ -1489,7 +1490,8 @@ $total_ht_by_third += $total_ht_by_line; $total_ttc_by_third += $total_ttc_by_line; - $total_time = $total_time + $total_time_by_line; + if (!isset($total_time)) $total_time = $total_time_by_line; + else $total_time += $total_time_by_line; } if (canApplySubtotalOn($tablename)) {