// Warehouse: when being flaged as deleted, fixed deletion of associations with carriers, products, shops. StockInterfaces: fixed size of the filters
This commit is contained in:
@@ -228,13 +228,17 @@ form#product_form h4 { font-size:18px; font-weight:normal;}
|
||||
.filter-module .button-filter { float:right;}
|
||||
|
||||
/*FILTER STOCK*/
|
||||
.filter-stock { background-color:#ebedf4; border:1px solid #c2c4d9; margin-bottom:15px; padding:10px; display:block; min-height:65px;}
|
||||
.filter-stock #stock_cover {float:left; margin-right:30px;}
|
||||
.filter-stock { background-color:#ebedf4; border:1px solid #c2c4d9; margin-bottom:15px; padding:10px; display:block; min-height:25px;}
|
||||
.filter-stock #stock_instant_state {float:left; margin-right:30px;}
|
||||
.filter-stock #supply_orders {float:left; margin-right:30px;}
|
||||
.filter-stock label {width:auto;}
|
||||
.filter-stock .select-filter { float:left;}
|
||||
.filter-stock .button-filter { float:right;}
|
||||
.filter-stock-extended { background-color:#ebedf4; border:1px solid #c2c4d9; margin-bottom:15px; padding:10px; display:block; min-height:65px;}
|
||||
.filter-stock-extended #stock_cover {float:left; margin-right:30px;}
|
||||
.filter-stock-extended #supply_orders {float:left; margin-right:30px;}
|
||||
.filter-stock-extended label {width:auto;}
|
||||
.filter-stock-extended .select-filter { float:left;}
|
||||
.filter-stock-extended .button-filter { float:right;}
|
||||
|
||||
/*ADDONS LOGIN*/
|
||||
#addons_login_div { background: #EBEDF4 url(lock.png) no-repeat scroll left 5px;}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*}
|
||||
{extends file="helper/list/list_header.tpl"}
|
||||
{block name=override_header}
|
||||
<div class="filter-stock">
|
||||
<div class="filter-stock-extended">
|
||||
<form id="stock_cover" type="get">
|
||||
<input type="hidden" name="controller" value="AdminStockCover" />
|
||||
<input type="hidden" name="token" value="{$token}" />
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
{extends file="helper/list/list_header.tpl"}
|
||||
{block name=override_header}
|
||||
{if isset($warehouses) && count($warehouses) > 0 && isset($filter_status)}
|
||||
<div class="filter-stock">
|
||||
<div class="filter-stock-extended">
|
||||
<form id="supply_orders" type="get">
|
||||
<input type="hidden" name="controller" value="AdminSupplyOrders" />
|
||||
<input type="hidden" name="token" value="{$token}" />
|
||||
|
||||
@@ -134,6 +134,9 @@ class WarehouseCore extends ObjectModel
|
||||
*/
|
||||
public function setShops($ids_shop)
|
||||
{
|
||||
if (!is_array($ids_shop))
|
||||
$ids_shop = array();
|
||||
|
||||
$row_to_insert = array();
|
||||
foreach ($ids_shop as $id_shop)
|
||||
$row_to_insert[] = array($this->def['primary'] => $this->id, 'id_shop' => (int)$id_shop);
|
||||
@@ -262,6 +265,16 @@ class WarehouseCore extends ObjectModel
|
||||
return (Db::getInstance()->execute($query));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all product locations for this warehouse
|
||||
*/
|
||||
public function resetProductsLocations()
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'warehouse_product_location`
|
||||
WHERE `id_warehouse` = '.(int)$this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given {product, product attribute} gets its location in the given warehouse
|
||||
*
|
||||
@@ -302,6 +315,7 @@ class WarehouseCore extends ObjectModel
|
||||
$query->innerJoin('warehouse', 'w', 'ws.id_warehouse = w.id_warehouse');
|
||||
$query->where('id_product = '.(int)$id_product);
|
||||
$query->where('id_product_attribute = '.(int)$id_product_attribute);
|
||||
$query->where('w.deleted = 0');
|
||||
$query->groupBy('wpl.id_warehouse');
|
||||
|
||||
return (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query));
|
||||
|
||||
@@ -437,14 +437,21 @@ class AdminWarehousesControllerCore extends AdminController
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
else if ($obj->getQuantitiesOfProducts() > 0)
|
||||
$this->_errors[] = $this->l('It is not possible to delete a Warehosue when there are products in it.');
|
||||
$this->_errors[] = $this->l('It is not possible to delete a Warehouse when there are products in it.');
|
||||
else if (SupplyOrder::warehouseHasPendingOrders($obj->id))
|
||||
$this->_errors[] = $this->l('It is not possible to delete a Warehouse if it has pending supply orders.');
|
||||
else
|
||||
{
|
||||
// sets the address of the warehouse as deleted
|
||||
$address = new Address($obj->id_address);
|
||||
$address->deleted = 1;
|
||||
$address->save();
|
||||
|
||||
// removes associations
|
||||
$obj->setCarriers(array());
|
||||
$obj->setShops(array());
|
||||
$obj->resetProductsLocations();
|
||||
|
||||
return parent::postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user