mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #7077 from turbo124/master
Fixes for Send Notification Mailer
This commit is contained in:
commit
d5e5acf6c4
@ -140,7 +140,7 @@ class ClientPortalController extends BaseController
|
|||||||
$paymentURL = '';
|
$paymentURL = '';
|
||||||
if (count($paymentTypes) == 1) {
|
if (count($paymentTypes) == 1) {
|
||||||
$paymentURL = $paymentTypes[0]['url'];
|
$paymentURL = $paymentTypes[0]['url'];
|
||||||
if (in_array($paymentTypes[0]['gatewayTypeId'], [GATEWAY_TYPE_CUSTOM1, GATEWAY_TYPE_CUSTOM2, GATEWAY_TYPE_CUSTOM3])) {
|
if (array_key_exists('gatewayTypeId', $paymentTypes[0]) && in_array($paymentTypes[0]['gatewayTypeId'], [GATEWAY_TYPE_CUSTOM1, GATEWAY_TYPE_CUSTOM2, GATEWAY_TYPE_CUSTOM3])) {
|
||||||
// do nothing
|
// do nothing
|
||||||
} elseif (! $account->isGatewayConfigured(GATEWAY_PAYPAL_EXPRESS)) {
|
} elseif (! $account->isGatewayConfigured(GATEWAY_PAYPAL_EXPRESS)) {
|
||||||
$paymentURL = URL::to($paymentURL);
|
$paymentURL = URL::to($paymentURL);
|
||||||
@ -162,6 +162,11 @@ class ClientPortalController extends BaseController
|
|||||||
$showApprove = false;
|
$showApprove = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$gatewayTypeIdCast = false;
|
||||||
|
|
||||||
|
if(count($paymentTypes) >= 1 && array_key_exists('gatewayTypeId', $paymentTypes[0]))
|
||||||
|
$gatewayTypeIdCast = $paymentTypes[0]['gatewayTypeId'];
|
||||||
|
|
||||||
$data += [
|
$data += [
|
||||||
'account' => $account,
|
'account' => $account,
|
||||||
'showApprove' => $showApprove,
|
'showApprove' => $showApprove,
|
||||||
@ -173,7 +178,7 @@ class ClientPortalController extends BaseController
|
|||||||
'paymentTypes' => $paymentTypes,
|
'paymentTypes' => $paymentTypes,
|
||||||
'paymentURL' => $paymentURL,
|
'paymentURL' => $paymentURL,
|
||||||
'phantomjs' => Request::has('phantomjs'),
|
'phantomjs' => Request::has('phantomjs'),
|
||||||
'gatewayTypeId' => count($paymentTypes) == 1 ? $paymentTypes[0]['gatewayTypeId'] : false,
|
'gatewayTypeId' => count($paymentTypes) == 1 ? $gatewayTypeIdCast : false,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($invoice->canBePaid()) {
|
if ($invoice->canBePaid()) {
|
||||||
|
@ -25,9 +25,9 @@ use App\Services\RecurringInvoiceService;
|
|||||||
use Auth;
|
use Auth;
|
||||||
use Cache;
|
use Cache;
|
||||||
use DB;
|
use DB;
|
||||||
|
use Illuminate\Support\Facades\Session;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Request;
|
use Request;
|
||||||
use Session;
|
|
||||||
use URL;
|
use URL;
|
||||||
use Utils;
|
use Utils;
|
||||||
use View;
|
use View;
|
||||||
@ -427,7 +427,7 @@ class InvoiceController extends BaseController
|
|||||||
$response = $this->emailRecurringInvoice($invoice);
|
$response = $this->emailRecurringInvoice($invoice);
|
||||||
} else {
|
} else {
|
||||||
$userId = Auth::user()->id;
|
$userId = Auth::user()->id;
|
||||||
$this->dispatch(new SendInvoiceEmail($invoice, $userId, $reminder, $template));
|
dispatch(new SendInvoiceEmail($invoice, $userId, $reminder, $template));
|
||||||
$response = true;
|
$response = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class SendInvoiceEmail extends Job implements ShouldQueue
|
|||||||
/**
|
/**
|
||||||
* @var Invoice
|
* @var Invoice
|
||||||
*/
|
*/
|
||||||
protected $invoice;
|
public $invoice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
|
@ -2,51 +2,53 @@
|
|||||||
|
|
||||||
namespace App\Jobs;
|
namespace App\Jobs;
|
||||||
|
|
||||||
|
use App\Models\Invoice;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
|
use App\Models\Traits\SerialisesDeletedModels;
|
||||||
|
use App\Models\User;
|
||||||
use App\Ninja\Mailers\UserMailer;
|
use App\Ninja\Mailers\UserMailer;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use App\Models\Traits\SerialisesDeletedModels;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class SendInvoiceEmail.
|
* Class SendInvoiceEmail.
|
||||||
*/
|
*/
|
||||||
class SendNotificationEmail extends Job implements ShouldQueue
|
class SendNotificationEmail extends Job implements ShouldQueue
|
||||||
{
|
{
|
||||||
use InteractsWithQueue, SerializesModels, SerialisesDeletedModels {
|
use InteractsWithQueue;
|
||||||
SerialisesDeletedModels::getRestoredPropertyValue insteadof SerializesModels;
|
|
||||||
}
|
public $deleteWhenMissingModels = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var User
|
* @var User
|
||||||
*/
|
*/
|
||||||
protected $user;
|
public User $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Invoice
|
* @var Invoice
|
||||||
*/
|
*/
|
||||||
protected $invoice;
|
public Invoice $invoice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $type;
|
public $type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Payment
|
* @var Payment
|
||||||
*/
|
*/
|
||||||
protected $payment;
|
public ?Payment $payment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $notes;
|
public $notes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $server;
|
public $server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new job instance.
|
* Create a new job instance.
|
||||||
@ -59,7 +61,7 @@ class SendNotificationEmail extends Job implements ShouldQueue
|
|||||||
* @param mixed $type
|
* @param mixed $type
|
||||||
* @param mixed $payment
|
* @param mixed $payment
|
||||||
*/
|
*/
|
||||||
public function __construct($user, $invoice, $type, $payment, $notes)
|
public function __construct(User $user, Invoice $invoice, $type, ?Payment $payment, $notes)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->invoice = $invoice;
|
$this->invoice = $invoice;
|
||||||
|
@ -1,17 +1,20 @@
|
|||||||
<?php namespace App\Listeners;
|
<?php
|
||||||
|
|
||||||
|
namespace App\Listeners;
|
||||||
|
|
||||||
use App\Ninja\Mailers\UserMailer;
|
|
||||||
use App\Ninja\Mailers\ContactMailer;
|
|
||||||
use App\Events\InvoiceWasEmailed;
|
|
||||||
use App\Events\QuoteWasEmailed;
|
|
||||||
use App\Events\InvoiceInvitationWasViewed;
|
use App\Events\InvoiceInvitationWasViewed;
|
||||||
use App\Events\QuoteInvitationWasViewed;
|
use App\Events\InvoiceWasEmailed;
|
||||||
use App\Events\QuoteInvitationWasApproved;
|
|
||||||
use App\Events\PaymentWasCreated;
|
use App\Events\PaymentWasCreated;
|
||||||
use App\Services\PushService;
|
use App\Events\QuoteInvitationWasApproved;
|
||||||
|
use App\Events\QuoteInvitationWasViewed;
|
||||||
|
use App\Events\QuoteWasEmailed;
|
||||||
use App\Jobs\SendNotificationEmail;
|
use App\Jobs\SendNotificationEmail;
|
||||||
use App\Jobs\SendPaymentEmail;
|
use App\Jobs\SendPaymentEmail;
|
||||||
|
use App\Models\Invoice;
|
||||||
|
use App\Ninja\Mailers\ContactMailer;
|
||||||
|
use App\Ninja\Mailers\UserMailer;
|
||||||
use App\Notifications\PaymentCreated;
|
use App\Notifications\PaymentCreated;
|
||||||
|
use App\Services\PushService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class NotificationListener
|
* Class NotificationListener
|
||||||
@ -49,7 +52,7 @@ class NotificationListener
|
|||||||
* @param $type
|
* @param $type
|
||||||
* @param null $payment
|
* @param null $payment
|
||||||
*/
|
*/
|
||||||
private function sendNotifications($invoice, $type, $payment = null, $notes = false)
|
private function sendNotifications(Invoice $invoice, $type, $payment = null, $notes = false)
|
||||||
{
|
{
|
||||||
foreach ($invoice->account->users as $user)
|
foreach ($invoice->account->users as $user)
|
||||||
{
|
{
|
||||||
|
@ -73,7 +73,7 @@ class UserMailer extends Mailer
|
|||||||
User $user,
|
User $user,
|
||||||
Invoice $invoice,
|
Invoice $invoice,
|
||||||
$notificationType,
|
$notificationType,
|
||||||
Payment $payment = null,
|
?Payment $payment,
|
||||||
$notes = false
|
$notes = false
|
||||||
) {
|
) {
|
||||||
if (! $user->shouldNotify($invoice)) {
|
if (! $user->shouldNotify($invoice)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user