From a11cf0246312b2395a6c2fc0d4c7f937e4d1d193 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 10 Jan 2018 22:19:29 +0200 Subject: [PATCH] Workaround for auto-bill w/archived user --- app/Console/Commands/SendRecurringInvoices.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Console/Commands/SendRecurringInvoices.php b/app/Console/Commands/SendRecurringInvoices.php index b608a092055d..86586efcc43e 100644 --- a/app/Console/Commands/SendRecurringInvoices.php +++ b/app/Console/Commands/SendRecurringInvoices.php @@ -150,6 +150,13 @@ class SendRecurringInvoices extends Command if ($invoice->getAutoBillEnabled() && $invoice->client->autoBillLater()) { $this->info('Processing Autobill-delayed Invoice: ' . $invoice->id); + + // TODO don't skip + if ($invoice->user->trashed()) { + $this->info('Archived user: skipping'); + continue; + } + Auth::loginUsingId($invoice->user_id); $this->paymentService->autoBillInvoice($invoice); Auth::logout();