small InvoiceJob update

This commit is contained in:
Frank Schubert
2024-08-29 15:29:47 +02:00
parent b713e803c9
commit c9552055dd
2 changed files with 28 additions and 7 deletions

View File

@@ -904,23 +904,29 @@ class InvoiceController extends mfBaseController {
try {
$pdf_file = $pdf->getFullPath();
} catch (Exception $e) {
$this->log->error("File for Invoice ".$invoice->id." not found");
$this->log->error(__METHOD__.": File for Invoice ".$invoice->id." not found");
continue;
}
if(!file_exists($pdf_file)) {
//echo "Datei ".$pdf->filename." nicht gefunden\n";
$this->log->error(__METHOD__.": Datei ".$pdf->filename." nicht gefunden");
continue;
}
if($invoice->total == 0) {
//echo "Skipping ".$invoice->invoice_number." because total is zero\n";
$this->log->info(__METHOD__.": Skipping ".$invoice->invoice_number." because total is zero");
$invoice->date_delivered = date("U");
$invoice->save();
continue;
}
if(!$invoice->sendByEmail()) {
$this->log->warning("Error sending ".$invoice->invoice_number." to ".$invoice->email);
$this->log->warning(__METHOD__.": Error sending ".$invoice->invoice_number." to ".$invoice->email);
$invoice->date_delivered = date("U");
$invoice->save();
continue;
}
$invoice->date_delivered = date("U");
$invoice->save();