Use correct values of eatby and sellby on batchs expeditions

Use new table "product_lot" to getting eatby and sellby date
This commit is contained in:
All3kcis 2018-03-01 14:23:19 +01:00 committed by GitHub
parent efb0cbfd53
commit 733ca8af7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,14 +59,15 @@ class ExpeditionLineBatch extends CommonObject
function fetchFromStock($id_stockdluo)
{
$sql = "SELECT";
$sql.= " t.sellby,";
$sql.= " t.eatby,";
$sql.= " t.batch,";
$sql.= " e.fk_entrepot";
$sql.= " pl.sellby,";
$sql.= " pl.eatby,";
$sql.= " pl.batch,";
$sql.= " ps.fk_entrepot";
$sql.= " FROM ".MAIN_DB_PREFIX."product_batch as t inner join ";
$sql.= MAIN_DB_PREFIX."product_stock as e on t.fk_product_stock=e.rowid ";
$sql.= " WHERE t.rowid = ".(int) $id_stockdluo;
$sql.= " FROM ".MAIN_DB_PREFIX."product_batch as pb";
$sql.= " JOIN ".MAIN_DB_PREFIX."product_stock as ps on pb.fk_product_stock=ps.rowid";
$sql.= ' JOIN '.MAIN_DB_PREFIX."product_lot as pl on pl.batch = pb.batch AND pl.fk_product = ps.fk_product";
$sql.= " WHERE pb.rowid = ".(int) $id_stockdluo;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);