From 6ec8e4e70ec85d2ce26e0ed32eb4b7c07802fbf6 Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Wed, 20 Nov 2013 17:57:58 +0100 Subject: [PATCH] mailalerts retro compat 1.5 when using helper form in module configuration --- modules/mailalerts/mailalerts.php | 5 ++ .../admin/_configure/helpers/form/form.tpl | 52 +++++++++++++++++++ .../admin/_configure/helpers/form/index.php | 35 +++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 modules/mailalerts/views/templates/admin/_configure/helpers/form/form.tpl create mode 100644 modules/mailalerts/views/templates/admin/_configure/helpers/form/index.php diff --git a/modules/mailalerts/mailalerts.php b/modules/mailalerts/mailalerts.php index 686dca8da..438fcae69 100644 --- a/modules/mailalerts/mailalerts.php +++ b/modules/mailalerts/mailalerts.php @@ -579,6 +579,7 @@ class MailAlerts extends Module 'input' => array( array( 'type' => 'switch', + 'is_bool' => true, //retro compat 1.5 'label' => $this->l('Product availability:'), 'name' => 'MA_CUSTOMER_QTY', 'desc' => $this->l('Gives the customer the option of receiving a notification for an available product if this one is out of stock.'), @@ -613,6 +614,7 @@ class MailAlerts extends Module 'input' => array( array( 'type' => 'switch', + 'is_bool' => true, //retro compat 1.5 'label' => $this->l('New order:'), 'name' => 'MA_MERCHANT_ORDER', 'desc' => $this->l('Receive a notification when an order is placed'), @@ -631,6 +633,7 @@ class MailAlerts extends Module ), array( 'type' => 'switch', + 'is_bool' => true, //retro compat 1.5 'label' => $this->l('Out of stock:'), 'name' => 'MA_MERCHANT_OOS', 'desc' => $this->l('Receive a notification if the available quantity of a product is below the following threshold'), @@ -656,6 +659,7 @@ class MailAlerts extends Module ), array( 'type' => 'switch', + 'is_bool' => true, //retro compat 1.5 'label' => $this->l('Coverage warning:'), 'name' => 'MA_MERCHANT_COVERAGE', 'desc' => $this->l('Receive a notification when an order is placed'), @@ -701,6 +705,7 @@ class MailAlerts extends Module $helper->table = $this->table; $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')); $helper->default_form_language = $lang->id; + $helper->module = $this; $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; $helper->identifier = $this->identifier; $helper->submit_action = 'submitMailAlert'; diff --git a/modules/mailalerts/views/templates/admin/_configure/helpers/form/form.tpl b/modules/mailalerts/views/templates/admin/_configure/helpers/form/form.tpl new file mode 100644 index 000000000..917522561 --- /dev/null +++ b/modules/mailalerts/views/templates/admin/_configure/helpers/form/form.tpl @@ -0,0 +1,52 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{extends file="helpers/form/form.tpl"} + +{block name="input"} + {if $input.type == 'switch'} + {foreach $input.values as $value} + + + {if isset($input.br) && $input.br}
{/if} + {if isset($value.p) && $value.p}

{$value.p}

{/if} + {/foreach} + {else} + {$smarty.block.parent} + {/if} + +{/block} diff --git a/modules/mailalerts/views/templates/admin/_configure/helpers/form/index.php b/modules/mailalerts/views/templates/admin/_configure/helpers/form/index.php new file mode 100644 index 000000000..3f6561f72 --- /dev/null +++ b/modules/mailalerts/views/templates/admin/_configure/helpers/form/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file