Changes in POS extension related to bank account structure change.
[fa-stable.git] / reporting / includes / pdf_report.inc
index 0fec40a9b406e7353def05ad8253159efcb55966..115fa929d24ab9a34469ed9bffab0707fba42b7d 100644 (file)
@@ -361,7 +361,7 @@ class FrontReport extends Cpdf
 
                if ($pdf_debug == 1)
                {
-                       $pdfcode = $this->Output();
+                       $pdfcode = $this->Output('','S');
                        $pdfcode = str_replace("\n", "\n<br>", htmlspecialchars($pdfcode));
                        echo '<html><body>';
                        echo trim($pdfcode);
@@ -377,8 +377,6 @@ class FrontReport extends Cpdf
                else
                {
 
-                       $buf = $this->Output();
-                       $len = strlen($buf);
                        $dir =  $comp_path.'/'.user_company(). '/pdf_files';
                        //save the file
                        if (!file_exists($dir))
@@ -387,12 +385,8 @@ class FrontReport extends Cpdf
                        }
                        // do not use standard filenames or your sensitive company data 
                        // are world readable
-                       $fname = tempnam($dir, 'FA');
-                       rename($fname, $fname.'.pdf');
-                       $fname .= '.pdf';
-                       $fp = fopen($fname,'w');
-                       fwrite($fp,$buf);
-                       fclose($fp);
+                       $fname = $dir.'/'.uniqid('').'.pdf';
+                       $this->Output($fname, 'F');
                        if ($email == 1)
                        {
                                $emailtype = true;