Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4b02314
BO: Update keyboard shortcuts in product page
AntoineMille Feb 2, 2017
f70032f
BO: Fix Module configure permission
dheerajwebkul Feb 3, 2017
af17687
CO: Deprecate getOrderByCartId(), use new methods
bbsimon Sep 13, 2016
88338d7
CO: harmonize hook name
aleeks Feb 3, 2017
e2f2e92
CO: rename filtered hook to filter
aleeks Feb 3, 2017
e5f8f3d
Merge pull request #6327 from bbsimon/deprecate-getOrderByCartId-method
aleeks Feb 6, 2017
e02dcdc
Merge pull request #7457 from aleeks/harmonize_hook
antoin-m Feb 6, 2017
b3e9504
CO: add actionEmailSendBefore hook
antoin-m Feb 1, 2017
88e18c7
BO: Fix id_order ambiguous search
Myo1030 Feb 6, 2017
6f7399d
CO: Superfluous table alias
antoin-m Feb 6, 2017
9c9f38b
FO: Add manufacturer name in cart products
cedricfontaine Feb 6, 2017
be7d5ab
Merge pull request #7460 from antoin-m/fix/table-alias
aleeks Feb 6, 2017
a371af2
Merge pull request #7443 from antoin-m/patch-3
aleeks Feb 6, 2017
3dc93de
Merge pull request #7459 from aleeks/pick-myo
antoin-m Feb 6, 2017
28b560a
BO: update invoice pdf
Nobodaddy Feb 6, 2017
f5a58db
Merge pull request #7461 from aleeks/manufacturer_name
antoin-m Feb 6, 2017
19a6b4a
Merge pull request #7462 from aleeks/nobo
antoin-m Feb 6, 2017
22c8df1
CO: Calculate carrier price on the real order price
axometeam Nov 6, 2015
aa69f23
Merge pull request #7464 from antoin-m/axome
aleeks Feb 6, 2017
e3a7637
CO: improvement in SpecificPrice::getSpecificPrice
lozal2244 Dec 2, 2015
91289a8
BO: update comment
aleeks Feb 6, 2017
21e56eb
Merge pull request #7466 from antoin-m/specific-price
aleeks Feb 6, 2017
e434f43
Merge pull request #7467 from aleeks/jquery
Feb 6, 2017
18d4202
CO: Allow rel="nofollow" in Tools::purifyHTML
Oct 27, 2015
19eae39
BO: Show rel="nofollow" option for anchor in TinyMCE
Oct 27, 2015
f5c95b0
CO: rename ESlint config file
102 Feb 7, 2017
985a14b
Merge pull request #7469 from 102/patch-1
Feb 7, 2017
1cfbf56
BO: Update keyboard shortcuts in product page (add shift)
AntoineMille Feb 3, 2017
21046c4
CO: Use boolean variables for tracking configuration value type
Oct 15, 2015
db12d1b
Merge pull request #7468 from antoin-m/seotools
aleeks Feb 7, 2017
2131281
BO: File doesn't exists
kermes Mar 28, 2016
d299044
Merge pull request #7449 from AntoineMille/BOOM-1755-2
aleeks Feb 7, 2017
ad26f40
Merge pull request #7463 from antoin-m/fix/boules
aleeks Feb 7, 2017
465ba7f
CO: add "use instead" doc on method display as deprecated when possible
PrestaEdit Mar 10, 2016
2149b14
Merge pull request #7470 from antoin-m/fix/unknown-files
aleeks Feb 7, 2017
e502079
CO: Update ObjectModelCore::getFieldsLang
gu78 Nov 20, 2015
79d9e92
Merge pull request #7472 from antoin-m/fix/deprecated
aleeks Feb 7, 2017
f1d5f28
Merge pull request #7473 from antoin-m/fix/multilang-field
thierrymarianne Feb 7, 2017
25d45c8
Merge pull request #7455 from aleeks/module_config
thierrymarianne Feb 7, 2017
0e8a3b5
BO: Fix Administering email setting whith/without log
kompilorb Feb 7, 2017
295bee1
Merge pull request #7474 from kompilorb/develop
antoin-m Feb 7, 2017
0ec6c6c
FO: Fix empty template var to utf8
lbanchio Feb 4, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintrc → .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"browser": true
},
"parserOptions": {
ecmaVersion: 6,
sourceType: "module"
"ecmaVersion": 6,
"sourceType": "module"
},
"rules": {
"semi": 2,
Expand Down
12 changes: 6 additions & 6 deletions admin-dev/themes/default/js/bundle/product/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
9 changes: 5 additions & 4 deletions classes/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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'));
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions classes/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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]);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions classes/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion classes/Customization.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down
29 changes: 29 additions & 0 deletions classes/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion classes/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion classes/ObjectModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion classes/PaymentModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion classes/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion classes/SpecificPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion classes/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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'));
Expand Down
4 changes: 4 additions & 0 deletions classes/controller/FrontController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1584,6 +1584,10 @@ public function getTemplateVarShop()
'fax' => Configuration::get('PS_SHOP_FAX'),
);

array_walk($shop, function (&$entry) {
$entry = utf8_encode($entry);
});

return $shop;
}

Expand Down
2 changes: 1 addition & 1 deletion classes/exception/PrestaShopException.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ protected function logError()
*/
protected function getExentedMessage($html = true)
{
Tools::displayAsDeprecated();
Tools::displayAsDeprecated('Use getExtendedMessage instead');
return $this->getExtendedMessage($html);
}

Expand Down
2 changes: 1 addition & 1 deletion classes/helper/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion classes/module/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -2665,7 +2665,7 @@ public function getPosition($id_hook)

/**
* Getter for $tabs attribute
*
*
* @return array
*/
public function getTabs()
Expand Down
49 changes: 38 additions & 11 deletions classes/order/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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;
}

/**
Expand All @@ -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'));
}

Expand Down
2 changes: 1 addition & 1 deletion classes/order/OrderSlip.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion controllers/admin/AdminCartsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading