diff --git a/.eslintrc b/.eslintrc.json similarity index 85% rename from .eslintrc rename to .eslintrc.json index 6a8ab8fbd0022..2673df5a03ead 100644 --- a/.eslintrc +++ b/.eslintrc.json @@ -7,8 +7,8 @@ "browser": true }, "parserOptions": { - ecmaVersion: 6, - sourceType: "module" + "ecmaVersion": 6, + "sourceType": "module" }, "rules": { "semi": 2, diff --git a/admin-dev/themes/default/js/bundle/product/form.js b/admin-dev/themes/default/js/bundle/product/form.js index a5bedd48b12a0..f7e1e74d791df 100644 --- a/admin-dev/themes/default/js/bundle/product/form.js +++ b/admin-dev/themes/default/js/bundle/product/form.js @@ -963,38 +963,38 @@ var form = (function() { }); /** create keyboard event for save */ - jwerty.key('ctrl+S/cmd+S', function(e) { + jwerty.key('alt+shift+S', function(e) { e.preventDefault(); send(); }); /** create keyboard event for save & duplicate */ - jwerty.key('ctrl+D/cmd+D', function(e) { + jwerty.key('alt+shift+D', function(e) { e.preventDefault(); send($('.product-footer .duplicate').attr('data-redirect')); }); /** create keyboard event for save & new */ - jwerty.key('ctrl+P/cmd+P', function(e) { + jwerty.key('alt+shift+P', function(e) { e.preventDefault(); send($('.product-footer .new-product').attr('data-redirect')); }); /** create keyboard event for save & go catalog */ - jwerty.key('ctrl+Q', function(e) { + jwerty.key('alt+shift+Q', function(e) { e.preventDefault(); send($('.product-footer .go-catalog').attr('data-redirect')); }); /** create keyboard event for save & go preview */ - jwerty.key('ctrl+E/cmd+E', function(e) { + jwerty.key('alt+shift+V', function(e) { e.preventDefault(); var productFooter = $('.product-footer .preview'); send(productFooter.attr('data-redirect'), productFooter.attr('target')); }); /** create keyboard event for save & active or desactive product*/ - jwerty.key('ctrl+O/cmd+O', function(e) { + jwerty.key('alt+shift+O', function(e) { e.preventDefault(); var step1CheckBox = $('#form_step1_active'); step1CheckBox.prop('checked', !step1CheckBox.is(':checked')); diff --git a/classes/Cart.php b/classes/Cart.php index 572f3a56affff..2873b2fcac928 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -611,7 +611,7 @@ public function getProducts($refresh = false, $id_product = false, $id_country = // Build SELECT $sql->select('cp.`id_product_attribute`, cp.`id_product`, cp.`quantity` AS cart_quantity, cp.id_shop, cp.`id_customization`, pl.`name`, p.`is_virtual`, pl.`description_short`, pl.`available_now`, pl.`available_later`, product_shop.`id_category_default`, p.`id_supplier`, - p.`id_manufacturer`, product_shop.`on_sale`, product_shop.`ecotax`, product_shop.`additional_shipping_cost`, + p.`id_manufacturer`, m.`name` AS manufacturer_name, product_shop.`on_sale`, product_shop.`ecotax`, product_shop.`additional_shipping_cost`, product_shop.`available_for_order`, product_shop.`price`, product_shop.`active`, product_shop.`unity`, product_shop.`unit_price_ratio`, stock.`quantity` AS quantity_available, p.`width`, p.`height`, p.`depth`, stock.`out_of_stock`, p.`weight`, p.`date_add`, p.`date_upd`, IFNULL(stock.quantity, 0) as quantity, pl.`link_rewrite`, cl.`link_rewrite` AS category, @@ -639,6 +639,7 @@ public function getProducts($refresh = false, $id_product = false, $id_country = ); $sql->leftJoin('product_supplier', 'ps', 'ps.`id_product` = cp.`id_product` AND ps.`id_product_attribute` = cp.`id_product_attribute` AND ps.`id_supplier` = p.`id_supplier`'); + $sql->leftJoin('manufacturer', 'm', 'm.`id_manufacturer` = p.`id_manufacturer`'); // @todo test if everything is ok, then refactorise call of this method $sql->join(Product::sqlStock('cp', 'cp')); @@ -3203,7 +3204,7 @@ public function getCarrierCost($id_carrier, $useTax = true, Country $default_cou */ public function getOrderShippingCost($id_carrier = null, $use_tax = true, Country $default_country = null, $product_list = null) { - Tools::displayAsDeprecated(); + Tools::displayAsDeprecated('Use Cart->getPackageShippingCost()'); return $this->getPackageShippingCost((int)$id_carrier, $use_tax, $default_country, $product_list); } @@ -3271,7 +3272,7 @@ public function getPackageShippingCost($id_carrier = null, $use_tax = true, Coun } // Order total in default currency without fees - $order_total = $this->getOrderTotal(true, Cart::ONLY_PHYSICAL_PRODUCTS_WITHOUT_SHIPPING, $product_list); + $order_total = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING, $product_list); // Start with shipping cost at 0 $shipping_cost = 0; @@ -3940,7 +3941,7 @@ public function addPictureToProduct($id_product, $index, $type, $file) */ public function deletePictureToProduct($id_product, $index) { - Tools::displayAsDeprecated(); + Tools::displayAsDeprecated('Use deleteCustomizationToProduct() instead'); return $this->deleteCustomizationToProduct($id_product, 0); } diff --git a/classes/Configuration.php b/classes/Configuration.php index 11df770076e0d..9bfcb66541e41 100644 --- a/classes/Configuration.php +++ b/classes/Configuration.php @@ -158,7 +158,7 @@ public static function loadConfiguration() if ($results) { foreach ($results as $row) { $lang = ($row['id_lang']) ? $row['id_lang'] : 0; - self::$types[$row['name']] = ($lang) ? 'lang' : 'normal'; + self::$types[$row['name']] = (bool)$lang; if (!isset(self::$_cache[self::$definition['table']][$lang])) { self::$_cache[self::$definition['table']][$lang] = array( @@ -668,7 +668,7 @@ public static function isOverridenByCurrentContext($key) */ public static function isLangKey($key) { - return (isset(self::$types[$key]) && self::$types[$key] == 'lang') ? true : false; + return (isset(self::$types[$key]) && self::$types[$key]); } /** diff --git a/classes/Cookie.php b/classes/Cookie.php index 65cfe0b583f98..84d38016af5d6 100644 --- a/classes/Cookie.php +++ b/classes/Cookie.php @@ -210,7 +210,7 @@ public function __unset($key) */ public function isLogged($withGuest = false) { - Tools::displayAsDeprecated(); + Tools::displayAsDeprecated('Use Customer::isLogged() instead'); if (!$withGuest && $this->is_guest == 1) { return false; } @@ -232,7 +232,7 @@ public function isLogged($withGuest = false) */ public function isLoggedBack() { - Tools::displayAsDeprecated(); + Tools::displayAsDeprecated('Use Employee::isLoggedBack() instead'); /* Employee is valid only if it can be load and if cookie password is the same as database one */ return $this->id_employee && Validate::isUnsignedId($this->id_employee) diff --git a/classes/Customization.php b/classes/Customization.php index 2506152999b8f..2d466441ea1a3 100644 --- a/classes/Customization.php +++ b/classes/Customization.php @@ -231,7 +231,7 @@ public static function getLabel($idCustomization, $idLang, $idShop = null) $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT `name` FROM `'._DB_PREFIX_.'customization_field_lang` - WHERE `id_customization_field` = '.(int) $idCustomization.((int) $idShop ? ' AND cfl.`id_shop` = '.(int) $idShop : '').' + WHERE `id_customization_field` = '.(int) $idCustomization.((int) $idShop ? ' AND `id_shop` = '.(int) $idShop : '').' AND `id_lang` = '.(int) $idLang ); diff --git a/classes/Mail.php b/classes/Mail.php index d0524c284520f..a5d93c026c865 100644 --- a/classes/Mail.php +++ b/classes/Mail.php @@ -109,6 +109,35 @@ public static function Send( $idShop = Context::getContext()->shop->id; } + $skip = array_reduce(Hook::exec( + 'actionEmailSendBefore', + array( + 'idLang' => &$idLang, + 'template' => &$template, + 'subject' => &$subject, + 'templateVars' => &$templateVars, + 'to' => &$to, + 'toName' => &$toName, + 'from' => &$from, + 'fromName' => &$fromName, + 'fileAttachment' => &$fileAttachment, + 'mode_smtp' => &$mode_smtp, + 'templatePath' => &$templatePath, + 'die' => &$die, + 'idShop' => &$idShop, + 'bcc' => &$bcc, + 'replyTo' => &$replyTo + ), + null, + true + ), function ($carry, $item) { + return $carry && $item; + }, true); + + if (!$skip) { + return true; + } + if (is_numeric($idShop) && $idShop) { $shop = new Shop((int) $idShop); } diff --git a/classes/Media.php b/classes/Media.php index 538eca1cdfc4b..1e71f439fb479 100644 --- a/classes/Media.php +++ b/classes/Media.php @@ -306,7 +306,8 @@ public static function getJqueryPath($version = null, $folder = null, $minifier $return[] = Media::getJSPath(Context::getContext()->shop->getBaseURL(true, false)._PS_JS_DIR_.'jquery/jquery.noConflict.php?version='.$version); } - //added query migrate for compatibility with new version of jquery will be removed in ps 1.6 + // added jQuery migrate for compatibility with new version of jQuery + // will be removed when using latest version of jQuery $return[] = Media::getJSPath(_PS_JS_DIR_.'jquery/jquery-migrate-1.2.1.min.js'); return $return; diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index 293db34bcf6cc..5c8637e64ab63 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -322,7 +322,7 @@ public function getFieldsLang() $is_lang_multishop = $this->isLangMultishop(); $fields = array(); - if ($this->id_lang === null) { + if (!is_int($this->id_lang)) { foreach (Language::getIDs(false) as $id_lang) { $fields[$id_lang] = $this->formatFields(self::FORMAT_LANG, $id_lang); $fields[$id_lang]['id_lang'] = $id_lang; diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index c00cb33ddcfbc..15cdd24d2b5df 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -885,7 +885,7 @@ public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_ */ public function formatProductAndVoucherForEmail($content) { - Tools::displayAsDeprecated(); + Tools::displayAsDeprecated('Use $content instead'); return $content; } diff --git a/classes/Product.php b/classes/Product.php index 5d86013eb20e8..6d49d5c60c937 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -1543,7 +1543,7 @@ public static function updateDefaultAttribute($id_product) public function updateProductAttribute($id_product_attribute, $wholesale_price, $price, $weight, $unit, $ecotax, $id_images, $reference, $id_supplier = null, $ean13, $default, $location = null, $upc = null, $minimal_quantity, $available_date, $isbn = '') { - Tools::displayAsDeprecated(); + Tools::displayAsDeprecated('Use updateAttribute() instead'); $return = $this->updateAttribute( $id_product_attribute, $wholesale_price, $price, $weight, $unit, $ecotax, diff --git a/classes/SpecificPrice.php b/classes/SpecificPrice.php index e3fce3a96daf1..9eee2fe99065e 100644 --- a/classes/SpecificPrice.php +++ b/classes/SpecificPrice.php @@ -357,7 +357,7 @@ public static function getSpecificPrice($id_product, $id_shop, $id_currency, $id AND IF(`from_quantity` > 1, `from_quantity`, 0) <= '; $query .= ($psQtyDiscountOnCombination || !$id_cart || !$real_quantity) ? (int)$quantity : max(1, (int)$real_quantity); - $query .= ' ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC, `to` DESC, `from` DESC'; + $query .= ' ORDER BY `id_product_attribute` DESC, `id_cart` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC, `to` DESC, `from` DESC'; SpecificPrice::$_specificPriceCache[$key] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($query); } diff --git a/classes/Tools.php b/classes/Tools.php index f2bcd1a9b1215..3d7795992c409 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -2091,7 +2091,7 @@ public static function parserSQL($sql) public static function replaceByAbsoluteURL($matches) { - Tools::displayAsDeprecated(); + Tools::displayAsDeprecated('Use Media::replaceByAbsoluteURL($matches) instead'); return Media::replaceByAbsoluteURL($matches); } @@ -3657,6 +3657,7 @@ public static function purifyHTML($html, $uri_unescape = null, $allow_style = fa $config = HTMLPurifier_Config::createDefault(); $config->set('Attr.EnableID', true); + $config->set('Attr.AllowedRel', array('nofollow')); $config->set('HTML.Trusted', true); $config->set('Cache.SerializerPath', _PS_CACHE_DIR_.'purifier'); $config->set('Attr.AllowedFrameTargets', array('_blank', '_self', '_parent', '_top')); diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index 423426ae52b55..191493e5667f3 100644 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -1584,6 +1584,10 @@ public function getTemplateVarShop() 'fax' => Configuration::get('PS_SHOP_FAX'), ); + array_walk($shop, function (&$entry) { + $entry = utf8_encode($entry); + }); + return $shop; } diff --git a/classes/exception/PrestaShopException.php b/classes/exception/PrestaShopException.php index 70804ba9147ee..bf6fab4b49371 100644 --- a/classes/exception/PrestaShopException.php +++ b/classes/exception/PrestaShopException.php @@ -158,7 +158,7 @@ protected function logError() */ protected function getExentedMessage($html = true) { - Tools::displayAsDeprecated(); + Tools::displayAsDeprecated('Use getExtendedMessage instead'); return $this->getExtendedMessage($html); } diff --git a/classes/helper/Helper.php b/classes/helper/Helper.php index 9e57f8c5a3b60..3c3e5843e04b2 100755 --- a/classes/helper/Helper.php +++ b/classes/helper/Helper.php @@ -369,7 +369,7 @@ public function renderModulesList($modules_list) */ public static function renderShopList() { - Tools::displayAsDeprecated(); + Tools::displayAsDeprecated('Use HelperShop->getRenderedShopList instead'); if (!Shop::isFeatureActive() || Shop::getTotalShops(false, null) < 2) { return null; diff --git a/classes/module/Module.php b/classes/module/Module.php index 4cbeea0298432..557a8a7fcb660 100644 --- a/classes/module/Module.php +++ b/classes/module/Module.php @@ -2665,7 +2665,7 @@ public function getPosition($id_hook) /** * Getter for $tabs attribute - * + * * @return array */ public function getTabs() diff --git a/classes/order/Order.php b/classes/order/Order.php index eb1a9112cd245..7158e20ead163 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -769,11 +769,11 @@ public function isVirtual($strict = true) } /** - * @deprecated 1.5.0.1 + * @deprecated 1.5.0.1 use Order::getCartRules() instead */ public function getDiscounts($details = false) { - Tools::displayAsDeprecated(); + Tools::displayAsDeprecated('Use Order::getCartRules() instead'); return Order::getCartRules(); } @@ -1080,20 +1080,47 @@ public static function getCustomerNbOrders($id_customer) } /** - * Get an order by its cart id + * Get an order id by its cart id * * @param int $id_cart Cart id - * @return array Order details + * @return int Order id + * + * @deprecated since 1.7.1.0 Use getIdByCartId() instead */ public static function getOrderByCartId($id_cart) { - $sql = 'SELECT `id_order` - FROM `'._DB_PREFIX_.'orders` - WHERE `id_cart` = '.(int)$id_cart - .Shop::addSqlRestriction(); - $result = Db::getInstance()->getRow($sql); + return self::getIdByCartId($id_cart); + } + + /** + * Get an order object by its cart id + * + * @param int $id_cart Cart id + * @return OrderCore + */ + public static function getByCartId($id_cart) + { + $id_order = (int) self::getIdByCartId((int) $id_cart); + + return ($id_order > 0) ? new self($id_order) : null; + } + + /** + * Get the order id by its cart id + * + * @param int $id_cart Cart id + * @return int $id_order + */ + public static function getIdByCartId($id_cart) + { + $sql = 'SELECT `id_order` + FROM `'._DB_PREFIX_.'orders` + WHERE `id_cart` = '.(int) $id_cart. + Shop::addSqlRestriction(); + + $result = Db::getInstance()->getValue($sql); - return isset($result['id_order']) ? $result['id_order'] : false; + return !empty($result) ? (int) $result : false; } /** @@ -1106,7 +1133,7 @@ public static function getOrderByCartId($id_cart) */ public function addDiscount($id_cart_rule, $name, $value) { - Tools::displayAsDeprecated(); + Tools::displayAsDeprecated('Use Order::addCartRule($id_cart_rule, $name, array(\'tax_incl\' => $value, \'tax_excl\' => \'0.00\')) instead'); return Order::addCartRule($id_cart_rule, $name, array('tax_incl' => $value, 'tax_excl' => '0.00')); } diff --git a/classes/order/OrderSlip.php b/classes/order/OrderSlip.php index 06025daf2f8b9..78f2bffc47b72 100644 --- a/classes/order/OrderSlip.php +++ b/classes/order/OrderSlip.php @@ -247,7 +247,7 @@ public static function getSlipsIdByDate($dateFrom, $dateTo) */ public static function createOrderSlip($order, $productList, $qtyList, $shipping_cost = false) { - Tools::displayAsDeprecated(); + Tools::displayAsDeprecated('Use OrderSlip::create() instead'); $product_list = array(); foreach ($productList as $id_order_detail) { diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index 1ea26b92177d5..7bf544c2f6701 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -219,7 +219,7 @@ public function renderView() $summary = $cart->getSummaryDetails(); /* Display order information */ - $id_order = (int)Order::getOrderByCartId($cart->id); + $id_order = (int)Order::getIdByCartId($cart->id); $order = new Order($id_order); if (Validate::isLoadedObject($order)) { $tax_calculation_method = $order->getTaxCalculationMethod(); diff --git a/controllers/admin/AdminEmailsController.php b/controllers/admin/AdminEmailsController.php index 0a901eb9d1122..2981c086e22f5 100644 --- a/controllers/admin/AdminEmailsController.php +++ b/controllers/admin/AdminEmailsController.php @@ -32,19 +32,19 @@ class AdminEmailsControllerCore extends AdminController public function __construct() { $this->bootstrap = true; + + $this->table = 'mail'; + $this->className = 'Mail'; + + parent::__construct(); if (Configuration::get('PS_LOG_EMAILS')) { - $this->table = 'mail'; - $this->className = 'Mail'; - $this->lang = false; $this->noLink = true; $this->list_no_link = true; $this->explicitSelect = true; $this->addRowAction('delete'); - parent::__construct(); - $this->bulk_actions = array( 'delete' => array( 'text' => $this->trans('Delete selected', array(), 'Admin.Actions'), diff --git a/controllers/admin/AdminModulesController.php b/controllers/admin/AdminModulesController.php index f244904d06eda..87cd6c30fcb77 100644 --- a/controllers/admin/AdminModulesController.php +++ b/controllers/admin/AdminModulesController.php @@ -864,7 +864,7 @@ public function postProcessCallback() $this->errors[] = $this->trans('You do not have permission to install this module.', array(), 'Admin.Modules.Notification'); } elseif ($key == 'delete' && (!$this->access('delete') || !$module->getPermission('configure'))) { $this->errors[] = $this->trans('You do not have permission to delete this module.', array(), 'Admin.Modules.Notification'); - } elseif ($key == 'configure' && (!$this->access('edit') || !$module->getPermission('configure') || !$moduleManager->isInstalled(urldecode($name)))) { + } elseif ($key == 'configure' && (!$module->getPermission('configure') || !$moduleManager->isInstalled(urldecode($name)))) { $this->errors[] = $this->trans('You do not have permission to configure this module.', array(), 'Admin.Modules.Notification'); } elseif ($key == 'install' && $moduleManager->isInstalled($module->name)) { $this->errors[] = $this->trans('This module is already installed: %s.', array($module->name), 'Admin.Modules.Notification'); diff --git a/controllers/admin/AdminReturnController.php b/controllers/admin/AdminReturnController.php index a6f23957c22eb..147f33cbcbd4e 100644 --- a/controllers/admin/AdminReturnController.php +++ b/controllers/admin/AdminReturnController.php @@ -45,7 +45,7 @@ public function __construct() $this->fields_list = array( 'id_order_return' => array('title' => $this->trans('ID', array(), 'Admin.Global'), 'align' => 'center', 'width' => 25), - 'id_order' => array('title' => $this->trans('Order ID', array(), 'Admin.Orderscustomers.Feature'), 'width' => 100, 'align' => 'center', 'filter_key'=>'a!id_order'), + 'id_order' => array('title' => $this->trans('Order ID', array(), 'Admin.Orderscustomers.Feature'), 'width' => 100, 'align' => 'center', 'filter_key'=>'a!id_order', 'havingFilter' => true), 'name' => array('title' => $this->trans('Status', array(), 'Admin.Global'),'color' => 'color', 'width' => 'auto', 'align' => 'left'), 'date_add' => array('title' => $this->trans('Date issued', array(), 'Admin.Orderscustomers.Feature'), 'width' => 150, 'type' => 'date', 'align' => 'right', 'filter_key'=>'a!date_add'), ); diff --git a/controllers/front/CmsController.php b/controllers/front/CmsController.php index ee3b290b098cc..29775fc32fe03 100644 --- a/controllers/front/CmsController.php +++ b/controllers/front/CmsController.php @@ -95,7 +95,7 @@ public function initContent() $cmsVar = $this->objectPresenter->present($this->cms); $filteredCmsContent = Hook::exec( - 'filteredCmsContent', + 'filterCmsContent', array('object' => $cmsVar), $id_module = null, $array_return = false, @@ -125,7 +125,7 @@ public function initContent() $cmsCategoryVar = $this->getTemplateVarCategoryCms(); $filteredCmsCategoryContent = Hook::exec( - 'filteredCmsCategoryContent', + 'filterCmsCategoryContent', array('object' => $cmsCategoryVar), $id_module = null, $array_return = false, diff --git a/controllers/front/OrderConfirmationController.php b/controllers/front/OrderConfirmationController.php index ebd819ec3578b..bbbb526927ca4 100644 --- a/controllers/front/OrderConfirmationController.php +++ b/controllers/front/OrderConfirmationController.php @@ -50,7 +50,7 @@ public function init() $redirectLink = 'index.php?controller=history'; $this->id_module = (int) (Tools::getValue('id_module', 0)); - $this->id_order = Order::getOrderByCartId((int) ($this->id_cart)); + $this->id_order = Order::getIdByCartId((int) ($this->id_cart)); $this->secure_key = Tools::getValue('key', false); $order = new Order((int) ($this->id_order)); @@ -80,7 +80,7 @@ public function initContent() } parent::initContent(); - $order = new Order(Order::getOrderByCartId((int) ($this->id_cart))); + $order = new Order(Order::getIdByCartId((int) ($this->id_cart))); $presentedOrder = $this->order_presenter->present($order); $register_form = $this ->makeCustomerForm() diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index faff8f723edab..618f0215b4631 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -307,7 +307,7 @@ public function initContent() $product_for_template = $this->getTemplateVarProduct(); $filteredProduct = Hook::exec( - 'filteredProductContent', + 'filterProductContent', array('object' => $product_for_template), $id_module = null, $array_return = false, diff --git a/controllers/front/listing/CategoryController.php b/controllers/front/listing/CategoryController.php index cc29deac481d8..9c5a9b09a93fd 100644 --- a/controllers/front/listing/CategoryController.php +++ b/controllers/front/listing/CategoryController.php @@ -81,7 +81,7 @@ public function init() $categoryVar = $this->getTemplateVarCategory(); $filteredCategory= Hook::exec( - 'filteredCategoryContent', + 'filterCategoryContent', array('object' => $categoryVar), $id_module = null, $array_return = false, diff --git a/controllers/front/listing/ManufacturerController.php b/controllers/front/listing/ManufacturerController.php index 1852926e76b3a..8eeabc66c555d 100644 --- a/controllers/front/listing/ManufacturerController.php +++ b/controllers/front/listing/ManufacturerController.php @@ -123,7 +123,7 @@ protected function assignManufacturer() $manufacturerVar = $this->objectPresenter->present($this->manufacturer); $filteredManufacturer = Hook::exec( - 'filteredManufacturerContent', + 'filterManufacturerContent', array('filtered_content' => $manufacturerVar['description']), $id_module = null, $array_return = false, @@ -151,7 +151,7 @@ protected function assignAll() if (!empty($manufacturersVar)) { foreach ($manufacturersVar as $k => $manufacturer) { $filteredManufacturer = Hook::exec( - 'filteredManufacturerContent', + 'filterManufacturerContent', array('filtered_content' => $manufacturer['text']), $id_module = null, $array_return = false, diff --git a/controllers/front/listing/SupplierController.php b/controllers/front/listing/SupplierController.php index 69252c87d924f..a65a47286ad6e 100644 --- a/controllers/front/listing/SupplierController.php +++ b/controllers/front/listing/SupplierController.php @@ -124,7 +124,7 @@ protected function assignSupplier() $supplierVar = $this->objectPresenter->present($this->supplier); $filteredSupplier = Hook::exec( - 'filteredSupplierContent', + 'filterSupplierContent', array('object' => $supplierVar), $id_module = null, $array_return = false, @@ -152,7 +152,7 @@ protected function assignAll() if (!empty($suppliersVar)) { foreach ($suppliersVar as $k => $supplier) { $filteredSupplier = Hook::exec( - 'filteredSupplierContent', + 'filterSupplierContent', array('object' => $supplier), $id_module = null, $array_return = false, diff --git a/install-dev/data/xml/hook.xml b/install-dev/data/xml/hook.xml index 906e018d22933..807ba07d94531 100644 --- a/install-dev/data/xml/hook.xml +++ b/install-dev/data/xml/hook.xml @@ -74,12 +74,12 @@ displayAfterBodyOpeningTag Very top of pages - Use this hook for advertisement or modals you want to load first. + Use this hook for advertisement or modals you want to load first displayBeforeBodyClosingTag Very bottom of pages - Use this hook for your modals or any content you want to load at the very end. + Use this hook for your modals or any content you want to load at the very end displayTop @@ -124,7 +124,7 @@ actionOrderStatusUpdate Order status update - Event - This hook launches modules when the status of an order changes. + This hook launches modules when the status of an order changes displayAdminOrder @@ -509,7 +509,7 @@ actionOrderEdited Order edited - This hook is called when an order is edited. + This hook is called when an order is edited actionEmailAddBeforeContent @@ -574,7 +574,7 @@ displayCarrierExtraContent Display additional content for a carrier (e.g pickup points) - This hook calls only the module related to the carrier, in order to add options when needed. + This hook calls only the module related to the carrier, in order to add options when needed validateCustomerFormFields @@ -584,52 +584,52 @@ displayProductExtraContent Display extra content on the product page - This hook expects ProductExtraContent instances, which will be properly displayed by the template on the product page. + This hook expects ProductExtraContent instances, which will be properly displayed by the template on the product page - - filteredCmsContent + + filterCmsContent Filter the content page - This hook is called just before fetching content page. + This hook is called just before fetching content page - - filteredCmsCategoryContent + + filterCmsCategoryContent Filter the content page category - This hook is called just before fetching content page category. + This hook is called just before fetching content page category - - filteredProductContent + + filterProductContent Filter the content page product - This hook is called just before fetching content page product. + This hook is called just before fetching content page product - - filteredCategoryContent + + filterCategoryContent Filter the content page category - This hook is called just before fetching content page category. + This hook is called just before fetching content page category - - filteredManufacturerContent + + filterManufacturerContent Filter the content page manufacturer - This hook is called just before fetching content page manufacturer. + This hook is called just before fetching content page manufacturer - - filteredSupplierContent + + filterSupplierContent Filter the content page supplier - This hook is called just before fetching content page supplier. + This hook is called just before fetching content page supplier - - filteredHtmlContent + + filterHtmlContent Filter HTML field before rending a page - This hook is called just before fetching a page on HTML field. + This hook is called just before fetching a page on HTML field displayDashboardTop Dashboard Top - Displays the content in the dashboard's top area. + Displays the content in the dashboard's top area actionUpdateLangAfter Update "lang" tables - Update "lang" tables after adding or updating a language. + Update "lang" tables after adding or updating a language actionOutputHTMLBefore @@ -659,7 +659,12 @@ actionProductSearchAfter Event triggered after search product completed - This hook is called after the product search. Parameters are already filtered + This hook is called after the product search. Parameters are already filter + + + actionEmailSendBefore + Before sending an email + This hook is used to filter the content or the metadata of an email before sending it or even prevent its sending diff --git a/install-dev/upgrade/sql/1.7.1.0.sql b/install-dev/upgrade/sql/1.7.1.0.sql index 50d2cf9bcb2f2..b58d7407d4f72 100644 --- a/install-dev/upgrade/sql/1.7.1.0.sql +++ b/install-dev/upgrade/sql/1.7.1.0.sql @@ -46,17 +46,17 @@ ALTER TABLE `PREFIX_product` CHANGE `id_product_redirected` `id_type_redirected` ALTER TABLE `PREFIX_product_shop` CHANGE `id_product_redirected` `id_type_redirected` INT(10) NOT NULL DEFAULT '0'; INSERT INTO `PREFIX_hook` (`id_hook`, `name`, `title`, `description`, `position`) VALUES - (NULL, 'filteredCmsContent', 'Filter the content page', 'This hook is called just before fetching content page.', '1'), - (NULL, 'filteredCmsCategoryContent', 'Filter the content page category', 'This hook is called just before fetching content page category.', '1'), - (NULL, 'filteredProductContent', 'Filter the content page product', 'This hook is called just before fetching content page product.', '1'), - (NULL, 'filteredCategoryContent', 'Filter the content page category', 'This hook is called just before fetching content page category.', '1'), - (NULL, 'filteredManufacturerContent', 'Filter the content page manufacturer', 'This hook is called just before fetching content page manufacturer.', '1'), - (NULL, 'filteredSupplierContent', 'Filter the content page supplier', 'This hook is called just before fetching content page supplier.', '1'), - (NULL, 'filteredHtmlContent', 'Filter HTML field before rending a page', 'This hook is called just before fetching a page on HTML field.', '1'), - (NULL, 'displayDashboardTop', 'Dashboard Top', 'Displays the content in the dashboard''s top area.', '1'), + (NULL, 'filterCmsContent', 'Filter the content page', 'This hook is called just before fetching content page', '1'), + (NULL, 'filterCmsCategoryContent', 'Filter the content page category', 'This hook is called just before fetching content page category', '1'), + (NULL, 'filterProductContent', 'Filter the content page product', 'This hook is called just before fetching content page product', '1'), + (NULL, 'filterCategoryContent', 'Filter the content page category', 'This hook is called just before fetching content page category', '1'), + (NULL, 'filterManufacturerContent', 'Filter the content page manufacturer', 'This hook is called just before fetching content page manufacturer', '1'), + (NULL, 'filterSupplierContent', 'Filter the content page supplier', 'This hook is called just before fetching content page supplier', '1'), + (NULL, 'filterHtmlContent', 'Filter HTML field before rending a page', 'This hook is called just before fetching a page on HTML field', '1'), + (NULL, 'displayDashboardTop', 'Dashboard Top', 'Displays the content in the dashboard''s top area', '1'), (NULL, 'actionObjectProductInCartDeleteBefore', 'Cart product removal', 'This hook is called before a product is removed from a cart', '1'), (NULL, 'actionObjectProductInCartDeleteAfter', 'Cart product removal', 'This hook is called after a product is removed from a cart', '1'), - (NULL, 'actionUpdateLangAfter', 'Update "lang" tables', 'Update "lang" tables after adding or updating a language.', '1'), + (NULL, 'actionUpdateLangAfter', 'Update "lang" tables', 'Update "lang" tables after adding or updating a language', '1'), (NULL, 'actionOutputHTMLBefore', 'Filter the whole HTML page', 'This hook is used to filter the whole HTML page before it is rendered (only front)', '1'), (NULL, 'displayAfterProductThumbs', 'Display extra content below product thumbs', 'This hook displays new elements below product images ex. additional media', '1'), (NULL, 'actionDispatcherBefore', 'Before dispatch', 'This hook is called at the beginning of the dispatch method of the Dispatcher', '1'), @@ -65,6 +65,7 @@ INSERT INTO `PREFIX_hook` (`id_hook`, `name`, `title`, `description`, `position` (NULL, 'actionClearCompileCache', 'Clear smarty compile cache', 'This hook is called when smarty''s compile cache is cleared', '1'), (NULL, 'actionClearSf2Cache', 'Clear Sf2 cache', 'This hook is called when the Symfony cache is cleared', '1'), (NULL, 'filterProductSearch', 'Filter search products result', 'This hook is called in order to allow to modify search product result', '1'), - (NULL, 'actionProductSearchAfter', 'Event triggered after search product completed', 'This hook is called after the product search. Parameters are already filtered', '1'); + (NULL, 'actionProductSearchAfter', 'Event triggered after search product completed', 'This hook is called after the product search. Parameters are already filtered', '1'), + (NULL, 'actionEmailSendBefore', 'Before sending an email', 'This hook is used to filter the content or the metadata of an email before sending it or even prevent its sending', '1'); DELETE FROM `PREFIX_configuration` WHERE `name` IN ('PS_META_KEYWORDS'); diff --git a/js/admin/tinymce.inc.js b/js/admin/tinymce.inc.js index 237288b0053a6..019309f911057 100644 --- a/js/admin/tinymce.inc.js +++ b/js/admin/tinymce.inc.js @@ -64,7 +64,10 @@ function tinySetup(config) { extended_valid_elements: "em[class|name|id],@[role|data-*|aria-*]", valid_children: "+*[*]", valid_elements: "*[*]", - init_instance_callback: "changeToMaterial" + init_instance_callback: "changeToMaterial", + rel_list:[ + { title: 'nofollow', value: 'nofollow' } + ] }; $.each(default_config, function (index, el) { diff --git a/js/jquery/plugins/ajaxfileupload/jquery.ajaxfileupload.css b/js/jquery/plugins/ajaxfileupload/jquery.ajaxfileupload.css index 0e3f111a9186f..fb7f60046f398 100755 --- a/js/jquery/plugins/ajaxfileupload/jquery.ajaxfileupload.css +++ b/js/jquery/plugins/ajaxfileupload/jquery.ajaxfileupload.css @@ -24,8 +24,8 @@ } .qq-upload-file {} -.qq-upload-spinner {display:inline-block; background: url("loading.gif"); width:15px; height:15px; vertical-align:text-bottom;} +.qq-upload-spinner {display:inline-block; background: url("../../../../img/loader.gif"); width:15px; height:15px; vertical-align:text-bottom;} .qq-upload-size,.qq-upload-cancel {font-size:11px;} .qq-upload-failed-text {display:none;} -.qq-upload-fail .qq-upload-failed-text {display:inline;} \ No newline at end of file +.qq-upload-fail .qq-upload-failed-text {display:inline;} diff --git a/js/jquery/plugins/jquery.colorpicker.js b/js/jquery/plugins/jquery.colorpicker.js index f09fa5c03e295..1a246daf08431 100755 --- a/js/jquery/plugins/jquery.colorpicker.js +++ b/js/jquery/plugins/jquery.colorpicker.js @@ -78,7 +78,7 @@ }; $.fn.mColorPicker.defaults = { - imageFolder: baseDir + 'img/admin/', + imageFolder: '../../../img/admin/', swatches: [ "#ffffff", "#ffff00", diff --git a/js/jquery/plugins/thickbox/jquery.thickbox.css b/js/jquery/plugins/thickbox/jquery.thickbox.css index e274bf193de17..5087050ee0e8f 100755 --- a/js/jquery/plugins/thickbox/jquery.thickbox.css +++ b/js/jquery/plugins/thickbox/jquery.thickbox.css @@ -35,7 +35,7 @@ width:100%; } -.TB_overlayMacFFBGHack {background: url(../img/macFFBgHack.png) repeat;} +.TB_overlayMacFFBGHack {background: url(../../../../img/macFFBgHack.png) repeat;} .TB_overlayBG { background-color:#000; filter:alpha(opacity=75); @@ -166,4 +166,4 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d *+html #TB_window { /* ie7 hack */ position: absolute; margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); -} \ No newline at end of file +} diff --git a/pdf/invoice.addresses-tab.tpl b/pdf/invoice.addresses-tab.tpl index 74fd315c76065..ec48791b9d21a 100644 --- a/pdf/invoice.addresses-tab.tpl +++ b/pdf/invoice.addresses-tab.tpl @@ -24,14 +24,11 @@ *} - - - diff --git a/src/Adapter/ObjectPresenter.php b/src/Adapter/ObjectPresenter.php index 8f55ab967458c..4f6c7236582db 100644 --- a/src/Adapter/ObjectPresenter.php +++ b/src/Adapter/ObjectPresenter.php @@ -71,7 +71,7 @@ private function filterHtmlContent($type, &$presentedObject, $htmlFields) { if (!empty($htmlFields) && is_array($htmlFields)) { $filteredHtml = Hook::exec( - 'filteredHtmlContent', + 'filterHtmlContent', array( 'type' => $type, 'htmlFields' => $htmlFields, diff --git a/src/PrestaShopBundle/Resources/views/Admin/Product/form.html.twig b/src/PrestaShopBundle/Resources/views/Admin/Product/form.html.twig index babed043381df..6f793a70d9f60 100644 --- a/src/PrestaShopBundle/Resources/views/Admin/Product/form.html.twig +++ b/src/PrestaShopBundle/Resources/views/Admin/Product/form.html.twig @@ -989,15 +989,15 @@ class="btn btn-tertiary btn-submit preview" data-toggle="tooltip" id="product_form_preview_btn" - title="{{ 'See how your product sheet will look online: CTRL+E'|trans({}, 'Admin.Catalog.Help') }}" + title="{{ 'See how your product sheet will look online: ALT+SHIFT+V'|trans({}, 'Admin.Catalog.Help') }}" > {{ 'Preview'|trans({}, 'Admin.Actions')}}

{{ 'Online'|trans({}, 'Admin.Global') }}

+ title="{{ 'Enable or disable the product on your shop: ALT+SHIFT+O'|trans({}, 'Admin.Catalog.Help') }}">{{ 'Online'|trans({}, 'Admin.Global') }}

{{ 'Offline'|trans({}, 'Admin.Global') }}

+ title="{{ 'Enable or disable the product on your shop: ALT+SHIFT+0'|trans({}, 'Admin.Catalog.Help') }}">{{ 'Offline'|trans({}, 'Admin.Global') }} {{ 'Duplicate'|trans({}, 'Admin.Actions')|raw }} @@ -1027,7 +1027,7 @@ id="product_form_save_go_to_catalog_btn" data-redirect="{{ path('admin_product_catalog', {'offset': 'last', 'limit': 'last'}) }}" data-toggle="tooltip" - title="{{ 'Save and go back to the catalog: CTRL+Q'|trans({}, 'Admin.Catalog.Help') }}" + title="{{ 'Save and go back to the catalog: ALT+SHIFT+Q'|trans({}, 'Admin.Catalog.Help') }}" > {{ 'Go to catalog'|trans({}, 'Admin.Catalog.Feature')|raw }} @@ -1037,7 +1037,7 @@ id="product_form_save_new_btn" data-redirect="{{ path('admin_product_new') }}" data-toggle="tooltip" - title="{{ 'Save and create a new product: CTRL+P'|trans({}, 'Admin.Catalog.Help') }}" + title="{{ 'Save and create a new product: ALT+SHIFT+P'|trans({}, 'Admin.Catalog.Help') }}" > {{ 'Add new product'|trans({}, 'Admin.Catalog.Feature')|raw }} @@ -1047,7 +1047,7 @@ class="btn btn-primary save uppercase" value="{{ 'Save'|trans({}, 'Admin.Actions') }}" data-toggle="tooltip" - title="{{ 'Save the product and stay on the current page: CTRL+S'|trans({}, 'Admin.Catalog.Help') }}" + title="{{ 'Save the product and stay on the current page: ALT+SHIFT+S'|trans({}, 'Admin.Catalog.Help') }}" />


- {if isset($order_invoice)}{$order_invoice->shop_address}{/if} -
{if $delivery_address}{l s='Delivery Address' d='Shop.Pdf' pdf='true'}

+
{if $delivery_address}{l s='Delivery Address' d='Shop.Pdf' pdf='true'}

{$delivery_address} {/if}
{l s='Billing Address' d='Shop.Pdf' pdf='true'}

+
{l s='Billing Address' d='Shop.Pdf' pdf='true'}

{$invoice_address}