[*] PDF : PDF could now be returned as a string
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11579 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -118,7 +118,7 @@ abstract class PaymentModuleCore extends Module
|
|||||||
$id_currency = $currency_special ? (int)($currency_special) : (int)($cart->id_currency);
|
$id_currency = $currency_special ? (int)($currency_special) : (int)($cart->id_currency);
|
||||||
$currency = new Currency($id_currency);
|
$currency = new Currency($id_currency);
|
||||||
|
|
||||||
$this->context->cart->order_reference = $reference;
|
$cart->order_reference = $reference;
|
||||||
|
|
||||||
$orderCreationFailed = false;
|
$orderCreationFailed = false;
|
||||||
$cart_total_paid = (float)Tools::ps_round((float)($cart->getOrderTotal(true, Cart::BOTH)), 2);
|
$cart_total_paid = (float)Tools::ps_round((float)($cart->getOrderTotal(true, Cart::BOTH)), 2);
|
||||||
@@ -441,7 +441,8 @@ abstract class PaymentModuleCore extends Module
|
|||||||
// Join PDF invoice
|
// Join PDF invoice
|
||||||
if ((int)(Configuration::get('PS_INVOICE')) && $order_status->invoice && $order->invoice_number)
|
if ((int)(Configuration::get('PS_INVOICE')) && $order_status->invoice && $order->invoice_number)
|
||||||
{
|
{
|
||||||
$fileAttachment['content'] = PDF::invoice($order, 'S');
|
$pdf = new PDF($order->getInvoicesCollection(), PDF::TEMPLATE_INVOICE, $this->context->smarty);
|
||||||
|
$fileAttachment['content'] = $pdf->render(false);
|
||||||
$fileAttachment['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)($order->id_lang)).sprintf('%06d', $order->invoice_number).'.pdf';
|
$fileAttachment['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)($order->id_lang)).sprintf('%06d', $order->invoice_number).'.pdf';
|
||||||
$fileAttachment['mime'] = 'application/pdf';
|
$fileAttachment['mime'] = 'application/pdf';
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -52,7 +52,7 @@ class PDFCore
|
|||||||
$this->objects = array($objects);
|
$this->objects = array($objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render($display = true)
|
||||||
{
|
{
|
||||||
$render = false;
|
$render = false;
|
||||||
$this->pdf_renderer->setFontForLang('fr');
|
$this->pdf_renderer->setFontForLang('fr');
|
||||||
@@ -81,7 +81,7 @@ class PDFCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($render)
|
if ($render)
|
||||||
$this->pdf_renderer->render($this->filename);
|
return $this->pdf_renderer->render($this->filename, $display);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTemplateObject($object)
|
public function getTemplateObject($object)
|
||||||
|
|||||||
@@ -121,15 +121,18 @@ class PDFGeneratorCore extends TCPDF
|
|||||||
* Render the pdf file
|
* Render the pdf file
|
||||||
*
|
*
|
||||||
* @param string $filename
|
* @param string $filename
|
||||||
|
* @param boolean $inline
|
||||||
* @throws PrestashopException
|
* @throws PrestashopException
|
||||||
*/
|
*/
|
||||||
public function render($filename)
|
public function render($filename, $display = true)
|
||||||
{
|
{
|
||||||
if (empty($filename))
|
if (empty($filename))
|
||||||
throw new PrestashopException('Missing filename.');
|
throw new PrestashopException('Missing filename.');
|
||||||
|
|
||||||
$this->lastPage();
|
$this->lastPage();
|
||||||
$this->output($filename, 'I');
|
|
||||||
|
$output = $display ? 'I' : 'S';
|
||||||
|
return $this->output($filename, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user