Merge remote-tracking branch 'upstream/development' into development

This commit is contained in:
Grégoire Bélorgey
2013-05-25 13:15:00 +02:00
42 changed files with 241 additions and 105 deletions
+5
View File
@@ -237,6 +237,8 @@ class AddressCore extends ObjectModel
*/
public static function getZoneById($id_address)
{
if(!isset($id_address) || empty($id_address))
return false;
if (isset(self::$_idZones[$id_address]))
return self::$_idZones[$id_address];
@@ -259,6 +261,9 @@ class AddressCore extends ObjectModel
*/
public static function isCountryActiveById($id_address)
{
if(!isset($id_address) || empty($id_address))
return false;
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT c.`active`
FROM `'._DB_PREFIX_.'address` a
+2 -2
View File
@@ -71,7 +71,7 @@ class AttributeCore extends ObjectModel
public function delete()
{
if (!$this->hasMultishopEntries())
if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
{
$result = Db::getInstance()->executeS('SELECT id_product_attribute FROM '._DB_PREFIX_.'product_attribute_combination WHERE id_attribute = '.(int)$this->id);
foreach ($result as $row)
@@ -343,4 +343,4 @@ class AttributeCore extends ObjectModel
return (is_numeric($position)) ? $position : -1;
}
}
}
+12 -2
View File
@@ -70,6 +70,11 @@ class AttributeGroupCore extends ObjectModel
public function add($autodate = true, $nullValues = false)
{
if ($this->group_type == 'color')
$this->is_color_group = 1;
else
$this->is_color_group = 0;
if ($this->position <= 0)
$this->position = AttributeGroup::getHigherPosition() + 1;
@@ -80,11 +85,16 @@ class AttributeGroupCore extends ObjectModel
public function update($nullValues = false)
{
if ($this->group_type == 'color')
$this->is_color_group = 1;
else
$this->is_color_group = 0;
$return = parent::update($nullValues);
Hook::exec('actionAttributeGroupSave', array('id_attribute_group' => $this->id));
return $return;
}
public static function cleanDeadCombinations()
{
$attribute_combinations = Db::getInstance()->executeS('
@@ -109,7 +119,7 @@ class AttributeGroupCore extends ObjectModel
public function delete()
{
if (!$this->hasMultishopEntries())
if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
{
/* Select children in order to find linked combinations */
$attribute_ids = Db::getInstance()->executeS('
+3 -3
View File
@@ -466,7 +466,7 @@ class LanguageCore extends ObjectModel
public function delete()
{
if (!$this->hasMultishopEntries())
if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
{
if (empty($this->iso_code))
$this->iso_code = Language::getIsoById($this->id);
@@ -514,7 +514,7 @@ class LanguageCore extends ObjectModel
if (!parent::delete())
return false;
if (!$this->hasMultishopEntries())
if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
{
// delete images
$files_copy = array(
@@ -831,4 +831,4 @@ class LanguageCore extends ObjectModel
{
return (Language::countActiveLanguages() > 1);
}
}
}
+1 -1
View File
@@ -156,7 +156,7 @@ class SupplierCore extends ObjectModel
$rewrite_settings = (int)Configuration::get('PS_REWRITING_SETTINGS');
for ($i = 0; $i < $nb_suppliers; $i++)
if ($rewrite_settings)
$suppliers[$i]['link_rewrite'] = Tools::link_rewrite($suppliers[$i]['name'], false);
$suppliers[$i]['link_rewrite'] = Tools::link_rewrite($suppliers[$i]['name']);
else
$suppliers[$i]['link_rewrite'] = 0;
return $suppliers;
+4 -1
View File
@@ -267,6 +267,9 @@ class ToolsCore
// $_SERVER['SSL'] exists only in some specific configuration
if (isset($_SERVER['SSL']))
return ($_SERVER['SSL'] == 1 || strtolower($_SERVER['SSL']) == 'on');
// $_SERVER['REDIRECT_HTTPS'] exists only in some specific configuration
if (isset($_SERVER['REDIRECT_HTTPS']))
return ($_SERVER['REDIRECT_HTTPS'] == 1 || strtolower($_SERVER['REDIRECT_HTTPS']) == 'on');
return false;
}
@@ -1520,7 +1523,7 @@ class ToolsCore
if (self::$_cache_nb_media_servers && ($id_media_server = (abs(crc32($filename)) % self::$_cache_nb_media_servers + 1)))
return constant('_MEDIA_SERVER_'.$id_media_server.'_');
return Tools::getHttpHost();
return Tools::getShopDomain();
}
public static function generateHtaccess($path = null, $rewrite_settings = null, $cache_control = null, $specific = '', $disable_multiviews = null, $medias = false, $disable_modsec = null)
+2 -2
View File
@@ -724,7 +724,7 @@ class ValidateCore
*/
public static function isTrackingNumber($tracking_number)
{
return preg_match('/^[~:#,%&_=\(\)\.\? \+\-@\/a-zA-Z0-9]+$/', $tracking_number);
return preg_match('/^[~:#,%&_=\(\)\[\]\.\? \+\-@\/a-zA-Z0-9]+$/', $tracking_number);
}
/**
@@ -747,7 +747,7 @@ class ValidateCore
public static function isAbsoluteUrl($url)
{
if (!empty($url))
return preg_match('/^https?:\/\/[,:#%&_=\(\)\.\? \+\-@\/a-zA-Z0-9]+$/', $url);
return preg_match('/^https?:\/\/[~:#,%&_=\(\)\[\]\.\? \+\-@\/a-zA-Z0-9]+$/', $url);
return true;
}
+9 -3
View File
@@ -215,7 +215,7 @@ abstract class ModuleCore
}
// Check if module is installed
$result = Db::getInstance()->getRow('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($this->name).'\'');
$result = Module::isInstalled($this->name);
if ($result)
{
$this->_errors[] = $this->l('This module has already been installed.');
@@ -311,6 +311,12 @@ abstract class ModuleCore
*/
public static function initUpgradeModule($module)
{
if (((int)$module->installed == 1) & (empty($module->database_version) === true))
{
Module::upgradeModuleVersion($module->name, $module->version);
$module->database_version = $module->version;
}
// Init cache upgrade details
self::$modules_cache[$module->name]['upgrade'] = array(
'success' => false, // bool to know if upgrade succeed or not
@@ -1543,7 +1549,7 @@ abstract class ModuleCore
{
if (!Cache::isStored('Module::isInstalled'.$module_name))
{
$id_module = Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($module_name).'\'');
$id_module = Module::getModuleIdByName($module_name);
Cache::store('Module::isInstalled'.$module_name, (bool)$id_module);
}
return Cache::retrieve('Module::isInstalled'.$module_name);
@@ -1554,7 +1560,7 @@ abstract class ModuleCore
if (!Cache::isStored('Module::isEnabled'.$module_name))
{
$active = false;
$id_module = Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = \''.pSQL($module_name).'\'');
$id_module = Module::getModuleIdByName($module_name);
if (Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module_shop` WHERE `id_module` = '.(int)$id_module.' AND `id_shop` = '.(int)Context::getContext()->shop->id))
$active = true;
Cache::store('Module::isEnabled'.$module_name, (bool)$active);
+2
View File
@@ -211,6 +211,8 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
if ($ecotax)
foreach ($tmp_tax_infos as $rate => &$row)
{
if (!isset($ecotax[$rate]))
continue
$row['total_price_tax_excl'] -= $ecotax[$rate]['ecotax_tax_excl'];
$row['total_amount'] -= ($ecotax[$rate]['ecotax_tax_incl'] - $ecotax[$rate]['ecotax_tax_excl']);
}
+3 -3
View File
@@ -479,8 +479,8 @@ class StockManagerCore implements StockManagerInterface
$query->where('o.valid = 1 OR (os.id_order_state != '.(int)Configuration::get('PS_OS_ERROR').'
AND os.id_order_state != '.(int)Configuration::get('PS_OS_CANCELED').')');
$query->groupBy('od.id_order_detail');
//if (count($ids_warehouse))
//$query->where('od.id_warehouse IN('.implode(', ', $ids_warehouse).')');
if (count($ids_warehouse))
$query->where('od.id_warehouse IN('.implode(', ', $ids_warehouse).')');
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
$client_orders_qty = 0;
if (count($res))
@@ -658,4 +658,4 @@ class StockManagerCore implements StockManagerInterface
return $stocks;
}
}
}
+2 -1
View File
@@ -28,7 +28,8 @@
define('_PS_MODE_DEV_', true);
if (_PS_MODE_DEV_)
{
@ini_set('display_errors', 'on');
@ini_set('display_errors', 'on');
@error_reporting(E_ALL | E_STRICT);
define('_PS_DEBUG_SQL_', true);
/* Compatibility warning */
define('_PS_DISPLAY_COMPATIBILITY_WARNING_', true);
@@ -669,7 +669,7 @@ class AdminCustomersControllerCore extends AdminController
'count_better_customers' => $count_better_customers,
'shop_is_feature_active' => Shop::isFeatureActive(),
'name_shop' => $shop->name,
'customer_birthday' => Tools::displayDate($customer->birthday, $this->default_form_language),
'customer_birthday' => Tools::displayDate($customer->birthday),
'last_update' => Tools::displayDate($customer->date_upd,null , true),
'customer_exists' => Customer::customerExists($customer->email),
'id_lang' => $customer->id_lang,
+4 -2
View File
@@ -139,6 +139,9 @@ class AuthControllerCore extends FrontController
'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')
));
// Just set $this->template value here in case it's used by Ajax
$this->setTemplate(_PS_THEME_DIR_.'authentication.tpl');
if ($this->ajax)
{
// Call a hook to display more information on form
@@ -150,12 +153,11 @@ class AuthControllerCore extends FrontController
$return = array(
'hasError' => !empty($this->errors),
'errors' => $this->errors,
'page' => $this->context->smarty->fetch(_PS_THEME_DIR_.'authentication.tpl'),
'page' => $this->context->smarty->fetch($this->template),
'token' => Tools::getToken(false)
);
die(Tools::jsonEncode($return));
}
$this->setTemplate(_PS_THEME_DIR_.'authentication.tpl');
}
/**
+2 -1
View File
@@ -335,7 +335,8 @@ class CartControllerCore extends FrontController
if ($result['customizedDatas'])
Product::addCustomizationPrice($result['summary']['products'], $result['customizedDatas']);
die(Tools::jsonEncode($result));
Hook::exec('actionCartListOverride', array('summary' => $result, 'json' => &$json));
die(Tools::jsonEncode(array_merge($result, (array)Tools::jsonDecode($json, true))));
}
// @todo create a hook
elseif (file_exists(_PS_MODULE_DIR_.'/blockcart/blockcart-ajax.php'))
+1 -1
View File
@@ -281,7 +281,7 @@ class ContactControllerCore extends FrontController
$tmp = $order->getProducts();
foreach ($tmp as $key => $val)
$products[$row['id_order']][$val['product_id']] = array('value' => $val['product_id'], 'label' => $val['product_name']);
$orders[] = array('value' => $order->id, 'label' => $order->getUniqReference().' - '.Tools::displayDate($date[0],null , 'selected' => (int)Tools::getValue('id_order') == $order->id);
$orders[] = array('value' => $order->id, 'label' => $order->getUniqReference().' - '.Tools::displayDate($date[0],null) , 'selected' => (int)Tools::getValue('id_order') == $order->id);
}
$this->context->smarty->assign('orderList', $orders);
+5 -2
View File
@@ -399,10 +399,11 @@ class ParentOrderControllerCore extends FrontController
// Getting a list of formated address fields with associated values
$formatedAddressFieldsValuesList = array();
foreach ($customerAddresses as $address)
foreach ($customerAddresses as $i => $address)
{
if (!Address::isCountryActiveById((int)($address['id_address'])))
unset($customerAddresses[$i]);
$tmpAddress = new Address($address['id_address']);
$formatedAddressFieldsValuesList[$address['id_address']]['ordered_fields'] = AddressFormat::getOrderedAddressFields($address['id_country']);
$formatedAddressFieldsValuesList[$address['id_address']]['formated_fields_values'] = AddressFormat::getFormattedAddressFieldsValues(
$tmpAddress,
@@ -459,6 +460,8 @@ class ParentOrderControllerCore extends FrontController
{
$address = new Address($this->context->cart->id_address_delivery);
$id_zone = Address::getZoneById($address->id);
if (!Address::isCountryActiveById((int)($this->context->cart->id_address_delivery)) || !Address::isCountryActiveById((int)($this->context->cart->id_address_invoice)))
Tools::redirect('index.php?controller=order&step=1');
$carriers = $this->context->cart->simulateCarriersOutput();
$checked = $this->context->cart->simulateCarrierSelectedOutput();
$delivery_option_list = $this->context->cart->getDeliveryOptionList();
+1 -1
View File
@@ -509,7 +509,7 @@ select optgroup option {
background: #DFF2BF url(../img/admin/icon-valid.png) no-repeat scroll 6px 6px;
border: 1px solid #4F8A10;
color:#4F8A10;
padding:20px;
padding:20px 40px;
position:fixed;
bottom:0;
width:100%;
+1 -1
View File
@@ -29,7 +29,7 @@ abstract class InstallControllerHttp
/**
* @var array List of installer steps
*/
protected static $steps = array('welcome', 'license', 'system', 'database', 'configure', 'process');
protected static $steps = array('welcome', 'license', 'system', 'configure', 'database', 'process');
protected static $instances = array();
+4 -1
View File
@@ -224,10 +224,13 @@ class InstallXmlLoader
return;
}
if (substr($entity, 0, 1) == '.' || substr($entity, 0, 1) == '_')
return;
$xml = $this->loadEntity($entity);
// Read list of fields
if (!$xml->fields)
if (!is_object($xml) || !$xml->fields)
throw new PrestashopInstallerException('List of fields not found for entity '.$entity);
if ($this->isMultilang($entity))
+1 -1
View File
@@ -2,7 +2,7 @@
return array(
'informations' => array(
'phone' => '+1 888.947.6543',
'support' => 'http://support.prestashop.com/en/',
'support' => 'https://www.prestashop.com/pt/support',
),
'translations' => array(
'menu_welcome' => 'Escolha seu idioma',
+1
View File
@@ -2,6 +2,7 @@
return array(
'informations' => array(
'phone' => '+33 (0)1.40.18.30.04',
'support' => 'https://www.prestashop.com/de/support',
),
'translations' => array(
'menu_welcome' => 'Sprachauswahl',
+1 -1
View File
@@ -6,7 +6,7 @@ return array(
'documentation_upgrade' => 'http://docs.prestashop.com/display/PS15/Updating+PrestaShop',
'forum' => 'http://www.prestashop.com/forums/',
'blog' => 'http://www.prestashop.com/blog/',
'support' => 'http://support.prestashop.com/en/',
'support' => 'https://www.prestashop.com/en/support',
),
'translations' => array(
'menu_welcome' => 'Choose your language',
+1
View File
@@ -2,6 +2,7 @@
return array(
'informations' => array(
'phone' => '+1 (888) 947-6543',
'support' => 'https://www.prestashop.com/es/support',
),
'translations' => array(
'menu_welcome' => 'Elegir el idioma',
+1
View File
@@ -2,6 +2,7 @@
return array(
'informations' => array(
'phone' => '+33 (0)1.40.18.30.04',
'support' => 'https://www.prestashop.com/it/support',
),
'translations' => array(
'menu_welcome' => 'Scelta della lingua',
+4
View File
@@ -1,5 +1,9 @@
<?php
return array(
'informations' => array(
'phone' => '+33 (0)1.40.18.30.04',
'support' => 'https://www.prestashop.com/pl/wsparcie-techniczne',
),
'translations' => array(
'An SQL error occured for entity <i>%1$s</i>: <i>%2$s</i>' => 'Wystąpił błąd SQL w rekordzie <i>%1$s</i>: <i>%2$s</i>',
'Cannot create image "%1$s" for entity "%2$s"' => 'Nie można utworzyć obrazu "%1$s" dla rekordu "%2$s"',
+5 -1
View File
@@ -1,5 +1,9 @@
<?php
return array(
'informations' => array(
'phone' => '+33 (0)1.40.18.30.04',
'support' => 'https://www.prestashop.com/en/support',
),
'translations' => array(
'An SQL error occured for entity <i>%1$s</i>: <i>%2$s</i>' => 'В SQL произошла ошибка для значения <i>%1$s</i>: <i>%2$s</i>',
'Cannot create image "%1$s" for entity "%2$s"' => 'Невозможно создать изображение "%1$s" для значения "%2$s"',
@@ -183,7 +187,7 @@ return array(
'menu_license' => 'Лицензионное соглашение',
'PrestaShop core is released under the OSL 3.0 while PrestaShop modules and themes are released under the AFL 3.0.' => 'Ядро PrestaShop разработано на OSL 3.0, а модули и шаблоны PrestaShop разработаны на AFL 3.0.',
'I agree to the above terms and conditions.' => 'Я принимаю правила и условия.',
'I agree to participate in improving the solution by sending anonymous information about my configuration.' => 'Внесите свой вклад в улучшение программного обеспечения, отравив анонимное сообщене о Вашей конфгурации.',
'I agree to participate in improving the solution by sending anonymous information about my configuration.' => 'Внесите свой вклад в улучшение программного обеспечения, отправив анонимное сообщение о Вашей конфигурации.',
'PHP 5.1.2 or later is not enabled' => 'PHP 5.1.2 или более поздняя версия не активирована',
'Cannot upload files' => 'Невозможно загрузить файлы',
'Cannot create new files and folders' => 'Невозможно создать новые файлы и папки',
@@ -27,47 +27,49 @@
function add_order_reference_in_order_payment()
{
$res = true;
$payments = Db::getInstance()->executeS('
$payments = Db::getInstance()->query('
SELECT op.id_order_payment, o.reference
FROM `'._DB_PREFIX_.'order_payment` op
INNER JOIN `'._DB_PREFIX_.'orders` o
ON o.id_order = op.id_order');
if (!is_array($payments))
if (!is_object($payments))
return false;
$errors = array();
// Populate "order_reference"
foreach ($payments as $payment)
while ($payment = Db::getInstance()->nextRow($payments))
{
$res = Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'order_payment`
SET order_reference = \''.$payment['reference'].'\'
WHERE id_order_payment = '.(int)$payment['id_order_payment']);
if (!$res)
$errors[] = Db::getInstance()->getMsgError();
if(isset($payment['id_order_payment']))
{
$res = Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'order_payment`
SET order_reference = \''.$payment['reference'].'\'
WHERE id_order_payment = '.(int)$payment['id_order_payment']);
if (!$res)
$errors[] = Db::getInstance()->getMsgError();
}
}
if (count($errors))
return array('error' => true, 'msg' => implode('<br/>', $errors));
// Get lines to merge (with multishipping on, durring the payment one line was added by order, only one is necessary by cart)
$duplicate_lines = Db::getInstance()->executeS('
$duplicate_lines = Db::getInstance()->query('
SELECT GROUP_CONCAT(id_order_payment) as id_order_payments
FROM `'._DB_PREFIX_.'order_payment`
GROUP BY order_reference, date_add
HAVING COUNT(*) > 1');
if (!is_array($duplicate_lines))
if (!is_object($duplicate_lines))
return false;
$order_payments_to_remove = array();
foreach ($duplicate_lines as $order_payments)
while ($order_payments = Db::getInstance()->nextRow($duplicate_lines))
{
$order_payments_array = explode(',', $order_payments['id_order_payments']);
$order_payments_array = array();
if(isset($order_payments['id_order_payments']))
$order_payments_array = explode(',', $order_payments['id_order_payments']);
// Remove the first item (we want to keep one line)
$id_order_payment_keep = array_shift($order_payments_array);
@@ -84,6 +86,5 @@ function add_order_reference_in_order_payment()
if (!$res)
return array('errors' => true, 'msg' => Db::getInstance()->getMsgError());
return true;
}
@@ -32,13 +32,19 @@ function p15013_add_missing_columns()
if ($id_module)
{
if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'statssearch`
ADD `id_group_shop` INT(10) NOT NULL default "1" AFTER id_statssearch,
ADD `id_shop` INT(10) NOT NULL default "1" AFTER id_statssearch'))
{
$errors[] = $db->getMsgError();
}
$list_fields = Db::getInstance()->executeS('SHOW FIELDS FROM `'._DB_PREFIX_.'statssearch`');
foreach ($list_fields as $k => $field)
$list_fields[$k] = $field['Field'];
if (!in_array('id_group_shop', $list_fields))
if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'statssearch`
ADD `id_group_shop` INT(10) NOT NULL default "1" AFTER id_statssearch'))
$errors[] = $db->getMsgError();
if (!in_array('id_shop', $list_fields))
if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'statssearch`
ADD `id_shop` INT(10) NOT NULL default "1" AFTER id_statssearch'))
$errors[] = $db->getMsgError();
}
if (count($errors))
return array('error' => 1, 'msg' => implode(',', $errors)) ;
}
}
@@ -34,13 +34,31 @@ function p15016_add_missing_columns()
$list_fields = Db::getInstance()->executeS('SHOW FIELDS FROM `'._DB_PREFIX_.'reinsurance`');
foreach ($list_fields as $k => $field)
$list_fields[$k] = $field['Field'];
if (in_array('id_contactinfos', $list_fields))
if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'reinsurance` CHANGE `id_contactinfos` `id_reinsurance` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT'))
$errors[] = Db::getInstance()->getMsgError();
if (!in_array('id_shop', $list_fields))
if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'reinsurance` ADD `id_shop` INT(10) NOT NULL default "1" AFTER id_reinsurance'))
$errors[] = Db::getInstance()->getMsgError();
if (in_array('filename', $list_fields))
if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'reinsurance` CHANGE `filename` `file_name` VARCHAR(100) NOT NULL'))
$errors[] = Db::getInstance()->getMsgError();
$errors[] = Db::getInstance()->getMsgError();
$list_fields = Db::getInstance()->executeS('SHOW FIELDS FROM `'._DB_PREFIX_.'reinsurance_lang`');
if (!is_array($list_fields) || $list_fields == false)
{
$return = Db::getInstance()->execute('
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'reinsurance_lang` (
`id_reinsurance` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`id_lang` int(10) unsigned NOT NULL ,
`text` VARCHAR(300) NOT NULL,
PRIMARY KEY (`id_reinsurance`, `id_lang`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8 ;');
if (!$return)
$errors[] = Db::getInstance()->getMsgError();
}
}
$id_module = Db::getInstance()->getValue('SELECT id_module FROM `'._DB_PREFIX_.'module` WHERE name="blocktopmenu"');
+3 -7
View File
@@ -3,7 +3,7 @@ SET NAMES 'utf8';
/* PHP:category_product_index_unique(); */;
CREATE TABLE IF NOT EXISTS `PREFIX_order_tax` (
`id_order` int(11) NOT NULL,
`id_order` int(10) NOT NULL,
`tax_name` varchar(40) NOT NULL,
`tax_rate` decimal(6,3) NOT NULL,
`amount` decimal(20,6) NOT NULL
@@ -12,10 +12,6 @@ CREATE TABLE IF NOT EXISTS `PREFIX_order_tax` (
INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`, `live_edit`) VALUES
('frontCanonicalRedirect', 'Front Canonical Redirect', 'Check for 404 errors before canonical redirects', 0, 0);
SET @id_hook = (SELECT `id_hook` FROM `PREFIX_hook` WHERE `name` = 'frontCanonicalRedirect');
SET @position = (SELECT IFNULL(MAX(`position`),0)+1 FROM `PREFIX_hook_module` WHERE `id_hook` = @id_hook);
SET @id_module = (SELECT `id_module` FROM `PREFIX_module` WHERE `name` = 'pagesnotfound');
/* PHP:update_module_pagesnotfound(); */;
INSERT INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VALUES (@id_hook, @id_module, @position);
ALTER TABLE `PREFIX_order_state` ADD COLUMN `deleted` tinyint(1) UNSIGNED NOT NULL default '0' AFTER `delivery`;
ALTER TABLE `PREFIX_order_state` ADD COLUMN `deleted` tinyint(1) UNSIGNED NOT NULL default '0' AFTER `delivery`;
-1
View File
@@ -1 +0,0 @@
SET NAMES 'utf8';
+1 -3
View File
@@ -52,6 +52,4 @@ UPDATE `PREFIX_customer` SET `id_gender` = 1 WHERE `email` LIKE 'pub@prestashop.
UPDATE `PREFIX_cart_rule_carrier` crc INNER JOIN `PREFIX_carrier` c ON crc.`id_carrier` = c.`id_carrier` SET crc.`id_carrier` = c.`id_reference`;
UPDATE `PREFIX_order_payment` SET `order_reference` = LPAD(order_reference, 9 , '0');
/* PHP:p1540_add_missing_columns(); */;
UPDATE `PREFIX_order_payment` SET `order_reference` = LPAD(order_reference, 9 , '0');
+9 -1
View File
@@ -5,4 +5,12 @@ ALTER TABLE `PREFIX_store` CHANGE `latitude` `latitude` DECIMAL( 13, 8 ) NULL
INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES('PS_CUSTOMER_CREATION_EMAIL', 1, NOW(), NOW());
ALTER TABLE `PREFIX_webservice_account` CHANGE `class_name` `class_name` VARCHAR(64) NOT NULL DEFAULT 'WebserviceRequest',
CHANGE `module_name` `module_name` VARCHAR(64) NULL DEFAULT NULL;
CHANGE `module_name` `module_name` VARCHAR(64) NULL DEFAULT NULL;
/* PHP:add_module_to_hook(blockcart, actionCartListOverride); */;
/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerDeleteAfter); */;
/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerAddAfter); */;
/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerUpdateAfter); */;
/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierDeleteAfter); */;
/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierAddAfter); */;
/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierUpdateAfter); */;
+1 -1
View File
@@ -24,7 +24,7 @@
*/
//constant
verifMailREGEX = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
verifMailREGEX = /^([\w+-]+(?:\.[\w+-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
function verifyMail(testMsg, testSubject)
{
+2 -1
View File
@@ -232,6 +232,7 @@ var ajaxCart = {
.animate({ 'width': $element.attr('width')*0.66, 'height': $element.attr('height')*0.66, 'opacity': 0.2, 'top': cartBlockOffset.top + 30, 'left': cartBlockOffset.left + 15 }, 1000)
.fadeOut(100, function() {
ajaxCart.updateCartInformation(jsonData, addedFromProductPage);
$(this).remove();
});
}
else
@@ -443,7 +444,7 @@ var ajaxCart = {
var content = '<dt class="hidden" id="cart_block_product_' + domIdProduct + '">';
content += '<span class="quantity-formated"><span class="quantity">' + this.quantity + '</span>x</span>';
var name = (this.name.length > 12 ? this.name.substring(0, 10) + '...' : this.name);
content += '<a href="' + this.link + '" title="' + this.name + '">' + name + '</a>';
content += '<a href="' + this.link + '" title="' + this.name + '" class="cart_block_product_name">' + name + '</a>';
if (parseFloat(this.price_float) > 0)
content += '<span class="remove_link"><a rel="nofollow" class="ajax_cart_block_remove_link" href="' + baseUri + '?controller=cart&amp;delete=1&amp;id_product=' + productId + '&amp;token=' + static_token + (this.hasAttributes ? '&amp;ipa=' + parseInt(this.idCombination) : '') + '"> </a></span>';
+12 -1
View File
@@ -43,7 +43,7 @@ class BlockCart extends Module
$this->description = $this->l('Adds a block containing the customer\'s shopping cart.');
}
public function assignContentVars(&$params)
public function assignContentVars($params)
{
global $errors;
@@ -164,6 +164,7 @@ class BlockCart extends Module
parent::install() == false
|| $this->registerHook('top') == false
|| $this->registerHook('header') == false
|| $this->registerHook('actionCartListOverride') == false
|| Configuration::updateValue('PS_BLOCK_CART_AJAX', 1) == false)
return false;
return true;
@@ -195,10 +196,20 @@ class BlockCart extends Module
return $res;
}
public function hookActionCartListOverride($params)
{
if (!Configuration::get('PS_BLOCK_CART_AJAX'))
return;
$this->assignContentVars(array('cookie' => $this->context->cookie, 'cart' => $this->context->cart));
$params['json'] = $this->display(__FILE__, 'blockcart-json.tpl');
}
public function hookHeader()
{
if (Configuration::get('PS_CATALOG_MODE'))
return;
$this->context->controller->addCSS(($this->_path).'blockcart.css', 'all');
if ((int)(Configuration::get('PS_BLOCK_CART_AJAX')))
$this->context->controller->addJS(($this->_path).'ajax-cart.js');
@@ -48,19 +48,25 @@ class BlockManufacturer extends Module
Configuration::updateValue('MANUFACTURER_DISPLAY_TEXT', true);
Configuration::updateValue('MANUFACTURER_DISPLAY_TEXT_NB', 5);
Configuration::updateValue('MANUFACTURER_DISPLAY_FORM', true);
return parent::install() && $this->registerHook('leftColumn') && $this->registerHook('header');
return parent::install() &&
$this->registerHook('leftColumn') &&
$this->registerHook('header') &&
$this->registerHook('actionObjectManufacturerDeleteAfter') &&
$this->registerHook('actionObjectManufacturerAddAfter') &&
$this->registerHook('actionObjectManufacturerUpdateAfter');
}
public function hookLeftColumn($params)
{
$this->smarty->assign(array(
'manufacturers' => Manufacturer::getManufacturers(),
'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'),
'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'),
'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'),
'display_link_manufacturer' => Configuration::get('PS_DISPLAY_SUPPLIERS'),
));
return $this->display(__FILE__, 'blockmanufacturer.tpl');
if (!$this->isCached('blockmanufacturer.tpl', $this->getCacheId()))
$this->smarty->assign(array(
'manufacturers' => Manufacturer::getManufacturers(),
'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'),
'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'),
'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'),
'display_link_manufacturer' => Configuration::get('PS_DISPLAY_SUPPLIERS'),
));
return $this->display(__FILE__, 'blockmanufacturer.tpl', $this->getCacheId());
}
public function hookRightColumn($params)
@@ -85,6 +91,7 @@ class BlockManufacturer extends Module
Configuration::updateValue('MANUFACTURER_DISPLAY_TEXT', $text_list);
Configuration::updateValue('MANUFACTURER_DISPLAY_TEXT_NB', $text_nb);
Configuration::updateValue('MANUFACTURER_DISPLAY_FORM', $form_list);
$this->_clearCache('blockmanufacturer.tpl');
}
if (isset($errors) && count($errors))
$output .= $this->displayError(implode('<br />', $errors));
@@ -126,4 +133,19 @@ class BlockManufacturer extends Module
{
$this->context->controller->addCSS(($this->_path).'blockmanufacturer.css', 'all');
}
public function hookActionObjectManufacturerUpdateAfter($params)
{
$this->_clearCache('blockmanufacturer.tpl');
}
public function hookActionObjectManufacturerAddAfter($params)
{
$this->_clearCache('blockmanufacturer.tpl');
}
public function hookActionObjectManufacturerDeleteAfter($params)
{
$this->_clearCache('blockmanufacturer.tpl');
}
}
+34 -15
View File
@@ -47,9 +47,12 @@ class BlockSupplier extends Module
{
if (!parent::install())
return false;
if (!$this->registerHook('displayLeftColumn'))
return false;
if (!$this->registerHook('displayHeader'))
if (!$this->registerHook('displayLeftColumn') ||
!$this->registerHook('displayHeader') ||
!$this->registerHook('actionObjectSupplierDeleteAfter') ||
!$this->registerHook('actionObjectSupplierAddAfter') ||
!$this->registerHook('actionObjectSupplierUpdateAfter')
)
return false;
Configuration::updateValue('SUPPLIER_DISPLAY_TEXT', true);
Configuration::updateValue('SUPPLIER_DISPLAY_TEXT_NB', 5);
@@ -73,16 +76,16 @@ class BlockSupplier extends Module
function hookDisplayLeftColumn($params)
{
$id_lang = (int)Context::getContext()->language->id;
$this->smarty->assign(array(
'suppliers' => Supplier::getSuppliers(false, $id_lang),
'link' => $this->context->link,
'text_list' => Configuration::get('SUPPLIER_DISPLAY_TEXT'),
'text_list_nb' => Configuration::get('SUPPLIER_DISPLAY_TEXT_NB'),
'form_list' => Configuration::get('SUPPLIER_DISPLAY_FORM'),
'display_link_supplier' => Configuration::get('PS_DISPLAY_SUPPLIERS')
));
return $this->display(__FILE__, 'blocksupplier.tpl');
if (!$this->isCached('blocksupplier.tpl', $this->getCacheId()))
$this->smarty->assign(array(
'suppliers' => Supplier::getSuppliers(false, $id_lang),
'link' => $this->context->link,
'text_list' => Configuration::get('SUPPLIER_DISPLAY_TEXT'),
'text_list_nb' => Configuration::get('SUPPLIER_DISPLAY_TEXT_NB'),
'form_list' => Configuration::get('SUPPLIER_DISPLAY_FORM'),
'display_link_supplier' => Configuration::get('PS_DISPLAY_SUPPLIERS')
));
return $this->display(__FILE__, 'blocksupplier.tpl', $this->getCacheId());
}
function getContent()
@@ -102,6 +105,7 @@ class BlockSupplier extends Module
Configuration::updateValue('SUPPLIER_DISPLAY_TEXT', $text_list);
Configuration::updateValue('SUPPLIER_DISPLAY_TEXT_NB', $text_nb);
Configuration::updateValue('SUPPLIER_DISPLAY_FORM', $form_list);
$this->_clearCache('blocksupplier.tpl');
}
if (isset($errors) AND sizeof($errors))
$output .= $this->displayError(implode('<br />', $errors));
@@ -139,14 +143,29 @@ class BlockSupplier extends Module
return $output;
}
function hookDisplayRightColumn($params)
public function hookDisplayRightColumn($params)
{
return $this->hookDisplayLeftColumn($params);
}
function hookDisplayHeader($params)
public function hookDisplayHeader($params)
{
$this->context->controller->addCSS(($this->_path).'blocksupplier.css', 'all');
}
public function hookActionObjectSupplierUpdateAfter($params)
{
$this->_clearCache('blocksupplier.tpl');
}
public function hookActionObjectSupplierAddAfter($params)
{
$this->_clearCache('blocksupplier.tpl');
}
public function hookActionObjectSupplierDeleteAfter($params)
{
$this->_clearCache('blocksupplier.tpl');
}
}
+3 -1
View File
@@ -34,6 +34,7 @@ $id_category = ((int)(Tools::getValue('id_category')) ? (int)(Tools::getValue('i
$products = Product::getProducts((int)Context::getContext()->language->id, 0, ($number > 10 ? 10 : $number), $orderBy, $orderWay, $id_category, true);
$currency = new Currency((int)Context::getContext()->currency->id);
$affiliate = (Tools::getValue('ac') ? '?ac='.(int)(Tools::getValue('ac')) : '');
$metas = Meta::getMetaByPage('index', (int)Context::getContext()->language->id);
// Send feed
header("Content-Type:text/xml; charset=utf-8");
@@ -42,8 +43,9 @@ echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
<rss version="2.0">
<channel>
<title><![CDATA[<?php echo Configuration::get('PS_SHOP_NAME') ?>]]></title>
<description><![CDATA[<?php echo $metas['description'] ?>]]></description>
<link><?php echo _PS_BASE_URL_.__PS_BASE_URI__; ?></link>
<mail><?php echo Configuration::get('PS_SHOP_EMAIL') ?></mail>
<webMaster><?php echo Configuration::get('PS_SHOP_EMAIL') ?></webMaster>
<generator>PrestaShop</generator>
<language><?php echo Context::getContext()->language->iso_code; ?></language>
<image>
+6 -2
View File
@@ -353,7 +353,9 @@ class MailAlerts extends Module
'{delivery_postal_code}' => $delivery->postcode,
'{delivery_country}' => $delivery->country,
'{delivery_state}' => $delivery->id_state ? $delivery_state->name : '',
'{delivery_phone}' => $delivery->phone ? $delivery->phone : $delivery->phone_mobile,
'{delivery_phone}' => $delivery->phone,
'{delivery_phone_mobile}' => $delivery->phone_mobile,
'{delivery_vat_number}' => $delivery->vat_number,
'{delivery_other}' => $delivery->other,
'{invoice_company}' => $invoice->company,
'{invoice_firstname}' => $invoice->firstname,
@@ -364,7 +366,9 @@ class MailAlerts extends Module
'{invoice_postal_code}' => $invoice->postcode,
'{invoice_country}' => $invoice->country,
'{invoice_state}' => $invoice->id_state ? $invoice_state->name : '',
'{invoice_phone}' => $invoice->phone ? $invoice->phone : $invoice->phone_mobile,
'{invoice_phone}' => $invoice->phone,
'{invoice_phone_mobile}' => $invoice->phone_mobile,
'{invoice_vat_number}' => $invoice->vat_number,
'{invoice_other}' => $invoice->other,
'{order_name}' => sprintf('%06d', $order->id),
'{shop_name}' => Configuration::get('PS_SHOP_NAME'),
+10 -6
View File
@@ -106,6 +106,8 @@ function changeAddressDelivery(obj)
if ($('#product_'+id_product+'_'+id_product_attribute+'_0_'+new_id_address_delivery).length)
{
updateCartSummary(jsonData.summary);
if (window.ajaxCart != undefined)
ajaxCart.updateCart(jsonData);
updateCustomizedDatas(jsonData.customizedDatas);
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
@@ -119,9 +121,8 @@ function changeAddressDelivery(obj)
// @todo improve customization upgrading
$('.product_'+id_product+'_'+id_product_attribute+'_0_'+old_id_address_delivery).remove();
}
if (window.ajaxCart != undefined)
ajaxCart.refresh();
ajaxCart.updateCart(jsonData);
updateAddressId(id_product, id_product_attribute, old_id_address_delivery, new_id_address_delivery);
cleanSelectAddressDelivery();
}
@@ -190,9 +191,8 @@ function changeAddressDelivery(obj)
cleanSelectAddressDelivery();
updateCartSummary(jsonData.summary);
if (window.ajaxCart !== undefined)
ajaxCart.refresh();
ajaxCart.updateCart(jsonData);
}
});
}
@@ -370,6 +370,8 @@ function deleteProductFromSummary(id)
});
}
updateCartSummary(jsonData.summary);
if (window.ajaxCart != undefined)
ajaxCart.updateCart(jsonData);
updateCustomizedDatas(jsonData.customizedDatas);
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
@@ -461,6 +463,8 @@ function upQuantity(id, qty)
if (jsonData.refresh)
location.reload();
updateCartSummary(jsonData.summary);
if (window.ajaxCart != undefined)
ajaxCart.updateCart(jsonData);
if (customizationId !== 0)
updateCustomizedDatas(jsonData.customizedDatas);
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
@@ -544,6 +548,8 @@ function downQuantity(id, qty)
if (jsonData.refresh)
location.reload();
updateCartSummary(jsonData.summary);
if (window.ajaxCart !== undefined)
ajaxCart.updateCart(jsonData);
if (customizationId !== 0)
updateCustomizedDatas(jsonData.customizedDatas);
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
@@ -754,8 +760,6 @@ function updateCartSummary(json)
$('#total_wrapping').html(formatCurrency(json.total_wrapping, currencyFormat, currencySign, currencyBlank));
$('#total_wrapping').parent().hide();
}
if (window.ajaxCart !== undefined)
ajaxCart.refresh();
}
function updateCustomizedDatas(json)