// Warehouse : added isEmpty()

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9277 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
bMancone
2011-10-12 14:38:07 +00:00
parent c4e28b117d
commit 81aae0acf3
+14
View File
@@ -102,6 +102,20 @@ class WarehouseCore extends ObjectModel
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
*