diff --git a/admin-dev/themes/template/products/combinations.tpl b/admin-dev/themes/template/products/combinations.tpl index d061f0185..012a757b5 100644 --- a/admin-dev/themes/template/products/combinations.tpl +++ b/admin-dev/themes/template/products/combinations.tpl @@ -100,8 +100,6 @@ {l s='EAN13:'} {l s='UPC:'} {l s='Special characters allowed:'} .-_# - {l s='Location:'} - {l s='Special characters allowed:'} .-_# diff --git a/admin-dev/themes/template/products/informations.tpl b/admin-dev/themes/template/products/informations.tpl index e676bf32b..15cb241a8 100644 --- a/admin-dev/themes/template/products/informations.tpl +++ b/admin-dev/themes/template/products/informations.tpl @@ -126,12 +126,6 @@ {l s='(US, Canada)'} -
{l s='You can specify product reference(s) for each supplier associated.'}
-
-
| ||||||
| {$product_designation[$attribute['id_product_attribute']]} | ++ + | +
| + {l s='Product location in warehouses'} + | +
{l s='Please choose the warehouses associated to this product, and the default one.'}
+ +{assign var=confirm value="Are you sure you want to delete entered product information?"} + + +
{l s='Create new warehouse'}
+
+
+
+
+| {l s='In the warehouse?'} | +{l s='product name'} | +{l s='location in the warehouse (optionnal)'} | +
|---|---|---|
| + | +{$product_designation[$attribute['id_product_attribute']]} | ++ | +
+
'.(!$product_attribute['default_on'] ? '
' : '').'
@@ -3172,6 +3257,47 @@ class AdminProductsControllerCore extends AdminController
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
}
+ public function initFormWarehouses($obj)
+ {
+ $data = $this->context->smarty->createData();
+
+ if ($this->object->id)
+ {
+ // Get all id_product_attribute
+ $attributes = $obj->getAttributesResume($this->context->language->id);
+ if (empty($attributes))
+ $attributes[] = array(
+ 'id_product_attribute' => 0,
+ 'attribute_designation' => ''
+ );
+
+ $product_designation = array();
+
+ foreach ($attributes as $attribute)
+ $product_designation[$attribute['id_product_attribute']] = rtrim($obj->name[$this->context->language->id].' - '.$attribute['attribute_designation'], ' - ');
+
+ // Get all available warehouses
+ $warehouses = Warehouse::getWarehouses(true);
+
+ // Get already associated warehouses
+ $associated_warehouses_collection = WarehouseProductLocation::getCollection($this->object->id);
+
+ $data->assign(array(
+ 'attributes' => $attributes,
+ 'warehouses' => $warehouses,
+ 'associated_warehouses' => $associated_warehouses_collection,
+ 'product_designation' => $product_designation,
+ 'product' => $this->object,
+ 'link' => $this->context->link,
+ 'token' => $this->token
+ ));
+ }
+ else
+ $data->assign('content', ''.$this->l('You must save this product before manage warehouses').'.');
+
+ $this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
+ }
+
public function initFormFeatures($obj)
{
if (!Feature::isFeatureActive())
diff --git a/controllers/admin/AdminStockMvtController.php b/controllers/admin/AdminStockMvtController.php
index 5249e3fd1..b4ed1e036 100644
--- a/controllers/admin/AdminStockMvtController.php
+++ b/controllers/admin/AdminStockMvtController.php
@@ -280,7 +280,7 @@ class AdminStockMvtControllerCore extends AdminController
),
'reason' => array(
'title' => $this->l('Reason'),
- 'width' => 250,
+ 'width' => 100,
'havingFilter' => true
),
'employee' => array(
diff --git a/controllers/admin/AdminSupplyOrdersController.php b/controllers/admin/AdminSupplyOrdersController.php
index d366c0f2d..5cf0a7655 100644
--- a/controllers/admin/AdminSupplyOrdersController.php
+++ b/controllers/admin/AdminSupplyOrdersController.php
@@ -518,22 +518,22 @@ class AdminSupplyOrdersControllerCore extends AdminController
$this->fieldsDisplay = array(
'reference' => array(
'title' => $this->l('Order Reference'),
- 'width' => 120,
+ 'width' => 100,
'havingFilter' => true
),
'supplier' => array(
'title' => $this->l('Supplier'),
- 'width' => 200,
+ 'width' => 100,
'filter_key' => 's!name'
),
'warehouse' => array(
'title' => $this->l('Warehouse'),
- 'width' => 200,
+ 'width' => 100,
'filter_key' => 'w!name'
),
'state' => array(
'title' => $this->l('State'),
- 'width' => 250,
+ 'width' => 200,
'filter_key' => 'stl!name',
'color' => 'color',
),
diff --git a/controllers/admin/AdminWarehousesController.php b/controllers/admin/AdminWarehousesController.php
index 03dab5e29..51fcbb3fa 100644
--- a/controllers/admin/AdminWarehousesController.php
+++ b/controllers/admin/AdminWarehousesController.php
@@ -204,8 +204,8 @@ class AdminWarehousesControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('City:'),
'name' => 'city',
- 'size' => 10,
- 'maxlength' => 12,
+ 'size' => 20,
+ 'maxlength' => 32,
'required' => true,
),
array(
diff --git a/install-dev/sql/db.sql b/install-dev/sql/db.sql
index 2b453cb29..4e84ec195 100644
--- a/install-dev/sql/db.sql
+++ b/install-dev/sql/db.sql
@@ -2067,14 +2067,13 @@ CREATE TABLE `PREFIX_warehouse` (
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_warehouse_product_location` (
-`id_product` INT(11) UNSIGNED NOT NULL,
-`id_product_attribute` INT(11) UNSIGNED NOT NULL,
-`id_warehouse` INT(11) UNSIGNED NOT NULL,
-`location` VARCHAR(64) DEFAULT NULL,
- PRIMARY KEY (`id_product`, `id_product_attribute`, `id_warehouse`),
- KEY `id_warehouse` (`id_warehouse`),
- KEY `id_product` (`id_product`),
- KEY `id_product_attribute` (`id_product_attribute`)
+ `id_warehouse_product_location` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `id_product` int(11) unsigned NOT NULL,
+ `id_product_attribute` int(11) unsigned NOT NULL,
+ `id_warehouse` int(11) unsigned NOT NULL,
+ `location` varchar(64) DEFAULT NULL,
+ PRIMARY KEY (`id_warehouse_product_location`),
+ UNIQUE KEY `id_product` (`id_product`,`id_product_attribute`,`id_warehouse`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_warehouse_shop` (
@@ -2245,4 +2244,4 @@ CREATE TABLE `PREFIX_accounting_product_zone_shop` (
`account_number` varchar(64) NOT NULL,
PRIMARY KEY (`id_accounting_product_zone_shop`),
UNIQUE KEY `id_product` (`id_product`,`id_shop`,`id_zone`)
-) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
\ No newline at end of file
+) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
diff --git a/js/attributesBack.js b/js/attributesBack.js
index eab86ba2d..5562d58e0 100644
--- a/js/attributesBack.js
+++ b/js/attributesBack.js
@@ -27,7 +27,7 @@
var storeUsedGroups = {};
function fillCombinaison(wholesale_price, price_impact, weight_impact, unit_impact, reference,
-ean, quantity, image, old_attr, id_product_attribute, default_attribute, eco_tax, location, upc, minimal_quantity, available_date,
+ean, quantity, image, old_attr, id_product_attribute, default_attribute, eco_tax, upc, minimal_quantity, available_date,
virtual_product_name_attribute, virtual_product_filename_attribute, virtual_product_nb_downloable, virtual_product_expiration_date_attribute,
virtual_product_nb_days, is_shareable)
{
@@ -59,7 +59,7 @@ virtual_product_nb_days, is_shareable)
getE('attribute_unity').value = Math.abs(unit_impact);
if ($('#attribute_ecotax').length != 0)
getE('attribute_ecotax').value = eco_tax;
- getE('attribute_location').value = location;
+
if (default_attribute == 1)
getE('attribute_default').checked = true;
else