diff --git a/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl
index 57a7643f6..702e3df33 100755
--- a/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl
+++ b/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl
@@ -192,6 +192,12 @@
+
+
diff --git a/admin-dev/themes/default/template/controllers/supply_orders_change_state/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/supply_orders_change_state/helpers/form/form.tpl
index 107c595c0..8acabb544 100644
--- a/admin-dev/themes/default/template/controllers/supply_orders_change_state/helpers/form/form.tpl
+++ b/admin-dev/themes/default/template/controllers/supply_orders_change_state/helpers/form/form.tpl
@@ -28,6 +28,18 @@
{block name="other_input"}
{if isset($supply_order) && $supply_order->id > 0 && isset($supply_order_states)}
+
diff --git a/classes/CMS.php b/classes/CMS.php
index f44074ba9..ed9cd718b 100644
--- a/classes/CMS.php
+++ b/classes/CMS.php
@@ -160,11 +160,14 @@ class CMSCore extends ObjectModel
public static function cleanPositions($id_category)
{
- $result = Db::getInstance()->executeS('
+ $sql = '
SELECT `id_cms`
FROM `'._DB_PREFIX_.'cms`
WHERE `id_cms_category` = '.(int)$id_category.'
- ORDER BY `position`');
+ ORDER BY `position`';
+
+ $result = Db::getInstance()->executeS($sql);
+
for ($i = 0, $total = count($result); $i < $total; ++$i)
{
$sql = 'UPDATE `'._DB_PREFIX_.'cms`
@@ -178,7 +181,12 @@ class CMSCore extends ObjectModel
public static function getLastPosition($id_category)
{
- return (Db::getInstance()->getValue('SELECT MAX(position)+1 FROM `'._DB_PREFIX_.'cms` WHERE `id_cms_category` = '.(int)$id_category));
+ $sql = '
+ SELECT MAX(position) + 1
+ FROM `'._DB_PREFIX_.'cms`
+ WHERE `id_cms_category` = '.(int)$id_category;
+
+ return (Db::getInstance()->getValue($sql));
}
public static function getCMSPages($id_lang = null, $id_cms_category = null, $active = true)
@@ -207,6 +215,7 @@ class CMSCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'lang` AS l ON c.`id_lang` = l.`id_lang`
WHERE c.`id_cms` = '.(int)$id_cms.'
AND l.`active` = 1';
+
return Db::getInstance()->executeS($sql);
}
}
diff --git a/classes/cache/Cache.php b/classes/cache/Cache.php
index fa5b75ba2..90e308983 100755
--- a/classes/cache/Cache.php
+++ b/classes/cache/Cache.php
@@ -307,6 +307,11 @@ abstract class CacheCore
return isset(Cache::$local[$key]) ? Cache::$local[$key] : null;
}
+ public static function retrieveAll()
+ {
+ return Cache::$local;
+ }
+
public static function isStored($key)
{
return isset(Cache::$local[$key]);
@@ -324,4 +329,5 @@ abstract class CacheCore
else
unset(Cache::$local[$key]);
}
+
}
diff --git a/classes/stock/SupplyOrderState.php b/classes/stock/SupplyOrderState.php
index 189bf11dd..3ed00e1d7 100755
--- a/classes/stock/SupplyOrderState.php
+++ b/classes/stock/SupplyOrderState.php
@@ -165,6 +165,8 @@ class SupplyOrderStateCore extends ObjectModel
if ($ids)
$query->where('s.id_supply_order_state NOT IN('.implode(',', array_map('intval', $ids)).')');
+ $query->orderBy('sl.name ASC');
+
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
}
diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php
index 1458368e9..a6232a859 100644
--- a/controllers/admin/AdminAddressesController.php
+++ b/controllers/admin/AdminAddressesController.php
@@ -51,7 +51,7 @@ class AdminAddressesControllerCore extends AdminController
$countries = Country::getCountries($this->context->language->id);
foreach ($countries as $country)
$this->countries_array[$country['id_country']] = $country['name'];
-
+
$this->fieldsDisplay = array(
'id_address' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'firstname' => array('title' => $this->l('First name'), 'width' => 120, 'filter_key' => 'a!firstname'),
@@ -187,24 +187,42 @@ class AdminAddressesControllerCore extends AdminController
}
else if ($addr_field_item == 'lastname')
{
+ if (isset($customer) &&
+ !Tools::isSubmit('submit'.strtoupper($this->table)) &&
+ Validate::isLoadedObject($customer) &&
+ !Validate::isLoadedObject($this->object))
+ $default_value = $customer->lastname;
+ else
+ $default_value = '';
+
$temp_fields[] = array(
'type' => 'text',
'label' => $this->l('Last name'),
'name' => 'lastname',
'size' => 33,
'required' => true,
- 'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"�{}_$%: '
+ 'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"�{}_$%: ',
+ 'default_value' => $default_value,
);
}
else if ($addr_field_item == 'firstname')
{
+ if (isset($customer) &&
+ !Tools::isSubmit('submit'.strtoupper($this->table)) &&
+ Validate::isLoadedObject($customer) &&
+ !Validate::isLoadedObject($this->object))
+ $default_value = $customer->firstname;
+ else
+ $default_value = '';
+
$temp_fields[] = array(
'type' => 'text',
'label' => $this->l('First name'),
'name' => 'firstname',
'size' => 33,
'required' => true,
- 'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"�{}_$%: '
+ 'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"�{}_$%: ',
+ 'default_value' => $default_value,
);
}
else if ($addr_field_item == 'address1')
@@ -254,11 +272,11 @@ class AdminAddressesControllerCore extends AdminController
'label' => $this->l('Country:'),
'name' => 'id_country',
'required' => false,
+ 'default_value' => (int)$this->context->country->id,
'options' => array(
'query' => Country::getCountries($this->context->language->id),
'id' => 'id_country',
'name' => 'name',
- 'preselect_country' => true,
)
);
$temp_fields[] = array(
@@ -272,17 +290,9 @@ class AdminAddressesControllerCore extends AdminController
'name' => 'name',
)
);
-
- $this->fields_value['id_country'] = Configuration::get('PS_COUNTRY_DEFAULT');
}
}
- if (isset($customer) && !Tools::isSubmit('submit'.strtoupper($this->table)) && Validate::isLoadedObject($customer) && !Validate::isLoadedObject($this->object))
- {
- $this->fields_value['lastname'] = $customer->lastname;
- $this->fields_value['firstname'] = $customer->firstname;
- }
-
// merge address format with the rest of the form
array_splice($this->fields_form['input'], 3, 0, $temp_fields);
@@ -373,7 +383,7 @@ class AdminAddressesControllerCore extends AdminController
Tools::redirectAdmin(Tools::getValue('back').'&conf=4');
}
}
-
+
public function processAdd($token)
{
if (Tools::getValue('submitFormAjax'))
diff --git a/controllers/admin/AdminCmsContentController.php b/controllers/admin/AdminCmsContentController.php
index e22332b7e..240834ac4 100644
--- a/controllers/admin/AdminCmsContentController.php
+++ b/controllers/admin/AdminCmsContentController.php
@@ -76,9 +76,10 @@ class AdminCmsContentControllerCore extends AdminController
if ($this->display == 'edit_category')
$this->content .= $this->adminCMSCategories->renderForm();
- elseif ($this->display == 'edit_page')
+ else if ($this->display == 'edit_page')
$this->content .= $this->adminCMS->renderForm();
- elseif ($this->display == 'view_page'){}
+ else if ($this->display == 'view_page')
+ $fixme = 'fixme';// @FIXME
else
{
$id_cms_category = (int)(Tools::getValue('id_cms_category'));
@@ -112,14 +113,14 @@ class AdminCmsContentControllerCore extends AdminController
|| isset($_GET['updatecms_category'])
|| isset($_GET['addcms_category']))
$this->display = 'edit_category';
- elseif (((Tools::isSubmit('submitAddcms') || Tools::isSubmit('submitAddcmsAndStay')) && count($this->adminCMS->errors))
+ else if (((Tools::isSubmit('submitAddcms') || Tools::isSubmit('submitAddcmsAndStay')) && count($this->adminCMS->errors))
|| isset($_GET['updatecms'])
|| isset($_GET['addcms']))
$this->display = 'edit_page';
else
{
$this->display = 'list';
- $this->id_cms_category = (int)(Tools::getValue('id_cms_category'));
+ $this->id_cms_category = (int)Tools::getValue('id_cms_category');
}
if (Tools::isSubmit('submitDelcms')
@@ -129,7 +130,7 @@ class AdminCmsContentControllerCore extends AdminController
|| Tools::isSubmit('viewcms')
|| (Tools::isSubmit('statuscms') && Tools::isSubmit('id_cms')) && (Tools::isSubmit('position') && !Tools::isSubmit('id_cms_category_to_move')))
$this->adminCMS->postProcess();
- elseif (Tools::isSubmit('submitDelcms_category')
+ else if (Tools::isSubmit('submitDelcms_category')
|| Tools::isSubmit('submitAddcms_categoryAndBackToParent')
|| Tools::isSubmit('submitAddcms_category')
|| isset($_GET['deletecms_category'])
diff --git a/controllers/admin/AdminCmsController.php b/controllers/admin/AdminCmsController.php
index c27ba5eba..a241b19d5 100644
--- a/controllers/admin/AdminCmsController.php
+++ b/controllers/admin/AdminCmsController.php
@@ -53,7 +53,7 @@ class AdminCmsControllerCore extends AdminController
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'cms_category` c ON (c.`id_cms_category` = a.`id_cms_category`)';
$this->_select = 'a.position ';
- $this->_filter = 'AND c.id_cms_category = '.(int)($this->_category->id);
+ $this->_filter = 'AND c.id_cms_category = '.(int)$this->_category->id;
parent::__construct();
}
@@ -231,7 +231,7 @@ class AdminCmsControllerCore extends AdminController
Configuration::updateValue('PS_CONDITIONS', 0);
Configuration::updateValue('PS_CONDITIONS_CMS_ID', 0);
}
- $cms = new CMS((int)(Tools::getValue('id_cms')));
+ $cms = new CMS((int)Tools::getValue('id_cms'));
$cms->cleanPositions($cms->id_cms_category);
if (!$cms->delete())
$this->errors[] = Tools::displayError('An error occurred while deleting object.').' '.$this->table.' ('.Db::getInstance()->getMsgError().')';
diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php
index 1be15bb64..03e4d6c04 100644
--- a/controllers/admin/AdminCustomerThreadsController.php
+++ b/controllers/admin/AdminCustomerThreadsController.php
@@ -405,16 +405,6 @@ class AdminCustomerThreadsControllerCore extends AdminController
$this->errors[] = Tools::displayError('An error occurred, your message was not sent. Please contact your system administrator.');
}
}
-
- /*
-if (Tools::isSubmit('submitGeneral'.$this->table))
- {
- p($_POST);
-
- die('toto');
- //PS_SAV_IMAP_OPT
- }
-*/
return parent::postProcess();
}
diff --git a/controllers/admin/AdminManufacturersController.php b/controllers/admin/AdminManufacturersController.php
index 10ec8e99f..1ef8788d6 100644
--- a/controllers/admin/AdminManufacturersController.php
+++ b/controllers/admin/AdminManufacturersController.php
@@ -456,11 +456,11 @@ class AdminManufacturersControllerCore extends AdminController
'label' => $this->l('Country:'),
'name' => 'id_country',
'required' => false,
+ 'default_value' => (int)$this->context->country->id,
'options' => array(
'query' => Country::getCountries($this->context->language->id),
'id' => 'id_country',
'name' => 'name',
- 'preselect_country' => true,
)
);
$form['input'][] = array(
diff --git a/controllers/admin/AdminStatesController.php b/controllers/admin/AdminStatesController.php
index 8ee670876..d10607cbd 100644
--- a/controllers/admin/AdminStatesController.php
+++ b/controllers/admin/AdminStatesController.php
@@ -124,11 +124,11 @@ class AdminStatesControllerCore extends AdminController
'label' => $this->l('Country:'),
'name' => 'id_country',
'required' => false,
+ 'default_value' => (int)$this->context->country->id,
'options' => array(
'query' => Country::getCountries($this->context->language->id, false, true),
'id' => 'id_country',
'name' => 'name',
- 'preselect_country' => true,
),
'desc' => $this->l('Country where state, region or city is located')
),
diff --git a/controllers/admin/AdminStoresController.php b/controllers/admin/AdminStoresController.php
index 7656f2175..b037b6246 100644
--- a/controllers/admin/AdminStoresController.php
+++ b/controllers/admin/AdminStoresController.php
@@ -180,11 +180,11 @@ class AdminStoresControllerCore extends AdminController
'label' => $this->l('Country:'),
'name' => 'id_country',
'required' => true,
+ 'default_value' => (int)$this->context->country->id,
'options' => array(
'query' => Country::getCountries($this->context->language->id),
'id' => 'id_country',
'name' => 'name',
- 'preselect_country' => true,
)
),
array(
diff --git a/controllers/admin/AdminSuppliersController.php b/controllers/admin/AdminSuppliersController.php
index 586092eaa..0cc4234e4 100644
--- a/controllers/admin/AdminSuppliersController.php
+++ b/controllers/admin/AdminSuppliersController.php
@@ -139,11 +139,11 @@ class AdminSuppliersControllerCore extends AdminController
'label' => $this->l('Country:'),
'name' => 'id_country',
'required' => true,
+ 'default_value' => (int)$this->context->country->id,
'options' => array(
'query' => Country::getCountries($this->context->language->id, false),
'id' => 'id_country',
'name' => 'name',
- 'preselect_country' => true,
),
'desc' => $this->l('Country where the state, region or city is located')
),
diff --git a/controllers/admin/AdminSupplyOrdersController.php b/controllers/admin/AdminSupplyOrdersController.php
index b130b088f..fd5c8f022 100644
--- a/controllers/admin/AdminSupplyOrdersController.php
+++ b/controllers/admin/AdminSupplyOrdersController.php
@@ -44,7 +44,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
$this->identifier = 'id_supply_order';
$this->lang = false;
$this->is_template_list = false;
- $this->multishop_context = Shop::CONTEXT_ALL;
+ $this->multishop_context = Shop::CONTEXT_ALL;
$this->addRowAction('updatereceipt');
$this->addRowAction('changestate');
@@ -805,6 +805,10 @@ class AdminSupplyOrdersControllerCore extends AdminController
$helper->override_folder = 'supply_orders_receipt_history/';
$helper->toolbar_btn = $this->toolbar_btn;
+ $helper->ajax_params = array(
+ 'display_product_history' => 1,
+ );
+
$helper->currentIndex = self::$currentIndex.$action;
// display these global order informations
@@ -1451,7 +1455,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
public function ajaxProcess()
{
// tests if an id is submit
- if (Tools::isSubmit('id'))
+ if (Tools::isSubmit('id') && !Tools::isSubmit('display_product_history'))
{
// overrides attributes
$this->identifier = 'id_supply_order_history';
@@ -1524,14 +1528,14 @@ class AdminSupplyOrdersControllerCore extends AdminController
echo Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content));
}
- else if (Tools::isSubmit('id_supply_order_detail'))
+ else if (Tools::isSubmit('id') && Tools::isSubmit('display_product_history'))
{
$this->identifier = 'id_supply_order_receipt_history';
$this->table = 'supply_order_receipt_history';
$this->display = 'list';
$this->lang = false;
$lang_id = (int)$this->context->language->id;
- $id_supply_order_detail = (int)Tools::getValue('id_supply_order_detail');
+ $id_supply_order_detail = (int)Tools::getValue('id');
unset($this->fieldsDisplay);
$this->fieldsDisplay = array(
@@ -2023,14 +2027,13 @@ class AdminSupplyOrdersControllerCore extends AdminController
$manager = StockManagerFactory::getManager();
foreach ($items as $item)
{
- $diff = 0;
+ $diff = (int)$threshold;
+
if ($supply_order->is_template != 0)
{
$real_quantity = (int)$manager->getProductRealQuantities($item['id_product'], $item['id_product_attribute'], $supply_order->id_warehouse, true);
$diff = (int)$threshold - (int)$real_quantity;
}
- else
- $diff = (int)$threshold;
if ($diff > 0)
{
@@ -2060,6 +2063,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
// updates supply order
$supply_order->update();
+
}
/**