From f1d1fdf9511408ba8d559c3fead9aae36cfa52ca Mon Sep 17 00:00:00 2001 From: All-3kcis Date: Thu, 12 Apr 2018 17:11:02 +0200 Subject: [PATCH] Fix bug when entity=null on DB --- htdocs/product/stock/class/productlot.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index f420ec3b501..6167a967199 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -201,6 +201,7 @@ class Productlot extends CommonObject */ public function fetch($id = 0, $product_id = 0, $batch = '') { + global $conf; dol_syslog(__METHOD__, LOG_DEBUG); $sql = 'SELECT'; @@ -233,7 +234,7 @@ class Productlot extends CommonObject //$this->ref = $obj->fk_product.'_'.$obj->batch; $this->batch = $obj->batch; - $this->entity = $obj->entity; + $this->entity = (!empty($obj->entity)?$obj->entity:$conf->entity); // Prevent "null" entity $this->fk_product = $obj->fk_product; $this->eatby = $this->db->jdate($obj->eatby); $this->sellby = $this->db->jdate($obj->sellby);