Fix bug when entity=null on DB

This commit is contained in:
All-3kcis 2018-04-12 17:11:02 +02:00
parent 21df700325
commit f1d1fdf951

View File

@ -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);