From 6d0d0bab1f5046731d68e453f7a522122928d12c 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 81931f40a0e375625dd9ef7063635107e45f3c94 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)