// Deleted carriers are now properly removed from the table warehouse_carrier
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10107 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -182,6 +182,20 @@ class WarehouseCore extends ObjectModel
|
||||
Db::getInstance()->autoExecute(_DB_PREFIX_.'warehouse_carrier', $row_to_insert, 'INSERT');
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given carrier, removes it from the warehouse/carrier association
|
||||
* If $id_warehouse is set, it only removes the carrier for this warehouse
|
||||
* @param int $id_carrier
|
||||
* @param int $id_warehouse optional
|
||||
*/
|
||||
public static function removeCarrier($id_carrier, $id_warehouse = null)
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM '._DB_PREFIX_.'warehouse_carrier
|
||||
WHERE id_carrier = '.(int)$id_carrier.
|
||||
($id_warehouse ? ' AND id_warehouse = '.(int)$id_warehouse : ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a warehouse is empty - i.e. holds no stock
|
||||
*
|
||||
@@ -315,7 +329,9 @@ class WarehouseCore extends ObjectModel
|
||||
FROM '._DB_PREFIX_.'stock s
|
||||
WHERE s.id_warehouse = '.(int)$this->id;
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
|
||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
|
||||
|
||||
return ($res ? $res : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user