From d8a6578be206eb377321df760a8a383013b37029 Mon Sep 17 00:00:00 2001 From: Lars Kusch Date: Mon, 7 Aug 2023 21:18:50 +0200 Subject: [PATCH] More fixes --- app/Services/Invoice/InvoiceService.php | 2 ++ app/Services/Invoice/MergeEInvoice.php | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index a024ccaef8ba..d8fc0f47d5ea 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -343,6 +343,7 @@ class InvoiceService })->toArray(); $this->deletePdf(); + $this->deleteEInvoice(); return $this; } @@ -410,6 +411,7 @@ class InvoiceService $this->invoice = $this->invoice->calc()->getInvoice(); $this->deletePdf(); + $this->deleteEInvoice(); /* 24-03-2022 */ $new_balance = $this->invoice->balance; diff --git a/app/Services/Invoice/MergeEInvoice.php b/app/Services/Invoice/MergeEInvoice.php index ecb30f7a8d69..c40cb0bafa58 100644 --- a/app/Services/Invoice/MergeEInvoice.php +++ b/app/Services/Invoice/MergeEInvoice.php @@ -19,14 +19,15 @@ class MergeEInvoice public function run(): void { - $file_path = $this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()). $this->invoice->getFileName("xml"); - + $file_path_xml = $this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()). $this->invoice->getFileName("xml"); + $file_path_pdf = $this->invoice->getFileName(); // $disk = 'public'; $disk = config('filesystems.default'); - $file = Storage::disk($disk)->exists($file_path); + $file_xml = Storage::disk($disk)->exists($file_path_xml); + $file_pdf = Storage::disk($disk)->exists($file_path_pdf); - if (! $file) { + if ($file_xml && $file_pdf) { (new \App\Jobs\Invoice\MergeEInvoice($this->invoice))->handle(); }