From 7e9dde9513093e20db99b4872513af3616ec1687 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 20 Oct 2024 08:14:05 +1100 Subject: [PATCH] Fixes for credit sent events --- app/Http/Controllers/CreditController.php | 2 -- app/Services/Credit/CreditService.php | 4 ++-- app/Services/Credit/TriggeredActions.php | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/CreditController.php b/app/Http/Controllers/CreditController.php index 11abfd50a3..e1862e4e6d 100644 --- a/app/Http/Controllers/CreditController.php +++ b/app/Http/Controllers/CreditController.php @@ -644,8 +644,6 @@ class CreditController extends BaseController EmailEntity::dispatch($invitation, $credit->company, 'credit'); }); - // $credit->sendEvent(Webhook::EVENT_SENT_CREDIT, "client"); - if (! $bulk) { return response()->json(['message' => 'email sent'], 200); } diff --git a/app/Services/Credit/CreditService.php b/app/Services/Credit/CreditService.php index 8f16c58e5a..68c09f9150 100644 --- a/app/Services/Credit/CreditService.php +++ b/app/Services/Credit/CreditService.php @@ -152,9 +152,9 @@ class CreditService return $this; } - public function markSent() + public function markSent($fire_event = false) { - $this->credit = (new MarkSent($this->credit->client, $this->credit))->run(); + $this->credit = (new MarkSent($this->credit->client, $this->credit))->run($fire_event); return $this; } diff --git a/app/Services/Credit/TriggeredActions.php b/app/Services/Credit/TriggeredActions.php index 04ce784ad5..c2d8e40019 100644 --- a/app/Services/Credit/TriggeredActions.php +++ b/app/Services/Credit/TriggeredActions.php @@ -43,7 +43,7 @@ class TriggeredActions extends AbstractService } if ($this->request->has('mark_sent') && $this->request->input('mark_sent') == 'true') { - $this->credit = $this->credit->service()->markSent()->save(); + $this->credit = $this->credit->service()->markSent(true)->save(); } if ($this->request->has('save_default_footer') && $this->request->input('save_default_footer') == 'true') {