// AdminWarehousesController: fixed association with carriers. Warehouse: fixed association with carriers. Carrier: norm & tags. AdminProductsController: added warning when using the advanced stock management without assocations with warehouses/carriers

This commit is contained in:
bMancone
2011-12-22 11:09:33 +00:00
parent 072738a68c
commit 415e56d37e
4 changed files with 69 additions and 23 deletions
+5 -1
View File
@@ -175,6 +175,9 @@ class WarehouseCore extends ObjectModel
*/
public function setCarriers($ids_carriers)
{
if (!is_array($ids_carriers))
$ids_carriers = array();
$row_to_insert = array();
foreach ($ids_carriers as $id_carrier)
$row_to_insert[] = array($this->def['primary'] => $this->id, 'id_carrier' => (int)$id_carrier);
@@ -183,7 +186,8 @@ class WarehouseCore extends ObjectModel
DELETE FROM '._DB_PREFIX_.'warehouse_carrier
WHERE '.$this->def['primary'].' = '.(int)$this->id);
Db::getInstance()->autoExecute(_DB_PREFIX_.'warehouse_carrier', $row_to_insert, 'INSERT');
if ($row_to_insert)
Db::getInstance()->autoExecute(_DB_PREFIX_.'warehouse_carrier', $row_to_insert, 'INSERT');
}
/**