Merge branch 'fronkdev' into 'master'

Fixes for Invoice Email

See merge request fronk/thetool!466
This commit is contained in:
Frank Schubert
2024-07-10 14:21:37 +00:00
3 changed files with 27 additions and 6 deletions
@@ -3,7 +3,7 @@
* @var Invoice $invoice * @var Invoice $invoice
*/ */
$this->setReturnValue([ $this->setReturnValue([
'subject' => "Ihre Rechnung ".$invoice->invoice_number, 'subject' => "Ihre ".(($invoice->total < 0) ? "Gutschrift" : "Rechnung" )." ".$invoice->invoice_number,
'from_email' => "billing@xinon.at", 'from_email' => "billing@xinon.at",
'from_email_name' => "XINON GmbH - Verrechnung" 'from_email_name' => "XINON GmbH - Verrechnung"
]); ]);
@@ -11,7 +11,7 @@ $this->setReturnValue([
Sehr geehrte Damen und Herren, Sehr geehrte Damen und Herren,
Im Anhang erhalten Sie Ihre aktuelle Rechnung. Im Anhang erhalten Sie Ihre aktuelle <?=($invoice->total < 0) ? "Gutschrift" : "Rechnung"?>.
Mit besten Grüßen, Mit besten Grüßen,
+10 -4
View File
@@ -103,7 +103,8 @@ class InvoiceController extends mfBaseController {
$pdf = $ifile->file; $pdf = $ifile->file;
} }
$filename = $pdf->getFullPath(); $pdf_path = $pdf->getFullPath();
$filename = $pdf->filename;
if(!file_exists($filename)) { if(!file_exists($filename)) {
$this->layout()->setFlash("PDF-Datei nicht gefunden"); $this->layout()->setFlash("PDF-Datei nicht gefunden");
@@ -113,10 +114,10 @@ class InvoiceController extends mfBaseController {
header('Content-disposition: attachment; filename="'.$filename.'"'); header('Content-disposition: attachment; filename="'.$filename.'"');
header('Content-Transfer-Encoding: binary'); header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Type: ' . mime_content_type($filename)); header('Content-Type: ' . mime_content_type($pdf_path));
header("Content-Length: " . filesize($filename)); header("Content-Length: " . filesize($pdf_path));
readfile($filename); readfile($pdf_path);
exit; exit;
/*$vat = []; /*$vat = [];
@@ -725,6 +726,11 @@ class InvoiceController extends mfBaseController {
continue; continue;
} }
if($invoice->total == 0) {
echo "Skipping ".$invoice->invoice_number." because total is zero\n";
continue;
}
if(!$invoice->sendByEmail()) { if(!$invoice->sendByEmail()) {
echo "Error sending ".$invoice->invoice_number." to ".$invoice->email."\n"; echo "Error sending ".$invoice->invoice_number." to ".$invoice->email."\n";
continue; continue;
+15
View File
@@ -315,6 +315,21 @@ class InvoiceModel {
} }
} }
if(array_key_exists("billing_type", $filter)) {
$billing_type = $db->escape($filter['billing_type']);
if($billing_type) {
$where .= " AND Invoice.billing_type LIKE '$billing_type'";
}
}
if(array_key_exists("billing_delivery", $filter)) {
$billing_delivery = $db->escape($filter['billing_delivery']);
if($billing_delivery) {
$where .= " AND Invoice.billing_delivery LIKE '$billing_delivery'";
}
}
if (array_key_exists("company", $filter)) { if (array_key_exists("company", $filter)) {
$company = FronkDB::singleton()->escape($filter["company"]); $company = FronkDB::singleton()->escape($filter["company"]);
if ($company) { if ($company) {