From e30284982bc2cb8617d2ec75ff029b8a9afe0ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Thu, 7 Oct 2021 10:33:05 +0300 Subject: [PATCH] close #2255 #2251 Fixed: Software Generates all recurring invoices in one swoop the next day after the first invoice is manually created. --- app/Console/Commands/RecurringCheck.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/RecurringCheck.php b/app/Console/Commands/RecurringCheck.php index df5c9f305..f29cf3ce0 100644 --- a/app/Console/Commands/RecurringCheck.php +++ b/app/Console/Commands/RecurringCheck.php @@ -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); } }