mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 22:54:25 +01:00
Smooth out cron jobs
This commit is contained in:
parent
5140046cb6
commit
a91feab3b6
@ -84,7 +84,7 @@ class Kernel extends ConsoleKernel
|
||||
$schedule->job(new TaskScheduler())->dailyAt('06:50')->withoutOverlapping();
|
||||
|
||||
/* Performs system maintenance such as pruning the backup table */
|
||||
$schedule->job(new SystemMaintenance)->weekly()->withoutOverlapping();
|
||||
$schedule->job(new SystemMaintenance)->sundays()->at('02:30')->withoutOverlapping();
|
||||
|
||||
/* Pulls in bank transactions from third party services */
|
||||
$schedule->job(new BankTransactionSync)->dailyAt('04:10')->withoutOverlapping();
|
||||
|
@ -49,10 +49,6 @@ class SystemMaintenance implements ShouldQueue
|
||||
|
||||
nlog('Starting System Maintenance');
|
||||
|
||||
if (Ninja::isHosted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$delete_pdf_days = config('ninja.maintenance.delete_pdfs');
|
||||
|
||||
nlog("Number of days to keep PDFs {$delete_pdf_days}");
|
||||
|
@ -87,7 +87,7 @@ class ReminderJob implements ShouldQueue
|
||||
$query->where('is_disabled', 0);
|
||||
})
|
||||
->with('invitations')->cursor()->each(function ($invoice) {
|
||||
if ($invoice->isPayable()) {
|
||||
if ($invoice->refresh() && $invoice->isPayable()) {
|
||||
|
||||
//Attempts to prevent duplicates from sending
|
||||
if($invoice->reminder_last_sent && Carbon::parse($invoice->reminder_last_sent)->startOfDay()->eq(now()->startOfDay())){
|
||||
@ -97,9 +97,8 @@ class ReminderJob implements ShouldQueue
|
||||
|
||||
$reminder_template = $invoice->calculateTemplate('invoice');
|
||||
nlog("reminder template = {$reminder_template}");
|
||||
$invoice = $this->calcLateFee($invoice, $reminder_template);
|
||||
$invoice->service()->touchReminder($reminder_template)->save();
|
||||
$invoice->service()->touchPdf(true);
|
||||
$invoice = $this->calcLateFee($invoice, $reminder_template);
|
||||
|
||||
//20-04-2022 fixes for endless reminders - generic template naming was wrong
|
||||
$enabled_reminder = 'enable_'.$reminder_template;
|
||||
@ -220,16 +219,18 @@ class ReminderJob implements ShouldQueue
|
||||
$invoice->client->service()->updateBalance($invoice->balance - $temp_invoice_balance);
|
||||
$invoice->ledger()->updateInvoiceBalance($invoice->balance - $temp_invoice_balance, "Late Fee Adjustment for invoice {$invoice->number}");
|
||||
|
||||
$transaction = [
|
||||
'invoice' => $invoice->transaction_event(),
|
||||
'payment' => [],
|
||||
'client' => $invoice->client->transaction_event(),
|
||||
'credit' => [],
|
||||
'metadata' => ['setLateFee'],
|
||||
];
|
||||
// $transaction = [
|
||||
// 'invoice' => $invoice->transaction_event(),
|
||||
// 'payment' => [],
|
||||
// 'client' => $invoice->client->transaction_event(),
|
||||
// 'credit' => [],
|
||||
// 'metadata' => ['setLateFee'],
|
||||
// ];
|
||||
|
||||
// TransactionLog::dispatch(TransactionEvent::CLIENT_STATUS, $transaction, $invoice->company->db);
|
||||
|
||||
$invoice->service()->touchPdf(true);
|
||||
|
||||
return $invoice;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user