From 715e5022f0573a4bb760643daa9c0ef8e53490e2 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 6 Oct 2023 22:08:23 +1100 Subject: [PATCH] Fixes for missing payments --- app/Services/Template/TemplateAction.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Services/Template/TemplateAction.php b/app/Services/Template/TemplateAction.php index 240abcbec852..0a3c6a5f0081 100644 --- a/app/Services/Template/TemplateAction.php +++ b/app/Services/Template/TemplateAction.php @@ -84,8 +84,12 @@ class TemplateAction implements ShouldQueue $resource = $entity->query() ->withTrashed() ->whereIn('id', $this->transformKeys($this->ids)) - ->where('company_id', $this->company->id) - ->get(); + ->where('company_id', $this->company->id); + + if($this->entity == Invoice::class) + $resource->with('payments'); + + $resource->get(); if(count($resource) <= 1) $data[$key] = [$resource];