mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Improve template filters for bulk emails
This commit is contained in:
parent
4faf0d2e5f
commit
ea9632c72e
@ -640,8 +640,8 @@ class LoginController extends BaseController
|
||||
$parameters = ['response_type' => 'code', 'redirect_uri' => config('ninja.app_url') . "/auth/microsoft"];
|
||||
}
|
||||
|
||||
if(request()->hasHeader('X-REACT'))
|
||||
Cache::put("react_redir:".auth()->user()->account->key, 'true', 300);
|
||||
if(request()->hasHeader('X-REACT') || request()->query('react'))
|
||||
Cache::put("react_redir:".auth()->user()?->account->key, 'true', 300);
|
||||
|
||||
if (request()->has('code')) {
|
||||
return $this->handleProviderCallback($provider);
|
||||
|
@ -748,33 +748,12 @@ class InvoiceController extends BaseController
|
||||
break;
|
||||
|
||||
case 'email':
|
||||
//check query parameter for email_type and set the template else use calculateTemplate
|
||||
|
||||
// if (request()->has('email_type') && in_array(request()->input('email_type'), ['reminder1', 'reminder2', 'reminder3', 'reminder_endless', 'custom1', 'custom2', 'custom3'])) {
|
||||
if (request()->has('email_type') && property_exists($invoice->company->settings, request()->input('email_type'))) {
|
||||
$this->reminder_template = $invoice->client->getSetting(request()->input('email_type'));
|
||||
} else {
|
||||
$this->reminder_template = $invoice->calculateTemplate('invoice');
|
||||
}
|
||||
|
||||
BulkInvoiceJob::dispatch($invoice, $this->reminder_template);
|
||||
|
||||
if (! $bulk) {
|
||||
return response()->json(['message' => 'email sent'], 200);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'send_email':
|
||||
//check query parameter for email_type and set the template else use calculateTemplate
|
||||
|
||||
$template = request()->has('email_type') ? request()->input('email_type') : $invoice->calculateTemplate('invoice');
|
||||
|
||||
if (request()->has('email_type') && property_exists($invoice->company->settings, request()->input('email_type'))) {
|
||||
$this->reminder_template = $invoice->client->getSetting(request()->input('email_type'));
|
||||
} else {
|
||||
$this->reminder_template = $invoice->calculateTemplate('invoice');
|
||||
}
|
||||
|
||||
BulkInvoiceJob::dispatch($invoice, $this->reminder_template);
|
||||
BulkInvoiceJob::dispatch($invoice, $template);
|
||||
|
||||
if (! $bulk) {
|
||||
return response()->json(['message' => 'email sent'], 200);
|
||||
|
@ -24,7 +24,8 @@ class BulkInvoiceRequest extends Request
|
||||
{
|
||||
return [
|
||||
'action' => 'required|string',
|
||||
'ids' => 'required'
|
||||
'ids' => 'required',
|
||||
'email_type' => 'sometimes|in:reminder1,reminder2,reminder3,reminder_endless,custom1,custom2,custom3,invoice,quote,credit,payment,payment_partial,statement,purchase_order'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user