1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

Add invitation to payment emails

This commit is contained in:
David Bomba 2023-10-24 15:08:13 +11:00
parent 30f349ae13
commit e69869e06c
2 changed files with 25 additions and 4 deletions

View File

@ -83,11 +83,21 @@ class EmailPayment implements ShouldQueue
$invitation = null;
$nmo = new NinjaMailerObject;
if ($this->payment->invoices && $this->payment->invoices->count() >= 1) {
$invitation = $this->payment->invoices->first()->invitations()->first();
if($this->contact){
$invitation = $this->payment->invoices->first()->invitations()->where('contact_id', $this->contact->id)->first();
}
else
$invitation = $this->payment->invoices->first()->invitations()->first();
if($invitation)
$nmo->invitation = $invitation;
}
$nmo = new NinjaMailerObject;
$nmo->mailable = new TemplateEmail($email_builder, $this->contact, $invitation);
$nmo->to_user = $this->contact;
$nmo->settings = $this->settings;

View File

@ -88,11 +88,22 @@ class EmailRefundPayment implements ShouldQueue
$invitation = null;
$nmo = new NinjaMailerObject;
if ($this->payment->invoices && $this->payment->invoices->count() >= 1) {
$invitation = $this->payment->invoices->first()->invitations()->first();
if($this->contact) {
$invitation = $this->payment->invoices->first()->invitations()->where('contact_id', $this->contact->id)->first();
} else {
$invitation = $this->payment->invoices->first()->invitations()->first();
}
if($invitation)
$nmo->invitation = $invitation;
}
$nmo = new NinjaMailerObject;
$nmo->mailable = new TemplateEmail($email_builder, $this->contact, $invitation);
$nmo->to_user = $this->contact;
$nmo->settings = $this->settings;