Merge pull request #23192 from frederic34/patch-9

display lot with getNomUrl
This commit is contained in:
Laurent Destailleur 2022-12-22 15:06:20 +01:00 committed by GitHub
commit f912624e79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1951,23 +1951,27 @@ if ($action == 'create') {
if (isModEnabled('productbatch')) { if (isModEnabled('productbatch')) {
if (isset($lines[$i]->batch)) { if (isset($lines[$i]->batch)) {
print '<!-- Detail of lot -->'; print '<!-- Detail of lot -->';
print '<td class="linecolbatch">'; print '<td class="linecolbatch nowrap">';
$detail = ''; $detail = $langs->trans("NA");
if ($lines[$i]->product->status_batch) { if ($lines[$i]->product->status_batch && $lines[$i]->fk_product > 0) {
$detail .= $langs->trans("Batch").': '.$lines[$i]->batch; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { $productlot = new Productlot($db);
$detail .= ' - '.$langs->trans("SellByDate").': '.dol_print_date($lines[$i]->sellby, "day"); $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 .= '<br>';
print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"), $detail);
} else {
print $langs->trans("NA");
} }
print '</td>'; print $detail . '</td>';
} else { } else {
print '<td></td>'; print '<td></td>';
} }