X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Fincludes%2Fpdf_report.inc;h=3d072e660a2dfd7c2cc53340913ca810d1a6e94f;hb=9b852b19c91b5af6400cf94a9ff65d37d1a730b4;hp=b0277f1eda17de64b9bdd71c384b8ce9c0e60598;hpb=f58466eea31b624deacaf5e5cd4b9de7995e0373;p=fa-stable.git diff --git a/reporting/includes/pdf_report.inc b/reporting/includes/pdf_report.inc index b0277f1e..3d072e66 100644 --- a/reporting/includes/pdf_report.inc +++ b/reporting/includes/pdf_report.inc @@ -9,6 +9,7 @@ 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"); @@ -413,7 +414,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) { @@ -428,12 +432,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'] = $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) { @@ -452,24 +456,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 {