mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Fixes for mail notifications
This commit is contained in:
parent
60897083d1
commit
95c36f111b
@ -25,9 +25,9 @@ use App\Services\RecurringInvoiceService;
|
||||
use Auth;
|
||||
use Cache;
|
||||
use DB;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Redirect;
|
||||
use Request;
|
||||
use Session;
|
||||
use URL;
|
||||
use Utils;
|
||||
use View;
|
||||
@ -427,7 +427,7 @@ class InvoiceController extends BaseController
|
||||
$response = $this->emailRecurringInvoice($invoice);
|
||||
} else {
|
||||
$userId = Auth::user()->id;
|
||||
$this->dispatch(new SendInvoiceEmail($invoice, $userId, $reminder, $template));
|
||||
dispatch(new SendInvoiceEmail($invoice, $userId, $reminder, $template));
|
||||
$response = true;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ class SendInvoiceEmail extends Job implements ShouldQueue
|
||||
/**
|
||||
* @var Invoice
|
||||
*/
|
||||
protected $invoice;
|
||||
public $invoice;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
|
@ -2,51 +2,53 @@
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\Traits\SerialisesDeletedModels;
|
||||
use App\Models\User;
|
||||
use App\Ninja\Mailers\UserMailer;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\Traits\SerialisesDeletedModels;
|
||||
|
||||
/**
|
||||
* Class SendInvoiceEmail.
|
||||
*/
|
||||
class SendNotificationEmail extends Job implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue, SerializesModels, SerialisesDeletedModels {
|
||||
SerialisesDeletedModels::getRestoredPropertyValue insteadof SerializesModels;
|
||||
}
|
||||
use InteractsWithQueue;
|
||||
|
||||
public $deleteWhenMissingModels = true;
|
||||
|
||||
/**
|
||||
* @var User
|
||||
*/
|
||||
protected $user;
|
||||
public User $user;
|
||||
|
||||
/**
|
||||
* @var Invoice
|
||||
*/
|
||||
protected $invoice;
|
||||
public Invoice $invoice;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $type;
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @var Payment
|
||||
*/
|
||||
protected $payment;
|
||||
public ?Payment $payment;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $notes;
|
||||
public $notes;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $server;
|
||||
public $server;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
@ -59,7 +61,7 @@ class SendNotificationEmail extends Job implements ShouldQueue
|
||||
* @param mixed $type
|
||||
* @param mixed $payment
|
||||
*/
|
||||
public function __construct($user, $invoice, $type, $payment, $notes)
|
||||
public function __construct(User $user, Invoice $invoice, $type, ?Payment $payment, $notes)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->invoice = $invoice;
|
||||
|
@ -1,17 +1,20 @@
|
||||
<?php namespace App\Listeners;
|
||||
<?php
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Ninja\Mailers\UserMailer;
|
||||
use App\Ninja\Mailers\ContactMailer;
|
||||
use App\Events\InvoiceWasEmailed;
|
||||
use App\Events\QuoteWasEmailed;
|
||||
use App\Events\InvoiceInvitationWasViewed;
|
||||
use App\Events\QuoteInvitationWasViewed;
|
||||
use App\Events\QuoteInvitationWasApproved;
|
||||
use App\Events\InvoiceWasEmailed;
|
||||
use App\Events\PaymentWasCreated;
|
||||
use App\Services\PushService;
|
||||
use App\Events\QuoteInvitationWasApproved;
|
||||
use App\Events\QuoteInvitationWasViewed;
|
||||
use App\Events\QuoteWasEmailed;
|
||||
use App\Jobs\SendNotificationEmail;
|
||||
use App\Jobs\SendPaymentEmail;
|
||||
use App\Models\Invoice;
|
||||
use App\Ninja\Mailers\ContactMailer;
|
||||
use App\Ninja\Mailers\UserMailer;
|
||||
use App\Notifications\PaymentCreated;
|
||||
use App\Services\PushService;
|
||||
|
||||
/**
|
||||
* Class NotificationListener
|
||||
@ -49,7 +52,7 @@ class NotificationListener
|
||||
* @param $type
|
||||
* @param null $payment
|
||||
*/
|
||||
private function sendNotifications($invoice, $type, $payment = null, $notes = false)
|
||||
private function sendNotifications(Invoice $invoice, $type, $payment = null, $notes = false)
|
||||
{
|
||||
foreach ($invoice->account->users as $user)
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ class UserMailer extends Mailer
|
||||
User $user,
|
||||
Invoice $invoice,
|
||||
$notificationType,
|
||||
Payment $payment = null,
|
||||
?Payment $payment,
|
||||
$notes = false
|
||||
) {
|
||||
if (! $user->shouldNotify($invoice)) {
|
||||
|
Loading…
Reference in New Issue
Block a user