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) {
$response = $this->emailRecurringInvoice($invoice);
} else {
app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice, false, $pdfUpload);
// TODO remove this with Laravel 5.3 (https://github.com/invoiceninja/invoiceninja/issues/1303)
if (config('queue.default') === 'sync') {
$response = app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice, false, $pdfUpload);
} else {
$this->dispatch(new SendInvoiceEmail($invoice, false, $pdfUpload));
$response = true;
//$this->dispatch(new SendInvoiceEmail($invoice, false, $pdfUpload));
//return true;
}
}
if ($response === true) {
@ -448,9 +451,13 @@ class InvoiceController extends BaseController
if ($invoice->isPaid()) {
return true;
} else {
// TODO remove this with Laravel 5.3 (https://github.com/invoiceninja/invoiceninja/issues/1303)
if (config('queue.default') === 'sync') {
return app('App\Ninja\Mailers\ContactMailer')->sendInvoice($invoice);
//$this->dispatch(new SendInvoiceEmail($invoice));
//return true;
} 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) {
$actions[] = \DropdownButton::DIVIDER;
/*
$actions[] = [
'label' => mtrans($this->entityType, 'email_' . $this->entityType),
'url' => 'javascript:submitForm_'.$this->entityType.'("emailInvoice")',
];
*/
$actions[] = [
'label' => mtrans($this->entityType, 'mark_sent'),
'url' => 'javascript:submitForm_'.$this->entityType.'("markSent")',

View File

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