1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00

Fix CLI auto-billing

This commit is contained in:
Hillel Coren 2017-05-29 13:47:48 +03:00
parent 38f7b14f71
commit 4d1b64c041
2 changed files with 7 additions and 1 deletions

View File

@ -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();
}
}

View File

@ -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;