From 76dc6970d28bf0b008d2dc911e419079273d8ed0 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Tue, 15 Jan 2013 18:09:37 +0100 Subject: [PATCH 1/8] // Fixed potential warning --- classes/Customer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Customer.php b/classes/Customer.php index b05a0e042..ef3ab32df 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -233,7 +233,7 @@ class CustomerCore extends ObjectModel if ($this->newsletter && !Validate::isDate($this->newsletter_date_add)) $this->newsletter_date_add = date('Y-m-d H:i:s'); - if (Context::getContext()->controller->controller_type == 'admin') + if (isset(Context::getContext()->controller) && Context::getContext()->controller->controller_type == 'admin') $this->updateGroup($this->groupBox); if ($this->deleted) From aeb60a0eb96f2b1a6eb83d529ea6cdc3a844439e Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Tue, 15 Jan 2013 18:36:49 +0100 Subject: [PATCH 2/8] // Fixed typo --- classes/Tools.php | 2 +- override/classes/_Tools.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Tools.php b/classes/Tools.php index f49b44acb..fb1382d57 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -110,7 +110,7 @@ class ToolsCore } /** - * Redirect url wich allready PS_BASE_URI + * Redirect URLs already containing PS_BASE_URI * * @param string $url Desired URL */ diff --git a/override/classes/_Tools.php b/override/classes/_Tools.php index 771d7d736..065b3eb23 100755 --- a/override/classes/_Tools.php +++ b/override/classes/_Tools.php @@ -77,7 +77,7 @@ class Tools extends ToolsCore /** - * Redirect url wich allready PS_BASE_URI after 5 sec + * Redirect URLs already containing PS_BASE_URI after 5s * * @param string $url Desired URL */ From b86b1a089e80b11f746152eea1e65a40f68bdef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Tue, 15 Jan 2013 18:53:01 +0100 Subject: [PATCH 3/8] [-] FO: Fix Pack::getItemTable with some PHP versions --- classes/Pack.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Pack.php b/classes/Pack.php index c06b9c003..204dcad09 100644 --- a/classes/Pack.php +++ b/classes/Pack.php @@ -142,8 +142,8 @@ class PackCore extends Product AND a.`id_product_pack` = '.(int)$id_product; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); - foreach ($result as &$row) - $row = Product::getTaxesInformations($row); + foreach ($result as &$line) + $line = Product::getTaxesInformations($line); if (!$full) return $result; From adf928d60cf0599742494cbfae295ab510def22b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Tue, 15 Jan 2013 18:56:42 +0100 Subject: [PATCH 4/8] // opti --- classes/Tools.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/classes/Tools.php b/classes/Tools.php index fb1382d57..8ec0b5ac0 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -968,15 +968,20 @@ class ToolsCore */ public static function str2url($str) { + static $allow_accented_chars = null; + + if ($allow_accented_chars === null) + $allow_accented_chars = Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'); + if (function_exists('mb_strtolower')) $str = mb_strtolower($str, 'utf-8'); $str = trim($str); - if (!function_exists('mb_strtolower') || !Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL')) + if (!function_exists('mb_strtolower') || !$allow_accented_chars) $str = Tools::replaceAccentedChars($str); // Remove all non-whitelist chars. - if (Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL')) + if ($allow_accented_chars) $str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-\pL]/u', '', $str); else $str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-]/','', $str); From eed3f3453b3a38f8ebda0da255ee13b2068c19b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Tue, 15 Jan 2013 19:31:21 +0100 Subject: [PATCH 5/8] [-] BO: Fix #PSCFV-6616 id_shop should be loaded from cart when no order is created on Admin Carts --- controllers/admin/AdminCartsController.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index dcc1e27d7..8a99921a5 100755 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -113,8 +113,18 @@ class AdminCartsControllerCore extends AdminController /* Display order information */ $id_order = (int)Order::getOrderByCartId($cart->id); $order = new Order($id_order); - - if ($order->getTaxCalculationMethod() == PS_TAX_EXC) + if (Validate::isLoadedObject($order)) + { + $tax_calculation_method = $order->getTaxCalculationMethod(); + $id_shop = (int)$order->id_shop; + } + else + { + $id_shop = (int)$cart->id_shop; + $tax_calculation_method = Group::getPriceDisplayMethod(Group::getCurrent()->id); + } + + if ($tax_calculation_method == PS_TAX_EXC) { $total_products = $summary['total_products']; $total_discounts = $summary['total_discounts_tax_exc']; @@ -132,7 +142,7 @@ class AdminCartsControllerCore extends AdminController } foreach ($products as $k => &$product) { - if ($order->getTaxCalculationMethod() == PS_TAX_EXC) + if ($tax_calculation_method == PS_TAX_EXC) { $product['product_price'] = $product['price']; $product['product_total'] = $product['total']; @@ -153,7 +163,7 @@ class AdminCartsControllerCore extends AdminController WHERE id_product = '.(int)$product['id_product'].' AND cover = 1'); $product_obj = new Product($product['id_product']); - $product['qty_in_stock'] = StockAvailable::getQuantityAvailableByProduct($product['id_product'], isset($product['id_product_attribute']) ? $product['id_product_attribute'] : null, (int)$order->id_shop); + $product['qty_in_stock'] = StockAvailable::getQuantityAvailableByProduct($product['id_product'], isset($product['id_product_attribute']) ? $product['id_product_attribute'] : null, (int)$id_shop); $image_product = new Image($image['id_image']); $product['image'] = (isset($image['id_image']) ? ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$image_product->getExistingImgPath().'.jpg', 'product_mini_'.(int)$product['id_product'].(isset($product['id_product_attribute']) ? '_'.(int)$product['id_product_attribute'] : '').'.jpg', 45, 'jpg') : '--'); From 46b4570e14a142190a1042486d09e19527d315c2 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Tue, 15 Jan 2013 19:30:48 +0100 Subject: [PATCH 6/8] [-] MO : fixed phone number in mailalert #PSCFV-6667 --- modules/mailalerts/mailalerts.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/mailalerts/mailalerts.php b/modules/mailalerts/mailalerts.php index 9f4cd0826..4d8e0c105 100644 --- a/modules/mailalerts/mailalerts.php +++ b/modules/mailalerts/mailalerts.php @@ -353,7 +353,7 @@ 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 ? $delivery->phone : $delivery->phone_mobile, '{delivery_other}' => $delivery->other, '{invoice_company}' => $invoice->company, '{invoice_firstname}' => $invoice->firstname, @@ -364,7 +364,7 @@ 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 ? $invoice->phone : $invoice->phone_mobile, '{invoice_other}' => $invoice->other, '{order_name}' => sprintf('%06d', $order->id), '{shop_name}' => Configuration::get('PS_SHOP_NAME'), From 571f6a4d71f722318b21ef7c389d0281c9a61b3f Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Tue, 15 Jan 2013 20:00:24 +0100 Subject: [PATCH 7/8] [-] FO : fixed +/- Tx on the customer voucher page #PSCFV-6642 --- themes/default/discount.tpl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/themes/default/discount.tpl b/themes/default/discount.tpl index 790541978..3e4abef8c 100644 --- a/themes/default/discount.tpl +++ b/themes/default/discount.tpl @@ -50,7 +50,7 @@ {if $discountDetail.id_discount_type == 1} {$discountDetail.value|escape:'htmlall':'UTF-8'}% {elseif $discountDetail.id_discount_type == 2} - {convertPrice price=$discountDetail.value} + {convertPrice price=$discountDetail.value} ({if $discountDetail.reduction_tax == 1}{l s='Tax included'}{else}{l s='Tax excluded'}{/if}) {elseif $discountDetail.id_discount_type == 3} {l s='Free shipping'} {else} @@ -76,9 +76,6 @@ {/foreach} -

