From 3aa5db7198528094b7fd6bca908d17ca671afb1d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 4 Dec 2022 17:37:31 +1100 Subject: [PATCH 1/4] Fixes for the way we attach documents/pdfs to puchase orders --- app/Mail/VendorTemplateEmail.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Mail/VendorTemplateEmail.php b/app/Mail/VendorTemplateEmail.php index ccf9ef06955e..1ed0ca78f279 100644 --- a/app/Mail/VendorTemplateEmail.php +++ b/app/Mail/VendorTemplateEmail.php @@ -141,7 +141,13 @@ class VendorTemplateEmail extends Mailable // $this->attach($file['path'], ['as' => $file['name'], 'mime' => null]); // } - $this->attachData(base64_decode($file['file']), $file['name']); + // $this->attachData(base64_decode($file['file']), $file['name']); + + if(array_key_exists('file', $file)) + $this->attachData(base64_decode($file['file']), $file['name']); + else + $this->attach($file['path'], ['as' => $file['name'], 'mime' => null]); + } From 1df4079625dd0b372897ba78da9afa7a02737974 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 4 Dec 2022 18:46:25 +1100 Subject: [PATCH 2/4] Fixes for checkout --- app/PaymentDrivers/CheckoutComPaymentDriver.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index c59534a05788..b68cfd958720 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -302,7 +302,8 @@ class CheckoutComPaymentDriver extends BaseDriver } $phone = new Phone(); - $phone->number = $this->client->present()->phone(); + // $phone->number = $this->client->present()->phone(); + $phone->number = substr(str_pad($this->client->present()->phone(),6, "0", STR_PAD_RIGHT), 0 , 24); $request->email = $this->client->present()->email(); $request->name = $this->client->present()->name(); From 8b2f9a8708291ed43c2026013eecc8a4bb5ff982 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 5 Dec 2022 08:22:15 +1100 Subject: [PATCH 3/4] Fixes for middle ware key --- app/Services/Bank/BankMatchingService.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Services/Bank/BankMatchingService.php b/app/Services/Bank/BankMatchingService.php index dd15e5397745..02292fef432f 100644 --- a/app/Services/Bank/BankMatchingService.php +++ b/app/Services/Bank/BankMatchingService.php @@ -33,7 +33,7 @@ class BankMatchingService implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(protected int $company_id, private string $db){} + public function __construct(public int $company_id, private string $db){} public function handle() :void { @@ -53,6 +53,8 @@ class BankMatchingService implements ShouldQueue public function middleware() { - return [new WithoutOverlapping("bank_match_rate:{$this->company_id}")]; + $middleware_key = "bank_match_rate:{$this->company_id}"; + + return [new WithoutOverlapping($middleware_key)]; } } From ea3b6d0259d0eb570718e6d3354f6e8dd7a9a03a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 5 Dec 2022 09:28:08 +1100 Subject: [PATCH 4/4] add status to client export --- app/Export/CSV/ClientExport.php | 14 ++++++++++++++ app/Filters/InvoiceFilters.php | 2 -- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/Export/CSV/ClientExport.php b/app/Export/CSV/ClientExport.php index 5ba69ed72622..3b740de32c24 100644 --- a/app/Export/CSV/ClientExport.php +++ b/app/Export/CSV/ClientExport.php @@ -76,6 +76,7 @@ class ClientExport extends BaseExport 'contact_custom_value3' => 'contact.custom_value3', 'contact_custom_value4' => 'contact.custom_value4', 'email' => 'contact.email', + 'status' => 'status' ]; private array $decorate_keys = [ @@ -173,6 +174,19 @@ class ClientExport extends BaseExport $entity['industry_id'] = $client->industry ? ctrans("texts.industry_{$client->industry->name}") : ''; } + $entity['status'] = $this->calculateStatus($client); + return $entity; } + + private function calculateStatus($client) + { + if($client->is_deleted) + return ctrans('texts.deleted'); + + if($client->deleted_at) + return ctrans('texts.arcvived'); + + return ctrans('texts.active'); + } } diff --git a/app/Filters/InvoiceFilters.php b/app/Filters/InvoiceFilters.php index 46a63b0be388..d2c5c82aefcf 100644 --- a/app/Filters/InvoiceFilters.php +++ b/app/Filters/InvoiceFilters.php @@ -56,8 +56,6 @@ class InvoiceFilters extends QueryFilters if (in_array('unpaid', $status_parameters)) { $this->builder->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]); } - //->where('due_date', '>', Carbon::now()) - //->orWhere('partial_due_date', '>', Carbon::now()); if (in_array('overdue', $status_parameters)) { $this->builder->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])