From 61753791b47eb270abf09d545c6e5a07754612f3 Mon Sep 17 00:00:00 2001 From: Frans Bosman Date: Thu, 27 May 2021 12:20:42 +0200 Subject: [PATCH 1/7] Update card.php Add Batchinfo on invoice detail lines if hidden feature INCUDE_BATCHINFO_ON_INVOICE is set --- htdocs/compta/facture/card.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a088d94a01c..2d147c86b07 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2232,6 +2232,15 @@ if (empty($reshook)) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); setEventMessages($mesg, null, 'errors'); } else { + + // Add batchinfo if the detailline has batchinfo + + if (!empty($lines[$i]->detail_batch) && ! empty($conf->global->INCUDE_BATCHINFO_ON_INVOICE)){ + foreach ($lines[$i]->detail_batch as $batchline){ + $desc .= ' Batch: '.$batchline->batch.' aantal: '.$batchline->qty; + } + } + // Insert line $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, - 1, $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $_POST['progress'], '', $fk_unit, $pu_ht_devise); From c31530e7edcc308ae7775020d07a5f698b60eef5 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 27 May 2021 10:24:18 +0000 Subject: [PATCH 2/7] Fixing style errors. --- htdocs/compta/facture/card.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 2d147c86b07..beb9463acab 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2232,15 +2232,14 @@ if (empty($reshook)) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); setEventMessages($mesg, null, 'errors'); } else { - // Add batchinfo if the detailline has batchinfo - - if (!empty($lines[$i]->detail_batch) && ! empty($conf->global->INCUDE_BATCHINFO_ON_INVOICE)){ - foreach ($lines[$i]->detail_batch as $batchline){ - $desc .= ' Batch: '.$batchline->batch.' aantal: '.$batchline->qty; - } + + if (!empty($lines[$i]->detail_batch) && ! empty($conf->global->INCUDE_BATCHINFO_ON_INVOICE)) { + foreach ($lines[$i]->detail_batch as $batchline) { + $desc .= ' Batch: '.$batchline->batch.' aantal: '.$batchline->qty; + } } - + // Insert line $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, - 1, $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $_POST['progress'], '', $fk_unit, $pu_ht_devise); From fd2d10d443d73816b78b35120d7d954b4a1ceb03 Mon Sep 17 00:00:00 2001 From: Frans Bosman Date: Thu, 27 May 2021 16:23:33 +0200 Subject: [PATCH 3/7] Update card.php --- htdocs/compta/facture/card.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index beb9463acab..c7c9202c18c 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -67,7 +67,7 @@ if (!empty($conf->accounting->enabled)) { } // Load translation files required by the page -$langs->loadLangs(array('bills', 'companies', 'compta', 'products', 'banks', 'main', 'withdrawals')); +$langs->loadLangs(array('bills', 'companies', 'compta', 'products', 'banks', 'main', 'withdrawals','productbatch')); if (!empty($conf->incoterm->enabled)) { $langs->load('incoterm'); } @@ -2236,7 +2236,8 @@ if (empty($reshook)) { if (!empty($lines[$i]->detail_batch) && ! empty($conf->global->INCUDE_BATCHINFO_ON_INVOICE)) { foreach ($lines[$i]->detail_batch as $batchline) { - $desc .= ' Batch: '.$batchline->batch.' aantal: '.$batchline->qty; + $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty',$batchline->qty).' '; + } } From dfb2e547500646ddd5563fa1cf4fc8e0fe5907c2 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 27 May 2021 14:25:42 +0000 Subject: [PATCH 4/7] Fixing style errors. --- htdocs/compta/facture/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c7c9202c18c..02fb8467e21 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2236,8 +2236,7 @@ if (empty($reshook)) { if (!empty($lines[$i]->detail_batch) && ! empty($conf->global->INCUDE_BATCHINFO_ON_INVOICE)) { foreach ($lines[$i]->detail_batch as $batchline) { - $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty',$batchline->qty).' '; - + $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty', $batchline->qty).' '; } } From 292d5f6a154b97ae939be55b174ebc999e88d777 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 12:55:03 +0200 Subject: [PATCH 5/7] Update card.php --- htdocs/compta/facture/card.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 02fb8467e21..c3ba878cdbf 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2232,11 +2232,10 @@ if (empty($reshook)) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); setEventMessages($mesg, null, 'errors'); } else { - // Add batchinfo if the detailline has batchinfo - - if (!empty($lines[$i]->detail_batch) && ! empty($conf->global->INCUDE_BATCHINFO_ON_INVOICE)) { + // Add batchinfo if the detail_batch array is defined + if (!empty($lines[$i]->detail_batch) && is_array($lines[$i]->detail_batch) && !empty($conf->global->INVOICE_INCUDE_DETAILS_OF_LOTS_SERIALS)) { foreach ($lines[$i]->detail_batch as $batchline) { - $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty', $batchline->qty).' '; + $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty', $batchline->qty).' '; } } From 43be7cf996e5c221264d3a6bcf1d1dc99ef01d10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 12:56:40 +0200 Subject: [PATCH 6/7] Update card.php --- htdocs/compta/facture/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c3ba878cdbf..9f91c462a40 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -67,7 +67,7 @@ if (!empty($conf->accounting->enabled)) { } // Load translation files required by the page -$langs->loadLangs(array('bills', 'companies', 'compta', 'products', 'banks', 'main', 'withdrawals','productbatch')); +$langs->loadLangs(array('bills', 'companies', 'compta', 'products', 'banks', 'main', 'withdrawals')); if (!empty($conf->incoterm->enabled)) { $langs->load('incoterm'); } @@ -2234,6 +2234,7 @@ if (empty($reshook)) { } else { // Add batchinfo if the detail_batch array is defined if (!empty($lines[$i]->detail_batch) && is_array($lines[$i]->detail_batch) && !empty($conf->global->INVOICE_INCUDE_DETAILS_OF_LOTS_SERIALS)) { + $langs->load('productbatch'); foreach ($lines[$i]->detail_batch as $batchline) { $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty', $batchline->qty).' '; } From 8b5922a0df094f64ec602610b0c66f9804aa8408 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 12:57:43 +0200 Subject: [PATCH 7/7] Update card.php --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 9f91c462a40..be9e23afecc 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2233,7 +2233,7 @@ if (empty($reshook)) { setEventMessages($mesg, null, 'errors'); } else { // Add batchinfo if the detail_batch array is defined - if (!empty($lines[$i]->detail_batch) && is_array($lines[$i]->detail_batch) && !empty($conf->global->INVOICE_INCUDE_DETAILS_OF_LOTS_SERIALS)) { + if (!empty($conf->productbatch->enabled) && !empty($lines[$i]->detail_batch) && is_array($lines[$i]->detail_batch) && !empty($conf->global->INVOICE_INCUDE_DETAILS_OF_LOTS_SERIALS)) { $langs->load('productbatch'); foreach ($lines[$i]->detail_batch as $batchline) { $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty', $batchline->qty).' ';