From fb5000c7a3fb71d85ce6e9165fa516e4660eb6f6 Mon Sep 17 00:00:00 2001 From: Giorgos Patsiaouras Date: Sun, 1 Jun 2014 22:47:41 +0300 Subject: [PATCH 1/8] This my first step and my first commit on github --- bankwire.php | 2 +- translations/el.php | 56 +++++++++++++++++++++++++++++++++++++++++++++ translations/en.php | 56 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 translations/el.php create mode 100644 translations/en.php diff --git a/bankwire.php b/bankwire.php index bc00c81..7367c89 100644 --- a/bankwire.php +++ b/bankwire.php @@ -216,7 +216,7 @@ public function renderForm() ), ), 'submit' => array( - 'title' => $this->l('Save'), + 'title' => $this->l('Add New Account'), ) ), ); diff --git a/translations/el.php b/translations/el.php new file mode 100644 index 0000000..d8b9df6 --- /dev/null +++ b/translations/el.php @@ -0,0 +1,56 @@ +bankwire_05adcee99142c1a60fb38bb1330bbbc1'] = 'κατάθεση στην τράπεζα'; +$_MODULE['<{bankwire}prestashop>bankwire_a246a8e9907530c4c36b8b4c37bbc823'] = 'Δεχθείτε πληρωμές για τα προϊόντα σας μέσω τραπεζικού εμβάσματος.'; +$_MODULE['<{bankwire}prestashop>bankwire_cbe0a99684b145e77f3e14174ac212e3'] = 'Είστε βέβαιοι ότι θέλετε να διαγράψετε τα στοιχεία σας;'; +$_MODULE['<{bankwire}prestashop>bankwire_0ea0227283d959415eda0cfa31d9f718'] = 'Ο κάτοχος του λογαριασμού και οι λεπτομέρειες πρέπει να ρυθμιστούν ώστε να χρησιμοποιήσετε αυτό το module σωστά.'; +$_MODULE['<{bankwire}prestashop>bankwire_a02758d758e8bec77a33d7f392eb3f8a'] = 'Δεν έχετε ορίσει νόμισμα γι’ αυτό το module'; +$_MODULE['<{bankwire}prestashop>bankwire_bfa43217dfe8261ee7cb040339085677'] = 'Απαιτούνται οι λεπτομέρειες λογαριασμού.'; +$_MODULE['<{bankwire}prestashop>bankwire_ccab155f173ac76f79eb192703f86b18'] = 'Απαιτείται ο κάτοχος του λογαριασμού.'; +$_MODULE['<{bankwire}prestashop>bankwire_c888438d14855d7d96a2724ee9c306bd'] = 'Οι ρυθμίσεις ενημερώθηκαν'; +$_MODULE['<{bankwire}prestashop>bankwire_5dd532f0a63d89c5af0243b74732f63c'] = 'Στοιχεία επικοινωνίας'; +$_MODULE['<{bankwire}prestashop>bankwire_857216dd1b374de9bf54068fcd78a8f3'] = 'Κάτοχος λογαριασμού'; +$_MODULE['<{bankwire}prestashop>bankwire_3ec365dd533ddb7ef3d1c111186ce872'] = 'Λεπτομέρειες'; +$_MODULE['<{bankwire}prestashop>bankwire_6b154cafbab54ba3a1e76a78c290c02a'] = 'Όπως υποκατάστημα τράπεζας, αριθμός ΙΒΑΝ, BIC, κλπ.'; +$_MODULE['<{bankwire}prestashop>bankwire_f9a1a1bb716cbae0503d351ea2af4b34'] = 'Διεύθυνση Τράπεζας'; +$_MODULE['<{bankwire}prestashop>bankwire_c9cc8cce247e49bae79f15173ce97354'] = 'Αποθήκευση'; +$_MODULE['<{bankwire}prestashop>validation_e2b7dec8fa4b498156dfee6e4c84b156'] = 'Αυτή η μέθοδος πληρωμής δεν είναι διαθέσιμη.'; +$_MODULE['<{bankwire}prestashop>payment_execution_99227bacb2b4dfa29ce1701ac265a923'] = 'Πληρωμή μέσο τραπέζης'; +$_MODULE['<{bankwire}prestashop>payment_execution_f1d3b424cd68795ecaa552883759aceb'] = 'Περίληψη παραγγελίας'; +$_MODULE['<{bankwire}prestashop>payment_execution_879f6b8877752685a966564d072f498f'] = 'Το καλάθι αγορών σας είναι άδειο.'; +$_MODULE['<{bankwire}prestashop>payment_execution_05adcee99142c1a60fb38bb1330bbbc1'] = 'κατάθεση στην τράπεζα'; +$_MODULE['<{bankwire}prestashop>payment_execution_afda466128ee0594745d9f8152699b74'] = 'Έχετε επιλέξει να πληρώσετε με κατάθεση στην τράπεζα'; +$_MODULE['<{bankwire}prestashop>payment_execution_c884ed19483d45970c5bf23a681e2dd2'] = 'Εδώ είναι μια σύντομη περίληψη της παραγγελίας σας:'; +$_MODULE['<{bankwire}prestashop>payment_execution_e2867a925cba382f1436d1834bb52a1c'] = 'Το συνολικό ποσό της παραγγελίας σας είναι'; +$_MODULE['<{bankwire}prestashop>payment_execution_1f87346a16cf80c372065de3c54c86d9'] = '(με Φ.Π.Α.).'; +$_MODULE['<{bankwire}prestashop>payment_execution_b28be4c423d93e02081f4e79fe2434e8'] = 'Δεχόμαστε πληρωμή μέσο τραπέζης, σε διάφορα νομίσματα.'; +$_MODULE['<{bankwire}prestashop>payment_execution_a7a08622ee5c8019b57354b99b7693b2'] = 'Επιλέξτε ένα από τα παρακάτω:'; +$_MODULE['<{bankwire}prestashop>payment_execution_a854d894458d66d92cabf0411c499ef4'] = 'Για κατάθεση στην τράπεζα, δεχόμαστε τα ακόλουθα νομίσματα:'; +$_MODULE['<{bankwire}prestashop>payment_execution_3dd021316505c0204989f984246c6ff1'] = 'Τα στοιχεία τραπεζικού λογαριασμού θα εμφανιστούν στην επόμενη σελίδα.'; +$_MODULE['<{bankwire}prestashop>payment_execution_b939c4940deb5588f47ee8f12c61f11f'] = 'Παρακαλούμε επιβεβαιώστε την παραγγελία σας κάνοντας κλικ στο "Επιβεβαιώνω την παραγγελία μου."'; +$_MODULE['<{bankwire}prestashop>payment_execution_46b9e3665f187c739c55983f757ccda0'] = 'Επιβεβαίωση παραγγελίας'; +$_MODULE['<{bankwire}prestashop>payment_execution_569fd05bdafa1712c4f6be5b153b8418'] = 'Άλλες μέθοδοι πληρωμής'; +$_MODULE['<{bankwire}prestashop>infos_c1be305030739396775edaca9813f77d'] = 'Αυτό το module σας επιτρέπει να δέχεστε πληρωμές με μεταφορά μέσο τραπέζης.'; +$_MODULE['<{bankwire}prestashop>infos_60742d06006fde3043c77e6549d71a99'] = 'Αν ο πελάτης επιλέξει να πληρώσει με τραπεζικό έμβασμα, η κατάσταση της παραγγελίας θα αλλάξει σε “Αναμονή για πληρωμή”'; +$_MODULE['<{bankwire}prestashop>infos_5fb4bbf993c23848433caf58e6b2816d'] = 'Ως εκ τούτου, πρέπει να επιβεβαιώσετε την παραγγελία χειροκίνητα μόλις ολοκληρωθεί η μεταφορά.'; +$_MODULE['<{bankwire}prestashop>payment_return_88526efe38fd18179a127024aba8c1d7'] = 'Η παραγγελία σας στο %s έχει ολοκληρωθεί'; +$_MODULE['<{bankwire}prestashop>payment_return_1f8cdc30326f1f930b0c87b25fdac965'] = 'Παρακαλώ στείλτε μας την απόδειξη κατάθεσης με:'; +$_MODULE['<{bankwire}prestashop>payment_return_b2f40690858b404ed10e62bdf422c704'] = 'Ποσό'; +$_MODULE['<{bankwire}prestashop>payment_return_5ca0b1b910f393ed1f9f6fa99e414255'] = 'στον κάτοχο του λογαριασμού'; +$_MODULE['<{bankwire}prestashop>payment_return_d717aa33e18263b8405ba00e94353cdc'] = 'με αυτές τις λεπτομέρειες'; +$_MODULE['<{bankwire}prestashop>payment_return_984482eb9ff11e6310fef641d2268a2a'] = 'στην τράπεζα'; +$_MODULE['<{bankwire}prestashop>payment_return_63fb3f7c94ee5d8027bf599885de279d'] = 'Μην ξεχάσετε να εισάγετε τον αριθμό της παραγγελίας σας #%d στο θέμα της συναλλαγής σας'; +$_MODULE['<{bankwire}prestashop>payment_return_1faa25b80a8d31e5ef25a78d3336606d'] = 'Μην ξεχάσετε να εισάγετε την αναφορά της παραγγελίας σας #%d στο θέμα της συναλλαγής σας'; +$_MODULE['<{bankwire}prestashop>payment_return_19c419a8a4f1cd621853376a930a2e24'] = 'Σας έχει σταλεί ένα e-mail έχει με αυτές τις πληροφορίες.'; +$_MODULE['<{bankwire}prestashop>payment_return_b9a1cae09e5754424e33764777cfcaa0'] = 'Η παραγγελία σας θα αποσταλεί αμέσως μόλις λάβουμε την απόδειξη πληρωμής.'; +$_MODULE['<{bankwire}prestashop>payment_return_ca7e41a658753c87973936d7ce2429a8'] = 'Για οποιεσδήποτε ερωτήσεις ή για περαιτέρω πληροφορίες, παρακαλώ επικοινωνήστε με την'; +$_MODULE['<{bankwire}prestashop>payment_return_dfe239de8c0b2453a8e8f7657a191d5d'] = 'Εξυπηρέτηση πελατών'; +$_MODULE['<{bankwire}prestashop>payment_return_d15feee53d81ea16269e54d4784fa123'] = 'Έχουμε παρατηρήσει ένα πρόβλημα με την παραγγελία σας. Αν νομίζετε ότι είναι λάθος, μπορείτε να επικοινωνήσετε με την'; +$_MODULE['<{bankwire}prestashop>payment_5e1695822fc5af98f6b749ea3cbc9b4c'] = 'Πληρωμή μέσω τραπέζης'; +$_MODULE['<{bankwire}prestashop>payment_4e1fb9f4b46556d64db55d50629ee301'] = '(η επεξεργασία της παραγγελίας θα διαρκέσει περισσότερο)'; + + +return $_MODULE; diff --git a/translations/en.php b/translations/en.php new file mode 100644 index 0000000..2558b53 --- /dev/null +++ b/translations/en.php @@ -0,0 +1,56 @@ +bankwire_05adcee99142c1a60fb38bb1330bbbc1'] = 'Bank wire'; +$_MODULE['<{bankwire}prestashop>bankwire_a246a8e9907530c4c36b8b4c37bbc823'] = 'Accept payments for your products via bank wire transfer.'; +$_MODULE['<{bankwire}prestashop>bankwire_cbe0a99684b145e77f3e14174ac212e3'] = 'Are you sure about removing these details?'; +$_MODULE['<{bankwire}prestashop>bankwire_0ea0227283d959415eda0cfa31d9f718'] = 'Account owner and account details must be configured before using this module.'; +$_MODULE['<{bankwire}prestashop>bankwire_a02758d758e8bec77a33d7f392eb3f8a'] = 'No currency has been set for this module.'; +$_MODULE['<{bankwire}prestashop>bankwire_bfa43217dfe8261ee7cb040339085677'] = 'Account details are required.'; +$_MODULE['<{bankwire}prestashop>bankwire_ccab155f173ac76f79eb192703f86b18'] = 'Account owner is required.'; +$_MODULE['<{bankwire}prestashop>bankwire_c888438d14855d7d96a2724ee9c306bd'] = 'Settings updated'; +$_MODULE['<{bankwire}prestashop>bankwire_5dd532f0a63d89c5af0243b74732f63c'] = 'Contact details'; +$_MODULE['<{bankwire}prestashop>bankwire_857216dd1b374de9bf54068fcd78a8f3'] = 'Account owner'; +$_MODULE['<{bankwire}prestashop>bankwire_3ec365dd533ddb7ef3d1c111186ce872'] = 'Details'; +$_MODULE['<{bankwire}prestashop>bankwire_6b154cafbab54ba3a1e76a78c290c02a'] = 'Such as bank branch, IBAN number, BIC, etc.'; +$_MODULE['<{bankwire}prestashop>bankwire_f9a1a1bb716cbae0503d351ea2af4b34'] = 'Bank address'; +$_MODULE['<{bankwire}prestashop>bankwire_c9cc8cce247e49bae79f15173ce97354'] = 'Save'; +$_MODULE['<{bankwire}prestashop>validation_e2b7dec8fa4b498156dfee6e4c84b156'] = 'This payment method is not available.'; +$_MODULE['<{bankwire}prestashop>payment_execution_99227bacb2b4dfa29ce1701ac265a923'] = 'Bank-wire payment.'; +$_MODULE['<{bankwire}prestashop>payment_execution_f1d3b424cd68795ecaa552883759aceb'] = 'Order summary'; +$_MODULE['<{bankwire}prestashop>payment_execution_879f6b8877752685a966564d072f498f'] = 'Your shopping cart is empty.'; +$_MODULE['<{bankwire}prestashop>payment_execution_05adcee99142c1a60fb38bb1330bbbc1'] = 'Bank wire'; +$_MODULE['<{bankwire}prestashop>payment_execution_afda466128ee0594745d9f8152699b74'] = 'You have chosen to pay by bank wire.'; +$_MODULE['<{bankwire}prestashop>payment_execution_c884ed19483d45970c5bf23a681e2dd2'] = 'Here is a short summary of your order:'; +$_MODULE['<{bankwire}prestashop>payment_execution_e2867a925cba382f1436d1834bb52a1c'] = 'The total amount of your order is'; +$_MODULE['<{bankwire}prestashop>payment_execution_1f87346a16cf80c372065de3c54c86d9'] = '(tax incl.)'; +$_MODULE['<{bankwire}prestashop>payment_execution_b28be4c423d93e02081f4e79fe2434e8'] = 'We allow several currencies to be sent via bank wire.'; +$_MODULE['<{bankwire}prestashop>payment_execution_a7a08622ee5c8019b57354b99b7693b2'] = 'Choose one of the following:'; +$_MODULE['<{bankwire}prestashop>payment_execution_a854d894458d66d92cabf0411c499ef4'] = 'We allow the following currency to be sent via bank wire:'; +$_MODULE['<{bankwire}prestashop>payment_execution_3dd021316505c0204989f984246c6ff1'] = 'Bank wire account information will be displayed on the next page.'; +$_MODULE['<{bankwire}prestashop>payment_execution_b939c4940deb5588f47ee8f12c61f11f'] = 'Please confirm your order by clicking "I confirm my order."'; +$_MODULE['<{bankwire}prestashop>payment_execution_46b9e3665f187c739c55983f757ccda0'] = 'I confirm my order'; +$_MODULE['<{bankwire}prestashop>payment_execution_569fd05bdafa1712c4f6be5b153b8418'] = 'Other payment methods'; +$_MODULE['<{bankwire}prestashop>infos_c1be305030739396775edaca9813f77d'] = 'This module allows you to accept secure payments by bank wire.'; +$_MODULE['<{bankwire}prestashop>infos_60742d06006fde3043c77e6549d71a99'] = 'If the client chooses to pay by bank wire, the order\'s status will change to \'Waiting for Payment.\''; +$_MODULE['<{bankwire}prestashop>infos_5fb4bbf993c23848433caf58e6b2816d'] = 'That said, you must manually confirm the order upon receiving the bank wire.'; +$_MODULE['<{bankwire}prestashop>payment_return_88526efe38fd18179a127024aba8c1d7'] = 'Your order on %s is complete.'; +$_MODULE['<{bankwire}prestashop>payment_return_1f8cdc30326f1f930b0c87b25fdac965'] = 'Please send us a bank wire with'; +$_MODULE['<{bankwire}prestashop>payment_return_b2f40690858b404ed10e62bdf422c704'] = 'Amount'; +$_MODULE['<{bankwire}prestashop>payment_return_5ca0b1b910f393ed1f9f6fa99e414255'] = 'Name of account owner'; +$_MODULE['<{bankwire}prestashop>payment_return_d717aa33e18263b8405ba00e94353cdc'] = 'Include these details'; +$_MODULE['<{bankwire}prestashop>payment_return_984482eb9ff11e6310fef641d2268a2a'] = 'Bank name'; +$_MODULE['<{bankwire}prestashop>payment_return_63fb3f7c94ee5d8027bf599885de279d'] = 'Do not forget to insert your order number #%d in the subject of your bank wire'; +$_MODULE['<{bankwire}prestashop>payment_return_1faa25b80a8d31e5ef25a78d3336606d'] = 'Do not forget to insert your order reference %s in the subject of your bank wire.'; +$_MODULE['<{bankwire}prestashop>payment_return_19c419a8a4f1cd621853376a930a2e24'] = 'An email has been sent with this information.'; +$_MODULE['<{bankwire}prestashop>payment_return_b9a1cae09e5754424e33764777cfcaa0'] = 'Your order will be sent as soon as we receive payment.'; +$_MODULE['<{bankwire}prestashop>payment_return_ca7e41a658753c87973936d7ce2429a8'] = 'If you have questions, comments or concerns, please contact our'; +$_MODULE['<{bankwire}prestashop>payment_return_dfe239de8c0b2453a8e8f7657a191d5d'] = 'expert customer support team. '; +$_MODULE['<{bankwire}prestashop>payment_return_d15feee53d81ea16269e54d4784fa123'] = 'We noticed a problem with your order. If you think this is an error, feel free to contact our'; +$_MODULE['<{bankwire}prestashop>payment_5e1695822fc5af98f6b749ea3cbc9b4c'] = 'Pay by bank wire'; +$_MODULE['<{bankwire}prestashop>payment_4e1fb9f4b46556d64db55d50629ee301'] = '(order processing will be longer)'; + + +return $_MODULE; From 35acbc4d73780755a4ee431b74f55b5e563b6315 Mon Sep 17 00:00:00 2001 From: Giorgos Patsiaouras Date: Mon, 2 Jun 2014 20:59:22 +0300 Subject: [PATCH 2/8] Added in the creation of the database table when the module is being installed --- bankwire.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bankwire.php b/bankwire.php index 7367c89..af0b0b8 100644 --- a/bankwire.php +++ b/bankwire.php @@ -77,7 +77,16 @@ public function install() { if (!parent::install() || !$this->registerHook('payment') || !$this->registerHook('paymentReturn')) return false; - return true; + return Db::getInstance()->execute(' + CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'bankwire` ( + `id` int(6) NOT NULL AUTO_INCREMENT, + `id_shop` INTEGER UNSIGNED NOT NULL DEFAULT \'1\', + `id_shop_group` INTEGER UNSIGNED NOT NULL DEFAULT \'1\', + `owner` varchar(255) NOT NULL, + `details` text NOT NULL, + `address` text NOT NULL, + PRIMARY KEY(`id`) + ) ENGINE='._MYSQL_ENGINE_.' default CHARSET=utf8'); } public function uninstall() From 221b6d184595c110e4768db4b43c98303e1ecf8a Mon Sep 17 00:00:00 2001 From: Giorgos Patsiaouras Date: Mon, 2 Jun 2014 22:59:20 +0300 Subject: [PATCH 3/8] Added unistall and insert on submit on database --- bankwire.php | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/bankwire.php b/bankwire.php index af0b0b8..af05187 100644 --- a/bankwire.php +++ b/bankwire.php @@ -91,12 +91,8 @@ public function install() public function uninstall() { - if (!Configuration::deleteByName('BANK_WIRE_DETAILS') - || !Configuration::deleteByName('BANK_WIRE_OWNER') - || !Configuration::deleteByName('BANK_WIRE_ADDRESS') - || !parent::uninstall()) - return false; - return true; + Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'bankwire'); + return parent::uninstall(); } private function _postValidation() @@ -112,11 +108,21 @@ private function _postValidation() private function _postProcess() { - if (Tools::isSubmit('btnSubmit')) - { - 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')); + // if (Tools::isSubmit('btnSubmit')) + // { + // 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')); + // } + if (Tools::isSubmit('btnSubmit')) { + Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'bankwire (id_shop, id_shop_group, owner, details, address) + VALUES + ('.$this->context->shop->id.', + '.$this->context->shop->id_shop_group.',\'' + .Tools::getValue('BANK_WIRE_OWNER').'\',\'' + .Tools::getValue('BANK_WIRE_DETAILS').'\',\'' + .Tools::getValue('BANK_WIRE_ADDRESS').'\' + )') or die(Db::getInstance()->getMsgError()); } $this->_html .= $this->displayConfirmation($this->l('Settings updated')); } From b719e5b1ac6b82f4ae74b508655855758b8368ff Mon Sep 17 00:00:00 2001 From: Giorgos Patsiaouras Date: Wed, 4 Jun 2014 23:49:13 +0300 Subject: [PATCH 4/8] Added not working table --- bankwire.php | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/bankwire.php b/bankwire.php index af05187..6a45bf7 100644 --- a/bankwire.php +++ b/bankwire.php @@ -148,6 +148,7 @@ public function getContent() $this->_html .= $this->_displayBankWire(); $this->_html .= $this->renderForm(); + $this->_html .= $this->renderList(); return $this->_html; } @@ -257,6 +258,45 @@ public function renderForm() return $helper->generateForm(array($fields_form)); } + + public function renderList() { + $records_table = array( + 'id' => array( + 'title' => $this->l('id'), + 'width' => 140, + 'type' => 'text', + ), + 'owner' => array( + 'title' => $this->l('Owner'), + 'width' => 140, + 'type' => 'text', + ), + 'details' => array( + 'title' => $this->l('Details'), + 'width' => 140, + 'type' => 'text', + ), + 'bankaddress' => array( + 'title' => $this->l('Bank Address'), + 'width' => 140, + 'type' => 'text', + ) + ); + + $helper = new HelperList(); + $helper->shopLinkType = ''; + $helper->icon = "icon-envelope"; + $helper->simple_header = false; + $this->records_table = array(); + $helper->actions = array('edit', 'delete'); + $helper->identifier = $this->identifier; + $helper->show_toolbar = true; + $helper->title = $this->l('Existing Accounts'); + + $helper->token = Tools::getAdminTokenLite('AdminModules'); + $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; + return $helper->generateList(array($records_table)); + } public function getConfigFieldsValues() { return array( From 87ea1223aeb1b21584785e2618f70f390948fb59 Mon Sep 17 00:00:00 2001 From: Giorgos Patsiaouras Date: Sat, 7 Jun 2014 11:36:44 +0300 Subject: [PATCH 5/8] Bankwire completed. Functions created are, New account and delete account. Front office comes next. --- bankwire.php | 79 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/bankwire.php b/bankwire.php index 6a45bf7..2388bf9 100644 --- a/bankwire.php +++ b/bankwire.php @@ -124,7 +124,8 @@ private function _postProcess() .Tools::getValue('BANK_WIRE_ADDRESS').'\' )') or die(Db::getInstance()->getMsgError()); } - $this->_html .= $this->displayConfirmation($this->l('Settings updated')); + + $this->_html .= $this->displayConfirmation($this->l('New Account added successfully')); } private function _displayBankWire() @@ -143,9 +144,14 @@ public function getContent() foreach ($this->_postErrors as $err) $this->_html .= $this->displayError($err); } + elseif (Tools::isSubmit('deletebankwire')) + { + //action button of helper list "delete" was pressed + $this->deleterow(Tools::getValue('id')); + } else $this->_html .= '
'; - + $this->_html .= $this->_displayBankWire(); $this->_html .= $this->renderForm(); $this->_html .= $this->renderList(); @@ -239,7 +245,7 @@ public function renderForm() $helper = new HelperForm(); $helper->show_toolbar = false; - $helper->table = $this->table; + //$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; @@ -261,41 +267,42 @@ public function renderForm() public function renderList() { $records_table = array( - 'id' => array( - 'title' => $this->l('id'), - 'width' => 140, - 'type' => 'text', - ), - 'owner' => array( - 'title' => $this->l('Owner'), - 'width' => 140, - 'type' => 'text', - ), - 'details' => array( - 'title' => $this->l('Details'), - 'width' => 140, - 'type' => 'text', - ), - 'bankaddress' => array( - 'title' => $this->l('Bank Address'), - 'width' => 140, - 'type' => 'text', - ) + 'id' => array( + 'title' => $this->l('Id'), + 'width' => 140, + 'type' => 'text', + ), + 'owner' => array( + 'title' => $this->l('Account Owner'), + 'width' => 140, + 'type' => 'text', + ), + 'details' => array( + 'title' => $this->l('Details'), + 'width' => 140, + 'type' => 'text', + ), + 'address' => array( + 'title' => $this->l('Bank address'), + 'width' => 140, + 'type' => 'text', + ) ); $helper = new HelperList(); $helper->shopLinkType = ''; - $helper->icon = "icon-envelope"; - $helper->simple_header = false; - $this->records_table = array(); - $helper->actions = array('edit', 'delete'); - $helper->identifier = $this->identifier; + $helper->simple_header = true; + $helper->_select = $this->getBankAccounts(); + $helper->actions = array('delete'); + $helper->identifier = 'id'; $helper->show_toolbar = true; + $helper->_defaultOrderBy = 'id'; $helper->title = $this->l('Existing Accounts'); $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; - return $helper->generateList(array($records_table)); + $helper->table = "bankwire"; + return $helper->generateList($helper->_select, $records_table); } public function getConfigFieldsValues() { @@ -305,4 +312,18 @@ public function getConfigFieldsValues() 'BANK_WIRE_ADDRESS' => Tools::getValue('BANK_WIRE_ADDRESS', Configuration::get('BANK_WIRE_ADDRESS')), ); } + + public function getBankAccounts() { + $sql = 'SELECT * + FROM '._DB_PREFIX_.'bankwire'; + return Db::getInstance()->executeS($sql); + } + + public function deleterow($id) { + if ($id != null) + { + Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'bankwire WHERE `id` = '.$id); + $this->_html .= $this->displayConfirmation($this->l('Bank Account was deleted successfully')); + } + } } From f02870bbbe30633720c595060ad8b4436eef409f Mon Sep 17 00:00:00 2001 From: Giorgos Patsiaouras Date: Sat, 7 Jun 2014 12:23:21 +0300 Subject: [PATCH 6/8] Final Commit everything is ready --- bankwire.php | 4 +--- views/templates/hook/payment_return.tpl | 10 +++++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bankwire.php b/bankwire.php index 2388bf9..724707c 100644 --- a/bankwire.php +++ b/bankwire.php @@ -185,9 +185,7 @@ public function hookPaymentReturn($params) { $this->smarty->assign(array( 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), - 'bankwireDetails' => Tools::nl2br($this->details), - 'bankwireAddress' => Tools::nl2br($this->address), - 'bankwireOwner' => $this->owner, + 'bankAccounts' => $this->getBankAccounts(), 'status' => 'ok', 'id_order' => $params['objOrder']->id )); diff --git a/views/templates/hook/payment_return.tpl b/views/templates/hook/payment_return.tpl index c1c680b..99bd7f2 100644 --- a/views/templates/hook/payment_return.tpl +++ b/views/templates/hook/payment_return.tpl @@ -28,9 +28,13 @@

