예제 #1
2
 public function postProcess()
 {
     global $currentIndex;
     if (Tools::isSubmit('submitPrint')) {
         if (!Validate::isDate(Tools::getValue('date_from'))) {
             $this->_errors[] = $this->l('Invalid from date');
         }
         if (!Validate::isDate(Tools::getValue('date_to'))) {
             $this->_errors[] = $this->l('Invalid end date');
         }
         if (!sizeof($this->_errors)) {
             $orders = Order::getOrdersIdInvoiceByDate(Tools::getValue('date_from'), Tools::getValue('date_to'), NULL, 'invoice');
             if (sizeof($orders)) {
                 Tools::redirectAdmin('pdf.php?invoices&date_from=' . urlencode(Tools::getValue('date_from')) . '&date_to=' . urlencode(Tools::getValue('date_to')) . '&token=' . $this->token);
             }
             $this->_errors[] = $this->l('No invoice found for this period');
         }
     } elseif (Tools::isSubmit('submitOptionsinvoice')) {
         if (intval(Tools::getValue('PS_INVOICE_NUMBER')) == 0) {
             $this->_errors[] = $this->l('Invalid invoice number');
         } else {
             parent::postProcess();
         }
     } else {
         parent::postProcess();
     }
 }
예제 #2
0
파일: pdf.php 프로젝트: greench/prestashop
function generateInvoicesPDF()
{
    $orders = Order::getOrdersIdInvoiceByDate($_GET['date_from'], $_GET['date_to'], NULL, 'invoice');
    if (!is_array($orders)) {
        die(Tools::displayError('No invoices found'));
    }
    PDF::multipleInvoices($orders);
}
예제 #3
0
 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::getOrdersIdInvoiceByDate($_POST['date_from'], $_POST['date_to'], NULL, 'invoice');
             if (sizeof($orders)) {
                 Tools::redirectAdmin('pdf.php?invoices&date_from=' . urlencode($_POST['date_from']) . '&date_to=' . urlencode($_POST['date_to']) . '&token=' . $this->token);
             }
             $this->_errors[] = $this->l('No invoice found for this period');
         }
     } else {
         parent::postProcess();
     }
 }
예제 #4
0
파일: pdf.php 프로젝트: Bruno-2M/prestashop
    if (!Validate::isLoadedObject($order)) {
        die(Tools::displayError('cannot find order in database'));
    }
    PDF::invoice($order);
} elseif (isset($_GET['id_order_slip'])) {
    $orderSlip = new OrderSlip(intval($_GET['id_order_slip']));
    $order = new Order(intval($orderSlip->id_order));
    if (!Validate::isLoadedObject($order)) {
        die(Tools::displayError('cannot find order in database'));
    }
    $order->products = OrderSlip::getOrdersSlipProducts($orderSlip->id, $order);
    $tmp = NULL;
    PDF::invoice($order, 'D', false, $tmp, $orderSlip);
} elseif (isset($_GET['id_delivery'])) {
    $order = Order::getByDelivery(intval($_GET['id_delivery']));
    if (!Validate::isLoadedObject($order)) {
        die(Tools::displayError('cannot find order in database'));
    }
    $tmp = NULL;
    PDF::invoice($order, 'D', false, $tmp, false, $order->delivery_number);
} elseif (isset($_GET['invoices'])) {
    $invoices = Order::getOrdersIdInvoiceByDate($_GET['date_from'], $_GET['date_to'], NULL, 'invoice');
    if (is_array($invoices)) {
        PDF::multipleInvoices($invoices);
    }
} elseif (isset($_GET['deliveryslips'])) {
    $slips = unserialize(urldecode($_GET['deliveryslips']));
    if (is_array($slips)) {
        PDF::multipleDelivery($slips);
    }
}
예제 #5
0
 public function postProcess()
 {
     global $currentIndex;
     if (Tools::isSubmit('submitPrint')) {
         if (!Validate::isDate(Tools::getValue('date_from'))) {
             $this->_errors[] = $this->l('Invalid from date');
         }
         if (!Validate::isDate(Tools::getValue('date_to'))) {
             $this->_errors[] = $this->l('Invalid end date');
         }
         if (!sizeof($this->_errors)) {
             $orders = Order::getOrdersIdInvoiceByDate(Tools::getValue('date_from'), Tools::getValue('date_to'), NULL, 'invoice');
             if (sizeof($orders)) {
                 Tools::redirectAdmin('pdf.php?invoices&date_from=' . urlencode(Tools::getValue('date_from')) . '&date_to=' . urlencode(Tools::getValue('date_to')) . '&token=' . $this->token);
             }
             $this->_errors[] = $this->l('No invoice found for this period');
         }
     } elseif (Tools::isSubmit('submitPrint2')) {
         if (!is_array($statusArray = Tools::getValue('id_order_state')) or !count($statusArray)) {
             $this->_errors[] = $this->l('Invalid order statuses');
         } else {
             foreach ($statusArray as $id_order_state) {
                 if (count($orders = Order::getOrderIdsByStatus((int) $id_order_state))) {
                     Tools::redirectAdmin('pdf.php?invoices2&id_order_state=' . implode('-', $statusArray) . '&token=' . $this->token);
                 }
             }
             $this->_errors[] = $this->l('No invoice found for this status');
         }
     } elseif (Tools::isSubmit('submitOptionsinvoice')) {
         if ((int) Tools::getValue('PS_INVOICE_START_NUMBER') != 0 and (int) Tools::getValue('PS_INVOICE_START_NUMBER') <= Order::getLastInvoiceNumber()) {
             $this->_errors[] = $this->l('Invalid invoice number (must be > ') . Order::getLastInvoiceNumber() . ')';
         } else {
             parent::postProcess();
         }
     } else {
         parent::postProcess();
     }
 }