diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index d132a87233f..5e285f20457 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -928,7 +928,7 @@ if ($id > 0 || !empty($ref)) { '; // List of lines already dispatched - $sql = "SELECT p.ref, p.label,"; + $sql = "SELECT p.rowid as pid, p.ref, p.label,"; $sql .= " e.rowid as warehouse_id, e.ref as entrepot,"; $sql .= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.datec"; if ($conf->reception->enabled)$sql .= " ,cfd.fk_reception, r.date_delivery"; @@ -1005,9 +1005,18 @@ if ($id > 0 || !empty($ref)) { print ''.dol_print_date($db->jdate($objp->date_delivery), 'day').''; if (!empty($conf->productbatch->enabled)) { - print ''.$objp->batch.''; - print ''.dol_print_date($db->jdate($objp->eatby), 'day').''; - print ''.dol_print_date($db->jdate($objp->sellby), 'day').''; + if ($objp->batch) { + include_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; + $lot=new Productlot($db); + $lot->fetch(0, $objp->pid, $objp->batch); + print ''.$lot->getNomUrl(1).''; + print ''.dol_print_date($lot->eatby, 'day').''; + print ''.dol_print_date($lot->sellby, 'day').''; + } else { + print ''; + print ''; + print ''; + } } // Qty