diff --git a/modules/bankwire/bankwire.php b/modules/bankwire/bankwire.php index 057ca719a..b0f8b4873 100644 --- a/modules/bankwire/bankwire.php +++ b/modules/bankwire/bankwire.php @@ -92,9 +92,9 @@ class BankWire extends PaymentModule { if (Tools::isSubmit('btnSubmit')) { - if (!Tools::getValue('details')) + if (!Tools::getValue('BANK_WIRE_DETAILS')) $this->_postErrors[] = $this->l('Account details are required.'); - elseif (!Tools::getValue('owner')) + elseif (!Tools::getValue('BANK_WIRE_OWNER')) $this->_postErrors[] = $this->l('Account owner is required.'); } } @@ -103,52 +103,20 @@ class BankWire extends PaymentModule { if (Tools::isSubmit('btnSubmit')) { - Configuration::updateValue('BANK_WIRE_DETAILS', Tools::getValue('details')); - Configuration::updateValue('BANK_WIRE_OWNER', Tools::getValue('owner')); - Configuration::updateValue('BANK_WIRE_ADDRESS', Tools::getValue('address')); + Configuration::updateValue('BANK_WIRE_DETAILS', Tools::getValue('BANK_WIRE_DETAILS')); + Configuration::updateValue('BANK_WIRE_OWNER', Tools::getValue('BANK_WIRE_OWNER')); + Configuration::updateValue('BANK_WIRE_ADDRESS', Tools::getValue('BANK_WIRE_ADDRESS')); } - $this->_html .= '
'.$this->l('Settings updated').'
'; + $this->_html .= '
'.$this->l('Settings updated').'
'; } private function _displayBankWire() { - $this->_html .= ''.$this->l('This module allows you to accept secure payments by bank wire.').'

- '.$this->l('If the client chooses to pay by bank wire, the order\'s status will change to "Waiting for Payment."').'
- '.$this->l('That said, you must manually confirm the order upon receiving the bank wire. ').'


'; - } - - private function _displayForm() - { - $this->_html .= - '
-
- '.$this->l('Contact details').' - - - - - - - - - - - - -
'.$this->l('Please specify the bank wire account details for customers.').'.

'.$this->l('Account owner').'
'.$this->l('Details').' - -

'.$this->l('Such as bank branch, IBAN number, BIC, etc...').'

-
'.$this->l('Bank address').' - -
-
-
'; + return $this->display(__FILE__, 'infos.tpl'); } public function getContent() { - $this->_html = '

'.$this->displayName.'

'; - if (Tools::isSubmit('btnSubmit')) { $this->_postValidation(); @@ -156,13 +124,13 @@ class BankWire extends PaymentModule $this->_postProcess(); else foreach ($this->_postErrors as $err) - $this->_html .= '
'.$err.'
'; + $this->_html .= '
'.$err.'
'; } else $this->_html .= '
'; - - $this->_displayBankWire(); - $this->_displayForm(); + + $this->_html .= $this->_displayBankWire(); + $this->_html .= $this->renderForm(); return $this->_html; } @@ -218,4 +186,67 @@ class BankWire extends PaymentModule return true; return false; } -} + + public function renderForm() + { + $fields_form = array( + 'form' => array( + 'legend' => array( + 'title' => $this->l('Contact details'), + 'icon' => 'icon-envelope' + ), + 'id_form' => 'step_carrier_general', + 'input' => array( + array( + 'type' => 'text', + 'label' => $this->l('Account owner'), + 'name' => 'BANK_WIRE_OWNER', + ), + array( + 'type' => 'textarea', + 'label' => $this->l('Details'), + 'name' => 'BANK_WIRE_DETAILS', + 'desc' => $this->l('Such as bank branch, IBAN number, BIC, etc...') + ), + array( + 'type' => 'textarea', + 'label' => $this->l('Bank address'), + 'name' => 'BANK_WIRE_ADDRESS', + ), + ), + 'submit' => array( + 'title' => $this->l('Save'), + 'class' => 'btn btn-primary') + ), + ); + + $helper = new HelperForm(); + $helper->show_toolbar = false; + $helper->table = $this->table; + $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')); + $helper->default_form_language = $lang->id; + $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; + $this->fields_form = array(); + $helper->id = (int)Tools::getValue('id_carrier'); + $helper->identifier = $this->identifier; + $helper->submit_action = 'btnSubmit'; + $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name; + $helper->token = Tools::getAdminTokenLite('AdminModules'); + $helper->tpl_vars = array( + 'fields_value' => $this->getConfigFieldsValues(), + 'languages' => $this->context->controller->getLanguages(), + 'id_language' => $this->context->language->id + ); + + return $helper->generateForm(array($fields_form)); + } + + public function getConfigFieldsValues() + { + return array( + 'BANK_WIRE_DETAILS' => Tools::getValue('BANK_WIRE_DETAILS', Configuration::get('BANK_WIRE_DETAILS')), + 'BANK_WIRE_OWNER' => Tools::getValue('BANK_WIRE_OWNER', Configuration::get('BANK_WIRE_OWNER')), + 'BANK_WIRE_ADDRESS' => Tools::getValue('BANK_WIRE_ADDRESS', Configuration::get('BANK_WIRE_ADDRESS')), + ); + } +} \ No newline at end of file diff --git a/modules/bankwire/views/templates/hook/infos.tpl b/modules/bankwire/views/templates/hook/infos.tpl new file mode 100644 index 000000000..401f70b79 --- /dev/null +++ b/modules/bankwire/views/templates/hook/infos.tpl @@ -0,0 +1,31 @@ +{* +* 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 +*} + +
+ +

{l s="This module allows you to accept secure payments by bank wire."}

+

{l s="If the client chooses to pay by bank wire, the order\'s status will change to 'Waiting for Payment.'"}

+

{l s="That said, you must manually confirm the order upon receiving the bank wire."}

+
\ No newline at end of file