From d3f9f5c0cdc6444f4970d1700fc83f5e3ee6a0d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 11:16:58 +0100 Subject: [PATCH 1/4] display lot with getNomUrl --- htdocs/reception/card.php | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 3e99bc1194c..8f28dc72bb8 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1952,22 +1952,16 @@ if ($action == 'create') { if (isset($lines[$i]->batch)) { print ''; print ''; - $detail = ''; - if ($lines[$i]->product->status_batch) { - $detail .= $langs->trans("Batch").': '.$lines[$i]->batch; - if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { - $detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($lines[$i]->sellby, "day"); + $detail = $langs->trans("NA"); + if ($lines[$i]->product->status_batch && $lines[$i]->fk_product > 0) { + require_once DOL_DOCUMENT_ROOT.'/product/stock/productlot.class.php'; + $productlot = new Productlot($db); + $reslot = $productlot->fetch(0, $lines[$i]->fk_product, $lines[$i]->batch); + if ($reslot > 0) { + $detail = $productlot->getNomUrl(1); } - if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { - $detail .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($lines[$i]->eatby, "day"); - } - $detail .= '
'; - - print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"), $detail); - } else { - print $langs->trans("NA"); } - print ''; + print $detail . ''; } else { print ''; } From 2ad663c627e846d0a87e3ba85989f150ce06865f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 11:20:00 +0100 Subject: [PATCH 2/4] fix path --- htdocs/reception/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 8f28dc72bb8..4666f360354 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1954,7 +1954,7 @@ if ($action == 'create') { print ''; $detail = $langs->trans("NA"); if ($lines[$i]->product->status_batch && $lines[$i]->fk_product > 0) { - require_once DOL_DOCUMENT_ROOT.'/product/stock/productlot.class.php'; + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; $productlot = new Productlot($db); $reslot = $productlot->fetch(0, $lines[$i]->fk_product, $lines[$i]->batch); if ($reslot > 0) { From 64a686aad4128967391f54dd1c3338da753e389e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 11:21:28 +0100 Subject: [PATCH 3/4] Update card.php --- htdocs/reception/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 4666f360354..7ed0f112470 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1951,7 +1951,7 @@ if ($action == 'create') { if (isModEnabled('productbatch')) { if (isset($lines[$i]->batch)) { print ''; - print ''; + print ''; $detail = $langs->trans("NA"); if ($lines[$i]->product->status_batch && $lines[$i]->fk_product > 0) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; From 799b8b8e242ec3c74e4758df841b22fbc4efc00e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 11:55:43 +0100 Subject: [PATCH 4/4] Update card.php --- htdocs/reception/card.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 7ed0f112470..e20cd531565 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1959,6 +1959,16 @@ if ($action == 'create') { $reslot = $productlot->fetch(0, $lines[$i]->fk_product, $lines[$i]->batch); if ($reslot > 0) { $detail = $productlot->getNomUrl(1); + } else { + // lot is not created and info is only in reception lines + $batchinfo = $langs->trans("Batch").': '.$lines[$i]->batch; + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + $batchinfo .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($lines[$i]->sellby, "day"); + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + $batchinfo .= ' - '.$langs->trans("EatByDate").': '.dol_print_date($lines[$i]->eatby, "day"); + } + $detail = $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"), $batchinfo); } } print $detail . '';