From 7af9dce33b70cd618fc515a184be891691a929fc Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 6 Nov 2024 11:57:12 +0100 Subject: [PATCH] Add timezone to date objects --- .ci/php-cs-fixer/composer.lock | 24 ++-- app/Factory/BillFactory.php | 31 ++--- .../Events/Model/BudgetLimitHandler.php | 12 +- .../Events/Model/PiggyBankEventHandler.php | 1 + app/Handlers/Observer/PiggyBankObserver.php | 2 + .../Recurring/TriggerController.php | 1 + app/Jobs/CreateRecurringTransactions.php | 1 + app/Models/Bill.php | 3 + app/Models/PiggyBank.php | 2 +- app/Models/Recurrence.php | 2 +- app/Models/TransactionJournal.php | 12 +- .../Budget/AvailableBudgetRepository.php | 18 +-- .../Budget/BudgetLimitRepository.php | 27 +++-- .../Currency/CurrencyRepository.php | 11 +- .../PiggyBank/ModifiesPiggyBanks.php | 5 + app/Repositories/User/UserRepository.php | 1 + app/Rules/Account/IsUniqueAccount.php | 3 +- .../Internal/Update/BillUpdateService.php | 9 +- .../Update/RecurrenceUpdateService.php | 2 + .../Models/AccountBalanceCalculator.php | 10 +- composer.lock | 108 +++++++++--------- .../2024_11_05_062108_add_date_tz_columns.php | 23 ++-- 22 files changed, 169 insertions(+), 139 deletions(-) diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock index babbc4d56e..44bae57c40 100644 --- a/.ci/php-cs-fixer/composer.lock +++ b/.ci/php-cs-fixer/composer.lock @@ -1259,16 +1259,16 @@ }, { "name": "symfony/console", - "version": "v7.1.6", + "version": "v7.1.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "bb5192af6edc797cbab5c8e8ecfea2fe5f421e57" + "reference": "3284aafcac338b6e86fd955ee4d794cbe434151a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/bb5192af6edc797cbab5c8e8ecfea2fe5f421e57", - "reference": "bb5192af6edc797cbab5c8e8ecfea2fe5f421e57", + "url": "https://api.github.com/repos/symfony/console/zipball/3284aafcac338b6e86fd955ee4d794cbe434151a", + "reference": "3284aafcac338b6e86fd955ee4d794cbe434151a", "shasum": "" }, "require": { @@ -1332,7 +1332,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.6" + "source": "https://github.com/symfony/console/tree/v7.1.7" }, "funding": [ { @@ -1348,7 +1348,7 @@ "type": "tidelift" } ], - "time": "2024-10-09T08:46:59+00:00" + "time": "2024-11-05T15:34:55+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2246,16 +2246,16 @@ }, { "name": "symfony/process", - "version": "v7.1.6", + "version": "v7.1.7", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "6aaa189ddb4ff6b5de8fa3210f2fb42c87b4d12e" + "reference": "9b8a40b7289767aa7117e957573c2a535efe6585" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/6aaa189ddb4ff6b5de8fa3210f2fb42c87b4d12e", - "reference": "6aaa189ddb4ff6b5de8fa3210f2fb42c87b4d12e", + "url": "https://api.github.com/repos/symfony/process/zipball/9b8a40b7289767aa7117e957573c2a535efe6585", + "reference": "9b8a40b7289767aa7117e957573c2a535efe6585", "shasum": "" }, "require": { @@ -2287,7 +2287,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.1.6" + "source": "https://github.com/symfony/process/tree/v7.1.7" }, "funding": [ { @@ -2303,7 +2303,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-11-06T09:25:12+00:00" }, { "name": "symfony/service-contracts", diff --git a/app/Factory/BillFactory.php b/app/Factory/BillFactory.php index c8a249e80d..9a1b38cd47 100644 --- a/app/Factory/BillFactory.php +++ b/app/Factory/BillFactory.php @@ -58,20 +58,23 @@ class BillFactory /** @var Bill $bill */ $bill = Bill::create( [ - 'name' => $data['name'], - 'match' => 'MIGRATED_TO_RULES', - 'amount_min' => $data['amount_min'], - 'user_id' => $this->user->id, - 'user_group_id' => $this->user->user_group_id, - 'transaction_currency_id' => $currency->id, - 'amount_max' => $data['amount_max'], - 'date' => $data['date'], - 'end_date' => $data['end_date'] ?? null, - 'extension_date' => $data['extension_date'] ?? null, - 'repeat_freq' => $data['repeat_freq'], - 'skip' => $skip, - 'automatch' => true, - 'active' => $active, + 'name' => $data['name'], + 'match' => 'MIGRATED_TO_RULES', + 'amount_min' => $data['amount_min'], + 'user_id' => $this->user->id, + 'user_group_id' => $this->user->user_group_id, + 'transaction_currency_id' => $currency->id, + 'amount_max' => $data['amount_max'], + 'date' => $data['date'], + 'date_tz' => $data['date']->format('e'), + 'end_date' => $data['end_date'] ?? null, + 'end_date_tz' => $data['end_date']?->format('e'), + 'extension_date' => $data['extension_date'] ?? null, + 'extension_date_tz' => $data['extension_date']?->format('e'), + 'repeat_freq' => $data['repeat_freq'], + 'skip' => $skip, + 'automatch' => true, + 'active' => $active, ] ); } catch (QueryException $e) { diff --git a/app/Handlers/Events/Model/BudgetLimitHandler.php b/app/Handlers/Events/Model/BudgetLimitHandler.php index c6cb6dc627..bf77152558 100644 --- a/app/Handlers/Events/Model/BudgetLimitHandler.php +++ b/app/Handlers/Events/Model/BudgetLimitHandler.php @@ -131,14 +131,14 @@ class BudgetLimitHandler app('log')->debug(sprintf('Will create AB for period %s to %s', $current->format('Y-m-d'), $currentEnd->format('Y-m-d'))); $availableBudget = new AvailableBudget( [ - 'user_id' => $budgetLimit->budget->user->id, - 'user_group_id' => $budgetLimit->budget->user->user_group_id, - 'transaction_currency_id' => $budgetLimit->transaction_currency_id, - 'start_date' => $current, + 'user_id' => $budgetLimit->budget->user->id, + 'user_group_id' => $budgetLimit->budget->user->user_group_id, + 'transaction_currency_id' => $budgetLimit->transaction_currency_id, + 'start_date' => $current, 'start_date_tz' => $current->format('e'), - 'end_date' => $currentEnd, + 'end_date' => $currentEnd, 'end_date_tz' => $currentEnd->format('e'), - 'amount' => $amount, + 'amount' => $amount, ] ); $availableBudget->save(); diff --git a/app/Handlers/Events/Model/PiggyBankEventHandler.php b/app/Handlers/Events/Model/PiggyBankEventHandler.php index f97319bac6..ea4bb49a2e 100644 --- a/app/Handlers/Events/Model/PiggyBankEventHandler.php +++ b/app/Handlers/Events/Model/PiggyBankEventHandler.php @@ -58,6 +58,7 @@ class PiggyBankEventHandler 'piggy_bank_id' => $event->piggyBank->id, 'transaction_journal_id' => $journal?->id, 'date' => $date->format('Y-m-d'), + 'date_tz' => $date->format('e'), 'amount' => $event->amount, ] ); diff --git a/app/Handlers/Observer/PiggyBankObserver.php b/app/Handlers/Observer/PiggyBankObserver.php index 7e9b879892..d8e93364ff 100644 --- a/app/Handlers/Observer/PiggyBankObserver.php +++ b/app/Handlers/Observer/PiggyBankObserver.php @@ -37,7 +37,9 @@ class PiggyBankObserver $repetition = new PiggyBankRepetition(); $repetition->piggyBank()->associate($piggyBank); $repetition->startdate = $piggyBank->startdate; + $repetition->startdate_tz = $piggyBank->startdate->format('e'); $repetition->targetdate = $piggyBank->targetdate; + $repetition->targetdate_tz = $piggyBank->targetdate->format('e'); $repetition->currentamount = '0'; $repetition->save(); } diff --git a/app/Http/Controllers/Recurring/TriggerController.php b/app/Http/Controllers/Recurring/TriggerController.php index 77d5357274..d8483b84df 100644 --- a/app/Http/Controllers/Recurring/TriggerController.php +++ b/app/Http/Controllers/Recurring/TriggerController.php @@ -69,6 +69,7 @@ class TriggerController extends Controller } } $recurrence->latest_date = $backupDate; + $recurrence->latest_date_tz = $backupDate?->format('e'); $recurrence->save(); app('preferences')->mark(); diff --git a/app/Jobs/CreateRecurringTransactions.php b/app/Jobs/CreateRecurringTransactions.php index c7f4eb292d..05147b4b48 100644 --- a/app/Jobs/CreateRecurringTransactions.php +++ b/app/Jobs/CreateRecurringTransactions.php @@ -395,6 +395,7 @@ class CreateRecurringTransactions implements ShouldQueue // update recurring thing: $recurrence->latest_date = $date; + $recurrence->latest_date_tz = $date?->format('e'); $recurrence->save(); return $group; diff --git a/app/Models/Bill.php b/app/Models/Bill.php index 4a120765f8..655fc729d5 100644 --- a/app/Models/Bill.php +++ b/app/Models/Bill.php @@ -68,6 +68,7 @@ class Bill extends Model 'user_group_id', 'amount_max', 'date', + 'date_tz', 'repeat_freq', 'skip', 'automatch', @@ -75,6 +76,8 @@ class Bill extends Model 'transaction_currency_id', 'end_date', 'extension_date', + 'end_date_tz', + 'extension_date_tz', ]; protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted']; diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php index 7410d2138d..3b9fe5a0ef 100644 --- a/app/Models/PiggyBank.php +++ b/app/Models/PiggyBank.php @@ -53,7 +53,7 @@ class PiggyBank extends Model 'encrypted' => 'boolean', ]; - protected $fillable = ['name', 'account_id', 'order', 'targetamount', 'startdate', 'targetdate', 'active']; + protected $fillable = ['name', 'account_id', 'order', 'targetamount', 'startdate','startdate_tz', 'targetdate', 'targetdate_tz', 'active']; protected $hidden = ['targetamount_encrypted', 'encrypted']; diff --git a/app/Models/Recurrence.php b/app/Models/Recurrence.php index b4cc775bd4..2ba068135f 100644 --- a/app/Models/Recurrence.php +++ b/app/Models/Recurrence.php @@ -60,7 +60,7 @@ class Recurrence extends Model ]; protected $fillable - = ['user_id', 'transaction_type_id', 'title', 'description', 'first_date', 'repeat_until', 'latest_date', 'repetitions', 'apply_rules', 'active']; + = ['user_id', 'transaction_type_id', 'title', 'description', 'first_date','first_date_tz', 'repeat_until','repeat_until_tz', 'latest_date','latest_date_tz', 'repetitions', 'apply_rules', 'active']; /** @var string The table to store the data in */ protected $table = 'recurrences'; diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php index a16881253b..9fe911a8e7 100644 --- a/app/Models/TransactionJournal.php +++ b/app/Models/TransactionJournal.php @@ -51,7 +51,7 @@ class TransactionJournal extends Model use SoftDeletes; protected $casts - = [ + = [ 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime', @@ -66,7 +66,7 @@ class TransactionJournal extends Model ]; protected $fillable - = [ + = [ 'user_id', 'user_group_id', 'transaction_type_id', @@ -93,10 +93,10 @@ class TransactionJournal extends Model $journalId = (int) $value; /** @var User $user */ - $user = auth()->user(); + $user = auth()->user(); /** @var null|TransactionJournal $journal */ - $journal = $user->transactionJournals()->where('transaction_journals.id', $journalId)->first(['transaction_journals.*']); + $journal = $user->transactionJournals()->where('transaction_journals.id', $journalId)->first(['transaction_journals.*']); if (null !== $journal) { return $journal; } @@ -244,14 +244,14 @@ class TransactionJournal extends Model protected function order(): Attribute { return Attribute::make( - get: static fn($value) => (int) $value, + get: static fn ($value) => (int) $value, ); } protected function transactionTypeId(): Attribute { return Attribute::make( - get: static fn($value) => (int) $value, + get: static fn ($value) => (int) $value, ); } } diff --git a/app/Repositories/Budget/AvailableBudgetRepository.php b/app/Repositories/Budget/AvailableBudgetRepository.php index f002bc3eab..21012932ad 100644 --- a/app/Repositories/Budget/AvailableBudgetRepository.php +++ b/app/Repositories/Budget/AvailableBudgetRepository.php @@ -198,12 +198,12 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface ->where('end_date', $end->format('Y-m-d'))->first() ; if (null === $availableBudget) { - $availableBudget = new AvailableBudget(); + $availableBudget = new AvailableBudget(); $availableBudget->user()->associate($this->user); $availableBudget->transactionCurrency()->associate($currency); - $availableBudget->start_date = $start->startOfDay()->format('Y-m-d'); // @phpstan-ignore-line + $availableBudget->start_date = $start->startOfDay()->format('Y-m-d'); // @phpstan-ignore-line $availableBudget->start_date_tz = $start->format('e'); - $availableBudget->end_date = $end->endOfDay()->format('Y-m-d'); // @phpstan-ignore-line + $availableBudget->end_date = $end->endOfDay()->format('Y-m-d'); // @phpstan-ignore-line $availableBudget->end_date_tz = $end->format('e'); } $availableBudget->amount = $amount; @@ -237,9 +237,9 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface 'transaction_currency_id' => $data['currency_id'], 'amount' => $data['amount'], 'start_date' => $start->format('Y-m-d'), - 'start_date_tz' => $start->format('e'), + 'start_date_tz' => $start->format('e'), 'end_date' => $end->format('Y-m-d'), - 'end_date_tz' => $end->format('e'), + 'end_date_tz' => $end->format('e'), ] ); } @@ -259,8 +259,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface if (array_key_exists('start', $data)) { $start = $data['start']; if ($start instanceof Carbon) { - $start = $data['start']->startOfDay(); - $availableBudget->start_date = $start->format('Y-m-d'); + $start = $data['start']->startOfDay(); + $availableBudget->start_date = $start->format('Y-m-d'); $availableBudget->start_date_tz = $start->format('e'); $availableBudget->save(); } @@ -269,8 +269,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface if (array_key_exists('end', $data)) { $end = $data['end']; if ($end instanceof Carbon) { - $end = $data['end']->endOfDay(); - $availableBudget->end_date = $end->format('Y-m-d'); + $end = $data['end']->endOfDay(); + $availableBudget->end_date = $end->format('Y-m-d'); $availableBudget->end_date_tz = $end->format('e'); $availableBudget->save(); } diff --git a/app/Repositories/Budget/BudgetLimitRepository.php b/app/Repositories/Budget/BudgetLimitRepository.php index 6fb1961fce..f88983ff6e 100644 --- a/app/Repositories/Budget/BudgetLimitRepository.php +++ b/app/Repositories/Budget/BudgetLimitRepository.php @@ -277,7 +277,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface $currency->save(); // find the budget: - $budget = $this->user->budgets()->find((int)$data['budget_id']); + $budget = $this->user->budgets()->find((int) $data['budget_id']); if (null === $budget) { throw new FireflyException('200004: Budget does not exist.'); } @@ -323,8 +323,15 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface { $budgetLimit->amount = array_key_exists('amount', $data) ? $data['amount'] : $budgetLimit->amount; $budgetLimit->budget_id = array_key_exists('budget_id', $data) ? $data['budget_id'] : $budgetLimit->budget_id; - $budgetLimit->start_date = array_key_exists('start', $data) ? $data['start']->format('Y-m-d 00:00:00') : $budgetLimit->start_date; - $budgetLimit->end_date = array_key_exists('end', $data) ? $data['end']->format('Y-m-d 23:59:59') : $budgetLimit->end_date; + + if (array_key_exists('start', $data)) { + $budgetLimit->start_date = $data['start']->startOfDay(); + $budgetLimit->start_date_tz = $data['start']->format('e'); + } + if (array_key_exists('end', $data)) { + $budgetLimit->end_date = $data['end']->endOfDay(); + $budgetLimit->end_date_tz = $data['end']->format('e'); + } // if no currency has been provided, use the user's default currency: $currency = null; @@ -351,7 +358,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface public function updateLimitAmount(Budget $budget, Carbon $start, Carbon $end, string $amount): ?BudgetLimit { // count the limits: - $limits = $budget->budgetlimits() + $limits = $budget->budgetlimits() ->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00')) ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) ->count('budget_limits.*') @@ -360,7 +367,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface // there might be a budget limit for these dates: /** @var null|BudgetLimit $limit */ - $limit = $budget->budgetlimits() + $limit = $budget->budgetlimits() ->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00')) ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) ->first(['budget_limits.*']) @@ -395,11 +402,13 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface } app('log')->debug('No existing budget limit, create a new one'); // or create one and return it. - $limit = new BudgetLimit(); + $limit = new BudgetLimit(); $limit->budget()->associate($budget); - $limit->start_date = $start->startOfDay(); - $limit->end_date = $end->startOfDay(); - $limit->amount = $amount; + $limit->start_date = $start->startOfDay(); + $limit->start_date_tz = $start->format('e'); + $limit->end_date = $end->startOfDay(); + $limit->end_date_tz = $end->format('e'); + $limit->amount = $amount; $limit->save(); app('log')->debug(sprintf('Created new budget limit with ID #%d and amount %s', $limit->id, $amount)); diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index 725a5741ad..5ca4924769 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -89,11 +89,12 @@ class CurrencyRepository implements CurrencyRepositoryInterface { return CurrencyExchangeRate::create( [ - 'user_id' => $this->user->id, - 'from_currency_id' => $fromCurrency->id, - 'to_currency_id' => $toCurrency->id, - 'date' => $date, - 'rate' => $rate, + 'user_id' => $this->user->id, + 'from_currency_id' => $fromCurrency->id, + 'to_currency_id' => $toCurrency->id, + 'date' => $date, + 'date_tz' => $date->format('e'), + 'rate' => $rate, ] ); } diff --git a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php index 0fbf31de71..dfddb6a88a 100644 --- a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php +++ b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php @@ -192,6 +192,9 @@ trait ModifiesPiggyBanks $piggyData['targetamount'] = '0'; } + $piggyData['startdate_tz'] = $piggyData['startdate']?->format('e'); + $piggyData['targetdate_tz'] = $piggyData['targetdate']?->format('e'); + try { /** @var PiggyBank $piggyBank */ $piggyBank = PiggyBank::create($piggyData); @@ -374,9 +377,11 @@ trait ModifiesPiggyBanks } if (array_key_exists('targetdate', $data) && '' !== $data['targetdate']) { $piggyBank->targetdate = $data['targetdate']; + $piggyBank->targetdate_tz = $data['targetdate']->format('e'); } if (array_key_exists('startdate', $data)) { $piggyBank->startdate = $data['startdate']; + $piggyBank->startdate_tz = $data['targetdate']->format('e'); } $piggyBank->save(); diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php index 86f7e2e2b9..37c699d0f5 100644 --- a/app/Repositories/User/UserRepository.php +++ b/app/Repositories/User/UserRepository.php @@ -276,6 +276,7 @@ class UserRepository implements UserRepositoryInterface $invitee->email = $email; $invitee->redeemed = false; $invitee->expires = $now; + $invitee->expires_tz = $now->format('e'); $invitee->save(); return $invitee; diff --git a/app/Rules/Account/IsUniqueAccount.php b/app/Rules/Account/IsUniqueAccount.php index 4daa56b034..d485bd2911 100644 --- a/app/Rules/Account/IsUniqueAccount.php +++ b/app/Rules/Account/IsUniqueAccount.php @@ -105,10 +105,11 @@ class IsUniqueAccount implements ValidationRule, DataAwareRule /** * TODO duplicate from old validation class. */ - private function validateAccountAnonymously(): void + private function validateAccountAnonymously(): bool { if (!array_key_exists('user_id', $this->data)) { $this->fail('No user ID provided.'); + return false; } /** @var User $user */ diff --git a/app/Services/Internal/Update/BillUpdateService.php b/app/Services/Internal/Update/BillUpdateService.php index 1567867575..173f4f2118 100644 --- a/app/Services/Internal/Update/BillUpdateService.php +++ b/app/Services/Internal/Update/BillUpdateService.php @@ -145,7 +145,8 @@ class BillUpdateService $bill->amount_max = $data['amount_max']; } if (array_key_exists('date', $data) && '' !== (string)$data['date']) { - $bill->date = $data['date']; + $bill->date = $data['date']; + $bill->date_tz = $data['date']->format('e'); } if (array_key_exists('repeat_freq', $data) && '' !== (string)$data['repeat_freq']) { $bill->repeat_freq = $data['repeat_freq']; @@ -157,10 +158,12 @@ class BillUpdateService $bill->active = $data['active']; } if (array_key_exists('end_date', $data)) { - $bill->end_date = $data['end_date']; + $bill->end_date = $data['end_date']; + $bill->end_date_tz = $data['end_date']->format('e'); } if (array_key_exists('extension_date', $data)) { - $bill->extension_date = $data['extension_date']; + $bill->extension_date = $data['extension_date']; + $bill->extension_date_tz = $data['extension_date']->format('e'); } $bill->match = 'EMPTY'; diff --git a/app/Services/Internal/Update/RecurrenceUpdateService.php b/app/Services/Internal/Update/RecurrenceUpdateService.php index 13119a36cb..fc2dd43c27 100644 --- a/app/Services/Internal/Update/RecurrenceUpdateService.php +++ b/app/Services/Internal/Update/RecurrenceUpdateService.php @@ -65,9 +65,11 @@ class RecurrenceUpdateService } if (array_key_exists('first_date', $info)) { $recurrence->first_date = $info['first_date']; + $recurrence->first_date_tz = $info['first_date']?->format('e'); } if (array_key_exists('repeat_until', $info)) { $recurrence->repeat_until = $info['repeat_until']; + $recurrence->repeat_until_tz = $info['repeat_until']?->format('e'); $recurrence->repetitions = 0; } if (array_key_exists('nr_of_repetitions', $info)) { diff --git a/app/Support/Models/AccountBalanceCalculator.php b/app/Support/Models/AccountBalanceCalculator.php index 9ede74b6fb..cd0e0860c7 100644 --- a/app/Support/Models/AccountBalanceCalculator.php +++ b/app/Support/Models/AccountBalanceCalculator.php @@ -232,16 +232,16 @@ class AccountBalanceCalculator /** @var AccountBalance $object */ $object = $account->accountBalances()->firstOrCreate( [ - 'title' => 'running_balance', - 'balance' => '0', + 'title' => 'running_balance', + 'balance' => '0', 'transaction_currency_id' => $currencyId, - 'date' => $balance[1], - 'date_tz' => $balance[1]->format('e'), + 'date' => $balance[1], + 'date_tz' => $balance[1]->format('e'), ] ); $object->balance = $balance[0]; $object->date = $balance[1]; - $object->date_tz = $balance[1]->format('e'); + $object->date_tz = $balance[1]->format('e'); $object->save(); } } diff --git a/composer.lock b/composer.lock index ceaee30fc4..fafae80aa5 100644 --- a/composer.lock +++ b/composer.lock @@ -3208,16 +3208,16 @@ }, { "name": "lcobucci/jwt", - "version": "5.4.0", + "version": "5.4.1", "source": { "type": "git", "url": "https://github.com/lcobucci/jwt.git", - "reference": "aac4fd512681fd5cb4b77d2105ab7ec700c72051" + "reference": "848815d2287abd5d3c285482f8e1f501b289a2e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lcobucci/jwt/zipball/aac4fd512681fd5cb4b77d2105ab7ec700c72051", - "reference": "aac4fd512681fd5cb4b77d2105ab7ec700c72051", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/848815d2287abd5d3c285482f8e1f501b289a2e7", + "reference": "848815d2287abd5d3c285482f8e1f501b289a2e7", "shasum": "" }, "require": { @@ -3265,7 +3265,7 @@ ], "support": { "issues": "https://github.com/lcobucci/jwt/issues", - "source": "https://github.com/lcobucci/jwt/tree/5.4.0" + "source": "https://github.com/lcobucci/jwt/tree/5.4.1" }, "funding": [ { @@ -3277,7 +3277,7 @@ "type": "patreon" } ], - "time": "2024-10-08T22:06:45+00:00" + "time": "2024-11-06T06:16:04+00:00" }, { "name": "league/commonmark", @@ -7085,16 +7085,16 @@ }, { "name": "symfony/cache", - "version": "v7.1.6", + "version": "v7.1.7", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "567ef6de47fdcba56eb6c0b344b857d1fce1cce0" + "reference": "23b61c9592ee72233c31625f0ae805dd1571e928" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/567ef6de47fdcba56eb6c0b344b857d1fce1cce0", - "reference": "567ef6de47fdcba56eb6c0b344b857d1fce1cce0", + "url": "https://api.github.com/repos/symfony/cache/zipball/23b61c9592ee72233c31625f0ae805dd1571e928", + "reference": "23b61c9592ee72233c31625f0ae805dd1571e928", "shasum": "" }, "require": { @@ -7162,7 +7162,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v7.1.6" + "source": "https://github.com/symfony/cache/tree/v7.1.7" }, "funding": [ { @@ -7178,7 +7178,7 @@ "type": "tidelift" } ], - "time": "2024-10-25T15:39:55+00:00" + "time": "2024-11-05T15:34:55+00:00" }, { "name": "symfony/cache-contracts", @@ -7332,16 +7332,16 @@ }, { "name": "symfony/console", - "version": "v7.1.6", + "version": "v7.1.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "bb5192af6edc797cbab5c8e8ecfea2fe5f421e57" + "reference": "3284aafcac338b6e86fd955ee4d794cbe434151a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/bb5192af6edc797cbab5c8e8ecfea2fe5f421e57", - "reference": "bb5192af6edc797cbab5c8e8ecfea2fe5f421e57", + "url": "https://api.github.com/repos/symfony/console/zipball/3284aafcac338b6e86fd955ee4d794cbe434151a", + "reference": "3284aafcac338b6e86fd955ee4d794cbe434151a", "shasum": "" }, "require": { @@ -7405,7 +7405,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.6" + "source": "https://github.com/symfony/console/tree/v7.1.7" }, "funding": [ { @@ -7421,7 +7421,7 @@ "type": "tidelift" } ], - "time": "2024-10-09T08:46:59+00:00" + "time": "2024-11-05T15:34:55+00:00" }, { "name": "symfony/css-selector", @@ -7557,16 +7557,16 @@ }, { "name": "symfony/error-handler", - "version": "v7.1.6", + "version": "v7.1.7", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "d60117093c2a9fe667baa8fedf84e8a09b9c592f" + "reference": "010e44661f4c6babaf8c4862fe68c24a53903342" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/d60117093c2a9fe667baa8fedf84e8a09b9c592f", - "reference": "d60117093c2a9fe667baa8fedf84e8a09b9c592f", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/010e44661f4c6babaf8c4862fe68c24a53903342", + "reference": "010e44661f4c6babaf8c4862fe68c24a53903342", "shasum": "" }, "require": { @@ -7612,7 +7612,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v7.1.6" + "source": "https://github.com/symfony/error-handler/tree/v7.1.7" }, "funding": [ { @@ -7628,7 +7628,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-11-05T15:34:55+00:00" }, { "name": "symfony/event-dispatcher", @@ -7916,16 +7916,16 @@ }, { "name": "symfony/http-client", - "version": "v7.1.6", + "version": "v7.1.7", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "274e2f6886b43a36f8bd5dfeb67215f7ebf9e291" + "reference": "90ab2a4992dcf5d1f19a9b8737eba36a7c305fd0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/274e2f6886b43a36f8bd5dfeb67215f7ebf9e291", - "reference": "274e2f6886b43a36f8bd5dfeb67215f7ebf9e291", + "url": "https://api.github.com/repos/symfony/http-client/zipball/90ab2a4992dcf5d1f19a9b8737eba36a7c305fd0", + "reference": "90ab2a4992dcf5d1f19a9b8737eba36a7c305fd0", "shasum": "" }, "require": { @@ -7990,7 +7990,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.1.6" + "source": "https://github.com/symfony/http-client/tree/v7.1.7" }, "funding": [ { @@ -8006,7 +8006,7 @@ "type": "tidelift" } ], - "time": "2024-10-22T09:40:50+00:00" + "time": "2024-11-05T16:45:54+00:00" }, { "name": "symfony/http-client-contracts", @@ -8088,16 +8088,16 @@ }, { "name": "symfony/http-foundation", - "version": "v7.1.6", + "version": "v7.1.7", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "3d7bbf071b25f802f7d55524d408bed414ea71e2" + "reference": "5183b61657807099d98f3367bcccb850238b17a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3d7bbf071b25f802f7d55524d408bed414ea71e2", - "reference": "3d7bbf071b25f802f7d55524d408bed414ea71e2", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/5183b61657807099d98f3367bcccb850238b17a9", + "reference": "5183b61657807099d98f3367bcccb850238b17a9", "shasum": "" }, "require": { @@ -8145,7 +8145,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v7.1.6" + "source": "https://github.com/symfony/http-foundation/tree/v7.1.7" }, "funding": [ { @@ -8161,20 +8161,20 @@ "type": "tidelift" } ], - "time": "2024-10-11T19:23:14+00:00" + "time": "2024-11-06T09:02:46+00:00" }, { "name": "symfony/http-kernel", - "version": "v7.1.6", + "version": "v7.1.7", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "5d8315899cd76b2e7e29179bf5fea103e41bdf03" + "reference": "7f137cda31fd41e422edcdc01915f2c095b84399" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/5d8315899cd76b2e7e29179bf5fea103e41bdf03", - "reference": "5d8315899cd76b2e7e29179bf5fea103e41bdf03", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/7f137cda31fd41e422edcdc01915f2c095b84399", + "reference": "7f137cda31fd41e422edcdc01915f2c095b84399", "shasum": "" }, "require": { @@ -8259,7 +8259,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v7.1.6" + "source": "https://github.com/symfony/http-kernel/tree/v7.1.7" }, "funding": [ { @@ -8275,7 +8275,7 @@ "type": "tidelift" } ], - "time": "2024-10-27T13:54:21+00:00" + "time": "2024-11-06T09:54:34+00:00" }, { "name": "symfony/mailer", @@ -9291,16 +9291,16 @@ }, { "name": "symfony/process", - "version": "v7.1.6", + "version": "v7.1.7", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "6aaa189ddb4ff6b5de8fa3210f2fb42c87b4d12e" + "reference": "9b8a40b7289767aa7117e957573c2a535efe6585" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/6aaa189ddb4ff6b5de8fa3210f2fb42c87b4d12e", - "reference": "6aaa189ddb4ff6b5de8fa3210f2fb42c87b4d12e", + "url": "https://api.github.com/repos/symfony/process/zipball/9b8a40b7289767aa7117e957573c2a535efe6585", + "reference": "9b8a40b7289767aa7117e957573c2a535efe6585", "shasum": "" }, "require": { @@ -9332,7 +9332,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.1.6" + "source": "https://github.com/symfony/process/tree/v7.1.7" }, "funding": [ { @@ -9348,7 +9348,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-11-06T09:25:12+00:00" }, { "name": "symfony/psr-http-message-bridge", @@ -9932,16 +9932,16 @@ }, { "name": "symfony/var-dumper", - "version": "v7.1.6", + "version": "v7.1.7", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "cb5bd55a6b8c2c1c7fb68b0aeae0e257948a720c" + "reference": "f6ea51f669760cacd7464bf7eaa0be87b8072db1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/cb5bd55a6b8c2c1c7fb68b0aeae0e257948a720c", - "reference": "cb5bd55a6b8c2c1c7fb68b0aeae0e257948a720c", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/f6ea51f669760cacd7464bf7eaa0be87b8072db1", + "reference": "f6ea51f669760cacd7464bf7eaa0be87b8072db1", "shasum": "" }, "require": { @@ -9995,7 +9995,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v7.1.6" + "source": "https://github.com/symfony/var-dumper/tree/v7.1.7" }, "funding": [ { @@ -10011,7 +10011,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:20:29+00:00" + "time": "2024-11-05T15:34:55+00:00" }, { "name": "symfony/var-exporter", diff --git a/database/migrations/2024_11_05_062108_add_date_tz_columns.php b/database/migrations/2024_11_05_062108_add_date_tz_columns.php index b686a69433..13f890dde9 100644 --- a/database/migrations/2024_11_05_062108_add_date_tz_columns.php +++ b/database/migrations/2024_11_05_062108_add_date_tz_columns.php @@ -1,25 +1,26 @@ tables = [ - 'account_balances' => ['date'], - 'available_budgets' => ['start_date', 'end_date'], - 'bills' => ['date','end_date', 'extension_date'], - 'budget_limits' => ['start_date', 'end_date'], - 'currency_exchange_rates' => ['date'], + 'account_balances' => ['date'], // done + 'available_budgets' => ['start_date', 'end_date'], // done + 'bills' => ['date', 'end_date', 'extension_date'], // done + 'budget_limits' => ['start_date', 'end_date'], // done + 'currency_exchange_rates' => ['date'], // done 'invited_users' => ['expires'], - 'limit_repetitions' => ['startdate', 'enddate'], 'piggy_bank_events' => ['date'], 'piggy_bank_repetitions' => ['startdate', 'targetdate'], - 'piggy_banks' => ['startdate', 'targetdate'], + 'piggy_banks' => ['startdate', 'targetdate'], // done 'recurrences' => ['first_date', 'repeat_until', 'latest_date'], 'tags' => ['date'], 'transaction_journals' => ['date'], @@ -29,7 +30,6 @@ return new class extends Migration { /** * Run the migrations. * TODO journal_meta, all date fields? - * */ public function up(): void { @@ -56,8 +56,5 @@ return new class extends Migration { /** * Reverse the migrations. */ - public function down(): void - { - // - } + public function down(): void {} };