mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Fix CLI auto-billing
This commit is contained in:
parent
e2088d81d3
commit
050739e7fd
@ -10,6 +10,7 @@ use App\Services\PaymentService;
|
||||
use DateTime;
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Auth;
|
||||
|
||||
/**
|
||||
* Class SendRecurringInvoices.
|
||||
@ -91,12 +92,14 @@ class SendRecurringInvoices extends Command
|
||||
|
||||
$account = $recurInvoice->account;
|
||||
$account->loadLocalizationSettings($recurInvoice->client);
|
||||
Auth::loginUsingId($recurInvoice->user_id);
|
||||
$invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice);
|
||||
|
||||
if ($invoice && ! $invoice->isPaid()) {
|
||||
$this->info('Sending Invoice');
|
||||
$this->mailer->sendInvoice($invoice);
|
||||
}
|
||||
Auth::logout();
|
||||
}
|
||||
|
||||
$delayedAutoBillInvoices = Invoice::with('account.timezone', 'recurring_invoice', 'invoice_items', 'client', 'user')
|
||||
@ -115,7 +118,9 @@ class SendRecurringInvoices extends Command
|
||||
|
||||
if ($invoice->getAutoBillEnabled() && $invoice->client->autoBillLater()) {
|
||||
$this->info('Processing Autobill-delayed Invoice ' . $invoice->id);
|
||||
Auth::loginUsingId($invoice->user_id);
|
||||
$this->paymentService->autoBillInvoice($invoice);
|
||||
Auth::logout();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ use Auth;
|
||||
use DB;
|
||||
use Request;
|
||||
use Utils;
|
||||
use App;
|
||||
|
||||
class ActivityRepository
|
||||
{
|
||||
@ -56,9 +57,9 @@ class ActivityRepository
|
||||
} else {
|
||||
$activity->user_id = $entity->user_id;
|
||||
$activity->account_id = $entity->account_id;
|
||||
$activity->is_system = true;
|
||||
}
|
||||
|
||||
$activity->is_system = App::runningInConsole();
|
||||
$activity->token_id = session('token_id');
|
||||
|
||||
return $activity;
|
||||
|
Loading…
Reference in New Issue
Block a user