// AdminWarehousesController : added informations on the shops associated to a warehouse on the 'view' action
This commit is contained in:
@@ -70,6 +70,23 @@
|
|||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="margin-top: 30px">
|
||||||
|
<fieldset>
|
||||||
|
<legend><img src="/img/t/AdminShop.gif" alt="" /> {l s='Shops'}</legend>
|
||||||
|
{l s='The following are the shops associated to this warehouse.'}
|
||||||
|
<table style="width: 400px; margin-top:20px" classe="table">
|
||||||
|
<tr>
|
||||||
|
<th>{l s='ID'}</th>
|
||||||
|
<th>{l s='Name'}</th>
|
||||||
|
{foreach $shops as $shop}
|
||||||
|
<tr>
|
||||||
|
<td>{$shop.id_shop}</td>
|
||||||
|
<td>{$shop.name}</td>
|
||||||
|
</tr>
|
||||||
|
{/foreach}
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
<div style="margin-top: 30px">
|
<div style="margin-top: 30px">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><img src="/img/t/AdminStock.gif" alt="" /> {l s='Stock'}</legend>
|
<legend><img src="/img/t/AdminStock.gif" alt="" /> {l s='Stock'}</legend>
|
||||||
|
|||||||
@@ -107,20 +107,14 @@ class WarehouseCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public function getShops()
|
public function getShops()
|
||||||
{
|
{
|
||||||
$ids_shop = array();
|
|
||||||
|
|
||||||
$query = new DbQuery();
|
$query = new DbQuery();
|
||||||
$query->select('ws.id_shop');
|
$query->select('ws.id_shop, s.name');
|
||||||
$query->from('warehouse_shop ws');
|
$query->from('warehouse_shop ws');
|
||||||
|
$query->leftJoin('shop s ON (s.id_shop = ws.id_shop)');
|
||||||
$query->where($this->identifier.' = '.(int)$this->id);
|
$query->where($this->identifier.' = '.(int)$this->id);
|
||||||
|
|
||||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
|
||||||
|
return $res;
|
||||||
foreach ($res as $shops)
|
|
||||||
foreach ($shops as $shop)
|
|
||||||
$ids_shop[] = $shop;
|
|
||||||
|
|
||||||
return $ids_shop;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -338,6 +338,9 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
|
|
||||||
// loads current shops associated with this warehouse
|
// loads current shops associated with this warehouse
|
||||||
$shops = $obj->getShops();
|
$shops = $obj->getShops();
|
||||||
|
$ids_shop = array();
|
||||||
|
foreach ($shops as $shop)
|
||||||
|
$ids_shop[] = $shop['id_shop'];
|
||||||
|
|
||||||
// loads current carriers associated with this warehouse
|
// loads current carriers associated with this warehouse
|
||||||
$carriers = $obj->getCarriers();
|
$carriers = $obj->getCarriers();
|
||||||
@@ -356,7 +359,7 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
);
|
);
|
||||||
else
|
else
|
||||||
$this->fields_value['id_address'] = 0;
|
$this->fields_value['id_address'] = 0;
|
||||||
$this->fields_value['ids_shops[]'] = $shops;
|
$this->fields_value['ids_shops[]'] = $ids_shop;
|
||||||
$this->fields_value['ids_carriers[]'] = $carriers;
|
$this->fields_value['ids_carriers[]'] = $carriers;
|
||||||
|
|
||||||
return parent::initForm();
|
return parent::initForm();
|
||||||
@@ -451,6 +454,7 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
$employee = new Employee($warehouse->id_employee);
|
$employee = new Employee($warehouse->id_employee);
|
||||||
$currency = new Currency($warehouse->id_currency);
|
$currency = new Currency($warehouse->id_currency);
|
||||||
$address = new Address($warehouse->id_address);
|
$address = new Address($warehouse->id_address);
|
||||||
|
$shops = $warehouse->getShops();
|
||||||
|
|
||||||
if (!Validate::isLoadedObject($warehouse) ||
|
if (!Validate::isLoadedObject($warehouse) ||
|
||||||
!Validate::isLoadedObject($employee) ||
|
!Validate::isLoadedObject($employee) ||
|
||||||
@@ -462,6 +466,7 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
'employee' => $employee,
|
'employee' => $employee,
|
||||||
'currency' => $currency,
|
'currency' => $currency,
|
||||||
'address' => $address,
|
'address' => $address,
|
||||||
|
'shops' => $shops,
|
||||||
'warehouse_num_products' => $warehouse->getNumberOfProducts(),
|
'warehouse_num_products' => $warehouse->getNumberOfProducts(),
|
||||||
'warehouse_value' => Tools::ps_round($warehouse->getStockValue(), 2),
|
'warehouse_value' => Tools::ps_round($warehouse->getStockValue(), 2),
|
||||||
'warehouse_quantities' => $warehouse->getQuantitiesofProducts(),
|
'warehouse_quantities' => $warehouse->getQuantitiesofProducts(),
|
||||||
|
|||||||
Reference in New Issue
Block a user