From 8ef7c29d1974acf86fa0208b3c2df420e4da0707 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Wed, 17 Oct 2018 17:17:11 +0200 Subject: [PATCH] FIX PDF Total Ordered --- .../reception/doc/pdf_squille.modules.php | 21 ++++++++++++------- .../pdf/pdf_canelle_reception.modules.php | 1 + htdocs/reception/class/reception.class.php | 4 +++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index c48fc607f6d..dee68520728 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -352,7 +352,8 @@ class pdf_squille extends ModelePdfReception $iniY = $tab_top + 7; $curY = $tab_top + 7; $nexY = $tab_top + 7; - + $fk_commandefourndet=0; + $totalOrdered=0; // Loop on each lines for ($i = 0; $i < $nblignes; $i++) { @@ -470,7 +471,11 @@ class pdf_squille extends ModelePdfReception if (empty($conf->global->RECEPTION_PDF_HIDE_ORDERED)) { $pdf->SetXY($this->posxqtyordered, $curY); - $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3, $object->lines[$i]->qty_asked,'','C'); + if($object->lines[$i]->fk_commandefourndet!=$fk_commandefourndet){ + $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3, $object->lines[$i]->qty_asked,'','C'); + $totalOrdered+=$object->lines[$i]->qty_asked; + } + $fk_commandefourndet = $object->lines[$i]->fk_commandefourndet; } $pdf->SetXY($this->posxqtytoship, $curY); @@ -546,7 +551,7 @@ class pdf_squille extends ModelePdfReception } // Affiche zone totaux - $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); + $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs,$totalOrdered); // Pied de page $this->_pagefoot($pdf,$object,$outputlangs); @@ -590,7 +595,7 @@ class pdf_squille extends ModelePdfReception * @param Translate $outputlangs Objet langs * @return int Position pour suite */ - function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) + function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs,$totalOrdered) { global $conf,$mysoc; @@ -621,9 +626,11 @@ class pdf_squille extends ModelePdfReception $tmparray=$object->getTotalWeightVolume(); $totalWeight=$tmparray['weight']; $totalVolume=$tmparray['volume']; - $totalOrdered=$tmparray['ordered']; $totalToShip=$tmparray['toship']; + + + // Set trueVolume and volume_units not currently stored into database if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { @@ -924,6 +931,7 @@ class pdf_squille extends ModelePdfReception // Add internal contact of origin element if defined $arrayidcontact=array(); if (! empty($origin) && is_object($object->$origin)) $arrayidcontact=$object->$origin->getIdContact('internal','SALESREPFOLL'); + if(empty($arrayidcontact)) $arrayidcontact=$object->$origin->getIdContact('internal','SHIPPING'); if (count($arrayidcontact) > 0) { $object->fetch_user(reset($arrayidcontact)); @@ -951,9 +959,6 @@ class pdf_squille extends ModelePdfReception $pdf->SetTextColor(0,0,60); $pdf->SetFillColor(255,255,255); - - - // If RECEPTION contact defined, we use it $usecontact=false; $arrayidcontact=$object->$origin->getIdContact('external','SHIPPING'); diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle_reception.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle_reception.modules.php index 639381890de..177b598912b 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle_reception.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle_reception.modules.php @@ -386,6 +386,7 @@ class pdf_canelle_reception extends ModelePDFSuppliersInvoices // Reception + $object->fetchObjectLinked(); $reception_content = ''; if(!empty($object->linkedObjects['reception'])){ if(count($object->linkedObjects['reception']) == 1){ diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 75e98dbcbc6..c07d7b7ea5c 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1847,6 +1847,7 @@ class Reception extends CommonObject $this->error = $mouvS->error; $this->errors = $mouvS->errors; $error++; break; + } } else @@ -1861,6 +1862,7 @@ class Reception extends CommonObject $error++; break; } } + } } else @@ -1869,7 +1871,7 @@ class Reception extends CommonObject $error++; } } - + if (!$error) { // Call trigger $result=$this->call_trigger('RECEPTION_UNVALIDATE',$user);