1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for failed payment email

This commit is contained in:
= 2022-05-17 11:18:34 +10:00
parent c59b7e0187
commit b29831f8a4
2 changed files with 17 additions and 5 deletions

View File

@ -111,9 +111,10 @@ class PaymentFailedMailer implements ShouldQueue
//add client payment failures here.
//
if($contact = $this->client->contacts()->first() && $this->payment_hash)
if($this->client->contacts()->whereNotNull('email')->exists() && $this->payment_hash)
{
$contact = $this->client->contacts()->whereNotNull('email')->first();
$mail_obj = (new ClientPaymentFailureObject($this->client, $this->error, $this->company, $this->payment_hash))->build();
$nmo = new NinjaMailerObject;

View File

@ -32,7 +32,11 @@ trait UserNotifies
$notifiable_methods = [];
$notifications = $company_user->notifications;
if ($invitation->company->is_disabled && is_array($notifications->email) || $company_user->trashed() || $company_user->user->trashed()) {
if ($invitation->company->is_disabled &&
is_array($notifications->email) ||
$company_user->trashed() ||
!$company_user->user ||
$company_user->user->trashed()) {
return [];
}
@ -56,7 +60,11 @@ trait UserNotifies
$notifiable_methods = [];
$notifications = $company_user->notifications;
if ($entity->company->is_disabled || ! $notifications || $company_user->trashed() || $company_user->user->trashed()) {
if ($entity->company->is_disabled ||
! $notifications ||
$company_user->trashed() ||
! $company_user->user ||
$company_user->user->trashed()) {
return [];
}
@ -125,7 +133,10 @@ trait UserNotifies
public function findCompanyUserNotificationType($company_user, $required_permissions) :array
{
if ($company_user->company->is_disabled || $company_user->trashed() || $company_user->user->trashed()) {
if ($company_user->company->is_disabled ||
$company_user->trashed() ||
!$company_user->user ||
$company_user->user->trashed()) {
return [];
}