diff --git a/classes/Address.php b/classes/Address.php index abf8ac2a3..01a227232 100644 --- a/classes/Address.php +++ b/classes/Address.php @@ -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 diff --git a/classes/Attribute.php b/classes/Attribute.php index c27e409b3..93391bc6c 100644 --- a/classes/Attribute.php +++ b/classes/Attribute.php @@ -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; } -} +} \ No newline at end of file diff --git a/classes/AttributeGroup.php b/classes/AttributeGroup.php index 8a8548379..15f72122a 100644 --- a/classes/AttributeGroup.php +++ b/classes/AttributeGroup.php @@ -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(' diff --git a/classes/Language.php b/classes/Language.php index 3ce4b1908..6f0469774 100644 --- a/classes/Language.php +++ b/classes/Language.php @@ -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); } -} +} \ No newline at end of file diff --git a/classes/Supplier.php b/classes/Supplier.php index 3192fa28a..c878257f0 100644 --- a/classes/Supplier.php +++ b/classes/Supplier.php @@ -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; diff --git a/classes/Tools.php b/classes/Tools.php index 34c1229db..56e8645b5 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -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) diff --git a/classes/Validate.php b/classes/Validate.php index 6af8d92c2..9d43e805f 100644 --- a/classes/Validate.php +++ b/classes/Validate.php @@ -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; } diff --git a/classes/module/Module.php b/classes/module/Module.php index 2877c1bad..234897db7 100644 --- a/classes/module/Module.php +++ b/classes/module/Module.php @@ -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); diff --git a/classes/pdf/HTMLTemplateOrderSlip.php b/classes/pdf/HTMLTemplateOrderSlip.php index 06b8b2e23..70f395b75 100644 --- a/classes/pdf/HTMLTemplateOrderSlip.php +++ b/classes/pdf/HTMLTemplateOrderSlip.php @@ -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']); } diff --git a/classes/stock/StockManager.php b/classes/stock/StockManager.php index f1d956d1d..a313da21f 100644 --- a/classes/stock/StockManager.php +++ b/classes/stock/StockManager.php @@ -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; } -} +} \ No newline at end of file diff --git a/config/defines.inc.php b/config/defines.inc.php index 8ce70b580..ab72ff105 100755 --- a/config/defines.inc.php +++ b/config/defines.inc.php @@ -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); diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 67295f8f2..621e9b765 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -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, diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index e218feb83..935fe05e3 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -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'); } /** diff --git a/controllers/front/CartController.php b/controllers/front/CartController.php index a29dcbf39..828238c7c 100644 --- a/controllers/front/CartController.php +++ b/controllers/front/CartController.php @@ -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')) diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php index 82c2345a9..8098ad0ee 100644 --- a/controllers/front/ContactController.php +++ b/controllers/front/ContactController.php @@ -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); diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php index b5f5fdc1d..65e287e5d 100644 --- a/controllers/front/ParentOrderController.php +++ b/controllers/front/ParentOrderController.php @@ -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(); diff --git a/css/admin.css b/css/admin.css index ec73d1414..f5201ec60 100644 --- a/css/admin.css +++ b/css/admin.css @@ -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%; diff --git a/install-dev/classes/controllerHttp.php b/install-dev/classes/controllerHttp.php index 8063ab9af..33c6f9d97 100644 --- a/install-dev/classes/controllerHttp.php +++ b/install-dev/classes/controllerHttp.php @@ -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(); diff --git a/install-dev/classes/xmlLoader.php b/install-dev/classes/xmlLoader.php index 2b6daad41..b2c86ddc3 100644 --- a/install-dev/classes/xmlLoader.php +++ b/install-dev/classes/xmlLoader.php @@ -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)) diff --git a/install-dev/langs/br/install.php b/install-dev/langs/br/install.php index 104f2a514..e379bec88 100644 --- a/install-dev/langs/br/install.php +++ b/install-dev/langs/br/install.php @@ -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', diff --git a/install-dev/langs/de/install.php b/install-dev/langs/de/install.php index fedcb2247..b09b8ac8b 100644 --- a/install-dev/langs/de/install.php +++ b/install-dev/langs/de/install.php @@ -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', diff --git a/install-dev/langs/en/install.php b/install-dev/langs/en/install.php index ee296298a..cd29befe8 100644 --- a/install-dev/langs/en/install.php +++ b/install-dev/langs/en/install.php @@ -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', diff --git a/install-dev/langs/es/install.php b/install-dev/langs/es/install.php index e9fb6d41c..78401e6cb 100644 --- a/install-dev/langs/es/install.php +++ b/install-dev/langs/es/install.php @@ -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', diff --git a/install-dev/langs/it/install.php b/install-dev/langs/it/install.php index 77e6eb468..47bccfb0e 100644 --- a/install-dev/langs/it/install.php +++ b/install-dev/langs/it/install.php @@ -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', diff --git a/install-dev/langs/pl/install.php b/install-dev/langs/pl/install.php index d32708c8d..3197cf69b 100644 --- a/install-dev/langs/pl/install.php +++ b/install-dev/langs/pl/install.php @@ -1,5 +1,9 @@ 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 %1$s: %2$s' => 'Wystąpił błąd SQL w rekordzie %1$s: %2$s', 'Cannot create image "%1$s" for entity "%2$s"' => 'Nie można utworzyć obrazu "%1$s" dla rekordu "%2$s"', diff --git a/install-dev/langs/ru/install.php b/install-dev/langs/ru/install.php index eefaef775..1302da03d 100644 --- a/install-dev/langs/ru/install.php +++ b/install-dev/langs/ru/install.php @@ -1,5 +1,9 @@ array( + 'phone' => '+33 (0)1.40.18.30.04', + 'support' => 'https://www.prestashop.com/en/support', + ), 'translations' => array( 'An SQL error occured for entity %1$s: %2$s' => 'В SQL произошла ошибка для значения %1$s: %2$s', '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' => 'Невозможно создать новые файлы и папки', diff --git a/install-dev/upgrade/php/add_order_reference_in_order_payment.php b/install-dev/upgrade/php/add_order_reference_in_order_payment.php index 1ce631c1f..75b5d0782 100644 --- a/install-dev/upgrade/php/add_order_reference_in_order_payment.php +++ b/install-dev/upgrade/php/add_order_reference_in_order_payment.php @@ -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('
', $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; } diff --git a/install-dev/upgrade/php/p15013_add_missing_columns.php b/install-dev/upgrade/php/p15013_add_missing_columns.php index 0dc851843..55322a56c 100644 --- a/install-dev/upgrade/php/p15013_add_missing_columns.php +++ b/install-dev/upgrade/php/p15013_add_missing_columns.php @@ -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)) ; -} +} \ No newline at end of file diff --git a/install-dev/upgrade/php/p15016_add_missing_columns.php b/install-dev/upgrade/php/p15016_add_missing_columns.php index e9d8288fb..4916c4f6c 100644 --- a/install-dev/upgrade/php/p15016_add_missing_columns.php +++ b/install-dev/upgrade/php/p15016_add_missing_columns.php @@ -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"'); diff --git a/install-dev/upgrade/php/setAllGroupsOnHomeCategory.php b/install-dev/upgrade/php/setallgroupsonhomecategory.php old mode 100755 new mode 100644 similarity index 100% rename from install-dev/upgrade/php/setAllGroupsOnHomeCategory.php rename to install-dev/upgrade/php/setallgroupsonhomecategory.php diff --git a/install-dev/upgrade/sql/1.4.7.0.sql b/install-dev/upgrade/sql/1.4.7.0.sql index f38a89385..3cef2a5c3 100644 --- a/install-dev/upgrade/sql/1.4.7.0.sql +++ b/install-dev/upgrade/sql/1.4.7.0.sql @@ -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`; \ No newline at end of file diff --git a/install-dev/upgrade/sql/1.4.9.1.sql b/install-dev/upgrade/sql/1.4.9.1.sql deleted file mode 100644 index 22c382dd4..000000000 --- a/install-dev/upgrade/sql/1.4.9.1.sql +++ /dev/null @@ -1 +0,0 @@ -SET NAMES 'utf8'; \ No newline at end of file diff --git a/install-dev/upgrade/sql/1.5.4.0.sql b/install-dev/upgrade/sql/1.5.4.0.sql index 4c291e693..75da0cf64 100644 --- a/install-dev/upgrade/sql/1.5.4.0.sql +++ b/install-dev/upgrade/sql/1.5.4.0.sql @@ -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(); */; \ No newline at end of file +UPDATE `PREFIX_order_payment` SET `order_reference` = LPAD(order_reference, 9 , '0'); \ No newline at end of file diff --git a/install-dev/upgrade/sql/1.5.5.0.sql b/install-dev/upgrade/sql/1.5.5.0.sql index 5af9008e8..e43bee7e7 100644 --- a/install-dev/upgrade/sql/1.5.5.0.sql +++ b/install-dev/upgrade/sql/1.5.5.0.sql @@ -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; \ No newline at end of file +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); */; diff --git a/js/sendMailTest.js b/js/sendMailTest.js index ad2b16444..f46a6542d 100644 --- a/js/sendMailTest.js +++ b/js/sendMailTest.js @@ -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) { diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js index 872c448d9..ae99815e7 100644 --- a/modules/blockcart/ajax-cart.js +++ b/modules/blockcart/ajax-cart.js @@ -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 = '