mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add time to cron logs
This commit is contained in:
parent
77cf1a4ba2
commit
85a468e85d
@ -91,7 +91,7 @@ class SendRecurringInvoices extends Command
|
||||
->whereRaw('is_deleted IS FALSE AND deleted_at IS NULL AND is_recurring IS TRUE AND is_public IS TRUE AND frequency_id > 0 AND start_date <= ? AND (end_date IS NULL OR end_date >= ?)', [$today, $today])
|
||||
->orderBy('id', 'asc')
|
||||
->get();
|
||||
$this->info($invoices->count() . ' recurring invoice(s) found');
|
||||
$this->info(date('r ') . $invoices->count() . ' recurring invoice(s) found');
|
||||
|
||||
foreach ($invoices as $recurInvoice) {
|
||||
$shouldSendToday = $recurInvoice->shouldSendToday();
|
||||
@ -100,7 +100,7 @@ class SendRecurringInvoices extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->info('Processing Invoice: '. $recurInvoice->id);
|
||||
$this->info(date('r') . ' Processing Invoice: '. $recurInvoice->id);
|
||||
|
||||
$account = $recurInvoice->account;
|
||||
$account->loadLocalizationSettings($recurInvoice->client);
|
||||
@ -109,13 +109,13 @@ class SendRecurringInvoices extends Command
|
||||
try {
|
||||
$invoice = $this->invoiceRepo->createRecurringInvoice($recurInvoice);
|
||||
if ($invoice && ! $invoice->isPaid() && $account->auto_email_invoice) {
|
||||
$this->info('Not billed - Sending Invoice');
|
||||
$this->info(date('r') . ' Not billed - Sending Invoice');
|
||||
dispatch(new SendInvoiceEmail($invoice, $invoice->user_id));
|
||||
} elseif ($invoice) {
|
||||
$this->info('Successfully billed invoice');
|
||||
$this->info(date('r') . ' Successfully billed invoice');
|
||||
}
|
||||
} catch (Exception $exception) {
|
||||
$this->info('Error: ' . $exception->getMessage());
|
||||
$this->info(date('r') . ' Error: ' . $exception->getMessage());
|
||||
Utils::logError($exception);
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ class SendRecurringInvoices extends Command
|
||||
[$today->format('Y-m-d')])
|
||||
->orderBy('invoices.id', 'asc')
|
||||
->get();
|
||||
$this->info($delayedAutoBillInvoices->count() . ' due recurring invoice instance(s) found');
|
||||
$this->info(date('r ') . $delayedAutoBillInvoices->count() . ' due recurring invoice instance(s) found');
|
||||
|
||||
/** @var Invoice $invoice */
|
||||
foreach ($delayedAutoBillInvoices as $invoice) {
|
||||
@ -142,7 +142,7 @@ class SendRecurringInvoices extends Command
|
||||
}
|
||||
|
||||
if ($invoice->getAutoBillEnabled() && $invoice->client->autoBillLater()) {
|
||||
$this->info('Processing Autobill-delayed Invoice: ' . $invoice->id);
|
||||
$this->info(date('r') . ' Processing Autobill-delayed Invoice: ' . $invoice->id);
|
||||
Auth::loginUsingId($invoice->activeUser()->id);
|
||||
$this->paymentService->autoBillInvoice($invoice);
|
||||
Auth::logout();
|
||||
@ -158,7 +158,7 @@ class SendRecurringInvoices extends Command
|
||||
->whereRaw('is_deleted IS FALSE AND deleted_at IS NULL AND start_date <= ? AND (end_date IS NULL OR end_date >= ?)', [$today, $today])
|
||||
->orderBy('id', 'asc')
|
||||
->get();
|
||||
$this->info($expenses->count() . ' recurring expenses(s) found');
|
||||
$this->info(date('r ') . $expenses->count() . ' recurring expenses(s) found');
|
||||
|
||||
foreach ($expenses as $expense) {
|
||||
$shouldSendToday = $expense->shouldSendToday();
|
||||
@ -167,7 +167,7 @@ class SendRecurringInvoices extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->info('Processing Expense: '. $expense->id);
|
||||
$this->info(date('r') . ' Processing Expense: '. $expense->id);
|
||||
$this->recurringExpenseRepo->createRecurringExpense($expense);
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ class SendReminders extends Command
|
||||
$this->sendScheduledReports();
|
||||
$this->loadExchangeRates();
|
||||
|
||||
$this->info('Done');
|
||||
$this->info(date('r') . ' Done');
|
||||
|
||||
if ($errorEmail = env('ERROR_EMAIL')) {
|
||||
\Mail::raw('EOM', function ($message) use ($errorEmail, $database) {
|
||||
@ -88,7 +88,7 @@ class SendReminders extends Command
|
||||
private function chargeLateFees()
|
||||
{
|
||||
$accounts = $this->accountRepo->findWithFees();
|
||||
$this->info($accounts->count() . ' accounts found with fees');
|
||||
$this->info(date('r ') . $accounts->count() . ' accounts found with fees');
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
if (! $account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS)) {
|
||||
@ -96,11 +96,11 @@ class SendReminders extends Command
|
||||
}
|
||||
|
||||
$invoices = $this->invoiceRepo->findNeedingReminding($account, false);
|
||||
$this->info($account->name . ': ' . $invoices->count() . ' invoices found');
|
||||
$this->info(date('r ') . $account->name . ': ' . $invoices->count() . ' invoices found');
|
||||
|
||||
foreach ($invoices as $invoice) {
|
||||
if ($reminder = $account->getInvoiceReminder($invoice, false)) {
|
||||
$this->info('Charge fee: ' . $invoice->id);
|
||||
$this->info(date('r') . ' Charge fee: ' . $invoice->id);
|
||||
$account->loadLocalizationSettings($invoice->client); // support trans to add fee line item
|
||||
$number = preg_replace('/[^0-9]/', '', $reminder);
|
||||
|
||||
@ -115,7 +115,7 @@ class SendReminders extends Command
|
||||
private function sendReminderEmails()
|
||||
{
|
||||
$accounts = $this->accountRepo->findWithReminders();
|
||||
$this->info(count($accounts) . ' accounts found with reminders');
|
||||
$this->info(date('r ') . count($accounts) . ' accounts found with reminders');
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
if (! $account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS)) {
|
||||
@ -124,27 +124,27 @@ class SendReminders extends Command
|
||||
|
||||
// standard reminders
|
||||
$invoices = $this->invoiceRepo->findNeedingReminding($account);
|
||||
$this->info($account->name . ': ' . $invoices->count() . ' invoices found');
|
||||
$this->info(date('r ') . $account->name . ': ' . $invoices->count() . ' invoices found');
|
||||
|
||||
foreach ($invoices as $invoice) {
|
||||
if ($reminder = $account->getInvoiceReminder($invoice)) {
|
||||
if ($invoice->last_sent_date == date('Y-m-d')) {
|
||||
continue;
|
||||
}
|
||||
$this->info('Send email: ' . $invoice->id);
|
||||
$this->info(date('r') . ' Send email: ' . $invoice->id);
|
||||
dispatch(new SendInvoiceEmail($invoice, $invoice->user_id, $reminder));
|
||||
}
|
||||
}
|
||||
|
||||
// endless reminders
|
||||
$invoices = $this->invoiceRepo->findNeedingEndlessReminding($account);
|
||||
$this->info($account->name . ': ' . $invoices->count() . ' endless invoices found');
|
||||
$this->info(date('r ') . $account->name . ': ' . $invoices->count() . ' endless invoices found');
|
||||
|
||||
foreach ($invoices as $invoice) {
|
||||
if ($invoice->last_sent_date == date('Y-m-d')) {
|
||||
continue;
|
||||
}
|
||||
$this->info('Send email: ' . $invoice->id);
|
||||
$this->info(date('r') . ' Send email: ' . $invoice->id);
|
||||
dispatch(new SendInvoiceEmail($invoice, $invoice->user_id, 'reminder4'));
|
||||
}
|
||||
}
|
||||
@ -155,10 +155,10 @@ class SendReminders extends Command
|
||||
$scheduledReports = ScheduledReport::where('send_date', '<=', date('Y-m-d'))
|
||||
->with('user', 'account.company')
|
||||
->get();
|
||||
$this->info($scheduledReports->count() . ' scheduled reports');
|
||||
$this->info(date('r ') . $scheduledReports->count() . ' scheduled reports');
|
||||
|
||||
foreach ($scheduledReports as $scheduledReport) {
|
||||
$this->info('Processing report: ' . $scheduledReport->id);
|
||||
$this->info(date('r') . ' Processing report: ' . $scheduledReport->id);
|
||||
|
||||
$user = $scheduledReport->user;
|
||||
$account = $scheduledReport->account;
|
||||
@ -180,12 +180,12 @@ class SendReminders extends Command
|
||||
if ($file) {
|
||||
try {
|
||||
$this->userMailer->sendScheduledReport($scheduledReport, $file);
|
||||
$this->info('Sent report');
|
||||
$this->info(date('r') . ' Sent report');
|
||||
} catch (Exception $exception) {
|
||||
$this->info('ERROR: ' . $exception->getMessage());
|
||||
$this->info(date('r') . ' ERROR: ' . $exception->getMessage());
|
||||
}
|
||||
} else {
|
||||
$this->info('ERROR: Failed to run report');
|
||||
$this->info(date('r') . ' ERROR: Failed to run report');
|
||||
}
|
||||
|
||||
$scheduledReport->updateSendDate();
|
||||
@ -200,7 +200,7 @@ class SendReminders extends Command
|
||||
return;
|
||||
}
|
||||
|
||||
$this->info('Loading latest exchange rates...');
|
||||
$this->info(date('r') . ' Loading latest exchange rates...');
|
||||
|
||||
$data = CurlUtils::get(config('ninja.exchange_rates_url'));
|
||||
$data = json_decode($data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user