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 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)) 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; } 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); 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(); 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 { 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/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)) { diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index 7c4d18ce9..1357aacc0 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); @@ -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'); @@ -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': 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 diff --git a/modules/statsbestvouchers/statsbestvouchers.php b/modules/statsbestvouchers/statsbestvouchers.php index 14683f0a1..0fd6acb3b 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, 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 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()'); }