From 253ebd0a8bbfeb2a98e5914d6d89d491e5062df9 Mon Sep 17 00:00:00 2001 From: atm-jonathan <146709163+atm-jonathan@users.noreply.github.com> Date: Thu, 23 Nov 2023 17:08:07 +0100 Subject: [PATCH] FIX warning php8.2 undefined_array_key (#26830) --- htdocs/core/lib/pdf.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 3ac72e0d2c2..f20ef0a000a 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1789,7 +1789,7 @@ function pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails = 0) $reshook = 0; //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduce this test in the pdf_xxx function if you don't want your hook to run - $special_code = $object->lines[$i]->special_code; + $special_code = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; if (!empty($object->lines[$i]->fk_parent_line)) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } @@ -1856,7 +1856,7 @@ function pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails = 0) $reshook = 0; //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run - $special_code = $object->lines[$i]->special_code; + $special_code = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; if (!empty($object->lines[$i]->fk_parent_line)) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } @@ -1936,7 +1936,7 @@ function pdf_getlineqty($object, $i, $outputlangs, $hidedetails = 0) $reshook = 0; //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run - $special_code = $object->lines[$i]->special_code; + $special_code = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; if (!empty($object->lines[$i]->fk_parent_line)) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } @@ -2239,7 +2239,7 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0) $result = ''; //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager)) { // Old code is commented on preceding line. Reproduct this test in the pdf_xxx function if you don't want your hook to run - $special_code = $object->lines[$i]->special_code; + $special_code = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; if (!empty($object->lines[$i]->fk_parent_line)) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } @@ -2252,7 +2252,7 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0) } } if (empty($reshook)) { - if ($object->lines[$i]->special_code == 3) { + if (!empty($object->lines[$i]) && $object->lines[$i]->special_code == 3) { $result .= $outputlangs->transnoentities("Option"); } elseif (empty($hidedetails) || $hidedetails > 1) { $total_ht = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ht : $object->lines[$i]->total_ht);