From b9cf3b3afba4b1ca60065b6ef13228dfb02f5129 Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Fri, 21 Oct 2011 12:20:37 +0000 Subject: [PATCH] [*] BO : #PSFV-94 - added AdminInvoicesController and missing geolocation template --- .../themes/template/geolocation/content.tpl | 28 ++++++++ .../themes/template/geolocation/options.tpl | 60 ++++++++++++++++ .../themes/template/invoices/content.tpl | 70 ++++++++++++++++++ .../admin/AdminInvoicesController.php | 72 ++++--------------- 4 files changed, 173 insertions(+), 57 deletions(-) create mode 100644 admin-dev/themes/template/geolocation/content.tpl create mode 100644 admin-dev/themes/template/geolocation/options.tpl create mode 100644 admin-dev/themes/template/invoices/content.tpl rename admin-dev/tabs/AdminInvoices.php => controllers/admin/AdminInvoicesController.php (51%) diff --git a/admin-dev/themes/template/geolocation/content.tpl b/admin-dev/themes/template/geolocation/content.tpl new file mode 100644 index 000000000..df2e863e7 --- /dev/null +++ b/admin-dev/themes/template/geolocation/content.tpl @@ -0,0 +1,28 @@ +{* +* 2007-2011 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-2011 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +

{l s='Geolocation'}

+{$content} \ No newline at end of file diff --git a/admin-dev/themes/template/geolocation/options.tpl b/admin-dev/themes/template/geolocation/options.tpl new file mode 100644 index 000000000..748c7bf8c --- /dev/null +++ b/admin-dev/themes/template/geolocation/options.tpl @@ -0,0 +1,60 @@ +{* +* 2007-2011 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-2011 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{extends file="../options.tpl"} +{block name="start_field_block"} + {if $field['type'] == 'checkbox_table'} +
+ + + + + + + + + {foreach $field['list'] as $country} + + + + + {/foreach} + +
{l s='Name'}
{$country['name']|escape:'htmlall':'UTF-8'}
+ {elseif $field['type'] == 'textarea_newlines'} +
+ + {else} +
+ {/if} +{/block} + +{block name="end_field_block"} + {if $field['type'] == 'checkbox_table'} +
+
+ {/if} +{/block} \ No newline at end of file diff --git a/admin-dev/themes/template/invoices/content.tpl b/admin-dev/themes/template/invoices/content.tpl new file mode 100644 index 000000000..92e06b100 --- /dev/null +++ b/admin-dev/themes/template/invoices/content.tpl @@ -0,0 +1,70 @@ +{* +* 2007-2011 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-2011 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +

{l s='Print PDF invoices'}

+
{l s='By date'} +
+ +
+ * +

{l s='Format: 2007-12-31 (inclusive)'}

+
+ +
+ * +

{l s='Format: 2008-12-31 (inclusive)'}

+
+
+ +
+
* {l s='Required fields'}
+
+
+
{l s='By statuses'} +
+ +
+
    + {foreach $statuses as $status} +
  • + + +
  • + {/foreach} +
+

{l s='You can also export orders which have not been charged yet.'}()

+
+
+ +
+
+
+
 
+ +{$content} diff --git a/admin-dev/tabs/AdminInvoices.php b/controllers/admin/AdminInvoicesController.php similarity index 51% rename from admin-dev/tabs/AdminInvoices.php rename to controllers/admin/AdminInvoicesController.php index 38c671caa..d144bae51 100644 --- a/admin-dev/tabs/AdminInvoices.php +++ b/controllers/admin/AdminInvoicesController.php @@ -25,29 +25,30 @@ * International Registered Trademark & Property of PrestaShop SA */ -class AdminInvoices extends AdminTab +class AdminInvoicesControllerCore extends AdminController { public function __construct() { $this->table = 'invoice'; - $this->optionsList = array( + $this->options = array( 'general' => array( 'title' => $this->l('Invoice options'), 'fields' => array( 'PS_INVOICE' => array('title' => $this->l('Enable invoices:'), 'desc' => $this->l('Select whether or not to activate invoices for your shop'), 'cast' => 'intval', 'type' => 'bool'), 'PS_INVOICE_PREFIX' => array('title' => $this->l('Invoice prefix:'), 'desc' => $this->l('Prefix used for invoices'), 'size' => 6, 'type' => 'textLang'), - 'PS_INVOICE_START_NUMBER' => array('title' => $this->l('Invoice number:'), 'desc' => $this->l('The next invoice will begin with this number, and then increase with each additional invoice. Set to 0 if you want to keep the current number (#').(Order::getLastInvoiceNumber() + 1).').', 'size' => 6, 'type' => 'text', 'cast' => 'intval'), - 'PS_INVOICE_FREE_TEXT' => array('title' => $this->l('Free Text:'), 'desc' => $this->l('This text will appear at the bottom of the invoice'), 'size' => 6, 'type' => 'textareaLang', - 'cols' => 40, 'rows' => 8) + 'PS_INVOICE_START_NUMBER' => array('title' => $this->l('Invoice number:'), 'desc' => $this->l('The next invoice will begin with this number, and then increase with each additional invoice. Set to 0 if you want to keep the current number (#').(Order::getLastInvoiceNumber() + 1).').', 'size' => 6, 'type' => 'text', 'cast' => 'intval'), + 'PS_INVOICE_FREE_TEXT' => array('title' => $this->l('Free Text:'), 'desc' => $this->l('This text will appear at the bottom of the invoice'), 'size' => 6, 'type' => 'textareaLang', + 'cols' => 40, 'rows' => 8) ), + 'submit' => array() ), ); parent::__construct(); } - public function displayForm($isMainTab = true) + public function initContent() { $statuses = OrderState::getOrderStates($this->context->language->id); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' @@ -65,56 +66,13 @@ class AdminInvoices extends AdminTab foreach ($result as $row) $statusStats[$row['id_order_state']] = $row['nbOrders']; - echo ' -

'.$this->l('Print PDF invoices').'

-
'.$this->l('By date').' -
- -
- * -

'.$this->l('Format: 2007-12-31 (inclusive)').'

-
- -
- * -

'.$this->l('Format: 2008-12-31 (inclusive)').'

-
-
- -
-
* '.$this->l('Required fields').'
-
-
-
'.$this->l('By statuses').' -
- -
-
    '; - foreach ($statuses as $status) - echo '
  • - - -
  • '; - echo '
-

'.$this->l('You can also export orders which have not been charged yet.').'()

-
-
- -
-
-
-
 
'; - - return parent::displayForm(); - } - - public function display() - { - $this->displayForm(); - $this->displayOptionsList(); + $this->context->smarty->assign(array( + 'url_post' => self::$currentIndex.'&token='.$this->token, + 'date' => date('Y-m-d'), + 'statuses' => $statuses, + 'statusStats' => $statusStats + )); + parent::initContent(); } public function postProcess() @@ -148,7 +106,7 @@ class AdminInvoices extends AdminTab else parent::postProcess(); } - + public function beforeUpdateOptions() { if ((int)Tools::getValue('PS_INVOICE_START_NUMBER') != 0 AND (int)Tools::getValue('PS_INVOICE_START_NUMBER') <= Order::getLastInvoiceNumber())