forked from pal/prestashop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdf-invoice.php
22 lines (19 loc) · 876 Bytes
/
pdf-invoice.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
include(dirname(__FILE__).'/config/config.inc.php');
include(dirname(__FILE__).'/init.php');
$cookie = new Cookie('ps');
if (!$cookie->isLogged())
Tools::redirect('authentication.php?back=pdf-invoice.php');
if (!intval(Configuration::get('PS_INVOICE')))
die(Tools::displayError('invoices are disabled on this shop'));
if (isset($_GET['id_order']) AND Validate::isUnsignedId($_GET['id_order']))
$order = new Order(intval($_GET['id_order']));
if (!isset($order) OR !Validate::isLoadedObject($order))
die(Tools::displayError('invoice not found'));
elseif ($order->id_customer != $cookie->id_customer)
die(Tools::displayError('invoice not found'));
elseif (!OrderState::invoiceAvailable($order->getCurrentState()) AND !$order->invoice_number)
die(Tools::displayError('current order state doesn\'t allow to edit this invoice'));
else
PDF::invoice($order);
?>