mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for email payment
This commit is contained in:
parent
e302b9f9cb
commit
7955548b87
@ -11,20 +11,15 @@
|
|||||||
|
|
||||||
namespace App\Services\Payment;
|
namespace App\Services\Payment;
|
||||||
|
|
||||||
|
use App\Models\Payment;
|
||||||
|
use App\Models\ClientContact;
|
||||||
use App\Jobs\Payment\EmailPayment;
|
use App\Jobs\Payment\EmailPayment;
|
||||||
|
|
||||||
class SendEmail
|
class SendEmail
|
||||||
{
|
{
|
||||||
public $payment;
|
|
||||||
|
|
||||||
public $contact;
|
public function __construct(public Payment $payment, public ?ClientContact $contact)
|
||||||
|
{}
|
||||||
public function __construct($payment, $contact)
|
|
||||||
{
|
|
||||||
$this->payment = $payment;
|
|
||||||
|
|
||||||
$this->contact = $contact;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the correct template to send.
|
* Builds the correct template to send.
|
||||||
@ -34,12 +29,13 @@ class SendEmail
|
|||||||
{
|
{
|
||||||
$this->payment->load('company', 'client.contacts', 'invoices');
|
$this->payment->load('company', 'client.contacts', 'invoices');
|
||||||
|
|
||||||
$contact = $this->payment->client->contacts()->first();
|
if(!$this->contact)
|
||||||
|
$this->contact = $this->payment->client->contacts()->first();
|
||||||
|
|
||||||
// $this->payment->invoices->sortByDesc('id')->first(function ($invoice) {
|
// $this->payment->invoices->sortByDesc('id')->first(function ($invoice) {
|
||||||
// $invoice->invitations->each(function ($invitation) {
|
// $invoice->invitations->each(function ($invitation) {
|
||||||
// if (!$invitation->contact->trashed() && $invitation->contact->email) {
|
// if (!$invitation->contact->trashed() && $invitation->contact->email) {
|
||||||
EmailPayment::dispatch($this->payment, $this->payment->company, $contact);
|
EmailPayment::dispatch($this->payment, $this->payment->company, $this->contact);
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user