* @copyright 2007-2011 PrestaShop SA * @version Release: $Revision: 6594 $ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ class AdminDeliverySlip extends AdminTab { public function __construct() { global $cookie; $this->table = 'delivery'; $this->optionTitle = $this->l('Delivery slips options'); $this->_fieldsOptions = array( 'PS_DELIVERY_PREFIX' => array('title' => $this->l('Delivery prefix:'), 'desc' => $this->l('Prefix used for delivery slips'), 'size' => 6, 'type' => 'textLang'), 'PS_DELIVERY_NUMBER' => array('title' => $this->l('Delivery number:'), 'desc' => $this->l('The next delivery slip will begin with this number, and then increase with each additional slip'), 'size' => 6, 'type' => 'text'), ); parent::__construct(); } public function displayForm($isMainTab = true) { global $currentIndex; parent::displayForm(); $output = '

'.$this->l('Print PDF delivery slips').'

*

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

*

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

* '.$this->l('Required fields').'
'; echo $output; } public function display() { $this->displayForm(); $this->displayOptionsList(); } public function postProcess() { global $currentIndex; if (Tools::getValue('submitPrint')) { if (!Validate::isDate($_POST['date_from'])) $this->_errors[] = $this->l('Invalid from date'); if (!Validate::isDate($_POST['date_to'])) $this->_errors[] = $this->l('Invalid end date'); if (!sizeof($this->_errors)) { $orders = Order::getOrdersIdByDate($_POST['date_from'], $_POST['date_to'], NULL, 'delivery'); if (sizeof($orders)) Tools::redirectAdmin('pdf.php?deliveryslips='.urlencode(serialize($orders)).'&token='.$this->token); else $this->_errors[] = $this->l('No delivery slip found for this period'); } } else parent::postProcess(); } }