PreorderBilling: now copying invoice PDFs to Fibu transfer dir
This commit is contained in:
@@ -172,6 +172,9 @@ RML Infrastruktur GmbH";
|
|||||||
|
|
||||||
$tpl = new Layout();
|
$tpl = new Layout();
|
||||||
$tpl->setTemplate("Emailtemplates/preorder-invoice/rml/invoice-email");
|
$tpl->setTemplate("Emailtemplates/preorder-invoice/rml/invoice-email");
|
||||||
|
if($this->owner_id) {
|
||||||
|
$tpl->setTemplate("Emailtemplates/preorder-invoice/rml/invoice-email-anb");
|
||||||
|
}
|
||||||
|
|
||||||
$pdf_vars = [
|
$pdf_vars = [
|
||||||
"invoice" => $this
|
"invoice" => $this
|
||||||
|
|||||||
@@ -874,6 +874,7 @@ class PreorderBillingInvoiceController extends mfBaseController {
|
|||||||
|
|
||||||
|
|
||||||
$csv .= "$csv_line\n";
|
$csv .= "$csv_line\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*echo $csv;
|
/*echo $csv;
|
||||||
@@ -902,6 +903,39 @@ class PreorderBillingInvoiceController extends mfBaseController {
|
|||||||
]);
|
]);
|
||||||
$file->save();
|
$file->save();
|
||||||
|
|
||||||
|
// save invoice PDFs to bmd export transfer path
|
||||||
|
foreach($invoices as $invoice) {
|
||||||
|
$pdf = $invoice->pdf;
|
||||||
|
if(!$pdf || !$pdf->name || !file_exists($pdf->getFullPath())) {
|
||||||
|
$ifile = PreorderBillingInvoiceFile::createFromInvoice($invoice);
|
||||||
|
if(!$ifile) {
|
||||||
|
$this->layout()->setFlash("Fehler beim PDF erstellen");
|
||||||
|
$this->redirect("PreorderBillingInvoice");
|
||||||
|
}
|
||||||
|
$pdf = $ifile->file;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pdf_file = false;
|
||||||
|
try {
|
||||||
|
$pdf_file = $pdf->getFullPath();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->log->error(__METHOD__.": File for Invoice ".$invoice->id." not found");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!file_exists($pdf_file)) {
|
||||||
|
$this->log->error(__METHOD__.": Datei ".$pdf->filename." nicht gefunden");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy pdf file to bmd export transfer directory
|
||||||
|
$transfer_path = $netowner_config["bmd-export-transfer-path"];
|
||||||
|
$transfer_file = "$transfer_path/".$invoice->invoice_number.".pdf";
|
||||||
|
if(!copy($pdf_file, $transfer_file)) {
|
||||||
|
$this->log->error(__METHOD__.": Error copying ".$pdf_file." to ".$transfer_file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// copy csv file to bmd export transfer directory
|
// copy csv file to bmd export transfer directory
|
||||||
$transfer_path = $netowner_config["bmd-export-transfer-path"];
|
$transfer_path = $netowner_config["bmd-export-transfer-path"];
|
||||||
$transfer_file = "$transfer_path/$filename";
|
$transfer_file = "$transfer_path/$filename";
|
||||||
|
|||||||
Reference in New Issue
Block a user