mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Include reminder number in email notification subject
This commit is contained in:
parent
81764778d0
commit
93dad4be94
@ -17,13 +17,19 @@ class InvoiceWasEmailed extends Event
|
||||
*/
|
||||
public $invoice;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $notes;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Invoice $invoice
|
||||
*/
|
||||
public function __construct(Invoice $invoice)
|
||||
public function __construct(Invoice $invoice, $notes)
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
$this->notes = $notes;
|
||||
}
|
||||
}
|
||||
|
@ -12,13 +12,19 @@ class QuoteWasEmailed extends Event
|
||||
use SerializesModels;
|
||||
public $quote;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $notes;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param $quote
|
||||
*/
|
||||
public function __construct($quote)
|
||||
public function __construct($quote, $notes)
|
||||
{
|
||||
$this->quote = $quote;
|
||||
$this->notes = $notes;
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,11 @@ class SendNotificationEmail extends Job implements ShouldQueue
|
||||
*/
|
||||
protected $payment;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $notes;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
|
||||
@ -46,12 +51,13 @@ class SendNotificationEmail extends Job implements ShouldQueue
|
||||
* @param mixed $type
|
||||
* @param mixed $payment
|
||||
*/
|
||||
public function __construct($user, $invoice, $type, $payment)
|
||||
public function __construct($user, $invoice, $type, $payment, $notes)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->invoice = $invoice;
|
||||
$this->type = $type;
|
||||
$this->payment = $payment;
|
||||
$this->notes = $notes;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,6 +67,6 @@ class SendNotificationEmail extends Job implements ShouldQueue
|
||||
*/
|
||||
public function handle(UserMailer $userMailer)
|
||||
{
|
||||
$userMailer->sendNotification($this->user, $this->invoice, $this->type, $this->payment);
|
||||
$userMailer->sendNotification($this->user, $this->invoice, $this->type, $this->payment, $this->notes);
|
||||
}
|
||||
}
|
||||
|
@ -20,13 +20,13 @@ class NotificationListener
|
||||
* @param $type
|
||||
* @param null $payment
|
||||
*/
|
||||
private function sendEmails($invoice, $type, $payment = null)
|
||||
private function sendEmails($invoice, $type, $payment = null, $notes = false)
|
||||
{
|
||||
foreach ($invoice->account->users as $user)
|
||||
{
|
||||
if ($user->{"notify_{$type}"})
|
||||
{
|
||||
dispatch(new SendNotificationEmail($user, $invoice, $type, $payment));
|
||||
dispatch(new SendNotificationEmail($user, $invoice, $type, $payment, $notes));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -36,7 +36,7 @@ class NotificationListener
|
||||
*/
|
||||
public function emailedInvoice(InvoiceWasEmailed $event)
|
||||
{
|
||||
$this->sendEmails($event->invoice, 'sent');
|
||||
$this->sendEmails($event->invoice, 'sent', null, $event->notes);
|
||||
dispatch(new SendPushNotification($event->invoice, 'sent'));
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ class NotificationListener
|
||||
*/
|
||||
public function emailedQuote(QuoteWasEmailed $event)
|
||||
{
|
||||
$this->sendEmails($event->quote, 'sent');
|
||||
$this->sendEmails($event->quote, 'sent', null, $event->notes);
|
||||
dispatch(new SendPushNotification($event->quote, 'sent'));
|
||||
}
|
||||
|
||||
|
@ -105,9 +105,9 @@ class ContactMailer extends Mailer
|
||||
|
||||
if ($sent === true) {
|
||||
if ($invoice->isType(INVOICE_TYPE_QUOTE)) {
|
||||
event(new QuoteWasEmailed($invoice));
|
||||
event(new QuoteWasEmailed($invoice, $reminder));
|
||||
} else {
|
||||
event(new InvoiceWasEmailed($invoice));
|
||||
event(new InvoiceWasEmailed($invoice, $reminder));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,8 @@ class UserMailer extends Mailer
|
||||
User $user,
|
||||
Invoice $invoice,
|
||||
$notificationType,
|
||||
Payment $payment = null
|
||||
Payment $payment = null,
|
||||
$notes = false
|
||||
) {
|
||||
if (! $user->email || $user->cannot('view', $invoice)) {
|
||||
return;
|
||||
@ -81,6 +82,10 @@ class UserMailer extends Mailer
|
||||
'client' => $client->getDisplayName(),
|
||||
]);
|
||||
|
||||
if ($notes) {
|
||||
$subject .= ' [' . trans('texts.notes_' . $notes) . ']';
|
||||
}
|
||||
|
||||
$this->sendTo($user->email, CONTACT_EMAIL, CONTACT_NAME, $subject, $view, $data);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user