// Warehouse : added isEmpty()
This commit is contained in:
@@ -102,6 +102,20 @@ class WarehouseCore extends ObjectModel
|
|||||||
Db::getInstance()->autoExecute('warehouse_shop', $row_to_insert, 'INSERT');
|
Db::getInstance()->autoExecute('warehouse_shop', $row_to_insert, 'INSERT');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For the current warehouse, returns if the warehouse is empty
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isEmpty()
|
||||||
|
{
|
||||||
|
$query = new DbQuery();
|
||||||
|
$query->select('SUM(s.physical_quantity)');
|
||||||
|
$query->from('stock s');
|
||||||
|
$query->where($this->identifier.' = '.(int)$this->id);
|
||||||
|
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For a given warehouse, checks if it exists
|
* For a given warehouse, checks if it exists
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user