diff --git a/application/Invoice/InvoiceController.php b/application/Invoice/InvoiceController.php index be0b2d6f2..8d41e60bf 100644 --- a/application/Invoice/InvoiceController.php +++ b/application/Invoice/InvoiceController.php @@ -926,6 +926,11 @@ class InvoiceController extends mfBaseController { continue; } + if($invoice->total < 0) { + // Gutschriften auch an Xinon + $invoice->sendByEmail("billing@xinon.at"); + } + if(!$invoice->sendByEmail()) { $this->log->warning(__METHOD__.": Error sending ".$invoice->invoice_number." to ".$invoice->email); $invoice->date_delivered = date("U"); @@ -936,11 +941,6 @@ class InvoiceController extends mfBaseController { $invoice->date_delivered = date("U"); $invoice->save(); - if($invoice->total < 0) { - // Gutschriften auch an Xinon - $invoice->sendByEmail("billing@xinon.at"); - } - $sent++; } @@ -987,6 +987,13 @@ class InvoiceController extends mfBaseController { } $pdf_files[] = $pdf_file; + + // send gutschriften to billing@xinon.at + if($invoice->total < 0) { + // Gutschriften auch an Xinon + $invoice->sendByEmail("billing@xinon.at"); + } + } //var_dump($pdf_files);exit;