diff --git a/app/Listeners/Credit/CreditEmailedNotification.php b/app/Listeners/Credit/CreditEmailedNotification.php index 83d334d98a67..0b085e046ad4 100644 --- a/app/Listeners/Credit/CreditEmailedNotification.php +++ b/app/Listeners/Credit/CreditEmailedNotification.php @@ -12,7 +12,11 @@ namespace App\Listeners\Credit; use App\Jobs\Mail\EntitySentMailer; +use App\Jobs\Mail\NinjaMailer; +use App\Jobs\Mail\NinjaMailerJob; +use App\Jobs\Mail\NinjaMailerObject; use App\Libraries\MultiDB; +use App\Mail\Admin\EntitySentObject; use App\Notifications\Admin\EntitySentNotification; use App\Utils\Traits\Notifications\UserNotifies; use Illuminate\Contracts\Queue\ShouldQueue; @@ -41,6 +45,11 @@ class CreditEmailedNotification implements ShouldQueue $credit->last_sent_date = now(); $credit->save(); + $nmo = new NinjaMailerObject; + $nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'credit', $event->template))->build() ); + $nmo->company = $credit->company; + $nmo->settings = $credit->company->settings; + foreach ($event->invitation->company->company_users as $company_user) { $user = $company_user->user; @@ -51,7 +60,11 @@ class CreditEmailedNotification implements ShouldQueue if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) { unset($methods[$key]); - EntitySentMailer::dispatch($event->invitation, 'credit', $user, $event->invitation->company, $event->template); + $nmo->to_user = $user; + + NinjaMailerJob::dispatch($nmo); + + //EntitySentMailer::dispatch($event->invitation, 'credit', $user, $event->invitation->company, $event->template); $first_notification_sent = false; } diff --git a/app/Notifications/Admin/EntitySentNotification.php b/app/Notifications/Admin/EntitySentNotification.php index dd628e14bfcf..0608e3790732 100644 --- a/app/Notifications/Admin/EntitySentNotification.php +++ b/app/Notifications/Admin/EntitySentNotification.php @@ -21,6 +21,7 @@ use Illuminate\Notifications\Notification; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; +//@deprecated class EntitySentNotification extends Notification implements ShouldQueue { //use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;