From 2c7a78867847d532c5c5ad0c701f872389e5ad69 Mon Sep 17 00:00:00 2001 From: henrynopo Date: Fri, 27 Aug 2021 11:09:10 +0800 Subject: [PATCH 1/6] Update shipment.php --- htdocs/expedition/shipment.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 42b8630bd3c..f9714039016 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -617,15 +617,17 @@ if ($id > 0 || !empty($ref)) { $sql = "SELECT cd.rowid, cd.fk_product, cd.product_type as type, cd.label, cd.description,"; $sql .= " cd.price, cd.tva_tx, cd.subprice,"; - $sql .= " cd.qty,"; + $sql .= " cd.qty, cd.fk_unit,"; $sql .= ' cd.date_start,'; $sql .= ' cd.date_end,'; $sql .= ' cd.special_code,'; $sql .= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc,'; $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,'; $sql .= ' p.surface, p.surface_units, p.volume, p.volume_units'; + $sql .= ', u.short_label as unit_order'; $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units as u ON cd.fk_unit = u.rowid"; $sql .= " WHERE cd.fk_commande = ".((int) $object->id); $sql .= " ORDER BY cd.rang, cd.rowid"; @@ -761,7 +763,7 @@ if ($id > 0 || !empty($ref)) { } // Qty ordered - print ''.$objp->qty.''; + print ''.$objp->qty.' '.$objp->unit_order.''; // Qty already shipped $qtyProdCom = $objp->qty; @@ -769,7 +771,7 @@ if ($id > 0 || !empty($ref)) { // Nb of sending products for this line of order $qtyAlreadyShipped = (!empty($object->expeditions[$objp->rowid]) ? $object->expeditions[$objp->rowid] : 0); print $qtyAlreadyShipped; - print ''; + print ' '.$objp->unit_order.''; // Qty remains to ship print ''; @@ -780,7 +782,7 @@ if ($id > 0 || !empty($ref)) { } else { print '0 ('.$langs->trans("Service").')'; } - print ''; + print ' '.$objp->unit_order.''; if ($objp->fk_product > 0) { $product = new Product($db); From c219b8f576bd69db74be6020afa58c0a859adc20 Mon Sep 17 00:00:00 2001 From: henrynopo Date: Sat, 28 Aug 2021 15:19:45 +0800 Subject: [PATCH 2/6] Update card.php --- htdocs/expedition/card.php | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 676a5cae22c..6c3e3748892 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1133,11 +1133,17 @@ if ($action == 'create') { print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end)); print "\n"; } + + // unit of order + $unit_order = '' + if ($conf->global->PRODUCT_USE_UNITS) { + $unit_order = measuringUnitString($line->fk_unit); + } // Qty print ''.$line->qty; print ''; - print ''; + print ''.$unit_order.''; $qtyProdCom = $line->qty; // Qty already shipped @@ -1145,7 +1151,7 @@ if ($action == 'create') { $quantityDelivered = $object->expeditions[$line->id]; print $quantityDelivered; print ''; - print ''; + print ''.$unit_order.''; // Qty to ship $quantityAsked = $line->qty; @@ -2030,7 +2036,7 @@ if ($action == 'create') { // Get list of products already sent for same source object into $alreadysent $alreadysent = array(); if ($origin && $origin_id > 0) { - $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end"; + $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.fk_unit, obj.date_start, obj.date_end"; $sql .= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot"; $sql .= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition"; //if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; @@ -2149,9 +2155,14 @@ if ($action == 'create') { print_date_range($lines[$i]->date_start, $lines[$i]->date_end); print "\n"; } + + $unit_order = '' + if ($conf->global->PRODUCT_USE_UNITS) { + $unit_order = measuringUnitString($lines[$i]->fk_unit); + } // Qty ordered - print ''.$lines[$i]->qty_asked.''; + print ''.$lines[$i]->qty_asked.' '.$unit_order.''; // Qty in other shipments (with shipment and warehouse used) if ($origin && $origin_id > 0) { @@ -2215,7 +2226,7 @@ if ($action == 'create') { print ''; print ''; // Qty to ship or shipped - print ''; + print ''.$unit_order.''; // Warehouse source print ''.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).''; // Batch number managment @@ -2226,7 +2237,7 @@ if ($action == 'create') { foreach ($lines[$i]->details_entrepot as $detail_entrepot) { print ''; // Qty to ship or shipped - print ''; + print ''.$unit_order.''; // Warehouse source print ''.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).''; // Batch number managment @@ -2241,7 +2252,7 @@ if ($action == 'create') { print ''; print ''; // Qty to ship or shipped - print ''; + print ''.$unit_order.''; // Warehouse source print ''; // Batch number managment @@ -2253,7 +2264,7 @@ if ($action == 'create') { print ''; } else { // Qty to ship or shipped - print ''.$lines[$i]->qty_shipped.''; + print ''.$lines[$i]->qty_shipped.' '.$unit_order.''; // Warehouse source if (!empty($conf->stock->enabled)) { From 74ed754fcc3a08cba815470ba01f9d33655c0019 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 28 Aug 2021 07:22:25 +0000 Subject: [PATCH 3/6] Fixing style errors. --- htdocs/expedition/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 6c3e3748892..7c30789ecb0 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1133,7 +1133,7 @@ if ($action == 'create') { print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end)); print "\n"; } - + // unit of order $unit_order = '' if ($conf->global->PRODUCT_USE_UNITS) { @@ -2155,7 +2155,7 @@ if ($action == 'create') { print_date_range($lines[$i]->date_start, $lines[$i]->date_end); print "\n"; } - + $unit_order = '' if ($conf->global->PRODUCT_USE_UNITS) { $unit_order = measuringUnitString($lines[$i]->fk_unit); From 4ae29c53aa7678f031863828c35a8d4ba7ee69e5 Mon Sep 17 00:00:00 2001 From: henrynopo Date: Sat, 28 Aug 2021 15:30:05 +0800 Subject: [PATCH 4/6] Update pdf_espadon.modules.php --- .../expedition/doc/pdf_espadon.modules.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 28d797acffc..1d449dcccbd 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -650,6 +650,11 @@ class pdf_espadon extends ModelePdfExpedition $this->printStdColumnContent($pdf, $curY, 'qty_asked', $object->lines[$i]->qty_asked); $nexY = max($pdf->GetY(), $nexY); } + + if ($this->getColumnStatus('unit_order')) { + $this->printStdColumnContent($pdf, $curY, 'unit_order', measuringUnitString($object->lines[$i]->fk_unit)); + $nexY = max($pdf->GetY(), $nexY); + } if ($this->getColumnStatus('qty_shipped')) { $this->printStdColumnContent($pdf, $curY, 'qty_shipped', $object->lines[$i]->qty_shipped); @@ -1311,6 +1316,20 @@ class pdf_espadon extends ModelePdfExpedition 'align' => 'C', ), ); + + $rank = $rank + 10; + $this->cols['unit_order'] = array( + 'rank' => $rank, + 'width' => 15, // in mm + 'status' => empty($conf->global->PRODUCT_USE_UNITS) ? 0 : 1, + 'title' => array( + 'textkey' => 'Unit' + ), + 'border-left' => true, // add left line separator + 'content' => array( + 'align' => 'C', + ), + ); $rank = $rank + 10; $this->cols['qty_shipped'] = array( From 3598e0a2464666d78fcb5497d17dbc8e8681ef38 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 28 Aug 2021 07:32:07 +0000 Subject: [PATCH 5/6] Fixing style errors. --- .../modules/expedition/doc/pdf_espadon.modules.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 1d449dcccbd..55180a33eb4 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -650,11 +650,11 @@ class pdf_espadon extends ModelePdfExpedition $this->printStdColumnContent($pdf, $curY, 'qty_asked', $object->lines[$i]->qty_asked); $nexY = max($pdf->GetY(), $nexY); } - + if ($this->getColumnStatus('unit_order')) { - $this->printStdColumnContent($pdf, $curY, 'unit_order', measuringUnitString($object->lines[$i]->fk_unit)); - $nexY = max($pdf->GetY(), $nexY); - } + $this->printStdColumnContent($pdf, $curY, 'unit_order', measuringUnitString($object->lines[$i]->fk_unit)); + $nexY = max($pdf->GetY(), $nexY); + } if ($this->getColumnStatus('qty_shipped')) { $this->printStdColumnContent($pdf, $curY, 'qty_shipped', $object->lines[$i]->qty_shipped); @@ -1316,7 +1316,7 @@ class pdf_espadon extends ModelePdfExpedition 'align' => 'C', ), ); - + $rank = $rank + 10; $this->cols['unit_order'] = array( 'rank' => $rank, From cb84eef6dc837785944772f71c5ff1fa340589cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Oct 2021 16:13:02 +0200 Subject: [PATCH 6/6] Update shipment.php --- htdocs/expedition/shipment.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index ad14c11ace3..b8814450030 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -768,7 +768,7 @@ if ($id > 0 || !empty($ref)) { } // Qty ordered - print ''.$objp->qty.' '.$objp->unit_order.''; + print ''.$objp->qty.($objp->unit_order ? ' '.$objp->unit_order : '').''; // Qty already shipped $qtyProdCom = $objp->qty; @@ -776,7 +776,7 @@ if ($id > 0 || !empty($ref)) { // Nb of sending products for this line of order $qtyAlreadyShipped = (!empty($object->expeditions[$objp->rowid]) ? $object->expeditions[$objp->rowid] : 0); print $qtyAlreadyShipped; - print ' '.$objp->unit_order.''; + print ($objp->unit_order ? ' '.$objp->unit_order : '').''; // Qty remains to ship print ''; @@ -787,7 +787,7 @@ if ($id > 0 || !empty($ref)) { } else { print '0 ('.$langs->trans("Service").')'; } - print ' '.$objp->unit_order.''; + print ($objp->unit_order ? ' '.$objp->unit_order : '').''; if ($objp->fk_product > 0) { $product = new Product($db);