From 5eb63feecc748e1f968210989b5e2b22398d0df9 Mon Sep 17 00:00:00 2001 From: ldecoker Date: Fri, 8 Feb 2013 11:37:14 +0100 Subject: [PATCH 1/9] Update modules/blocksupplier/blocksupplier.php Missing uninstall function for blocksupplier to clean the configuration table. --- modules/blocksupplier/blocksupplier.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/blocksupplier/blocksupplier.php b/modules/blocksupplier/blocksupplier.php index eaaae1314..4eb395e12 100644 --- a/modules/blocksupplier/blocksupplier.php +++ b/modules/blocksupplier/blocksupplier.php @@ -57,6 +57,19 @@ class BlockSupplier extends Module return true; } + public function uninstall() + { + if (!parent::uninstall()) + return false; + + /* remove the configuration variable */ + $result = Configuration::deleteByName('SUPPLIER_DISPLAY_TEXT'); + $result &= Configuration::deleteByName('SUPPLIER_DISPLAY_TEXT_NB'); + $result &= Configuration::deleteByName('SUPPLIER_DISPLAY_FORM'); + + return $result; + } + function hookDisplayLeftColumn($params) { $id_lang = (int)Context::getContext()->language->id; From 5f902ada8c1228b32dbc84c88e5c2b56992faa17 Mon Sep 17 00:00:00 2001 From: minic studio Date: Fri, 1 Mar 2013 19:04:21 +0200 Subject: [PATCH 2/9] [*] MO : blocksearch - override buttons for ajax cart When instant search is in use buttons need override after load so the ajax functionality works --- modules/blocksearch/blocksearch-instantsearch.tpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/blocksearch/blocksearch-instantsearch.tpl b/modules/blocksearch/blocksearch-instantsearch.tpl index ad933b7bd..53163f296 100644 --- a/modules/blocksearch/blocksearch-instantsearch.tpl +++ b/modules/blocksearch/blocksearch-instantsearch.tpl @@ -38,6 +38,8 @@ $('#center_column').attr('id', 'old_center_column'); $('#old_center_column').after('
'+data+'
'); $('#old_center_column').hide(); + // Button override + ajaxCart.overrideButtonsInThePage(); $("#instant_search_results a.close").click(function() { $("#search_query_{$blocksearch_type}").val(''); return tryToCloseInstantSearch(); From 5b13f6aa7e0e0cfb884df24afd31ec56f27e47af Mon Sep 17 00:00:00 2001 From: ccauw Date: Tue, 16 Apr 2013 16:09:26 +0300 Subject: [PATCH 3/9] [*] BO : Add block "override_form_extra" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add block "override_form_extra" in list_header.tpl {if !$simple_header}
{block name="override_form_extra"}{/block} In AdminXxxxController, If we display list which are filtered by "variable" like index.php?controller=AdminXxxx&variable=val&token=... When using pagination or columns filters, the controller is called without our variable. There are two methods to retrieve our variable: cookie or form Post. To use the second opportunity, we need to put hidden input "variable" in the form. So we need à block in the form to override. --- admin-dev/themes/default/template/helpers/list/list_header.tpl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin-dev/themes/default/template/helpers/list/list_header.tpl b/admin-dev/themes/default/template/helpers/list/list_header.tpl index 1a821e4f6..b8df4bd49 100644 --- a/admin-dev/themes/default/template/helpers/list/list_header.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_header.tpl @@ -80,6 +80,9 @@ {if !$simple_header} + + {block name="override_form_extra"}{/block} + {/if} From 903b17979c04eaff723280c6117878d6185660eb Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 29 Apr 2013 10:47:19 +0200 Subject: [PATCH 4/9] [-] BO : fixed error message in language form #PSCFV-8890 --- classes/Validate.php | 9 ++++++--- .../admin/AdminLanguagesController.php | 19 +++++++++---------- css/admin.css | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/classes/Validate.php b/classes/Validate.php index 84d8bc24e..6af8d92c2 100644 --- a/classes/Validate.php +++ b/classes/Validate.php @@ -1055,6 +1055,9 @@ class ValidateCore { return (bool)(is_string($name) && preg_match('/^[0-9a-zA-Z-_]*$/u', $name)); } - -} - + + public static function isPrestaShopVersion($version) + { + return (preg_match('/^[0-1]\.[0-9]{1,2}(\.[0-9]{1,2}){0,2}$/', $version) && ip2long($version)); + } +} \ No newline at end of file diff --git a/controllers/admin/AdminLanguagesController.php b/controllers/admin/AdminLanguagesController.php index 9a00c8ca0..1db3d4eeb 100644 --- a/controllers/admin/AdminLanguagesController.php +++ b/controllers/admin/AdminLanguagesController.php @@ -475,19 +475,21 @@ class AdminLanguagesControllerCore extends AdminController public function ajaxProcessCheckLangPack() { $this->json = true; - if (empty($_GET['iso_lang'])) + if (!Tools::getValue('iso_lang') || !Validate::isLanguageIsoCode(Tools::getValue('iso_lang'))) { $this->status = 'error'; - $this->errors[] = '[TECHNICAL ERROR] iso_lang not set or empty'; + $this->errors[] = $this->l('Iso code is not valid'); + return; } - if (empty($_GET['ps_version'])) + if (!Tools::getValue('ps_version') || !Validate::isPrestaShopVersion(Tools::getValue('ps_version'))) { $this->status = 'error'; - $this->errors[] = '[TECHNICAL ERROR] ps_version not set or empty'; + $this->errors[] = $this->l('Technical Error: ps_version is not valid'); + return; } // Get all iso code available - if($lang_packs = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.(string)$_GET['ps_version'].'&iso_lang='.(string)$_GET['iso_lang'])) + if ($lang_packs = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.Tools::getValue('ps_version').'&iso_lang='.Tools::getValue('iso_lang'))) { $result = Tools::jsonDecode($lang_packs); if ($lang_packs !== '' && $result && !isset($result->error)) @@ -498,16 +500,13 @@ class AdminLanguagesControllerCore extends AdminController else { $this->status = 'error'; - $msg = $this->l('Wrong ISO code, or the selected language pack is unavailable.'); - if ($result) - $msg = $result->msg; - $this->errors[] = $msg; + $this->errors[] = $this->l('Wrong ISO code, or the selected language pack is unavailable.'); } } else { $this->status = 'error'; - $this->errors[] = '[TECHNICAL ERROR] Server unreachable'; + $this->errors[] = $this->l('Technical Error: translation server unreachable'); } } diff --git a/css/admin.css b/css/admin.css index 4ee837e91..ec73d1414 100644 --- a/css/admin.css +++ b/css/admin.css @@ -498,7 +498,7 @@ select optgroup option { background: #FFBABA url(../img/admin/icon-cancel.png) no-repeat scroll 6px 6px; border: 1px solid #CC0000; color:#D8000C; - padding:20px; + padding:20px 40px; position:fixed; bottom:0; width:100%; From a06b42704ec67ca4230415e31abea71b76790a9f Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 29 Apr 2013 10:52:44 +0200 Subject: [PATCH 5/9] [-] FO : fixed truncate and entities in the cart block #PSCFV-8870 --- modules/blockcart/blockcart-json.tpl | 2 +- modules/blockcart/blockcart.tpl | 2 +- themes/default/modules/blockcart/blockcart.tpl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/blockcart/blockcart-json.tpl b/modules/blockcart/blockcart-json.tpl index 6311433af..68ccf81d2 100644 --- a/modules/blockcart/blockcart-json.tpl +++ b/modules/blockcart/blockcart-json.tpl @@ -33,7 +33,7 @@ "link": "{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category, null, null, $product.id_shop, $product.id_product_attribute)|addslashes|replace:'\\\'':'\''}", "quantity": {$product.cart_quantity}, "priceByLine": "{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total}{else}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total_wt}{/if}", - "name": "{$product.name|html_entity_decode:2:'UTF-8'|escape:'htmlall'|truncate:15:'...':true}", + "name": "{$product.name|html_entity_decode:2:'UTF-8'|truncate:15:'...':true|escape:'htmlall'}", "price": "{if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total}{else}{displayWtPrice|html_entity_decode:2:'UTF-8' p=$product.total_wt}{/if}", "price_float": "{$product.total}", "idCombination": {if isset($product.attributes_small)}{$productAttributeId}{else}0{/if}, diff --git a/modules/blockcart/blockcart.tpl b/modules/blockcart/blockcart.tpl index 051bcf39e..d33a601c3 100644 --- a/modules/blockcart/blockcart.tpl +++ b/modules/blockcart/blockcart.tpl @@ -100,7 +100,7 @@ var delete_txt = '{l s='Delete' mod='blockcart' js=1}';
  • {$customization.quantity}x{if isset($customization.datas.$CUSTOMIZE_TEXTFIELD.0)} - {$customization.datas.$CUSTOMIZE_TEXTFIELD.0.value|escape:html:'UTF-8'|replace:"
    ":" "|truncate:28} + {$customization.datas.$CUSTOMIZE_TEXTFIELD.0.value|replace:"
    ":" "|truncate:28:'...'|escape:html:'UTF-8'} {else} {l s='Customization #%d:' sprintf=$id_customization|intval mod='blockcart'} {/if} diff --git a/themes/default/modules/blockcart/blockcart.tpl b/themes/default/modules/blockcart/blockcart.tpl index 287510b41..d273fb881 100644 --- a/themes/default/modules/blockcart/blockcart.tpl +++ b/themes/default/modules/blockcart/blockcart.tpl @@ -100,7 +100,7 @@ var delete_txt = '{l s='Delete' mod='blockcart' js=1}';
  • {$customization.quantity}x{if isset($customization.datas.$CUSTOMIZE_TEXTFIELD.0)} - {$customization.datas.$CUSTOMIZE_TEXTFIELD.0.value|escape:html:'UTF-8'|replace:"
    ":" "|truncate:28} + {$customization.datas.$CUSTOMIZE_TEXTFIELD.0.value|replace:"
    ":" "|truncate:28:'...'|escape:html:'UTF-8'} {else} {l s='Customization #%d:' sprintf=$id_customization|intval mod='blockcart'} {/if} From c587934e258241eec5a3bc2bbd6581a8a3dd5ce6 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 29 Apr 2013 11:16:26 +0200 Subject: [PATCH 6/9] [-] BO : fixed automatic creation of email overrides in the template #PSCFV-8785 --- controllers/admin/AdminTranslationsController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index 9b360eb8b..66dc641f0 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -1454,6 +1454,8 @@ class AdminTranslationsControllerCore extends AdminController $path = $arr_mail_path[$group_name]; if ($module_name) $path = str_replace('{module}', $module_name, $path); + if (!file_exists($path) && !mkdir($path, 0777, true)) + throw new PrestaShopException(sprintf(Tools::displayError('Directory "%s" cannot be created'), dirname($file_path))); file_put_contents($path.$mail_name.'.'.$type_content, $content); } else From 3b5591dc55b7550614fd8b45e2bfe7c931784762 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 29 Apr 2013 11:35:47 +0200 Subject: [PATCH 7/9] [-] FO : removed misleading label on the shipping total #PSCFV-8556 --- themes/default/order-payment.tpl | 2 +- themes/default/shopping-cart.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/default/order-payment.tpl b/themes/default/order-payment.tpl index bde92b04f..db4482b2f 100644 --- a/themes/default/order-payment.tpl +++ b/themes/default/order-payment.tpl @@ -118,7 +118,7 @@
  • {else} - {if $use_taxes} + {if $use_taxes && $total_shipping_tax_exc != $total_shipping} {if $priceDisplay} diff --git a/themes/default/shopping-cart.tpl b/themes/default/shopping-cart.tpl index 8b486c2de..cf3a8858a 100644 --- a/themes/default/shopping-cart.tpl +++ b/themes/default/shopping-cart.tpl @@ -126,7 +126,7 @@ {else} - {if $use_taxes} + {if $use_taxes && $total_shipping_tax_exc != $total_shipping} {if $priceDisplay} From 527f87a691258cb4b3e27c609c14d6bc55711f8d Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 29 Apr 2013 12:08:45 +0200 Subject: [PATCH 8/9] // Fixed directory creation in translation #PSCFV-8212 --- controllers/admin/AdminTranslationsController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index 66dc641f0..7c4d18ce9 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -2455,6 +2455,9 @@ class AdminTranslationsControllerCore extends AdminController protected function writeSubjectTranslationFile($sub, $path) { + if (!Tools::file_exists_cache(dirname(path))) + if (!mkdir(dirname(path), 0700)) + throw new PrestaShopException('Directory '.dirname(path).' cannot be created.'); if ($fd = @fopen($path, 'w')) { $tab = 'LANGMAIL'; From dc7f1ceddf57cbccdf45395e46a75fe0b0f0e958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Mon, 29 Apr 2013 13:47:46 +0200 Subject: [PATCH 9/9] [-] BO: Fix #PSCFV-8957 order creation when id_cart=0 is present in database but should normally not happen --- controllers/admin/AdminCartsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index fc0cf91ce..e8ee17cef 100755 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -209,7 +209,7 @@ class AdminCartsControllerCore extends AdminController if (!$this->context->cart->id_customer) $this->context->cart->id_customer = $id_customer; - if ($this->context->cart->OrderExists()) + if (Validate::isLoadedObject($this->context->cart) && $this->context->cart->OrderExists()) return; if (!$this->context->cart->secure_key) $this->context->cart->secure_key = $this->context->customer->secure_key;
    {l s='Free Shipping!'}