{l s='Please send us a bank wire with' mod='bankwire'}

- {l s='Amount' mod='bankwire'} {$total_to_pay} -

- {l s='Name of account owner' mod='bankwire'} {if $bankwireOwner}{$bankwireOwner}{else}___________{/if} -

- {l s='Include these details' mod='bankwire'} {if $bankwireDetails}{$bankwireDetails}{else}___________{/if} -

- {l s='Bank name' mod='bankwire'} {if $bankwireAddress}{$bankwireAddress}{else}___________{/if} +

{l s='on one of the following accounts' mod='bankwire'}: + {foreach from=$bankAccounts item=account} +
+
-- {l s='Owner' mod='bankwire'}: {$account.owner} +
-- {l s='Details' mod='bankwire'}: {$account.details} +
-- {l s='Bank Name' mod='bankwire'}: {$account.address} + {/foreach} {if !isset($reference)}

- {l s='Do not forget to insert your order number #%d in the subject of your bank wire' sprintf=$id_order mod='bankwire'} {else} From 1328f4a9cddec7a9f1bba5e7061e5de24a5c03df Mon Sep 17 00:00:00 2001 From: Giorgos Patsiaouras Date: Sat, 7 Jun 2014 12:29:35 +0300 Subject: [PATCH 7/8] Cleaned up old stuff --- bankwire.php | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/bankwire.php b/bankwire.php index 724707c..40659d6 100644 --- a/bankwire.php +++ b/bankwire.php @@ -32,9 +32,6 @@ class BankWire extends PaymentModule private $_html = ''; private $_postErrors = array(); - public $details; - public $owner; - public $address; public $extra_mail_vars; public function __construct() { @@ -47,14 +44,6 @@ public function __construct() $this->currencies = true; $this->currencies_mode = 'checkbox'; - $config = Configuration::getMultiple(array('BANK_WIRE_DETAILS', 'BANK_WIRE_OWNER', 'BANK_WIRE_ADDRESS')); - if (!empty($config['BANK_WIRE_OWNER'])) - $this->owner = $config['BANK_WIRE_OWNER']; - if (!empty($config['BANK_WIRE_DETAILS'])) - $this->details = $config['BANK_WIRE_DETAILS']; - if (!empty($config['BANK_WIRE_ADDRESS'])) - $this->address = $config['BANK_WIRE_ADDRESS']; - $this->bootstrap = true; parent::__construct(); @@ -66,11 +55,7 @@ public function __construct() if (!count(Currency::checkPaymentCurrencies($this->id))) $this->warning = $this->l('No currency has been set for this module.'); - $this->extra_mail_vars = array( - '{bankwire_owner}' => Configuration::get('BANK_WIRE_OWNER'), - '{bankwire_details}' => nl2br(Configuration::get('BANK_WIRE_DETAILS')), - '{bankwire_address}' => nl2br(Configuration::get('BANK_WIRE_ADDRESS')) - ); + $this->extra_mail_vars = $this->getBankAccounts(); } public function install() @@ -254,7 +239,6 @@ public function renderForm() $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 ); @@ -302,14 +286,6 @@ public function renderList() { $helper->table = "bankwire"; return $helper->generateList($helper->_select, $records_table); } - 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')), - ); - } public function getBankAccounts() { $sql = 'SELECT * From 0a52d3f1d156a1385d9a4d04ac727fb52878b4df Mon Sep 17 00:00:00 2001 From: Giorgos Patsiaouras Date: Sat, 7 Jun 2014 12:38:01 +0300 Subject: [PATCH 8/8] Removed old commented values --- bankwire.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/bankwire.php b/bankwire.php index 40659d6..49852dd 100644 --- a/bankwire.php +++ b/bankwire.php @@ -93,12 +93,6 @@ private function _postValidation() private function _postProcess() { - // if (Tools::isSubmit('btnSubmit')) - // { - // 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')); - // } if (Tools::isSubmit('btnSubmit')) { Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'bankwire (id_shop, id_shop_group, owner, details, address) VALUES