diff --git a/classes/CartRule.php b/classes/CartRule.php index e32bd3451..ab5cef179 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -637,7 +637,8 @@ class CartRuleCore extends ObjectModel FROM `'._DB_PREFIX_.'cart_product` cp LEFT JOIN `'._DB_PREFIX_.'category_product` catp ON cp.id_product = catp.id_product WHERE cp.`id_cart` = '.(int)$context->cart->id.' - AND cp.`id_product` IN ('.implode(array_map('intval', $eligibleProductsList), ',').')'); + AND cp.`id_product` IN ('.implode(array_map('intval', $eligibleProductsList), ',').') + AND cp.`id_product` <> '.(int)$this->gift_product); $countMatchingProducts = 0; $matchingProductsList = array(); foreach ($cartCategories as $cartCategory) diff --git a/controllers/admin/AdminAccessController.php b/controllers/admin/AdminAccessController.php index a3f79ab4b..9f636c25b 100644 --- a/controllers/admin/AdminAccessController.php +++ b/controllers/admin/AdminAccessController.php @@ -157,7 +157,7 @@ class AdminAccessControllerCore extends AdminController $sql = ' UPDATE `'._DB_PREFIX_.'access` a SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.' - WHERE `id_profile` = '.(int)$id_profile.' AND `id_tab` != '.(int)$this->id_tab_access; + WHERE `id_profile` = '.(int)$id_profile; else if ($id_tab == -1 && $perm == 'all') $sql = ' UPDATE `'._DB_PREFIX_.'access` a diff --git a/controllers/admin/AdminEmployeesController.php b/controllers/admin/AdminEmployeesController.php index ebdef6a4a..3c09f4cf1 100644 --- a/controllers/admin/AdminEmployeesController.php +++ b/controllers/admin/AdminEmployeesController.php @@ -297,7 +297,7 @@ class AdminEmployeesControllerCore extends AdminController } $this->fields_form['input'][] = array( 'type' => 'select', - 'label' => $this->l('Profile:'), + 'label' => $this->l('Profile Permission:'), 'name' => 'id_profile', 'required' => true, 'options' => array( diff --git a/controllers/admin/AdminImagesController.php b/controllers/admin/AdminImagesController.php index 38ecea2e4..22694773d 100644 --- a/controllers/admin/AdminImagesController.php +++ b/controllers/admin/AdminImagesController.php @@ -53,7 +53,7 @@ class AdminImagesControllerCore extends AdminController ); // No need to display the old image system if the install has been made later than 2013-03-26 - $this->display_move = (defined('_PS_CREATION_DATE_') && strtotime(_PS_CREATION_DATE_) > strtotime('2013-03-26')) ? false : true; + $this->display_move = (!Configuration::get('PS_LEGACY_IMAGES') && defined('_PS_CREATION_DATE_') && strtotime(_PS_CREATION_DATE_) > strtotime('2013-03-26')) ? false : true; $this->fields_options = array( 'images' => array( @@ -62,7 +62,7 @@ class AdminImagesControllerCore extends AdminController 'top' => '', 'bottom' => '', 'description' => $this->l('JPEG images have a small file size and standard quality. PNG images have a larger file size, a higher quality and support transparency. Note that in all cases the image files will have the .jpg extension.').' -

'.$this->l('WARNING: This feature may not be compatible with your theme, or with some of your modules. In particular, PNG mode is not compatible with the Watermark module. If you encounter any issues, turn it off by selecting "Use JPEG".'), +

'.$this->l('WARNING: This feature may not be compatible with your theme, or with some of your modules. In particular, PNG mode is not compatible with the Watermark module. If you encounter any issues, turn it off by selecting "Use JPEG".'), 'fields' => array( 'PS_IMAGE_QUALITY' => array( 'title' => $this->l('Image quality'), diff --git a/controllers/admin/AdminManufacturersController.php b/controllers/admin/AdminManufacturersController.php index 80d6fc516..550179b1d 100644 --- a/controllers/admin/AdminManufacturersController.php +++ b/controllers/admin/AdminManufacturersController.php @@ -440,6 +440,7 @@ class AdminManufacturersControllerCore extends AdminController 'type' => 'text', 'label' => $this->l('Zip Code/Postal Code'), 'name' => 'postcode', + 'required' => true, 'size' => 33, 'required' => false, ); diff --git a/controllers/admin/AdminTrackingController.php b/controllers/admin/AdminTrackingController.php index 2ccb0c6ab..8ba7265a4 100644 --- a/controllers/admin/AdminTrackingController.php +++ b/controllers/admin/AdminTrackingController.php @@ -52,6 +52,9 @@ class AdminTrackingControllerCore extends AdminController public function initContent() { + if ($id_category = Tools::getValue('id_category') && Tools::getIsset('viewcategory')) + Tools::redirectAdmin($this->context->link->getAdminLink('AdminProducts').'&id_category='.(int)$id_category.'&viewcategory'); + $this->_helper_list = new HelperList(); if (!Configuration::get('PS_STOCK_MANAGEMENT')) diff --git a/controllers/front/NewProductsController.php b/controllers/front/NewProductsController.php index 7cf283eba..a438c4826 100644 --- a/controllers/front/NewProductsController.php +++ b/controllers/front/NewProductsController.php @@ -47,6 +47,13 @@ class NewProductsControllerCore extends FrontController $this->productSort(); + // Override default configuration values: cause the new products page must display latest products first. + if (!Tools::getIsset('orderway') || !Tools::getIsset('orderby')) + { + $this->orderBy = 'date_add'; + $this->orderWay = 'DESC'; + } + $nbProducts = (int)Product::getNewProducts( $this->context->language->id, (isset($this->p) ? (int)($this->p) - 1 : null), diff --git a/install-dev/upgrade/php/p1540_add_missing_columns.php b/install-dev/upgrade/php/p1540_add_missing_columns.php index a86938056..b63af1a71 100644 --- a/install-dev/upgrade/php/p1540_add_missing_columns.php +++ b/install-dev/upgrade/php/p1540_add_missing_columns.php @@ -52,9 +52,14 @@ function p1540_add_missing_columns() } $key_exists = Db::getInstance()->executeS('SHOW INDEX FROM `'._DB_PREFIX_.'stock_available` WHERE KEY_NAME = "product_sqlstock"');; - if (is_array($key_exists)) + if (is_array($key_exists) && count($key_exists)) if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'stock_available` DROP INDEX `product_sqlstock`')) $errors[] = Db::getInstance()->getMsgError(); + + $key_exists = Db::getInstance()->executeS('SHOW INDEX FROM `'._DB_PREFIX_.'stock_available` WHERE KEY_NAME = "id_product_2"');; + if (is_array($key_exists) && count($key_exists)) + if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'stock_available` DROP INDEX `id_product_2`')) + $errors[] = Db::getInstance()->getMsgError(); if (count($errors)) return array('error' => 1, 'msg' => implode(',', $errors)) ;