Disable recurring invoice payment notifications

This commit is contained in:
David Bomba 2025-07-04 11:40:49 +10:00
parent 9112e69cfe
commit b70b3c76d8
2 changed files with 9 additions and 0 deletions

View File

@ -110,6 +110,13 @@ class PaymentNotification implements ShouldQueue
if (($key = array_search('mail', $methods)) !== false) { if (($key = array_search('mail', $methods)) !== false) {
unset($methods[$key]); unset($methods[$key]);
//new check, IF the payment is on a recurring invoice AND the user had notifications disabled for recurring invoices. then we disable the notification for this payment.
$disabled_recurring_invoice_notifications = $this->findUserEntityNotificationType($payment, $company_user,['disable_recurring_payment_notification']);
if ($payment->invoices->first()->recurring_id && (array_search('mail', $disabled_recurring_invoice_notifications) !== false)) {
continue;
}
$nmo = new NinjaMailerObject(); $nmo = new NinjaMailerObject();
$nmo->mailable = new NinjaMailer((new EntityPaidObject($payment, $company_user->portalType()))->build()); $nmo->mailable = new NinjaMailer((new EntityPaidObject($payment, $company_user->portalType()))->build());
$nmo->company = $event->company; $nmo->company = $event->company;

View File

@ -5591,6 +5591,8 @@ $lang = array(
'docuninja_disable_warning' => 'This will remove all access to your DocuNinja account.', 'docuninja_disable_warning' => 'This will remove all access to your DocuNinja account.',
'docuninja_downgrade_info' => 'Your user limit will automatically be reduced at the end of the current billing cycle.', 'docuninja_downgrade_info' => 'Your user limit will automatically be reduced at the end of the current billing cycle.',
'recurring_invoice_item' => 'Recurring Invoice Item', 'recurring_invoice_item' => 'Recurring Invoice Item',
'disable_recurring_payment_notification' => 'Disable Recurring Payment Notification',
'disable_recurring_payment_notification_help' => 'Successful recurring invoice payment notifications will not be sent.',
); );
return $lang; return $lang;