diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php
index 3e99bc1194c..e20cd531565 100644
--- a/htdocs/reception/card.php
+++ b/htdocs/reception/card.php
@@ -1951,23 +1951,27 @@ if ($action == 'create') {
if (isModEnabled('productbatch')) {
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");
+ 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';
+ $productlot = new Productlot($db);
+ $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);
}
- 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 ' | ';
}