From b230e4654db066854b63e758db4e68373c8ed148 Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Fri, 28 Oct 2011 16:07:40 +0000 Subject: [PATCH] [*] BO : #PSFV-94 - added AdminSlipController git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9730 b9a71923-0436-4b27-9f14-aed3839534dd --- admin-dev/themes/template/slip/content.tpl | 48 +++++++++++++++++++ classes/AdminController.php | 10 ++-- controllers/admin/AdminInvoicesController.php | 1 - controllers/admin/AdminShippingController.php | 2 +- .../admin/AdminSlipController.php | 38 +++++++++------ 5 files changed, 80 insertions(+), 19 deletions(-) create mode 100644 admin-dev/themes/template/slip/content.tpl rename admin-dev/tabs/AdminSlip.php => controllers/admin/AdminSlipController.php (90%) diff --git a/admin-dev/themes/template/slip/content.tpl b/admin-dev/themes/template/slip/content.tpl new file mode 100644 index 000000000..2ce6b1f8d --- /dev/null +++ b/admin-dev/themes/template/slip/content.tpl @@ -0,0 +1,48 @@ +{* +* 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 +*} + +{$content} + +

{l s='Print PDF'}

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

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

+
+ +
+ * +

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

+
+
+ +
+
+
+ + diff --git a/classes/AdminController.php b/classes/AdminController.php index 60d79df25..5229966cb 100644 --- a/classes/AdminController.php +++ b/classes/AdminController.php @@ -96,6 +96,9 @@ class AdminControllerCore extends Controller /** @var integer Number of results in list */ protected $_listTotal = 0; + /** @var boolean Automatically join language table if true */ + public $lang = false; + /** @var array WHERE clause determined by filter fields */ protected $_filter; @@ -772,7 +775,7 @@ class AdminControllerCore extends Controller if (!$this->checkToken()) { // If this is an XSS attempt, then we should only display a simple, secure page - // ${1} in the replacement string of the regexp is required, + // ${1} in the replacement string of the regexp is required, // because the token may begin with a number and mix up with it (e.g. $17) $url = preg_replace('/([&?]token=)[^&]*(&.*)?$/', '${1}'.$this->token.'$2', $_SERVER['REQUEST_URI']); if (false === strpos($url, '?token=') && false === strpos($url, '&token=')) @@ -1084,13 +1087,14 @@ class AdminControllerCore extends Controller 'table' => $this->table, 'current' => self::$currentIndex, 'token' => $this->token, - 'content' => $this->content + 'content' => $this->content, + 'url_post' => self::$currentIndex.'&token='.$this->token, )); } /** * initialize the invalid doom page of death - * + * * @return void */ public function initCursedPage() diff --git a/controllers/admin/AdminInvoicesController.php b/controllers/admin/AdminInvoicesController.php index d144bae51..221e6f4cf 100644 --- a/controllers/admin/AdminInvoicesController.php +++ b/controllers/admin/AdminInvoicesController.php @@ -67,7 +67,6 @@ class AdminInvoicesControllerCore extends AdminController $statusStats[$row['id_order_state']] = $row['nbOrders']; $this->context->smarty->assign(array( - 'url_post' => self::$currentIndex.'&token='.$this->token, 'date' => date('Y-m-d'), 'statuses' => $statuses, 'statusStats' => $statusStats diff --git a/controllers/admin/AdminShippingController.php b/controllers/admin/AdminShippingController.php index 2fe88931d..a5efaf633 100644 --- a/controllers/admin/AdminShippingController.php +++ b/controllers/admin/AdminShippingController.php @@ -194,7 +194,7 @@ class AdminShippingControllerCore extends AdminController $this->_errors[] = Tools::displayError('You do not have permission to edit here.'); } else - parent::postProcess(); + return parent::postProcess(); } } diff --git a/admin-dev/tabs/AdminSlip.php b/controllers/admin/AdminSlipController.php similarity index 90% rename from admin-dev/tabs/AdminSlip.php rename to controllers/admin/AdminSlipController.php index 94fae42fb..2a4bbb81c 100644 --- a/admin-dev/tabs/AdminSlip.php +++ b/controllers/admin/AdminSlipController.php @@ -1,6 +1,6 @@ table = 'order_slip'; $this->className = 'OrderSlip'; - $this->edit = true; - $this->delete = true; - $this->noAdd = true; - + $this->addRowAction('edit'); + $this->addRowAction('delete'); + $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'))); + $this->no_add = true; + $this->fieldsDisplay = array( 'id_order_slip' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'id_order' => array('title' => $this->l('ID Order'), 'width' => 75, 'align' => 'center'), 'date_add' => array('title' => $this->l('Date issued'), 'width' => 60, 'type' => 'date', 'align' => 'right')); - + $this->optionTitle = $this->l('Slip'); - + parent::__construct(); } - + public function postProcess() { if (Tools::isSubmit('submitPrint')) @@ -64,13 +65,22 @@ class AdminSlip extends AdminTab return parent::postProcess(); } - public function display() + public function initContent() + { + $this->context->smarty->assign(array( + 'date' => date('Y-m-d'), + )); + + parent::initContent(); + } + +/* public function display() { echo '
'; $this->getList($this->context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL); $this->displayList(); echo '
'; - + echo '
'.$this->l('Print PDF').'
@@ -90,8 +100,8 @@ class AdminSlip extends AdminTab
 
'; } - - public function displayListContent($token = NULL) +*/ +/* public function displayListContent($token = NULL) { $irow = 0; if ($this->_list) @@ -112,6 +122,6 @@ class AdminSlip extends AdminTab echo ''; echo ''; } - } + }*/ }