[*] BO : #PSFV-94 - added AdminSlipController

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9730 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-10-28 16:07:40 +00:00
parent 4e04df6d98
commit b230e4654d
5 changed files with 80 additions and 19 deletions
@@ -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 <contact@prestashop.com>
* @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}
<h2>{l s='Print PDF'}</h2>
<fieldset style="float:left;width:300px;margin-bottom:20px"><legend><img src="../img/admin/pdf.gif" alt="" /> {l s='By date'}</legend>
<form action="{$url_post}" method="post">
<label style="width:90px">{l s='From:'} </label>
<div class="margin-form" style="padding-left:100px">
<input type="text" size="4" maxlength="10" name="date_from" value="{$date}" style="width: 120px;" /> <sup>*</sup>
<p class="clear">{l s='Format: 2007-12-31 (inclusive)'}</p>
</div>
<label style="width:90px">{l s='To:'} </label>
<div class="margin-form" style="padding-left:100px">
<input type="text" size="4" maxlength="10" name="date_to" value="{$date}" style="width: 120px;" /> <sup>*</sup>
<p class="clear">{l s='Format: 2008-12-31 (inclusive)'}</p>
</div>
<div class="margin-form" style="padding-left:100px">
<input type="submit" value="{l s='Generate PDF file'}" name="submitPrint" class="button" />
</div>
</form>
</fieldset>
+7 -3
View File
@@ -96,6 +96,9 @@ class AdminControllerCore extends Controller
/** @var integer Number of results in list */ /** @var integer Number of results in list */
protected $_listTotal = 0; protected $_listTotal = 0;
/** @var boolean Automatically join language table if true */
public $lang = false;
/** @var array WHERE clause determined by filter fields */ /** @var array WHERE clause determined by filter fields */
protected $_filter; protected $_filter;
@@ -772,7 +775,7 @@ class AdminControllerCore extends Controller
if (!$this->checkToken()) if (!$this->checkToken())
{ {
// If this is an XSS attempt, then we should only display a simple, secure page // 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) // 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']); $url = preg_replace('/([&?]token=)[^&]*(&.*)?$/', '${1}'.$this->token.'$2', $_SERVER['REQUEST_URI']);
if (false === strpos($url, '?token=') && false === strpos($url, '&token=')) if (false === strpos($url, '?token=') && false === strpos($url, '&token='))
@@ -1084,13 +1087,14 @@ class AdminControllerCore extends Controller
'table' => $this->table, 'table' => $this->table,
'current' => self::$currentIndex, 'current' => self::$currentIndex,
'token' => $this->token, 'token' => $this->token,
'content' => $this->content 'content' => $this->content,
'url_post' => self::$currentIndex.'&token='.$this->token,
)); ));
} }
/** /**
* initialize the invalid doom page of death * initialize the invalid doom page of death
* *
* @return void * @return void
*/ */
public function initCursedPage() public function initCursedPage()
@@ -67,7 +67,6 @@ class AdminInvoicesControllerCore extends AdminController
$statusStats[$row['id_order_state']] = $row['nbOrders']; $statusStats[$row['id_order_state']] = $row['nbOrders'];
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'url_post' => self::$currentIndex.'&token='.$this->token,
'date' => date('Y-m-d'), 'date' => date('Y-m-d'),
'statuses' => $statuses, 'statuses' => $statuses,
'statusStats' => $statusStats 'statusStats' => $statusStats
@@ -194,7 +194,7 @@ class AdminShippingControllerCore extends AdminController
$this->_errors[] = Tools::displayError('You do not have permission to edit here.'); $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
} }
else else
parent::postProcess(); return parent::postProcess();
} }
} }
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -25,26 +25,27 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
class AdminSlip extends AdminTab class AdminSlipControllerCore extends AdminController
{ {
public function __construct() public function __construct()
{ {
$this->table = 'order_slip'; $this->table = 'order_slip';
$this->className = 'OrderSlip'; $this->className = 'OrderSlip';
$this->edit = true; $this->addRowAction('edit');
$this->delete = true; $this->addRowAction('delete');
$this->noAdd = true; $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->no_add = true;
$this->fieldsDisplay = array( $this->fieldsDisplay = array(
'id_order_slip' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'id_order_slip' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'id_order' => array('title' => $this->l('ID Order'), 'width' => 75, 'align' => 'center'), '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')); 'date_add' => array('title' => $this->l('Date issued'), 'width' => 60, 'type' => 'date', 'align' => 'right'));
$this->optionTitle = $this->l('Slip'); $this->optionTitle = $this->l('Slip');
parent::__construct(); parent::__construct();
} }
public function postProcess() public function postProcess()
{ {
if (Tools::isSubmit('submitPrint')) if (Tools::isSubmit('submitPrint'))
@@ -64,13 +65,22 @@ class AdminSlip extends AdminTab
return parent::postProcess(); 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 '<div style="float:left;width:600px">'; echo '<div style="float:left;width:600px">';
$this->getList($this->context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL); $this->getList($this->context->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
$this->displayList(); $this->displayList();
echo '</div>'; echo '</div>';
echo ' echo '
<fieldset style="float:left;width:280px"><legend><img src="../img/admin/pdf.gif" alt="" /> '.$this->l('Print PDF').'</legend> <fieldset style="float:left;width:280px"><legend><img src="../img/admin/pdf.gif" alt="" /> '.$this->l('Print PDF').'</legend>
<form action="'.self::$currentIndex.'&token='.$this->token.'" method="post"> <form action="'.self::$currentIndex.'&token='.$this->token.'" method="post">
@@ -90,8 +100,8 @@ class AdminSlip extends AdminTab
</form> </form>
</fieldset><div class="clear">&nbsp;</div>'; </fieldset><div class="clear">&nbsp;</div>';
} }
*/
public function displayListContent($token = NULL) /* public function displayListContent($token = NULL)
{ {
$irow = 0; $irow = 0;
if ($this->_list) if ($this->_list)
@@ -112,6 +122,6 @@ class AdminSlip extends AdminTab
echo '</td>'; echo '</td>';
echo '</tr>'; echo '</tr>';
} }
} }*/
} }