From a0143a3f447fd95064c01784ae2b86f67648fcb7 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 30 Jan 2024 13:51:56 +1100 Subject: [PATCH 1/2] Minor loggin --- app/Jobs/Payment/EmailPayment.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Jobs/Payment/EmailPayment.php b/app/Jobs/Payment/EmailPayment.php index 275a9579fa4c..2054d18ec0ee 100644 --- a/app/Jobs/Payment/EmailPayment.php +++ b/app/Jobs/Payment/EmailPayment.php @@ -59,6 +59,7 @@ class EmailPayment implements ShouldQueue public function handle() { if ($this->company->is_disabled || (!$this->contact->email ?? false)) { + nlog("company disabled - or - contact email not found"); return; } From c2af62fd4d62ade0ab47a50ad57a4af886d37760 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 30 Jan 2024 15:30:40 +1100 Subject: [PATCH 2/2] Send users to overview page instead of edit for React --- app/Http/Controllers/SearchController.php | 2 +- app/Listeners/Invoice/InvoiceEmailFailedActivity.php | 3 ++- app/Listeners/Invoice/InvoiceFailedEmailNotification.php | 9 ++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 6896dbde2213..c34efc2dced4 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -59,7 +59,7 @@ class SearchController extends Controller 'name' => $client->present()->name(), 'type' => '/client', 'id' => $client->hashed_id, - 'path' => "/clients/{$client->hashed_id}/edit" + 'path' => "/clients/{$client->hashed_id}" ]; $client->contacts->each(function ($contact) { diff --git a/app/Listeners/Invoice/InvoiceEmailFailedActivity.php b/app/Listeners/Invoice/InvoiceEmailFailedActivity.php index e8d21797afda..d2df49622fae 100644 --- a/app/Listeners/Invoice/InvoiceEmailFailedActivity.php +++ b/app/Listeners/Invoice/InvoiceEmailFailedActivity.php @@ -58,7 +58,8 @@ class InvoiceEmailFailedActivity implements ShouldQueue $fields->client_contact_id = $event->invitation->client_contact_id; $fields->company_id = $event->invitation->invoice->company_id; $fields->activity_type_id = Activity::EMAIL_INVOICE_FAILED; - + $fields->notes = $event->message ?? ''; + $this->activity_repo->save($fields, $event->invitation->invoice, $event->event_vars); } } diff --git a/app/Listeners/Invoice/InvoiceFailedEmailNotification.php b/app/Listeners/Invoice/InvoiceFailedEmailNotification.php index 136dcc71ed35..f2d58edbe872 100644 --- a/app/Listeners/Invoice/InvoiceFailedEmailNotification.php +++ b/app/Listeners/Invoice/InvoiceFailedEmailNotification.php @@ -11,10 +11,11 @@ namespace App\Listeners\Invoice; +use App\Libraries\MultiDB; use App\Jobs\Mail\NinjaMailer; use App\Jobs\Mail\NinjaMailerJob; use App\Jobs\Mail\NinjaMailerObject; -use App\Libraries\MultiDB; +use Illuminate\Support\Facades\Cache; use App\Mail\Admin\EntityFailedSendObject; use App\Utils\Traits\Notifications\UserNotifies; @@ -36,7 +37,8 @@ class InvoiceFailedEmailNotification { MultiDB::setDb($event->company->db); - $first_notification_sent = true; + if(Cache::has("invoice_failed_email_notification_{$event->invitation->key}")) + return; $invoice = $event->invitation->invoice; @@ -58,8 +60,9 @@ class InvoiceFailedEmailNotification $nmo = null; - $first_notification_sent = false; } } + + Cache::put("invoice_failed_email_notification_{$event->invitation->key}", true, 60 * 60); } }