Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Clean up cron jobs so hopefully AI tools will stop complaining.
James Cole6b9acc3ae1b3
diff --git a/app/Api/V1/Controllers/System/CronController.php b/app/Api/V1/Controllers/System/CronController.phpindex bacf67468e..d0bdabc504 100644--- a/app/Api/V1/Controllers/System/CronController.php+++ b/app/Api/V1/Controllers/System/CronController.php@@ -44,17 +44,18 @@ final class CronController extends Controller{CLIToken::routeBinder($cliToken, $request->route());$config = $request->getAll();+ $user = CLIToken::findUserByToken($cliToken);Log::debug(sprintf('Now in %s', __METHOD__));Log::debug(sprintf('Date is %s', $config['date']->toIsoString()));$return = [];- $return['recurring_transactions'] = $this->runRecurring($config['force'], $config['date']);- $return['auto_budgets'] = $this->runAutoBudget($config['force'], $config['date']);+ $return['recurring_transactions'] = $this->runRecurring($user, $config['force'], $config['date']);+ $return['auto_budgets'] = $this->runAutoBudget($user, $config['force'], $config['date']);if (true === AppConfiguration::get('enable_external_rates', config('cer.download_enabled'))->data) {- $return['exchange_rates'] = $this->exchangeRatesCronJob($config['force'], $config['date']);+ $return['exchange_rates'] = $this->exchangeRatesCronJob($user, $config['force'], $config['date']);}- $return['bill_notifications'] = $this->billWarningCronJob($config['force'], $config['date']);- $return['webhooks'] = $this->webhookCronJob($config['force'], $config['date']);+ $return['bill_notifications'] = $this->billWarningCronJob($user, $config['force'], $config['date']);+ $return['webhooks'] = $this->webhookCronJob($user, $config['force'], $config['date']);return response()->api($return);}diff --git a/app/Jobs/CreateAutoBudgetLimits.php b/app/Jobs/CreateAutoBudgetLimits.phpindex d61661dd50..0d223a3b99 100644--- a/app/Jobs/CreateAutoBudgetLimits.php+++ b/app/Jobs/CreateAutoBudgetLimits.php@@ -33,6 +33,7 @@ use FireflyIII\Models\BudgetLimit;use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;use FireflyIII\Support\Facades\Navigation;+use FireflyIII\User;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Foundation\Bus\Dispatchable;@@ -52,6 +53,7 @@ class CreateAutoBudgetLimits implements ShouldQueueuse SerializesModels;private Carbon $date;+ private User $user;/*** Create a new job instance.@@ -74,7 +76,11 @@ class CreateAutoBudgetLimits implements ShouldQueuepublic function handle(): void{Log::debug(sprintf('Now at start of CreateAutoBudgetLimits() job for %s.', $this->date->format('D d M Y')));- $autoBudgets = AutoBudget::get();++ $autoBudgets = AutoBudget::leftJoin('budgets','auto_budgets.budget_id','=','budgets.id')->where('budgets.user_id', $this->user->id)->get(['auto_budgets.*']);+ if($this->user->hasRole('owner')) {+ $autoBudgets = AutoBudget::get();+ }Log::debug(sprintf('Found %d auto budgets.', $autoBudgets->count()));foreach ($autoBudgets as $autoBudget) {$this->handleAutoBudget($autoBudget);@@ -88,6 +94,11 @@ class CreateAutoBudgetLimits implements ShouldQueue$this->date = $newDate;}+ public function setUser(User $user): void+ {+ $this->user = $user;+ }+private function createAdjustedLimit(AutoBudget $autoBudget): void{Log::debug(sprintf('Will now manage rollover for auto budget #%d', $autoBudget->id));diff --git a/app/Jobs/CreateRecurringTransactions.php b/app/Jobs/CreateRecurringTransactions.phpindex 49f1d25b8c..89cff35e45 100644--- a/app/Jobs/CreateRecurringTransactions.php+++ b/app/Jobs/CreateRecurringTransactions.php@@ -36,6 +36,7 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface;use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;use FireflyIII\Support\Facades\Preferences;+use FireflyIII\User;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Foundation\Bus\Dispatchable;@@ -54,28 +55,29 @@ class CreateRecurringTransactions implements ShouldQueueuse Queueable;use SerializesModels;- public int $created;- public int $executed;- public int $submitted;- private Carbon $date;- private bool $force;+ public int $created;+ public int $executed;+ public int $submitted;+ private Carbon $date;+ private bool $force;private TransactionGroupRepositoryInterface $groupRepository;- private Collection $groups;- private JournalRepositoryInterface $journalRepository;- private Collection $recurrences;- private RecurringRepositoryInterface $repository;+ private Collection $groups;+ private JournalRepositoryInterface $journalRepository;+ private Collection $recurrences;+ private RecurringRepositoryInterface $repository;+ private User $user;/*** Create a new job instance.*/public function __construct(?Carbon $date){- $newDate = new Carbon();+ $newDate = new Carbon();$newDate->startOfDay();- $this->date = $newDate;+ $this->date = $newDate;if ($date instanceof Carbon) {- $newDate = clone $date;+ $newDate = clone $date;$newDate->startOfDay();$this->date = $newDate;}@@ -97,6 +99,11 @@ class CreateRecurringTransactions implements ShouldQueuereturn $this->groups;}+ public function setUser(User $user): void+ {+ $this->user = $user;+ }+/*** Execute the job.*/@@ -110,7 +117,11 @@ class CreateRecurringTransactions implements ShouldQueue}if (0 === count($this->recurrences)) {Log::debug('Grab all recurrences from the database.');- $this->recurrences = $this->repository->getAll();+ $this->repository->setUser($this->user);+ $this->recurrences = $this->repository->get();+ if ($this->user->hasRole('owner')) {+ $this->recurrences = $this->repository->getAll();+ }}$result = [];@@ -119,7 +130,7 @@ class CreateRecurringTransactions implements ShouldQueueLog::debug(sprintf('Count of collection is %d', $count));// filter recurrences:- $filtered = $this->filterRecurrences($this->recurrences);+ $filtered = $this->filterRecurrences($this->recurrences);Log::debug(sprintf('Left after filtering is %d', $filtered->count()));/** @var Recurrence $recurrence */@@ -135,7 +146,7 @@ class CreateRecurringTransactions implements ShouldQueuePreferences::setForUser($recurrence->user, 'lastActivity', microtime());Log::debug(sprintf('Now at recurrence #%d of user #%d', $recurrence->id, $recurrence->user_id));- $createdReps = $this->handleRepetitions($recurrence);+ $createdReps = $this->handleRepetitions($recurrence);Log::debug(sprintf('Done with recurrence #%d', $recurrence->id));$result[$recurrence->user_id] = $result[$recurrence->user_id]->merge($createdReps);++$this->executed;@@ -155,7 +166,7 @@ class CreateRecurringTransactions implements ShouldQueuepublic function setDate(Carbon $date): void{- $newDate = clone $date;+ $newDate = clone $date;$newDate->startOfDay();Log::debug(sprintf('Overruled date to "%s', $newDate->format('Y-m-d H:i:s')));$this->date = $newDate;@@ -208,13 +219,13 @@ class CreateRecurringTransactions implements ShouldQueue$transactions = $recurrence->recurrenceTransactions()->get();$transactions->first();- $return = [];+ $return = [];/** @var RecurrenceTransaction $transaction */foreach ($transactions as $index => $transaction) {$single = ['type' => null === $transaction->transactionType?->type- ? strtolower((string) $recurrence->transactionType->type)+ ? strtolower((string)$recurrence->transactionType->type): strtolower($transaction->transactionType->type),'date' => $date,'user' => $recurrence->user,@@ -238,7 +249,7 @@ class CreateRecurringTransactions implements ShouldQueue'identifier' => $index,'recurrence_id' => $recurrence->id,'order' => $index,- 'notes' => (string) trans('firefly.created_from_recurrence', ['id' => $recurrence->id, 'title' => $recurrence->title]),+ 'notes' => (string)trans('firefly.created_from_recurrence', ['id' => $recurrence->id, 'title' => $recurrence->title]),'tags' => $this->repository->getTags($transaction),'piggy_bank_id' => $this->repository->getPiggyBank($transaction),'piggy_bank_name' => null,@@ -285,11 +296,11 @@ class CreateRecurringTransactions implements ShouldQueue}// create transaction array and send to factory.- $groupTitle = null;- $count = $recurrence->recurrenceTransactions->count();+ $groupTitle = null;+ $count = $recurrence->recurrenceTransactions->count();// #8844, if there is one recurrence transaction, use the first title as the title.// #9305, if there is one recurrence transaction, group title must be NULL.- $groupTitle = null;+ $groupTitle = null;// #8844, if there are more, use the recurrence transaction itself.if ($count > 1) {@@ -302,7 +313,7 @@ class CreateRecurringTransactions implements ShouldQueuereturn null;}- $array = [+ $array = ['user' => $recurrence->user,'user_group' => $recurrence->user->userGroup,'group_title' => $groupTitle,@@ -310,7 +321,7 @@ class CreateRecurringTransactions implements ShouldQueue];/** @var TransactionGroup $group */- $group = $this->groupRepository->store($array);+ $group = $this->groupRepository->store($array);++$this->created;Log::info(sprintf('Created new transaction group #%d', $group->id));$this->groups->push($group);@@ -356,22 +367,22 @@ class CreateRecurringTransactions implements ShouldQueue/** @var RecurrenceRepetition $repetition */foreach ($recurrence->recurrenceRepetitions as $repetition) {Log::debug(sprintf(- 'Now repeating %s with value "%s", skips every %d time(s)',- $repetition->repetition_type,- $repetition->repetition_moment,- $repetition->repetition_skip- ));+ 'Now repeating %s with value "%s", skips every %d time(s)',+ $repetition->repetition_type,+ $repetition->repetition_moment,+ $repetition->repetition_skip+ ));// start looping from $startDate to today perhaps we have a hit?// add two days to $this->date, so we always include the weekend.$includeWeekend = clone $this->date;$includeWeekend->addDays(2);- $occurrences = $this->repository->getOccurrencesInRange($repetition, $recurrence->first_date, $includeWeekend);+ $occurrences = $this->repository->getOccurrencesInRange($repetition, $recurrence->first_date, $includeWeekend);unset($includeWeekend);- $result = $this->handleOccurrences($recurrence, $repetition, $occurrences);- $collection = $collection->merge($result);+ $result = $this->handleOccurrences($recurrence, $repetition, $occurrences);+ $collection = $collection->merge($result);}return $collection;@@ -431,11 +442,11 @@ class CreateRecurringTransactions implements ShouldQueue// is no longer runningif ($this->repeatUntilHasPassed($recurrence)) {Log::info(sprintf(- 'Recurrence #%d was set to run until %s, and today\'s date is %s. Skipped.',- $recurrence->id,- $recurrence->repeat_until->format('Y-m-d'),- $this->date->format('Y-m-d')- ));+ 'Recurrence #%d was set to run until %s, and today\'s date is %s. Skipped.',+ $recurrence->id,+ $recurrence->repeat_until->format('Y-m-d'),+ $this->date->format('Y-m-d')+ ));return false;}@@ -443,11 +454,11 @@ class CreateRecurringTransactions implements ShouldQueue// first_date is in the futureif ($this->hasNotStartedYet($recurrence)) {Log::info(sprintf(- 'Recurrence #%d is set to run on %s, and today\'s date is %s. Skipped.',- $recurrence->id,- $recurrence->first_date->format('Y-m-d H:i:s'),- $this->date->format('Y-m-d H:i:s')- ));+ 'Recurrence #%d is set to run on %s, and today\'s date is %s. Skipped.',+ $recurrence->id,+ $recurrence->first_date->format('Y-m-d H:i:s'),+ $this->date->format('Y-m-d H:i:s')+ ));return false;}diff --git a/app/Jobs/DownloadExchangeRates.php b/app/Jobs/DownloadExchangeRates.phpindex 9cdd7255be..f9672b98b8 100644--- a/app/Jobs/DownloadExchangeRates.php+++ b/app/Jobs/DownloadExchangeRates.php@@ -29,6 +29,7 @@ use FireflyIII\Models\CurrencyExchangeRate;use FireflyIII\Models\TransactionCurrency;use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;use FireflyIII\Repositories\User\UserRepositoryInterface;+use FireflyIII\User;use GuzzleHttp\Client;use GuzzleHttp\Exception\ConnectException;use GuzzleHttp\Exception\GuzzleException;@@ -58,6 +59,7 @@ class DownloadExchangeRates implements ShouldQueueprivate Carbon $date;private CurrencyRepositoryInterface $repository;private Collection $users;+ private User $user;/*** Create a new job instance.@@ -66,11 +68,6 @@ class DownloadExchangeRates implements ShouldQueue{$this->repository = app(CurrencyRepositoryInterface::class);- // get all users:- /** @var UserRepositoryInterface $userRepository */- $userRepository = app(UserRepositoryInterface::class);- $this->users = $userRepository->all();-if ($date instanceof Carbon) {$newDate = clone $date;$newDate->startOfDay();@@ -100,6 +97,20 @@ class DownloadExchangeRates implements ShouldQueue$this->date = $newDate;}+ public function setUser(User $user): void+ {+ $this->user = $user;+ $this->users = new Collection([$user]);+ if($user->hasRole('admin')) {+ // get all users:+ /** @var UserRepositoryInterface $userRepository */+ $userRepository = app(UserRepositoryInterface::class);+ $this->users = $userRepository->all();+ }+ }+++/*** @throws GuzzleException* @throws JsonExceptiondiff --git a/app/Jobs/WarnAboutBills.php b/app/Jobs/WarnAboutBills.phpindex 97ae390ac2..33219b0866 100644--- a/app/Jobs/WarnAboutBills.php+++ b/app/Jobs/WarnAboutBills.php@@ -50,6 +50,7 @@ class WarnAboutBills implements ShouldQueueprivate Carbon $date;private bool $force;+ private User $user;/*** Create a new job instance.@@ -77,7 +78,14 @@ class WarnAboutBills implements ShouldQueuepublic function handle(): void{Log::debug(sprintf('Now at start of WarnAboutBills() job for %s.', $this->date->format('D d M Y')));- foreach (User::all() as $user) {++ $users = [$this->user];+ if($this->user->hasRole('owner')) {+ Log::debug('User is owner, will run for all users.');+ $users = User::all();+ }++ foreach ($users as $user) {$bills = $user->bills()->where('active', true)->get();$overdue = [];@@ -114,6 +122,11 @@ class WarnAboutBills implements ShouldQueue$this->force = $force;}+ public function setUser(User $user): void+ {+ $this->user = $user;+ }+private function getDates(Bill $bill): array{$start = clone $this->date;diff --git a/app/Support/Binder/CLIToken.php b/app/Support/Binder/CLIToken.phpindex 61e98919f6..3351b922f9 100644--- a/app/Support/Binder/CLIToken.php+++ b/app/Support/Binder/CLIToken.php@@ -26,6 +26,7 @@ namespace FireflyIII\Support\Binder;use FireflyIII\Repositories\User\UserRepositoryInterface;use FireflyIII\Support\Facades\Preferences;+use FireflyIII\User;use Illuminate\Auth\AuthenticationException;use Illuminate\Routing\Route;use Illuminate\Support\Facades\Log;@@ -42,13 +43,13 @@ class CLIToken implements BinderInterface$users = $repository->all();// check for static token- if (hash_equals($value, (string) config('firefly.static_cron_token')) && 32 === strlen(config('firefly.static_cron_token'))) {+ if (hash_equals($value, (string)config('firefly.static_cron_token')) && 32 === strlen(config('firefly.static_cron_token'))) {return $value;}foreach ($users as $user) {$accessToken = Preferences::getForUser($user, 'access_token');- if (null !== $accessToken && hash_equals((string) $accessToken->data, $value)) {+ if (null !== $accessToken && hash_equals((string)$accessToken->data, $value)) {Log::info(sprintf('Recognized user #%d (%s) from his access token.', $user->id, $user->email));return $value;@@ -58,4 +59,23 @@ class CLIToken implements BinderInterfacethrow new AuthenticationException();}++ public static function findUserByToken(string $value): ?User+ {++ /** @var UserRepositoryInterface $repository */+ $repository = app(UserRepositoryInterface::class);+ $users = $repository->all();++ foreach ($users as $user) {+ $accessToken = Preferences::getForUser($user, 'access_token');+ if (null !== $accessToken && hash_equals((string)$accessToken->data, $value)) {+ Log::info(sprintf('Recognized user #%d (%s) from his access token.', $user->id, $user->email));++ return $user;+ }+ }+ Log::error(sprintf('Recognized no users by access token "%s"', $value));+ return null;+ }}diff --git a/app/Support/Cronjobs/AbstractCronjob.php b/app/Support/Cronjobs/AbstractCronjob.phpindex 748d92936d..e2beac967d 100644--- a/app/Support/Cronjobs/AbstractCronjob.php+++ b/app/Support/Cronjobs/AbstractCronjob.php@@ -25,19 +25,22 @@ declare(strict_types=1);namespace FireflyIII\Support\Cronjobs;use Carbon\Carbon;+use FireflyIII\User;/*** Class AbstractCronjob*/abstract class AbstractCronjob{- public bool $jobErrored = false;- public bool $jobFired = false;- public bool $jobSucceeded = false;- public ?string $message = null;- public int $timeBetweenRuns = 43_200;+ public bool $jobErrored = false;+ public bool $jobFired = false;+ public bool $jobSucceeded = false;+ public ?string $message = null;+ public int $timeBetweenRuns = 43_200;protected Carbon $date;- protected bool $force = false;+ protected bool $force = false;+ protected User $user;+ protected bool $isOwner = false;/*** AbstractCronjob constructor.@@ -59,4 +62,10 @@ abstract class AbstractCronjob{$this->force = $force;}++ final public function setUser(User $user): void+ {+ $this->user = $user;+ $this->isOwner = $user->hasRole('owner');+ }}diff --git a/app/Support/Cronjobs/AutoBudgetCronjob.php b/app/Support/Cronjobs/AutoBudgetCronjob.phpindex 67e81a7502..dff8dd97ee 100644--- a/app/Support/Cronjobs/AutoBudgetCronjob.php+++ b/app/Support/Cronjobs/AutoBudgetCronjob.php@@ -49,7 +49,7 @@ class AutoBudgetCronjob extends AbstractCronjob// less than half a day ago:if ($lastTime > 0 && $diff <= 43_200) {Log::info(sprintf('It has been %s since the auto budget cron-job has fired.', $diffForHumans));- if (false === $this->force) {+ if (false === $this->force || false === $this->isOwner) {Log::info('The auto budget cron-job will not fire now.');$this->message = sprintf('It has been %s since the auto budget cron-job has fired. It will not fire now.', $diffForHumans);@@ -73,6 +73,7 @@ class AutoBudgetCronjob extends AbstractCronjob/** @var CreateAutoBudgetLimits $job */$job = app(CreateAutoBudgetLimits::class, [$this->date]);$job->setDate($this->date);+ $job->setUser($this->user);$job->handle();// get stuff from job:diff --git a/app/Support/Cronjobs/BillWarningCronjob.php b/app/Support/Cronjobs/BillWarningCronjob.phpindex b2e1c22a18..5326d5eded 100644--- a/app/Support/Cronjobs/BillWarningCronjob.php+++ b/app/Support/Cronjobs/BillWarningCronjob.php@@ -56,7 +56,7 @@ class BillWarningCronjob extends AbstractCronjob// less than half a day ago:if ($lastTime > 0 && $diff <= 43_200) {Log::info(sprintf('It has been %s since the bill notification cron-job has fired.', $diffForHumans));- if (false === $this->force) {+ if (false === $this->force || false === $this->isOwner) {Log::info('The cron-job will not fire now.');$this->message = sprintf('It has been %s since the bill notification cron-job has fired. It will not fire now.', $diffForHumans);$this->jobFired = false;@@ -85,6 +85,7 @@ class BillWarningCronjob extends AbstractCronjob/** @var WarnAboutBills $job */$job = app(WarnAboutBills::class);$job->setDate($this->date);+ $job->setUser($this->user);$job->setForce($this->force);$job->handle();diff --git a/app/Support/Cronjobs/ExchangeRatesCronjob.php b/app/Support/Cronjobs/ExchangeRatesCronjob.phpindex 887e45d65c..7c0677f121 100644--- a/app/Support/Cronjobs/ExchangeRatesCronjob.php+++ b/app/Support/Cronjobs/ExchangeRatesCronjob.php@@ -49,7 +49,7 @@ class ExchangeRatesCronjob extends AbstractCronjob// less than half a day ago:if ($lastTime > 0 && $diff <= 43_200) {Log::info(sprintf('It has been %s since the exchange rates cron-job has fired.', $diffForHumans));- if (false === $this->force) {+ if (false === $this->force || false === $this->isOwner) {Log::info('The exchange rates cron-job will not fire now.');$this->message = sprintf('It has been %s since the exchange rates cron-job has fired. It will not fire now.', $diffForHumans);@@ -74,6 +74,7 @@ class ExchangeRatesCronjob extends AbstractCronjob/** @var DownloadExchangeRates $job */$job = app(DownloadExchangeRates::class);$job->setDate($this->date);+ $job->setUser($this->user);$job->handle();// get stuff from job:diff --git a/app/Support/Cronjobs/RecurringCronjob.php b/app/Support/Cronjobs/RecurringCronjob.phpindex a3d8c1b6c0..27389fc9d9 100644--- a/app/Support/Cronjobs/RecurringCronjob.php+++ b/app/Support/Cronjobs/RecurringCronjob.php@@ -56,7 +56,7 @@ class RecurringCronjob extends AbstractCronjob// less than half a day ago:if ($lastTime > 0 && $diff <= 43_200) {Log::info(sprintf('It has been "%s" since the recurring transactions cron-job has fired.', $diffForHumans));- if (false === $this->force) {+ if (false === $this->force || false === $this->isOwner) {Log::info('The cron-job will not fire now.');$this->message = sprintf('It has been "%s" since the recurring transactions cron-job has fired. It will not fire now.', $diffForHumans);$this->jobFired = false;@@ -83,6 +83,7 @@ class RecurringCronjob extends AbstractCronjob$job = new CreateRecurringTransactions($this->date);$job->setForce($this->force);+ $job->setUser($this->user);$job->handle();// get stuff from job:diff --git a/app/Support/Cronjobs/WebhookCronjob.php b/app/Support/Cronjobs/WebhookCronjob.phpindex d9b0b33888..411f3aa208 100644--- a/app/Support/Cronjobs/WebhookCronjob.php+++ b/app/Support/Cronjobs/WebhookCronjob.php@@ -56,7 +56,7 @@ class WebhookCronjob extends AbstractCronjob// less than ten minutes ago.if ($lastTime > 0 && $diff <= 600) {Log::info(sprintf('It has been %s since the webhook cron-job has fired.', $diffForHumans));- if (false === $this->force) {+ if (false === $this->force || false === $this->isOwner) {Log::info('The cron-job will not fire now.');$this->message = sprintf('It has been %s since the webhook cron-job has fired. It will not fire now.', $diffForHumans);$this->jobFired = false;diff --git a/app/Support/Http/Controllers/CronRunner.php b/app/Support/Http/Controllers/CronRunner.phpindex 2cf906727b..37acbd59c9 100644--- a/app/Support/Http/Controllers/CronRunner.php+++ b/app/Support/Http/Controllers/CronRunner.php@@ -31,17 +31,19 @@ use FireflyIII\Support\Cronjobs\BillWarningCronjob;use FireflyIII\Support\Cronjobs\ExchangeRatesCronjob;use FireflyIII\Support\Cronjobs\RecurringCronjob;use FireflyIII\Support\Cronjobs\WebhookCronjob;+use FireflyIII\User;/*** Trait CronRunner*/trait CronRunner{- protected function billWarningCronJob(bool $force, Carbon $date): array+ protected function billWarningCronJob(User $user, bool $force, Carbon $date): array{/** @var BillWarningCronjob $billWarning */$billWarning = app(BillWarningCronjob::class);$billWarning->setForce($force);+ $billWarning->setUser($user);$billWarning->setDate($date);try {@@ -58,11 +60,12 @@ trait CronRunner];}- protected function exchangeRatesCronJob(bool $force, Carbon $date): array+ protected function exchangeRatesCronJob(User $user, bool $force, Carbon $date): array{/** @var ExchangeRatesCronjob $exchangeRates */$exchangeRates = app(ExchangeRatesCronjob::class);$exchangeRates->setForce($force);+ $exchangeRates->setUser($user);$exchangeRates->setDate($date);try {@@ -79,11 +82,12 @@ trait CronRunner];}- protected function runAutoBudget(bool $force, Carbon $date): array+ protected function runAutoBudget(User $user, bool $force, Carbon $date): array{/** @var AutoBudgetCronjob $autoBudget */$autoBudget = app(AutoBudgetCronjob::class);$autoBudget->setForce($force);+ $autoBudget->setUser($user);$autoBudget->setDate($date);try {@@ -100,11 +104,12 @@ trait CronRunner];}- protected function runRecurring(bool $force, Carbon $date): array+ protected function runRecurring(User $user, bool $force, Carbon $date): array{/** @var RecurringCronjob $recurring */$recurring = app(RecurringCronjob::class);$recurring->setForce($force);+ $recurring->setUser($user);$recurring->setDate($date);try {@@ -121,11 +126,12 @@ trait CronRunner];}- protected function webhookCronJob(bool $force, Carbon $date): array+ protected function webhookCronJob(User $user, bool $force, Carbon $date): array{/** @var WebhookCronjob $webhook */$webhook = app(WebhookCronjob::class);$webhook->setForce($force);+ $webhook->setUser($user);$webhook->setDate($date);try {