PHP7 compatibility fixes.
[fa-stable.git] / reporting / includes / pdf_report.inc
index 6b9b45c9f637c53b089a3a016eeefae8d93c9984..31dcdb367bc1eb584df1d8369e53eceabcb5c5a8 100644 (file)
@@ -70,7 +70,7 @@ class FrontReport extends Cpdf
        
        var $dest;      // destination: email or printer
        
-       function FrontReport($title, $filename, $size = 'A4', $fontsize = 9, $orientation = 'P', $margins = NULL, $excelColWidthFactor = NULL)
+       function __construct($title, $filename, $size = 'A4', $fontsize = 9, $orientation = 'P', $margins = NULL, $excelColWidthFactor = NULL)
        {
                global $page_security;
 
@@ -222,7 +222,7 @@ class FrontReport extends Cpdf
                $this->scaleLogoWidth = false; // if Logo, scale on width (else height).
                $this->SetHeaderType('Header'); // default
 
-               $this->Cpdf($size, $_SESSION['language']->code, $orientation);
+               parent::__construct($size, $_SESSION['language']->code, $orientation);
        }
        
        /*
@@ -296,6 +296,8 @@ class FrontReport extends Cpdf
        //
        function Header()
        {
+               global $SysPrefs;
+               
                $companyCol = $this->endLine - 150;
                $titleCol = $this->leftMargin + 100;
 
@@ -311,9 +313,18 @@ class FrontReport extends Cpdf
                $this->Text($this->leftMargin, $this->title, $companyCol);
                $this->Font();
                $this->fontSize -= 4;
-               $this->Text($companyCol, $this->company['coy_name']);
-               $this->row -= ($this->lineHeight + 4);
-
+               $logo = company_path() . "/images/" . $this->company['coy_logo'];
+               if (!empty($SysPrefs->prefs['company_logo_report']) && $this->company['coy_logo'] != '' && file_exists($logo))
+               {
+                       $this->row -= ($this->lineHeight + 3);
+                       $this->AddImage($logo, $companyCol, $this->row, 0, 30);
+                       $this->row -= 6;
+               }
+               else
+               {
+                       $this->Text($companyCol, $this->company['coy_name']);
+                       $this->row -= ($this->lineHeight + 4);
+               }
                $str = _("Print Out Date") . ':';
                $this->Text($this->leftMargin, $str, $titleCol);
                $str = Today() . '   ' . Now();
@@ -957,7 +968,7 @@ class FrontReport extends Cpdf
                        }
                        // do not use standard filenames or your sensitive company data 
                        // are world readable
-                       $fname = $dir.'/'.uniqid('').'.pdf';
+                       $fname = $dir.'/'.random_id().'.pdf';
                        $this->Output($fname, 'F');
 
                        if ($email == 1)