// norm & translations
This commit is contained in:
@@ -263,7 +263,7 @@ class AdminStockCoverControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$item['stock'] = 'See details';
|
$item['stock'] = $this->l('See details');
|
||||||
$item['reference'] = '--';
|
$item['reference'] = '--';
|
||||||
$item['ean13'] = '--';
|
$item['ean13'] = '--';
|
||||||
$item['upc'] = '--';
|
$item['upc'] = '--';
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ class AdminStockManagementControllerCore extends AdminController
|
|||||||
$this->displayInformation($this->l('Through this interface, you can increase quantities (add) and decrease quantities (delete) of products for a given warehouse.'));
|
$this->displayInformation($this->l('Through this interface, you can increase quantities (add) and decrease quantities (delete) of products for a given warehouse.'));
|
||||||
$this->displayInformation($this->l('Furthermore, you can move quantities (transfer) of products between warehouses, or within one warehouse.').'<br />');
|
$this->displayInformation($this->l('Furthermore, you can move quantities (transfer) of products between warehouses, or within one warehouse.').'<br />');
|
||||||
$this->displayInformation($this->l('Note that if you want to increase quantities of multiple products at once, you can use the supply orders tab.').'<br />');
|
$this->displayInformation($this->l('Note that if you want to increase quantities of multiple products at once, you can use the supply orders tab.').'<br />');
|
||||||
|
|
||||||
$this->displayInformation($this->l('Finally, you will be asked to specify the state of the quantity you will add : '));
|
$this->displayInformation($this->l('Finally, you will be asked to specify the state of the quantity you will add : '));
|
||||||
$this->displayInformation($this->l('usable for sale means that this quantity will be available in shop(s),'));
|
$this->displayInformation($this->l('usable for sale means that this quantity will be available in shop(s),'));
|
||||||
$this->displayInformation($this->l('otherwise it will be considered reserved (i.e. for other purposes).'));
|
$this->displayInformation($this->l('otherwise it will be considered reserved (i.e. for other purposes).'));
|
||||||
@@ -148,6 +147,7 @@ class AdminStockManagementControllerCore extends AdminController
|
|||||||
$last_sm_quantity_is_usable = -1;
|
$last_sm_quantity_is_usable = -1;
|
||||||
$last_sm = StockMvt::getLastPositiveStockMvt($id_product, $id_product_attribute);
|
$last_sm = StockMvt::getLastPositiveStockMvt($id_product, $id_product_attribute);
|
||||||
|
|
||||||
|
// if there is a stock mvt
|
||||||
if ($last_sm != false)
|
if ($last_sm != false)
|
||||||
{
|
{
|
||||||
$last_sm_currency = new Currency((int)$last_sm['id_currency']);
|
$last_sm_currency = new Currency((int)$last_sm['id_currency']);
|
||||||
@@ -577,7 +577,7 @@ class AdminStockManagementControllerCore extends AdminController
|
|||||||
$this->errors[] = Tools::displayError('The selected product is not valid.');
|
$this->errors[] = Tools::displayError('The selected product is not valid.');
|
||||||
|
|
||||||
// get quantity and check that the post value is really an integer
|
// get quantity and check that the post value is really an integer
|
||||||
// If it's not, we have to do nothing.
|
// If it's not, we have nothing to do
|
||||||
$quantity = Tools::getValue('quantity', 0);
|
$quantity = Tools::getValue('quantity', 0);
|
||||||
if (!is_numeric($quantity) || (int)$quantity <= 0)
|
if (!is_numeric($quantity) || (int)$quantity <= 0)
|
||||||
$this->errors[] = Tools::displayError('The quantity value is not valid.');
|
$this->errors[] = Tools::displayError('The quantity value is not valid.');
|
||||||
@@ -700,7 +700,7 @@ class AdminStockManagementControllerCore extends AdminController
|
|||||||
$this->errors[] = Tools::displayError('You have to specify if the product quantity is usable for sale on shops in destination warehouse.');
|
$this->errors[] = Tools::displayError('You have to specify if the product quantity is usable for sale on shops in destination warehouse.');
|
||||||
$usable_to = (bool)$usable_to;
|
$usable_to = (bool)$usable_to;
|
||||||
|
|
||||||
// if all is ok, transfer stock
|
// if we can process stock transfers
|
||||||
if (count($this->errors) == 0)
|
if (count($this->errors) == 0)
|
||||||
{
|
{
|
||||||
// transfer stock
|
// transfer stock
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
$this->table = 'warehouse';
|
$this->table = 'warehouse';
|
||||||
$this->className = 'Warehouse';
|
$this->className = 'Warehouse';
|
||||||
$this->context = Context::getContext();
|
|
||||||
$this->deleted = true;
|
$this->deleted = true;
|
||||||
$this->lang = false;
|
$this->lang = false;
|
||||||
|
|
||||||
@@ -113,8 +112,8 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
$this->displayInformation($this->l('Before adding stock in your warehouses, you should check the general default currency used.').'<br />');
|
$this->displayInformation($this->l('Before adding stock in your warehouses, you should check the general default currency used.').'<br />');
|
||||||
$this->displayInformation($this->l('Futhermore, for each warehouse, you have to check :'));
|
$this->displayInformation($this->l('Futhermore, for each warehouse, you have to check :'));
|
||||||
$this->displayInformation($this->l('the management type (according to the law in your country), the valuation currency, its associated carriers and shops.').'<br />');
|
$this->displayInformation($this->l('the management type (according to the law in your country), the valuation currency, its associated carriers and shops.').'<br />');
|
||||||
$this->displayInformation($this->l('Finally, you can see detailed informations on your stock per warehouse, such as its valuation, the number of products and quantities stored, ...').'<br /><br />');
|
$this->displayInformation($this->l('Finally, you can see detailed informations on your stock per warehouse, such as its valuation, the number of products and quantities stored, ...')
|
||||||
|
.'<br /><br />');
|
||||||
$this->displayInformation($this->l('Be careful, products from different warehouses will need to be shipped in different packages.'));
|
$this->displayInformation($this->l('Be careful, products from different warehouses will need to be shipped in different packages.'));
|
||||||
|
|
||||||
return parent::renderList();
|
return parent::renderList();
|
||||||
@@ -274,9 +273,10 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// It is not possible to change currency valuation and management type
|
// if it is still possible to change currency valuation and management type
|
||||||
if (Tools::isSubmit('addwarehouse') || Tools::isSubmit('submitAddwarehouse'))
|
if (Tools::isSubmit('addwarehouse') || Tools::isSubmit('submitAddwarehouse'))
|
||||||
{
|
{
|
||||||
|
// adds input management type
|
||||||
$this->fields_form['input'][] = array(
|
$this->fields_form['input'][] = array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => $this->l('Management type:'),
|
'label' => $this->l('Management type:'),
|
||||||
@@ -311,6 +311,7 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
if ($default_currency)
|
if ($default_currency)
|
||||||
$currencies = array_merge(array($default_currency, '-'), $currencies);
|
$currencies = array_merge(array($default_currency, '-'), $currencies);
|
||||||
|
|
||||||
|
// adds input valuation currency
|
||||||
$this->fields_form['input'][] = array(
|
$this->fields_form['input'][] = array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => $this->l('Stock valuation currency:'),
|
'label' => $this->l('Stock valuation currency:'),
|
||||||
@@ -324,7 +325,7 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else // else hide input
|
||||||
{
|
{
|
||||||
$this->fields_form['input'][] = array(
|
$this->fields_form['input'][] = array(
|
||||||
'type' => 'hidden',
|
'type' => 'hidden',
|
||||||
@@ -356,7 +357,7 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
// loads current carriers associated with this warehouse
|
// loads current carriers associated with this warehouse
|
||||||
$carriers = $obj->getCarriers();
|
$carriers = $obj->getCarriers();
|
||||||
|
|
||||||
// force specific fields values
|
// if an address is available : force specific fields values
|
||||||
if ($address != null)
|
if ($address != null)
|
||||||
$this->fields_value = array(
|
$this->fields_value = array(
|
||||||
'id_address' => $address->id,
|
'id_address' => $address->id,
|
||||||
@@ -368,11 +369,13 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
'id_country' => $address->id_country,
|
'id_country' => $address->id_country,
|
||||||
'id_state' => $address->id_state,
|
'id_state' => $address->id_state,
|
||||||
);
|
);
|
||||||
else
|
else // loads default country
|
||||||
$this->fields_value = array(
|
$this->fields_value = array(
|
||||||
'id_address' => 0,
|
'id_address' => 0,
|
||||||
'id_country' => Configuration::get('PS_COUNTRY_DEFAULT')
|
'id_country' => Configuration::get('PS_COUNTRY_DEFAULT')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// loads shops and carriers
|
||||||
$this->fields_value['ids_shops[]'] = $ids_shop;
|
$this->fields_value['ids_shops[]'] = $ids_shop;
|
||||||
$this->fields_value['ids_carriers[]'] = $carriers;
|
$this->fields_value['ids_carriers[]'] = $carriers;
|
||||||
|
|
||||||
@@ -384,8 +387,7 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
*/
|
*/
|
||||||
public function renderView()
|
public function renderView()
|
||||||
{
|
{
|
||||||
$this->displayInformation($this->l('This interface allows you to display detailed informations on your warehouse.'));
|
// gets necessary objects
|
||||||
|
|
||||||
$id_warehouse = (int)Tools::getValue('id_warehouse');
|
$id_warehouse = (int)Tools::getValue('id_warehouse');
|
||||||
$warehouse = new Warehouse($id_warehouse);
|
$warehouse = new Warehouse($id_warehouse);
|
||||||
$employee = new Employee($warehouse->id_employee);
|
$employee = new Employee($warehouse->id_employee);
|
||||||
@@ -393,11 +395,14 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
$address = new Address($warehouse->id_address);
|
$address = new Address($warehouse->id_address);
|
||||||
$shops = $warehouse->getShops();
|
$shops = $warehouse->getShops();
|
||||||
|
|
||||||
|
// checks objects
|
||||||
if (!Validate::isLoadedObject($warehouse) ||
|
if (!Validate::isLoadedObject($warehouse) ||
|
||||||
!Validate::isLoadedObject($employee) ||
|
!Validate::isLoadedObject($employee) ||
|
||||||
!Validate::isLoadedObject($currency))
|
!Validate::isLoadedObject($currency) ||
|
||||||
|
!Validate::isLoadedObject($address))
|
||||||
return parent::renderView();
|
return parent::renderView();
|
||||||
|
|
||||||
|
// assigns to our view
|
||||||
$this->tpl_view_vars = array(
|
$this->tpl_view_vars = array(
|
||||||
'warehouse' => $warehouse,
|
'warehouse' => $warehouse,
|
||||||
'employee' => $employee,
|
'employee' => $employee,
|
||||||
@@ -414,9 +419,12 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdminController::afterAdd()
|
* @see AdminController::afterAdd()
|
||||||
|
* Called once $object is set.
|
||||||
|
* Used to process the associations with address/shops/carriers
|
||||||
*/
|
*/
|
||||||
protected function afterAdd($object)
|
protected function afterAdd($object)
|
||||||
{
|
{
|
||||||
|
// handles address association
|
||||||
$address = new Address($object->id_address);
|
$address = new Address($object->id_address);
|
||||||
if (Validate::isLoadedObject($address))
|
if (Validate::isLoadedObject($address))
|
||||||
{
|
{
|
||||||
@@ -443,9 +451,11 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
||||||
|
|
||||||
|
// foreach item in the list to render
|
||||||
$nb_items = count($this->_list);
|
$nb_items = count($this->_list);
|
||||||
for ($i = 0; $i < $nb_items; ++$i)
|
for ($i = 0; $i < $nb_items; ++$i)
|
||||||
{
|
{
|
||||||
|
// depending on the management type, translates the management type
|
||||||
$item = &$this->_list[$i];
|
$item = &$this->_list[$i];
|
||||||
switch ($item['management_type'])
|
switch ($item['management_type'])
|
||||||
{
|
{
|
||||||
@@ -492,6 +502,7 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
else
|
else
|
||||||
$address = new Address(); // creates address
|
$address = new Address(); // creates address
|
||||||
|
|
||||||
|
// sets the address
|
||||||
$address->alias = Tools::getValue('reference', null);
|
$address->alias = Tools::getValue('reference', null);
|
||||||
$address->lastname = 'warehouse'; // skip problem with numeric characters in warehouse name
|
$address->lastname = 'warehouse'; // skip problem with numeric characters in warehouse name
|
||||||
$address->firstname = 'warehouse'; // skip problem with numeric characters in warehouse name
|
$address->firstname = 'warehouse'; // skip problem with numeric characters in warehouse name
|
||||||
@@ -503,16 +514,17 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
$address->id_state = Tools::getValue('id_state', null);
|
$address->id_state = Tools::getValue('id_state', null);
|
||||||
$address->city = Tools::getValue('city', null);
|
$address->city = Tools::getValue('city', null);
|
||||||
|
|
||||||
|
// validates the address
|
||||||
$validation = $address->validateController();
|
$validation = $address->validateController();
|
||||||
|
|
||||||
// checks address validity
|
// checks address validity
|
||||||
if (count($validation) > 0)
|
if (count($validation) > 0) // if not valid
|
||||||
{
|
{
|
||||||
foreach ($validation as $item)
|
foreach ($validation as $item)
|
||||||
$this->errors[] = $item;
|
$this->errors[] = $item;
|
||||||
$this->errors[] = Tools::displayError('The address is not correct. Check if all required fields are filled.');
|
$this->errors[] = Tools::displayError('The address is not correct. Check if all required fields are filled.');
|
||||||
}
|
}
|
||||||
else
|
else // valid
|
||||||
{
|
{
|
||||||
if (Tools::isSubmit('id_address') && Tools::getValue('id_address') > 0)
|
if (Tools::isSubmit('id_address') && Tools::getValue('id_address') > 0)
|
||||||
$address->update();
|
$address->update();
|
||||||
@@ -549,13 +561,14 @@ class AdminWarehousesControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
if (Tools::isSubmit('delete'.$this->table))
|
if (Tools::isSubmit('delete'.$this->table))
|
||||||
{
|
{
|
||||||
|
// check if the warehouse exists and can be deleted
|
||||||
if (!($obj = $this->loadObject(true)))
|
if (!($obj = $this->loadObject(true)))
|
||||||
return;
|
return;
|
||||||
else if ($obj->getQuantitiesOfProducts() > 0)
|
else if ($obj->getQuantitiesOfProducts() > 0) // not possible : products
|
||||||
$this->errors[] = $this->l('It is not possible to delete a Warehouse 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))
|
else if (SupplyOrder::warehouseHasPendingOrders($obj->id)) // not possible : supply orders
|
||||||
$this->errors[] = $this->l('It is not possible to delete a Warehouse if it has pending supply orders.');
|
$this->errors[] = $this->l('It is not possible to delete a Warehouse if it has pending supply orders.');
|
||||||
else
|
else // can be deleted
|
||||||
{
|
{
|
||||||
// sets the address of the warehouse as deleted
|
// sets the address of the warehouse as deleted
|
||||||
$address = new Address($obj->id_address);
|
$address = new Address($obj->id_address);
|
||||||
|
|||||||
Reference in New Issue
Block a user