diff --git a/app/Http/Controllers/Recurring/IndexController.php b/app/Http/Controllers/Recurring/IndexController.php index 5981e82c1e..e26a5507fe 100644 --- a/app/Http/Controllers/Recurring/IndexController.php +++ b/app/Http/Controllers/Recurring/IndexController.php @@ -29,6 +29,7 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\Recurrence; use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface; +use FireflyIII\Support\Http\Controllers\GetConfigurationData; use FireflyIII\Transformers\RecurrenceTransformer; use Illuminate\Http\Request; use Illuminate\Pagination\LengthAwarePaginator; @@ -41,6 +42,7 @@ use Symfony\Component\HttpFoundation\ParameterBag; */ class IndexController extends Controller { + use GetConfigurationData; /** @var RecurringRepositoryInterface Recurring repository */ private $recurring; @@ -97,6 +99,8 @@ class IndexController extends Controller $paginator = new LengthAwarePaginator($recurring, $total, $pageSize, $page); $paginator->setPath(route('recurring.index')); + $this->verifyRecurringCronJob(); + return view('recurring.index', compact('paginator', 'page', 'pageSize', 'total')); } diff --git a/app/Support/Http/Controllers/GetConfigurationData.php b/app/Support/Http/Controllers/GetConfigurationData.php index 824a5e1f11..2c46da121c 100644 --- a/app/Support/Http/Controllers/GetConfigurationData.php +++ b/app/Support/Http/Controllers/GetConfigurationData.php @@ -33,6 +33,7 @@ use Log; */ trait GetConfigurationData { + /** * All packages that are installed. * @@ -247,4 +248,21 @@ trait GetConfigurationData return false; } + + /** + * + */ + protected function verifyRecurringCronJob(): void + { + $config = app('fireflyconfig')->get('last_rt_job', 0); + $lastTime = (int)$config->data; + $now = time(); + if (0 === $lastTime) { + request()->session()->flash('info', trans('firefly.recurring_never_cron')); + return; + } + if($now - $lastTime > 129600) { + request()->session()->flash('warning', trans('firefly.recurring_cron_long_ago')); + } + } } \ No newline at end of file diff --git a/app/Support/Http/Controllers/PeriodOverview.php b/app/Support/Http/Controllers/PeriodOverview.php index 62bc74e7c6..c0b13e0b7b 100644 --- a/app/Support/Http/Controllers/PeriodOverview.php +++ b/app/Support/Http/Controllers/PeriodOverview.php @@ -59,8 +59,6 @@ use Illuminate\Support\Collection; */ trait PeriodOverview { - - /** * This method returns "period entries", so nov-2015, dec-2015, etc etc (this depends on the users session range) * and for each period, the amount of money spent and earned. This is a complex operation which is cached for diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index 847f9162ca..933466992f 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -1266,6 +1266,8 @@ return [ 'created_Deposits' => 'Created deposits', 'created_Transfers' => 'Created transfers', 'created_from_recurrence' => 'Created from recurring transaction ":title" (#:id)', + 'recurring_never_cron' => 'It seems the cron job that is necessary to support recurring transactions has never run. This is of course normal when you have just installed Firefly III, but this should be something to set up as soon as possible. Please check out the help-pages using the (?)-icon in the top right corner of the page.', + 'recurring_cron_long_ago' => 'It looks like it has been more than 36 hours since the cron job to support recurring transactions has fired for the last time. Are you sure it has been set up correctly? Please check out the help-pages using the (?)-icon in the top right corner of the page.', 'recurring_meta_field_tags' => 'Tags', 'recurring_meta_field_notes' => 'Notes',