mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Handle archived user in cron
This commit is contained in:
parent
131e50d02e
commit
429982cb38
@ -111,7 +111,7 @@ class SendRecurringInvoices extends Command
|
|||||||
|
|
||||||
$account = $recurInvoice->account;
|
$account = $recurInvoice->account;
|
||||||
$account->loadLocalizationSettings($recurInvoice->client);
|
$account->loadLocalizationSettings($recurInvoice->client);
|
||||||
Auth::loginUsingId($recurInvoice->user_id);
|
Auth::loginUsingId($recurInvoice->activeUser()->id);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice);
|
$invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice);
|
||||||
@ -157,7 +157,7 @@ class SendRecurringInvoices extends Command
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Auth::loginUsingId($invoice->user_id);
|
Auth::loginUsingId($recurInvoice->activeUser()->id);
|
||||||
$this->paymentService->autoBillInvoice($invoice);
|
$this->paymentService->autoBillInvoice($invoice);
|
||||||
Auth::logout();
|
Auth::logout();
|
||||||
}
|
}
|
||||||
|
@ -690,6 +690,15 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function activeUser()
|
||||||
|
{
|
||||||
|
if (! $this->user->trashed()) {
|
||||||
|
return $this->user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->account->users->first();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user