From b7ee10a0747062a2f1d16bcf30b2da801846327f Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 28 Jun 2014 17:17:37 +0200 Subject: [PATCH 1/2] New : can add all products in a shipment, even if qty is 0 with SHIPMENT_GETS_ALL_ORDER_PRODUCTS --- htdocs/expedition/class/expedition.class.php | 2 ++ htdocs/expedition/fiche.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 93c7f63b4ad..c0c647698e8 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -590,6 +590,8 @@ class Expedition extends CommonObject $cpt = $this->db->num_rows($resql); for ($i = 0; $i < $cpt; $i++) { + if($obj->qty <= 0) continue; + dol_syslog(get_class($this)."::valid movement index ".$i); $obj = $this->db->fetch_object($resql); diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 89d0995fb45..ff6b23c10be 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -163,7 +163,7 @@ if ($action == 'add') { $qty = "qtyl".$i; if (! isset($batch_line[$i])) { - if (GETPOST($qty,'int') > 0) + if (GETPOST($qty,'int') > 0 || (GETPOST($qty,'int') == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { $ent = "entl".$i; $idl = "idl".$i; From 7d16f62a9d628634e7d42bf68cff8a57cad724f7 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 28 Jun 2014 22:48:20 +0200 Subject: [PATCH 2/2] New : add remaining to ship on delivery PDF --- .../livraison/pdf/pdf_typhon.modules.php | 27 ++++++++++++++----- htdocs/livraison/class/livraison.class.php | 3 ++- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index b13177f9127..095e325cb81 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -97,10 +97,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Define position of columns $this->posxdesc=$this->marge_gauche+1; - $this->posxcomm=112; + $this->posxcomm=900; //$this->posxtva=112; //$this->posxup=126; - $this->posxqty=174; + $this->posxqty=140; + $this->posxremainingqty=165; //$this->posxdiscount=162; //$this->postotalht=174; if ($this->page_largeur < 210) // To work with US executive format @@ -207,6 +208,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $commande->fetch($expedition->origin_id); } $object->commande=$commande; // We set order of shipment onto delivery. + $object->commande->loadExpeditions(); $pdf->Open(); @@ -355,7 +357,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Quantity //$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxqty, $curY); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxqty, 3, $object->lines[$i]->qty_shipped, 0, 'R'); + $pdf->MultiCell($this->posxremainingqty - $this->posxqty, 3, $object->lines[$i]->qty_shipped, 0, 'R'); + + // Remaining to ship + $pdf->SetXY($this->posxremainingqty, $curY); + $qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line]; + $pdf->MultiCell($this->page_largeur-$this->marge_droite - $this->posxremainingqty, 3, $qtyRemaining, 0, 'R'); /* // Remise sur ligne $pdf->SetXY($this->posxdiscount, $curY); @@ -606,7 +613,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetXY($this->posxdesc-1, $tab_top+1); $pdf->MultiCell($this->posxcomm - $this->posxdesc,2, $outputlangs->transnoentities("Designation"),'','L'); } - + // Modif SEB pour avoir une col en plus pour les commentaires clients $pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height); if (empty($hidetop)) { @@ -615,12 +622,18 @@ class pdf_typhon extends ModelePDFDeliveryOrder } // Qty - $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); + $pdf->line($this->posxqty, $tab_top, $this->posxqty, $tab_top + $tab_height); if (empty($hidetop)) { - $pdf->SetXY($this->posxqty-1, $tab_top+1); - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxqty, 2, $outputlangs->transnoentities("QtyShipped"),'','R'); + $pdf->SetXY($this->posxqty, $tab_top+1); + $pdf->MultiCell($this->posxremainingqty - $this->posxqty, 2, $outputlangs->transnoentities("QtyShipped"),'','C'); } + // Remain to ship + $pdf->line($this->posxremainingqty, $tab_top, $this->posxremainingqty, $tab_top + $tab_height); + if (empty($hidetop)) { + $pdf->SetXY($this->posxremainingqty, $tab_top+1); + $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxremainingqty, 2, $outputlangs->transnoentities("KeepToShip"),'','C'); + } } /** diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 58ad4f1bc0d..647983491a0 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -677,7 +677,7 @@ class Livraison extends CommonObject { $this->lines = array(); - $sql = "SELECT ld.rowid, ld.fk_product, ld.description, ld.subprice, ld.total_ht, ld.qty as qty_shipped,"; + $sql = "SELECT ld.rowid, ld.fk_product, ld.description, ld.subprice, ld.total_ht, ld.qty as qty_shipped, ld.fk_origin_line, "; $sql.= " cd.qty as qty_asked, cd.label as custom_label,"; $sql.= " p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc"; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd, ".MAIN_DB_PREFIX."livraisondet as ld"; @@ -709,6 +709,7 @@ class Livraison extends CommonObject $line->product_ref = $obj->product_ref; // Product ref $line->product_desc = $obj->product_desc; // Product description $line->product_type = $obj->fk_product_type; + $line->fk_origin_line = $obj->fk_origin_line; $line->price = $obj->price; $line->total_ht = $obj->total_ht;