Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development

This commit is contained in:
gRoussac
2013-05-14 16:46:38 +02:00
13 changed files with 53 additions and 16 deletions
+2 -2
View File
@@ -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) 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 [1]: https://help.github.com/articles/using-pull-requests
[2]: http://docs.prestashop.com/display/PS15/Coding+Standard [2]: http://docs.prestashop.com/display/PS15/Coding+Standards
[3]: http://docs.prestashop.com/display/PS15/How+to+write+a+commit+message [3]: http://docs.prestashop.com/display/PS15/How+to+write+a+commit+message
+1
View File
@@ -1448,6 +1448,7 @@ class ProductCore extends ObjectModel
$id_shop_list_array = Product::getShopsByProduct($this->id); $id_shop_list_array = Product::getShopsByProduct($this->id);
foreach ($id_shop_list_array as $array_shop) foreach ($id_shop_list_array as $array_shop)
$id_shop_list[] = $array_shop['id_shop']; $id_shop_list[] = $array_shop['id_shop'];
$id_shop_list = array_unique($id_shop_list);
} }
if (count($id_shop_list)) if (count($id_shop_list))
+4
View File
@@ -140,7 +140,11 @@ class TabCore extends ObjectModel
public function delete() public function delete()
{ {
if (Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'access WHERE `id_tab` = '.(int)$this->id) && parent::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 $this->cleanPositions($this->id_parent);
}
return false; return false;
} }
+6 -4
View File
@@ -1019,11 +1019,12 @@ class ToolsCore
'/[\x{010F}]/u', '/[\x{010F}]/u',
'/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{011B}\x{0119}]/u', '/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{011B}\x{0119}]/u',
'/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}]/u', '/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}]/u',
'/[\x{011F}]/u',
'/[\x{0142}\x{013E}\x{013A}]/u', '/[\x{0142}\x{013E}\x{013A}]/u',
'/[\x{00F1}\x{0148}]/u', '/[\x{00F1}\x{0148}]/u',
'/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}]/u', '/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}]/u',
'/[\x{0159}\x{0155}]/u', '/[\x{0159}\x{0155}]/u',
'/[\x{015B}\x{0161}]/u', '/[\x{015B}\x{0161}\x{015F}]/u',
'/[\x{00DF}]/u', '/[\x{00DF}]/u',
'/[\x{0165}]/u', '/[\x{0165}]/u',
'/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{016F}]/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{00C7}\x{010C}\x{0106}]/u',
'/[\x{010E}]/u', '/[\x{010E}]/u',
'/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{011A}\x{0118}]/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{0141}\x{013D}\x{0139}]/u',
'/[\x{00D1}\x{0147}]/u', '/[\x{00D1}\x{0147}]/u',
'/[\x{00D3}]/u', '/[\x{00D3}]/u',
'/[\x{0158}\x{0154}]/u', '/[\x{0158}\x{0154}]/u',
'/[\x{015A}\x{0160}]/u', '/[\x{015A}\x{0160}\x{015E}]/u',
'/[\x{0164}]/u', '/[\x{0164}]/u',
'/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{016E}]/u', '/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{016E}]/u',
'/[\x{017B}\x{0179}\x{017D}]/u', '/[\x{017B}\x{0179}\x{017D}]/u',
@@ -1049,8 +1051,8 @@ class ToolsCore
'/[\x{0152}]/u'); '/[\x{0152}]/u');
$replacements = array( $replacements = array(
'a', 'c', 'd', 'e', 'i', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', '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', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE' 'A', 'C', 'D', 'E', 'G', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE'
); );
return preg_replace($patterns, $replacements, $str); return preg_replace($patterns, $replacements, $str);
+1 -1
View File
@@ -485,7 +485,7 @@ class StockManagerCore implements StockManagerInterface
$client_orders_qty = 0; $client_orders_qty = 0;
if (count($res)) if (count($res))
foreach ($res as $row) 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 // Gets supply_orders_qty
$query = new DbQuery(); $query = new DbQuery();
@@ -686,7 +686,11 @@ class AdminAttributesGroupsControllerCore extends AdminController
{ {
foreach ($this->_list as &$list) foreach ($this->_list as &$list)
if (file_exists(_PS_IMG_DIR_.$this->fieldImageSettings['dir'].'/'.(int)$list['id_attribute'].'.jpg')) 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'; $list['color']['texture'] = '../img/'.$this->fieldImageSettings['dir'].'/'.(int)$list['id_attribute'].'.jpg';
}
} }
else else
{ {
@@ -72,6 +72,14 @@ class AdminCustomerPreferencesControllerCore extends AdminController
'cast' => 'intval', 'cast' => 'intval',
'type' => 'bool' '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( 'PS_PASSWD_TIME_FRONT' => array(
'title' => $this->l('Regenerate password'), 'title' => $this->l('Regenerate password'),
'desc' => $this->l('Minimum time required to regenerate a password.'), 'desc' => $this->l('Minimum time required to regenerate a password.'),
+1 -2
View File
@@ -266,10 +266,9 @@ class AdminOrdersControllerCore extends AdminController
$order = new Order(Tools::getValue('id_order')); $order = new Order(Tools::getValue('id_order'));
if (!Validate::isLoadedObject($order)) if (!Validate::isLoadedObject($order))
throw new PrestaShopException('Can\'t load Order object'); throw new PrestaShopException('Can\'t load Order object');
ShopUrl::cacheMainDomainForShop((int)$order->id_shop);
} }
ShopUrl::cacheMainDomainForShop((int)$order->id_shop);
/* Update shipping number */ /* Update shipping number */
if (Tools::isSubmit('submitShippingNumber') && isset($order)) if (Tools::isSubmit('submitShippingNumber') && isset($order))
{ {
@@ -815,7 +815,7 @@ class AdminTranslationsControllerCore extends AdminController
$type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php'; $type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php';
// Parse this content // 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 // Write each translation on its module file
$template_name = substr(basename($file), 0, -4); $template_name = substr(basename($file), 0, -4);
@@ -858,7 +858,7 @@ class AdminTranslationsControllerCore extends AdminController
public function clearModuleFiles($files, $type_clear = 'file', $path = '') public function clearModuleFiles($files, $type_clear = 'file', $path = '')
{ {
// List of directory which not must be parsed // 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 // List of good extention files
$arr_good_ext = array('.tpl', '.php'); $arr_good_ext = array('.tpl', '.php');
@@ -914,7 +914,7 @@ class AdminTranslationsControllerCore extends AdminController
$type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php'; $type_file = substr($file, -4) == '.tpl' ? 'tpl' : 'php';
// Parse this content // 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 // Write each translation on its module file
$template_name = substr(basename($file), 0, -4); $template_name = substr(basename($file), 0, -4);
@@ -1057,9 +1057,10 @@ class AdminTranslationsControllerCore extends AdminController
* @param $content * @param $content
* @param $type_translation : front, back, errors, modules... * @param $type_translation : front, back, errors, modules...
* @param string|bool $type_file : (tpl|php) * @param string|bool $type_file : (tpl|php)
* @param string $module_name : name of the module
* @return return $matches * @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) switch ($type_translation)
{ {
@@ -1088,7 +1089,8 @@ class AdminTranslationsControllerCore extends AdminController
if ($type_file == 'php') if ($type_file == 'php')
$regex = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U'; $regex = '/->l\(\''._PS_TRANS_PATTERN_.'\'(, ?\'(.+)\')?(, ?(.+))?\)/U';
else 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; break;
case 'pdf': case 'pdf':
+3
View File
@@ -688,6 +688,9 @@ class AuthControllerCore extends FrontController
*/ */
protected function sendConfirmationMail(Customer $customer) protected function sendConfirmationMail(Customer $customer)
{ {
if (!Configuration::get('PS_CUSTOMER_CREATION_EMAIL'))
return true;
return Mail::Send( return Mail::Send(
$this->context->language->id, $this->context->language->id,
'account', 'account',
+3
View File
@@ -769,5 +769,8 @@ Country</value>
<configuration id="PS_ALLOW_MOBILE_DEVICE" name="PS_ALLOW_MOBILE_DEVICE"> <configuration id="PS_ALLOW_MOBILE_DEVICE" name="PS_ALLOW_MOBILE_DEVICE">
<value>1</value> <value>1</value>
</configuration> </configuration>
<configuration id="PS_CUSTOMER_CREATION_EMAIL" name="PS_CUSTOMER_CREATION_EMAIL">
<value>1</value>
</configuration>
</entities> </entities>
</entity_configuration> </entity_configuration>
+3 -1
View File
@@ -1,3 +1,5 @@
SET NAMES 'utf8'; 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 ; 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());
@@ -53,6 +53,13 @@ class StatsBestVouchers extends ModuleGrid
$this->_pagingMessage = sprintf($this->l('Displaying %1$s of %2$s'), '{0} - {1}', '{2}'); $this->_pagingMessage = sprintf($this->l('Displaying %1$s of %2$s'), '{0} - {1}', '{2}');
$this->_columns = array( $this->_columns = array(
array(
'id' => 'code',
'header' => $this->l('Code'),
'dataIndex' => 'code',
'align' => 'left',
'width' => 300
),
array( array(
'id' => 'name', 'id' => 'name',
'header' => $this->l('Name'), 'header' => $this->l('Name'),
@@ -110,9 +117,10 @@ class StatsBestVouchers extends ModuleGrid
public function getData() 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 FROM '._DB_PREFIX_.'order_cart_rule ocr
LEFT JOIN '._DB_PREFIX_.'orders o ON o.id_order = ocr.id_order 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 WHERE o.valid = 1
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').' '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
AND o.invoice_date BETWEEN '.$this->getDate().' 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)) if (($this->_start === 0 || Validate::IsUnsignedInt($this->_start)) && Validate::IsUnsignedInt($this->_limit))
$this->_query .= ' LIMIT '.$this->_start.', '.($this->_limit); $this->_query .= ' LIMIT '.$this->_start.', '.($this->_limit);
$this->_values = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query); $this->_values = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->_query);
$this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()'); $this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()');
} }