close #2255 #2251 Fixed: Software Generates all recurring invoices in one swoop the next day after the first invoice is manually created.

This commit is contained in:
Cüneyt Şentürk 2021-10-07 10:33:05 +03:00
parent 49226b02de
commit e30284982b

View File

@ -40,7 +40,7 @@ class RecurringCheck extends Command
config(['laravel-model-caching.enabled' => false]);
// Get all recurring
$recurring = Recurring::allCompanies()->with('company')->cursor();
$recurring = Recurring::allCompanies()->with('company')->get();
$this->info('Creating recurring records ' . $recurring->count());
@ -112,6 +112,11 @@ class RecurringCheck extends Command
foreach ($schedules as $schedule) {
$schedule_date = Date::parse($schedule->getStart()->format('Y-m-d'));
// Don't recur the future
if ($schedule_date->greaterThan($today)) {
continue;
}
$this->recur($model, $recur->recurable_type, $schedule_date);
}
}