From 1ca1f111b3a11f6373aac1483f46bf1d73328dad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Feb 2022 16:12:51 +0100 Subject: [PATCH] Fix warnings --- htdocs/core/class/commoninvoice.class.php | 2 +- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 3 +++ .../core/modules/commande/doc/pdf_eratosthene.modules.php | 5 ++++- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 3 +++ htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 5 ++++- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 6 +++++- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 5 ++++- .../core/modules/supplier_order/doc/pdf_cornas.modules.php | 3 +++ .../modules/supplier_order/doc/pdf_muscadet.modules.php | 3 +++ .../modules/supplier_proposal/doc/pdf_aurore.modules.php | 3 +++ 10 files changed, 33 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 74ff2141820..6043814dc45 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -857,7 +857,7 @@ abstract class CommonInvoice extends CommonObject // Using TLV format $s = pack('C1', 1).pack('C1', strlen($this->thirdparty->name)).$this->thirdparty->name; $s .= pack('C1', 2).pack('C1', strlen($this->thirdparty->tva_intra)).$this->thirdparty->tva_intra; - $s .= pack('C1', 3).pack('C1', strlen($datestring)).$date; + $s .= pack('C1', 3).pack('C1', strlen($datestring)).$this->date; $s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring; $s .= pack('C1', 5).pack('C1', strlen($pricetaxstring)).$pricetaxstring; $s .= ''; // Hash of xml invoice diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 20d38ed3805..db961962ba6 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -575,6 +575,9 @@ class pdf_einstein extends ModelePDFCommandes } $this->tva[$vatrate] += $tvaligne; $vatcode = $object->lines[$i]->vat_src_code; + if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) { + $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0; + } $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne); // Add line diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 5cf7ce6645b..210ef249ac2 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -259,7 +259,7 @@ class pdf_eratosthene extends ModelePDFCommandes $arephoto = false; foreach ($pdir as $midir) { if (!$arephoto) { - if ($conf->product->entity != $objphoto->entity) { + if ($conf->entity != $objphoto->entity) { $dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities } else { $dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product @@ -800,6 +800,9 @@ class pdf_eratosthene extends ModelePDFCommandes } $this->tva[$vatrate] += $tvaligne; $vatcode = $object->lines[$i]->vat_src_code; + if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) { + $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0; + } $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne); // Add line diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index b1ab0f671b9..b9ceb3e346b 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -751,6 +751,9 @@ class pdf_crabe extends ModelePDFFactures } $this->tva[$vatrate] += $tvaligne; // ->tva is abandonned, we use now ->tva_array that is more complete $vatcode = $object->lines[$i]->vat_src_code; + if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) { + $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0; + } $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne); if ($posYAfterImage > $posYAfterDescription) { diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index c1413a103f8..c1666545891 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -265,7 +265,7 @@ class pdf_sponge extends ModelePDFFactures $arephoto = false; foreach ($pdir as $midir) { if (!$arephoto) { - if ($conf->product->entity != $objphoto->entity) { + if ($conf->entity != $objphoto->entity) { $dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities } else { $dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product @@ -889,6 +889,9 @@ class pdf_sponge extends ModelePDFFactures } $this->tva[$vatrate] += $tvaligne; // ->tva is abandonned, we use now ->tva_array that is more complete $vatcode = $object->lines[$i]->vat_src_code; + if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) { + $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0; + } $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne); $nexY = max($nexY, $posYAfterImage); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 5e5a8ded7c5..0e30ec96e44 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -266,9 +266,10 @@ class pdf_azur extends ModelePDFPropales } $arephoto = false; + $realpath = ''; foreach ($pdir as $midir) { if (!$arephoto) { - if ($conf->product->entity != $objphoto->entity) { + if ($conf->entity != $objphoto->entity) { $dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities } else { $dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product @@ -685,6 +686,9 @@ class pdf_azur extends ModelePDFPropales } $this->tva[$vatrate] += $tvaligne; $vatcode = $object->lines[$i]->vat_src_code; + if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) { + $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0; + } $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne); if ($posYAfterImage > $posYAfterDescription) { diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 01cc1eebc9f..86e311b1306 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -255,7 +255,7 @@ class pdf_cyan extends ModelePDFPropales $arephoto = false; foreach ($pdir as $midir) { if (!$arephoto) { - if ($conf->product->entity != $objphoto->entity) { + if ($conf->entity != $objphoto->entity) { $dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities } else { $dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product @@ -810,6 +810,9 @@ class pdf_cyan extends ModelePDFPropales } $this->tva[$vatrate] += $tvaligne; $vatcode = $object->lines[$i]->vat_src_code; + if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) { + $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0; + } $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne); if ($posYAfterImage > $posYAfterDescription) { diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index f844a5fad55..5fcd0ee20de 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -746,6 +746,9 @@ class pdf_cornas extends ModelePDFSuppliersOrders } $this->tva[$vatrate] += $tvaligne; $vatcode = $object->lines[$i]->vat_src_code; + if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) { + $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0; + } $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne); if ($posYAfterImage > $posYAfterDescription) { diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index d5003c4b806..11ae04993eb 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -625,6 +625,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } $this->tva[$vatrate] += $tvaligne; $vatcode = $object->lines[$i]->vat_src_code; + if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) { + $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0; + } $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne); if ($posYAfterImage > $posYAfterDescription) { diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 4a8598a4d4d..0c708351acc 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -619,6 +619,9 @@ class pdf_aurore extends ModelePDFSupplierProposal } $this->tva[$vatrate] += $tvaligne; $vatcode = $object->lines[$i]->vat_src_code; + if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) { + $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0; + } $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne); if ($posYAfterImage > $posYAfterDescription) {