mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Use queues in recurring command
This commit is contained in:
parent
497154becb
commit
512badb9cf
@ -5,10 +5,10 @@ namespace App\Console\Commands;
|
||||
use App\Models\Account;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\RecurringExpense;
|
||||
use App\Ninja\Mailers\ContactMailer as Mailer;
|
||||
use App\Ninja\Repositories\InvoiceRepository;
|
||||
use App\Ninja\Repositories\RecurringExpenseRepository;
|
||||
use App\Services\PaymentService;
|
||||
use App\Jobs\SendInvoiceEmail;
|
||||
use DateTime;
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
@ -31,11 +31,6 @@ class SendRecurringInvoices extends Command
|
||||
*/
|
||||
protected $description = 'Send recurring invoices';
|
||||
|
||||
/**
|
||||
* @var Mailer
|
||||
*/
|
||||
protected $mailer;
|
||||
|
||||
/**
|
||||
* @var InvoiceRepository
|
||||
*/
|
||||
@ -49,15 +44,13 @@ class SendRecurringInvoices extends Command
|
||||
/**
|
||||
* SendRecurringInvoices constructor.
|
||||
*
|
||||
* @param Mailer $mailer
|
||||
* @param InvoiceRepository $invoiceRepo
|
||||
* @param PaymentService $paymentService
|
||||
*/
|
||||
public function __construct(Mailer $mailer, InvoiceRepository $invoiceRepo, PaymentService $paymentService, RecurringExpenseRepository $recurringExpenseRepo)
|
||||
public function __construct(InvoiceRepository $invoiceRepo, PaymentService $paymentService, RecurringExpenseRepository $recurringExpenseRepo)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->mailer = $mailer;
|
||||
$this->invoiceRepo = $invoiceRepo;
|
||||
$this->paymentService = $paymentService;
|
||||
$this->recurringExpenseRepo = $recurringExpenseRepo;
|
||||
@ -117,7 +110,7 @@ class SendRecurringInvoices extends Command
|
||||
$invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice);
|
||||
if ($invoice && ! $invoice->isPaid() && $account->auto_email_invoice) {
|
||||
$this->info('Not billed - Sending Invoice');
|
||||
$this->mailer->sendInvoice($invoice);
|
||||
dispatch(new SendInvoiceEmail($invoice, $invoice->user_id));
|
||||
} elseif ($invoice) {
|
||||
$this->info('Successfully billed invoice');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user