From d93928ffbe6d8127c9758f77cf3401087561a4c6 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 8 Oct 2021 16:23:00 +1100 Subject: [PATCH] Fixes for testS --- app/Repositories/ActivityRepository.php | 2 +- app/Services/Invoice/InvoiceService.php | 2 ++ app/Services/Payment/SendEmail.php | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Repositories/ActivityRepository.php b/app/Repositories/ActivityRepository.php index 7f39c37ce9e9..c2ed5748bbea 100644 --- a/app/Repositories/ActivityRepository.php +++ b/app/Repositories/ActivityRepository.php @@ -73,7 +73,6 @@ class ActivityRepository extends BaseRepository if ($entity instanceof User || $entity->company->is_disabled) return; - $entity->load('company', 'client'); $backup = new Backup(); @@ -82,6 +81,7 @@ class ActivityRepository extends BaseRepository || get_class($entity) == Credit::class || get_class($entity) == RecurringInvoice::class ) { + $entity->load('company', 'client'); $contact = $entity->client->primary_contact()->first(); $backup->html_backup = $this->generateHtml($entity); $backup->amount = $entity->amount; diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index d91799a9a5eb..b4f3e4312463 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -322,6 +322,8 @@ class InvoiceService public function deletePdf() { + $this->invoice->load('invitations'); + $this->invoice->invitations->each(function ($invitation){ Storage::disk(config('filesystems.default'))->delete($this->invoice->client->invoice_filepath($invitation) . $this->invoice->numberFormatter().'.pdf'); diff --git a/app/Services/Payment/SendEmail.php b/app/Services/Payment/SendEmail.php index 19702b631738..978a038df2fe 100644 --- a/app/Services/Payment/SendEmail.php +++ b/app/Services/Payment/SendEmail.php @@ -32,6 +32,8 @@ class SendEmail */ public function run() { + $this->payment->load('company', 'client.contacts'); + $this->payment->client->contacts->each(function ($contact) { if ($contact->email) { EmailPayment::dispatchNow($this->payment, $this->payment->company, $contact);