From 7834f1e2749bcb54b10217b23f9260dd5a077cae Mon Sep 17 00:00:00 2001 From: oleacorner Date: Wed, 28 Nov 2012 13:55:08 +0100 Subject: [PATCH 1/2] Update classes/pdf/PDFGenerator.php Proposal to enhance the $display parameter. The proposal supports the true/false value, but also the 'D', 'I' and 'S' of fpdf. The behavior of the true value is changed to 'D' instead of 'I'. So, in fornt or back office, while cliking on a button to retrieve a PDF, the download windows is proposed instead of displaying the PDF inside the navigator. --- classes/pdf/PDFGenerator.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/classes/pdf/PDFGenerator.php b/classes/pdf/PDFGenerator.php index d9e840364..9bf30d3d6 100755 --- a/classes/pdf/PDFGenerator.php +++ b/classes/pdf/PDFGenerator.php @@ -132,7 +132,17 @@ class PDFGeneratorCore extends TCPDF $this->lastPage(); - $output = $display ? 'I' : 'S'; + if ($display === true) + $output = 'D'; + elseif ($display === false) + $output = 'S'; + elseif (display == 'D') + $output = 'D'; + elseif (display == 'S') + $output = 'S'; + else + $output = 'I'; + return $this->output($filename, $output); } From 25ff95741b2b2c35dd2d4037d181a36bf392b0bb Mon Sep 17 00:00:00 2001 From: oleacorner Date: Thu, 29 Nov 2012 13:05:05 +0100 Subject: [PATCH 2/2] Update classes/pdf/PDFGenerator.php --- classes/pdf/PDFGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/pdf/PDFGenerator.php b/classes/pdf/PDFGenerator.php index 9bf30d3d6..c8edaf55c 100755 --- a/classes/pdf/PDFGenerator.php +++ b/classes/pdf/PDFGenerator.php @@ -122,7 +122,7 @@ class PDFGeneratorCore extends TCPDF * Render the pdf file * * @param string $filename - * @param boolean $inline + * @param $display : true:display to user, false:save, 'I','D','S' as fpdf display * @throws PrestaShopException */ public function render($filename, $display = true)