X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Fincludes%2Fpdf_report.inc;h=944b4c28509d38ba5078e93ddbbd7a26e6d57d13;hb=074f5b55ae369597c70953bc7f9324cc491a6a7e;hp=467fb3f1edd74ba02af7a5a8b9562e48633abdc9;hpb=2383d33373d6ddec06906658a0ed6398077c1147;p=fa-stable.git diff --git a/reporting/includes/pdf_report.inc b/reporting/includes/pdf_report.inc index 467fb3f1..944b4c28 100644 --- a/reporting/includes/pdf_report.inc +++ b/reporting/includes/pdf_report.inc @@ -9,7 +9,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License here . ***********************************************************************/ -$page_security = 8; //include_once($path_to_root . "reporting/includes/class.pdf.inc"); include_once(dirname(__FILE__)."/class.pdf.inc"); include_once(dirname(__FILE__)."/printer_class.inc"); @@ -51,6 +50,13 @@ class FrontReport extends Cpdf function FrontReport($title, $filename, $size = 'A4', $fontsize = 9) { + global $page_security; + if (!$_SESSION["wa_current_user"]->can_access_page($page_security)) + { + display_error(_("The security settings on your account do not permit you to print this report")); + end_page(); + exit; + } switch ($size) { default: @@ -260,13 +266,13 @@ class FrontReport extends Cpdf function Header2($myrow, $branch, $sales_order, $bankaccount, $doctype) { - global $comp_path, $path_to_root, $print_as_quote, $print_invoice_no; + global $comp_path, $path_to_root, $print_as_quote, $print_invoice_no, $packing_slip; $this->pageNumber++; if ($this->pageNumber > 1) $this->newPage(); $header2type = true; - if ($this->currency != $myrow['curr_code']) + if (isset($myrow['curr_code']) && $this->currency != $myrow['curr_code']) { include($path_to_root . "/reporting/includes/doctext2.inc"); } @@ -353,7 +359,7 @@ class FrontReport extends Cpdf do { $l = $this->TextWrap($c, $this->row , $width, $l, $align); - $this->NewLine(); + $this->row -= $this->lineHeight; } while ($l != ''); } @@ -407,7 +413,10 @@ class FrontReport extends Cpdf } // do not use standard filenames or your sensitive company data // are world readable - $fname = $dir.'/'.uniqid('').'.pdf'; + if ($email == 1) + $fname = $dir.'/'.$this->filename; + else + $fname = $dir.'/'.uniqid('').'.pdf'; $this->Output($fname, 'F'); if ($email == 1) { @@ -422,12 +431,12 @@ class FrontReport extends Cpdf } require_once($path_to_root . "/reporting/includes/class.mail.inc"); $mail = new email($this->company['coy_name'], $this->company['email']); - $from = $this->company['coy_name'] . " <" . $this->company['email'] . ">"; - if ($myrow['email'] == '') $myrow['email'] = $myrow['contact_email']; + if (!isset($myrow['email']) || $myrow['email'] == '') + $myrow['email'] = isset($myrow['contact_email']) ? $myrow['contact_email'] : ''; $to = $myrow['DebtorName'] . " <" . $myrow['email'] . ">"; $msg = $doc_Dear_Sirs . " " . $myrow['DebtorName'] . ",\n\n" . $doc_AttachedFile . " " . $subject . "\n\n"; - if ($myrow['dimension_id'] > 0 && $doctype == 10) // helper for payment links + if (isset($myrow['dimension_id']) && $myrow['dimension_id'] > 0 && $doctype == 10) // helper for payment links { if ($myrow['dimension_id'] == 1) { @@ -446,24 +455,12 @@ class FrontReport extends Cpdf $mail->text($msg . $sender); $mail->attachment($fname); $ret = $mail->send(); - if (1 == 1) // just for fun and for debugging purposes!! - { - $from = str_replace("<", "(", $from); - $from = str_replace(">", ")", $from); - $to = str_replace("<", "(", $to); - $to = str_replace(">", ")", $to); - $msg2 = "
From: " . $from; - $msg2 .= "
To: " . $to; - $msg2 .= "
Subject: " . $subject; - $msg2 .= "
Msg: " . nl2br($msg); - $msg2 .= nl2br($sender) . "
"; - $msg2 .= "
Filepath: " . $fname . "
Filename: " . $this->filename . "
"; - } if (!$ret) display_error(_("Sending document by email failed")); else display_notification($this->title . " " . $myrow['reference'] . " " . _("has been sent by email.")); + unlink($fname); } else { @@ -492,6 +489,7 @@ class FrontReport extends Cpdf header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); + $this->Stream(); } } else { // send report to network printer