[*] PDF : New hook actionPDFInvoiceRender
[-] PDF : Can't display invoice due to Collection
This commit is contained in:
+4
-1
@@ -81,7 +81,9 @@ function generateInvoicePDFByIdOrder($id_order)
|
||||
if (!Validate::isLoadedObject($order))
|
||||
die(Tools::displayError('Cannot find order in database'));
|
||||
|
||||
generatePDF($order->getInvoicesCollection(), PDF::TEMPLATE_INVOICE);
|
||||
$order_invoice_list = $order->getInvoicesCollection();
|
||||
Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list));
|
||||
generatePDF($order_invoice_list, PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
function generateInvoicePDFByIdOrderInvoice($id_order_invoice)
|
||||
@@ -90,6 +92,7 @@ function generateInvoicePDFByIdOrderInvoice($id_order_invoice)
|
||||
if (!Validate::isLoadedObject($order_invoice))
|
||||
die(Tools::displayError('Cannot find order invoice in database'));
|
||||
|
||||
Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => array($order_invoice)));
|
||||
generatePDF($order_invoice, PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ class PDFCore
|
||||
$this->smarty = $smarty;
|
||||
|
||||
$this->objects = $objects;
|
||||
if (!is_array($objects))
|
||||
if (!($objects instanceof Iterator))
|
||||
$this->objects = array($objects);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,8 +66,11 @@ class PdfInvoiceControllerCore extends FrontController
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
$pdf = new PDF($this->order, PDF::TEMPLATE_INVOICE, $this->context->smarty, $this->context->language->id);
|
||||
{
|
||||
$order_invoice_list = $this->order->getInvoicesCollection();
|
||||
Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list));
|
||||
|
||||
$pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $this->context->smarty, $this->context->language->id);
|
||||
$pdf->render();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user