From f1dcb365e97ee887ff8d5a2f62c3c4abf5876241 Mon Sep 17 00:00:00 2001 From: PrestaEdit Date: Thu, 11 Apr 2013 02:39:03 +0300 Subject: [PATCH 01/13] [-] MO: fix statsbestvouchers ocr.code not exist ; this one show the code and name of the cart rule. --- modules/statsbestvouchers/statsbestvouchers.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/statsbestvouchers/statsbestvouchers.php b/modules/statsbestvouchers/statsbestvouchers.php index 14683f0a1..0c76f94f0 100644 --- a/modules/statsbestvouchers/statsbestvouchers.php +++ b/modules/statsbestvouchers/statsbestvouchers.php @@ -53,6 +53,13 @@ class StatsBestVouchers extends ModuleGrid $this->_pagingMessage = sprintf($this->l('Displaying %1$s of %2$s'), '{0} - {1}', '{2}'); $this->_columns = array( + array( + 'id' => 'code', + 'header' => $this->l('Code'), + 'dataIndex' => 'code', + 'align' => 'left', + 'width' => 300 + ), array( 'id' => 'name', 'header' => $this->l('Name'), @@ -110,9 +117,10 @@ class StatsBestVouchers extends ModuleGrid public function getData() { - $this->_query = 'SELECT SQL_CALC_FOUND_ROWS ocr.name as name, COUNT(ocr.id_cart_rule) as total, ROUND(SUM(o.total_paid_real) / o.conversion_rate, 2) as ca + $this->_query = 'SELECT SQL_CALC_FOUND_ROWS cr.code, ocr.name, COUNT(ocr.id_cart_rule) as total, SUM(o.total_paid_real) / o.conversion_rate as ca FROM '._DB_PREFIX_.'order_cart_rule ocr LEFT JOIN '._DB_PREFIX_.'orders o ON o.id_order = ocr.id_order + LEFT JOIN '._DB_PREFIX_.'cart_rule cr ON cr.id_cart_rule = ocr.id_cart_rule WHERE o.valid = 1 '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').' AND o.invoice_date BETWEEN '.$this->getDate().' @@ -125,6 +133,7 @@ class StatsBestVouchers extends ModuleGrid } if (($this->_start === 0 || Validate::IsUnsignedInt($this->_start)) && Validate::IsUnsignedInt($this->_limit)) $this->_query .= ' LIMIT '.$this->_start.', '.($this->_limit); + $this->_values = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query); $this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()'); } From 04d7da802eb4688d6821374cc7cefa10827e3937 Mon Sep 17 00:00:00 2001 From: PrestaEdit Date: Thu, 11 Apr 2013 17:24:12 +0300 Subject: [PATCH 02/13] [-] Fix: copy paste a little too fast --- modules/statsbestvouchers/statsbestvouchers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/statsbestvouchers/statsbestvouchers.php b/modules/statsbestvouchers/statsbestvouchers.php index 0c76f94f0..ed8f38068 100644 --- a/modules/statsbestvouchers/statsbestvouchers.php +++ b/modules/statsbestvouchers/statsbestvouchers.php @@ -117,7 +117,7 @@ class StatsBestVouchers extends ModuleGrid public function getData() { - $this->_query = 'SELECT SQL_CALC_FOUND_ROWS cr.code, ocr.name, COUNT(ocr.id_cart_rule) as total, SUM(o.total_paid_real) / o.conversion_rate as ca + $this->_query = 'SELECT SQL_CALC_FOUND_ROWS cr.code, ocr.name, COUNT(ocr.id_cart_rule) as total, ROUND(SUM(o.total_paid_real) / o.conversion_rate) as ca FROM '._DB_PREFIX_.'order_cart_rule ocr LEFT JOIN '._DB_PREFIX_.'orders o ON o.id_order = ocr.id_order LEFT JOIN '._DB_PREFIX_.'cart_rule cr ON cr.id_cart_rule = ocr.id_cart_rule From 6d71b29618e408179ab8e45f3edeceda9f27229c Mon Sep 17 00:00:00 2001 From: PrestaEdit Date: Thu, 11 Apr 2013 17:25:44 +0300 Subject: [PATCH 03/13] // too fast --- modules/statsbestvouchers/statsbestvouchers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/statsbestvouchers/statsbestvouchers.php b/modules/statsbestvouchers/statsbestvouchers.php index ed8f38068..0fd6acb3b 100644 --- a/modules/statsbestvouchers/statsbestvouchers.php +++ b/modules/statsbestvouchers/statsbestvouchers.php @@ -117,7 +117,7 @@ class StatsBestVouchers extends ModuleGrid public function getData() { - $this->_query = 'SELECT SQL_CALC_FOUND_ROWS cr.code, ocr.name, COUNT(ocr.id_cart_rule) as total, ROUND(SUM(o.total_paid_real) / o.conversion_rate) as ca + $this->_query = 'SELECT SQL_CALC_FOUND_ROWS cr.code, ocr.name, COUNT(ocr.id_cart_rule) as total, ROUND(SUM(o.total_paid_real) / o.conversion_rate,2) as ca FROM '._DB_PREFIX_.'order_cart_rule ocr LEFT JOIN '._DB_PREFIX_.'orders o ON o.id_order = ocr.id_order LEFT JOIN '._DB_PREFIX_.'cart_rule cr ON cr.id_cart_rule = ocr.id_cart_rule From 25b42744c80b79776f1e5e5b0071f1202e075b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20B=C3=A9lorgey?= Date: Sun, 28 Apr 2013 11:51:50 +0200 Subject: [PATCH 04/13] Wrong link in CONTRIBUTING.md --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 944062c4e..29f1cdfdc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,5 +8,5 @@ All core files you commit in your pull request must have Open Software License ( All modules files you commit in your pull request must have Academic Free License (AFL 3.0) [1]: https://help.github.com/articles/using-pull-requests -[2]: http://docs.prestashop.com/display/PS15/Coding+Standard -[3]: http://docs.prestashop.com/display/PS15/How+to+write+a+commit+message \ No newline at end of file +[2]: http://docs.prestashop.com/display/PS15/Coding+Standards +[3]: http://docs.prestashop.com/display/PS15/How+to+write+a+commit+message From 444a99f56496959558f28f498fce94dcd737d008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Gaulu=C3=A9?= Date: Thu, 2 May 2013 18:21:54 +0200 Subject: [PATCH 05/13] [-] BO : don't show translation for class/controler overrides when on modules translation page --- controllers/admin/AdminTranslationsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index 7c4d18ce9..23a1b6e42 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -858,7 +858,7 @@ class AdminTranslationsControllerCore extends AdminController public function clearModuleFiles($files, $type_clear = 'file', $path = '') { // List of directory which not must be parsed - $arr_exclude = array('img', 'js', 'mails'); + $arr_exclude = array('img', 'js', 'mails','override'); // List of good extention files $arr_good_ext = array('.tpl', '.php'); From 0442bee9197cf257b9332ce45a7636b56fb73dbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Gaulu=C3=A9?= Date: Thu, 2 May 2013 18:46:13 +0200 Subject: [PATCH 06/13] [-] BO : don't show unecessary tpl module translations - complience with documentation --- controllers/admin/AdminTranslationsController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index 7c4d18ce9..ec7f70738 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -815,7 +815,7 @@ class AdminTranslationsControllerCore extends AdminController $type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php'; // Parse this content - $matches = $this->userParseFile($content, $this->type_selected, $type_file); + $matches = $this->userParseFile($content, $this->type_selected, $type_file, $module_name); // Write each translation on its module file $template_name = substr(basename($file), 0, -4); @@ -914,7 +914,7 @@ class AdminTranslationsControllerCore extends AdminController $type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php'; // Parse this content - $matches = $this->userParseFile($content, $this->type_selected, $type_file); + $matches = $this->userParseFile($content, $this->type_selected, $type_file, $module_name); // Write each translation on its module file $template_name = substr(basename($file), 0, -4); @@ -1057,9 +1057,10 @@ class AdminTranslationsControllerCore extends AdminController * @param $content * @param $type_translation : front, back, errors, modules... * @param string|bool $type_file : (tpl|php) + * @param string $module_name : name of the module * @return return $matches */ - protected function userParseFile($content, $type_translation, $type_file = false) + protected function userParseFile($content, $type_translation, $type_file = false, $module_name = '') { switch ($type_translation) { @@ -1088,7 +1089,8 @@ class AdminTranslationsControllerCore extends AdminController if ($type_file == 'php') $regex = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U'; else - $regex = '/\{l\s*s=[\'\"]'._PS_TRANS_PATTERN_.'[\'\"](\s*sprintf=.*)?(\s*mod=\'.+\')?(\s*js=1)?\s*\}/U'; + // In tpl file look for something that should contain mod='module_name' according to the documentation + $regex = '/\{l\s*s=[\'\"]'._PS_TRANS_PATTERN_.'[\'\"].*\s+mod=\''.$module_name.'\'.*\}/U'; break; case 'pdf': From 63993a425b76662908322febf96b445034742144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Fri, 3 May 2013 17:01:12 +0200 Subject: [PATCH 07/13] [-] BO: You can now disable the email sent after account creation --- controllers/admin/AdminCustomerPreferencesController.php | 8 ++++++++ controllers/front/AuthController.php | 3 +++ install-dev/data/xml/configuration.xml | 3 +++ install-dev/upgrade/sql/1.5.5.0.sql | 4 +++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminCustomerPreferencesController.php b/controllers/admin/AdminCustomerPreferencesController.php index 07e7393dd..497f69314 100644 --- a/controllers/admin/AdminCustomerPreferencesController.php +++ b/controllers/admin/AdminCustomerPreferencesController.php @@ -72,6 +72,14 @@ class AdminCustomerPreferencesControllerCore extends AdminController 'cast' => 'intval', 'type' => 'bool' ), + 'PS_CUSTOMER_CREATION_EMAIL' => array( + 'title' => $this->l('Send an email after registration'), + 'desc' => $this->l('Send an email with summary account (email, password) after registration.'), + 'validation' => 'isUnsignedInt', + 'validation' => 'isBool', + 'cast' => 'intval', + 'type' => 'bool' + ), 'PS_PASSWD_TIME_FRONT' => array( 'title' => $this->l('Regenerate password'), 'desc' => $this->l('Minimum time required to regenerate a password.'), diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index f5b8563b4..08b92c1aa 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -688,6 +688,9 @@ class AuthControllerCore extends FrontController */ protected function sendConfirmationMail(Customer $customer) { + if (!Configuration::get('PS_CUSTOMER_CREATION_EMAIL')) + return true; + return Mail::Send( $this->context->language->id, 'account', diff --git a/install-dev/data/xml/configuration.xml b/install-dev/data/xml/configuration.xml index 515f0762a..2494938f3 100644 --- a/install-dev/data/xml/configuration.xml +++ b/install-dev/data/xml/configuration.xml @@ -769,5 +769,8 @@ Country 1 + + 1 + diff --git a/install-dev/upgrade/sql/1.5.5.0.sql b/install-dev/upgrade/sql/1.5.5.0.sql index f2f11e95a..aea6a46be 100644 --- a/install-dev/upgrade/sql/1.5.5.0.sql +++ b/install-dev/upgrade/sql/1.5.5.0.sql @@ -1,3 +1,5 @@ SET NAMES 'utf8'; -ALTER TABLE `PREFIX_store` CHANGE `latitude` `latitude` DECIMAL( 13, 8 ) NULL DEFAULT NULL , CHANGE `longitude` `longitude` DECIMAL( 13, 8 ) NULL DEFAULT NULL ; \ No newline at end of file +ALTER TABLE `PREFIX_store` CHANGE `latitude` `latitude` DECIMAL( 13, 8 ) NULL DEFAULT NULL , CHANGE `longitude` `longitude` DECIMAL( 13, 8 ) NULL DEFAULT NULL ; + +INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('PS_CUSTOMER_CREATION_EMAIL', 1, NOW(), NOW()); \ No newline at end of file From 4df5ac447f475d38b355567bff760715075d9da9 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 6 May 2013 09:22:24 +0200 Subject: [PATCH 08/13] [-] BO : tab cache wasn't emptied on delete #PSCFV-9053 --- classes/Tab.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/classes/Tab.php b/classes/Tab.php index 19d839031..542d68c7f 100644 --- a/classes/Tab.php +++ b/classes/Tab.php @@ -140,7 +140,11 @@ class TabCore extends ObjectModel public function delete() { if (Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'access WHERE `id_tab` = '.(int)$this->id) && parent::delete()) + { + if (is_array(self::$_getIdFromClassName) && isset(self::$_getIdFromClassName[strtolower($this->class_name)])) + unset(self::$_getIdFromClassName[strtolower($this->class_name)]); return $this->cleanPositions($this->id_parent); + } return false; } From 80b5855006a61be88cae7c42c82a671a78288efb Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 6 May 2013 09:27:03 +0200 Subject: [PATCH 09/13] [-] BO : fixed potential warning with texture list #PSCFV-9050 --- controllers/admin/AdminAttributesGroupsController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controllers/admin/AdminAttributesGroupsController.php b/controllers/admin/AdminAttributesGroupsController.php index 26c53cc83..937d632e0 100644 --- a/controllers/admin/AdminAttributesGroupsController.php +++ b/controllers/admin/AdminAttributesGroupsController.php @@ -686,7 +686,11 @@ class AdminAttributesGroupsControllerCore extends AdminController { foreach ($this->_list as &$list) if (file_exists(_PS_IMG_DIR_.$this->fieldImageSettings['dir'].'/'.(int)$list['id_attribute'].'.jpg')) + { + if (!isset($list['color']) || !is_array($list['color'])) + $list['color'] = array(); $list['color']['texture'] = '../img/'.$this->fieldImageSettings['dir'].'/'.(int)$list['id_attribute'].'.jpg'; + } } else { From 693b3355a80d28abaf14bc211bcd40e054909428 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Tue, 7 May 2013 14:09:07 +0200 Subject: [PATCH 10/13] [-] BO : fixed turkish characters replacement #PSCFV-8968 --- classes/Tools.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/classes/Tools.php b/classes/Tools.php index 925a5fc39..97b1e1a2a 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1019,11 +1019,12 @@ class ToolsCore '/[\x{010F}]/u', '/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{011B}\x{0119}]/u', '/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}]/u', + '/[\x{011F}]/u', '/[\x{0142}\x{013E}\x{013A}]/u', '/[\x{00F1}\x{0148}]/u', '/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}]/u', '/[\x{0159}\x{0155}]/u', - '/[\x{015B}\x{0161}]/u', + '/[\x{015B}\x{0161}\x{015F}]/u', '/[\x{00DF}]/u', '/[\x{0165}]/u', '/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{016F}]/u', @@ -1037,11 +1038,12 @@ class ToolsCore '/[\x{00C7}\x{010C}\x{0106}]/u', '/[\x{010E}]/u', '/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{011A}\x{0118}]/u', + '/[\x{011E}]/u', '/[\x{0141}\x{013D}\x{0139}]/u', '/[\x{00D1}\x{0147}]/u', '/[\x{00D3}]/u', '/[\x{0158}\x{0154}]/u', - '/[\x{015A}\x{0160}]/u', + '/[\x{015A}\x{0160}\x{015E}]/u', '/[\x{0164}]/u', '/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{016E}]/u', '/[\x{017B}\x{0179}\x{017D}]/u', @@ -1049,8 +1051,8 @@ class ToolsCore '/[\x{0152}]/u'); $replacements = array( - 'a', 'c', 'd', 'e', 'i', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'z', 'ae', 'oe', - 'A', 'C', 'D', 'E', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE' + 'a', 'c', 'd', 'e', 'i', 'g', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'z', 'ae', 'oe', + 'A', 'C', 'D', 'E', 'G', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE' ); return preg_replace($patterns, $replacements, $str); From 52bffe6917171f6f76976cbf13abb1fd3fbe34ff Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Tue, 7 May 2013 17:27:16 +0200 Subject: [PATCH 11/13] // Fixed warning --- controllers/admin/AdminOrdersController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 6da191cd1..ace92cb6d 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -266,10 +266,9 @@ class AdminOrdersControllerCore extends AdminController $order = new Order(Tools::getValue('id_order')); if (!Validate::isLoadedObject($order)) throw new PrestaShopException('Can\'t load Order object'); + ShopUrl::cacheMainDomainForShop((int)$order->id_shop); } - ShopUrl::cacheMainDomainForShop((int)$order->id_shop); - /* Update shipping number */ if (Tools::isSubmit('submitShippingNumber') && isset($order)) { From 7b26967df0ad12c181c3f4e9d20ea2576e7b9fbb Mon Sep 17 00:00:00 2001 From: Samy Rabih Date: Mon, 13 May 2013 14:50:24 +0200 Subject: [PATCH 12/13] $id_shop_list filtering in addAttribute When addAttribute is used with a not-empty $id_shop_list array argument, the shop IDs are not filtered to be unique, so $combination->add() fails. --- classes/Product.php | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/Product.php b/classes/Product.php index d253d87f7..f86a1c09f 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -1448,6 +1448,7 @@ class ProductCore extends ObjectModel $id_shop_list_array = Product::getShopsByProduct($this->id); foreach ($id_shop_list_array as $array_shop) $id_shop_list[] = $array_shop['id_shop']; + $id_shop_list = array_unique($id_shop_list); } if (count($id_shop_list)) From dff200ac9dc014df04373a6ec699e5252dfe9319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Tue, 14 May 2013 09:53:33 +0200 Subject: [PATCH 13/13] [-] Core: Fix StockManager::getProductRealQuantities() for refunded quantities on non delivered orders --- classes/stock/StockManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/stock/StockManager.php b/classes/stock/StockManager.php index 1ad67d77b..f1d956d1d 100644 --- a/classes/stock/StockManager.php +++ b/classes/stock/StockManager.php @@ -485,7 +485,7 @@ class StockManagerCore implements StockManagerInterface $client_orders_qty = 0; if (count($res)) foreach ($res as $row) - $client_orders_qty += $row['product_quantity'] + $row['product_quantity_refunded']; + $client_orders_qty += ($row['product_quantity'] - $row['product_quantity_refunded']); // Gets supply_orders_qty $query = new DbQuery();