Re-enable support for queues

This commit is contained in:
Hillel Coren 2017-02-02 14:05:51 +02:00
parent ef46bb0050
commit 6e18841cea
3 changed files with 20 additions and 11 deletions

View File

@ -415,10 +415,13 @@ class InvoiceController extends BaseController
if ($invoice->is_recurring) { if ($invoice->is_recurring) {
$response = $this->emailRecurringInvoice($invoice); $response = $this->emailRecurringInvoice($invoice);
} else { } else {
app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice, false, $pdfUpload); // TODO remove this with Laravel 5.3 (https://github.com/invoiceninja/invoiceninja/issues/1303)
$response = true; if (config('queue.default') === 'sync') {
//$this->dispatch(new SendInvoiceEmail($invoice, false, $pdfUpload)); $response = app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice, false, $pdfUpload);
//return true; } else {
$this->dispatch(new SendInvoiceEmail($invoice, false, $pdfUpload));
$response = true;
}
} }
if ($response === true) { if ($response === true) {
@ -448,9 +451,13 @@ class InvoiceController extends BaseController
if ($invoice->isPaid()) { if ($invoice->isPaid()) {
return true; return true;
} else { } else {
return app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice); // TODO remove this with Laravel 5.3 (https://github.com/invoiceninja/invoiceninja/issues/1303)
//$this->dispatch(new SendInvoiceEmail($invoice)); if (config('queue.default') === 'sync') {
//return true; return app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice);
} else {
$this->dispatch(new SendInvoiceEmail($invoice));
return true;
}
} }
} }

View File

@ -180,12 +180,10 @@ class InvoiceDatatable extends EntityDatatable
if ($this->entityType == ENTITY_INVOICE || $this->entityType == ENTITY_QUOTE) { if ($this->entityType == ENTITY_INVOICE || $this->entityType == ENTITY_QUOTE) {
$actions[] = \DropdownButton::DIVIDER; $actions[] = \DropdownButton::DIVIDER;
/*
$actions[] = [ $actions[] = [
'label' => mtrans($this->entityType, 'email_' . $this->entityType), 'label' => mtrans($this->entityType, 'email_' . $this->entityType),
'url' => 'javascript:submitForm_'.$this->entityType.'("emailInvoice")', 'url' => 'javascript:submitForm_'.$this->entityType.'("emailInvoice")',
]; ];
*/
$actions[] = [ $actions[] = [
'label' => mtrans($this->entityType, 'mark_sent'), 'label' => mtrans($this->entityType, 'mark_sent'),
'url' => 'javascript:submitForm_'.$this->entityType.'("markSent")', 'url' => 'javascript:submitForm_'.$this->entityType.'("markSent")',

View File

@ -757,8 +757,12 @@ class InvoiceRepository extends BaseRepository
*/ */
public function emailInvoice(Invoice $invoice) public function emailInvoice(Invoice $invoice)
{ {
app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice); // TODO remove this with Laravel 5.3 (https://github.com/invoiceninja/invoiceninja/issues/1303)
//dispatch(new SendInvoiceEmail($invoice)); if (config('queue.default') === 'sync') {
app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice);
} else {
dispatch(new SendInvoiceEmail($invoice));
}
} }
/** /**