- *{l s='Tax included'} -

{else}

{l s='You do not have any vouchers.'}

{/if} From 57727a4cfa7e7575db6510d46562528fafaf2a3a Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Tue, 15 Jan 2013 20:07:44 +0100 Subject: [PATCH 8/8] [-] FO : fixed voucher highlighting in the cart #PSCFV-6422 --- classes/CartRule.php | 1 - controllers/front/ParentOrderController.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/classes/CartRule.php b/classes/CartRule.php index 5fd5e0eb3..b0f7fd4a5 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -219,7 +219,6 @@ class CartRuleCore extends ObjectModel cr.`id_customer` = '.(int)$id_customer.' '.($includeGeneric ? 'OR cr.`id_customer` = 0' : '').' ) - AND highlight = 1 '.($active ? 'AND cr.`active` = 1' : '').' '.($inStock ? 'AND cr.`quantity` > 0' : '')); diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php index 78a846db9..9efcf582c 100644 --- a/controllers/front/ParentOrderController.php +++ b/controllers/front/ParentOrderController.php @@ -329,7 +329,7 @@ class ParentOrderControllerCore extends FrontController $cart_cart_rules = $this->context->cart->getCartRules(); foreach ($available_cart_rules as $key => $available_cart_rule) { - if (strpos($available_cart_rule['code'], 'BO_ORDER_') === 0) + if (!$available_cart_rule['highlight'] || strpos($available_cart_rule['code'], 'BO_ORDER_') === 0) { unset($available_cart_rules[$key]); continue;