From 973a2ede9769a48d7b8783cf51b62c7f6c96c2f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Aug 2023 11:35:19 +0200 Subject: [PATCH 1/5] Fix syntax error --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 878c8d6cef0..e5e2adf4947 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1478,19 +1478,10 @@ class pdf_azur extends ModelePDFPropales if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; -<<<<<<< HEAD - if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; - if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) - { - $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; - } - else { -======= if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; } else { ->>>>>>> branch '10.0' of git@github.com:Dolibarr/dolibarr.git $logo = $logodir.'/logos/'.$this->emetteur->logo; } if (is_readable($logo)) From 4129813564a225e60f6caa6ef20be9e773ed8f89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Nov 2023 17:07:10 +0100 Subject: [PATCH 2/5] Fix missing parameter $filter --- htdocs/core/class/html.form.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1081249bf91..c9c3e09f634 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7671,10 +7671,11 @@ class Form * @param int $outputmode 0=HTML select string, 1=Array * @param int $disabled 1=Html component is disabled * @param string $sortfield Sort field + * @param string $filter Add more filter * @return string|array Return HTML string * @see selectForForms() */ - public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled = 0, $sortfield = '') + public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled = 0, $sortfield = '', $filter = '') { global $conf, $langs, $user, $hookmanager; From b3345e1796154f8b48b91b086f58e570ffa8fee1 Mon Sep 17 00:00:00 2001 From: boudet jean pascal <68547382+atm-jpb@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:10:56 +0100 Subject: [PATCH 3/5] FIX : special_code update line keep old value. (#26819) * FIX : special code update line keep old value. * Update fournisseur.commande.class.php --------- Co-authored-by: jpb Co-authored-by: Laurent Destailleur --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 8b69f763a83..30b0643a512 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2854,7 +2854,7 @@ class CommandeFournisseur extends CommonOrder $this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; $this->line->remise_percent = $remise_percent; $this->line->subprice = $pu_ht; - $this->line->rang = $this->rang; + $this->line->rang = $oldline->rang; $this->line->info_bits = $info_bits; $this->line->total_ht = $total_ht; $this->line->total_tva = $total_tva; @@ -2862,7 +2862,7 @@ class CommandeFournisseur extends CommonOrder $this->line->total_localtax2 = $total_localtax2; $this->line->total_ttc = $total_ttc; $this->line->product_type = $type; - $this->line->special_code = $this->special_code; + $this->line->special_code = $oldline->special_code; $this->line->origin = $this->origin; $this->line->fk_unit = $fk_unit; 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 4/5] 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); From 48ba0ec2d0712aa4471c47364e243adfc138b2d3 Mon Sep 17 00:00:00 2001 From: atm-jonathan <146709163+atm-jonathan@users.noreply.github.com> Date: Thu, 23 Nov 2023 17:12:57 +0100 Subject: [PATCH 5/5] FIX warning param $lineID getSpecialCode is negatif (#26826) * FIX warning param $lineID getSpecialCode is negatif * retour de PR --------- Co-authored-by: Laurent Destailleur --- htdocs/core/lib/pdf.lib.php | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index f20ef0a000a..a1f7516bba9 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1351,7 +1351,7 @@ function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $pos //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 = empty($object->lines[$i]->special_code) ? '' : $object->lines[$i]->special_code; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('pdf'=>$pdf, 'i'=>$i, 'outputlangs'=>$outputlangs, 'w'=>$w, 'h'=>$h, 'posx'=>$posx, 'posy'=>$posy, 'hideref'=>$hideref, 'hidedesc'=>$hidedesc, 'issupplierline'=>$issupplierline, 'special_code'=>$special_code); @@ -1693,7 +1693,7 @@ function pdf_getlinenum($object, $i, $outputlangs, $hidedetails = 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; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -1726,7 +1726,7 @@ function pdf_getlineref($object, $i, $outputlangs, $hidedetails = 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; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -1758,7 +1758,7 @@ function pdf_getlineref_supplier($object, $i, $outputlangs, $hidedetails = 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; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -1789,8 +1789,8 @@ 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 = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; - if (!empty($object->lines[$i]->fk_parent_line)) { + $special_code = empty($object->lines[$i]) ? '' : $object->lines[$i]->special_code; + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -1856,8 +1856,8 @@ 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 = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; - if (!empty($object->lines[$i]->fk_parent_line)) { + $special_code = empty($object->lines[$i]) ? '' : $object->lines[$i]->special_code; + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -1900,7 +1900,7 @@ function pdf_getlineupwithtax($object, $i, $outputlangs, $hidedetails = 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; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -1936,8 +1936,8 @@ 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 = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; - if (!empty($object->lines[$i]->fk_parent_line)) { + $special_code = empty($object->lines[$i]) ? '' : $object->lines[$i]->special_code; + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -1977,7 +1977,7 @@ function pdf_getlineqty_asked($object, $i, $outputlangs, $hidedetails = 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; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -2017,7 +2017,7 @@ function pdf_getlineqty_shipped($object, $i, $outputlangs, $hidedetails = 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; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -2057,7 +2057,7 @@ function pdf_getlineqty_keeptoship($object, $i, $outputlangs, $hidedetails = 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; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -2098,7 +2098,7 @@ function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanag //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; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array( @@ -2143,7 +2143,7 @@ function pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails = 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; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code); @@ -2187,7 +2187,7 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm //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; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); @@ -2239,8 +2239,8 @@ 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 = !empty($object->lines[$i]) ? $object->lines[$i]->special_code:''; - if (!empty($object->lines[$i]->fk_parent_line)) { + $special_code = empty($object->lines[$i]) ? '' : $object->lines[$i]->special_code; + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code, 'sign'=>$sign); @@ -2296,7 +2296,7 @@ function pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails = 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; - if (!empty($object->lines[$i]->fk_parent_line)) { + if (!empty($object->lines[$i]->fk_parent_line) && $object->lines[$i]->fk_parent_line > 0) { $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); } $parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code);