Add timezone to date objects

This commit is contained in:
James Cole 2024-11-06 11:57:12 +01:00
parent 038790a5d6
commit 7af9dce33b
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
22 changed files with 169 additions and 139 deletions

View File

@ -1259,16 +1259,16 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v7.1.6", "version": "v7.1.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "bb5192af6edc797cbab5c8e8ecfea2fe5f421e57" "reference": "3284aafcac338b6e86fd955ee4d794cbe434151a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/bb5192af6edc797cbab5c8e8ecfea2fe5f421e57", "url": "https://api.github.com/repos/symfony/console/zipball/3284aafcac338b6e86fd955ee4d794cbe434151a",
"reference": "bb5192af6edc797cbab5c8e8ecfea2fe5f421e57", "reference": "3284aafcac338b6e86fd955ee4d794cbe434151a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1332,7 +1332,7 @@
"terminal" "terminal"
], ],
"support": { "support": {
"source": "https://github.com/symfony/console/tree/v7.1.6" "source": "https://github.com/symfony/console/tree/v7.1.7"
}, },
"funding": [ "funding": [
{ {
@ -1348,7 +1348,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-10-09T08:46:59+00:00" "time": "2024-11-05T15:34:55+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
@ -2246,16 +2246,16 @@
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v7.1.6", "version": "v7.1.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "6aaa189ddb4ff6b5de8fa3210f2fb42c87b4d12e" "reference": "9b8a40b7289767aa7117e957573c2a535efe6585"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/6aaa189ddb4ff6b5de8fa3210f2fb42c87b4d12e", "url": "https://api.github.com/repos/symfony/process/zipball/9b8a40b7289767aa7117e957573c2a535efe6585",
"reference": "6aaa189ddb4ff6b5de8fa3210f2fb42c87b4d12e", "reference": "9b8a40b7289767aa7117e957573c2a535efe6585",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2287,7 +2287,7 @@
"description": "Executes commands in sub-processes", "description": "Executes commands in sub-processes",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/process/tree/v7.1.6" "source": "https://github.com/symfony/process/tree/v7.1.7"
}, },
"funding": [ "funding": [
{ {
@ -2303,7 +2303,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-09-25T14:20:29+00:00" "time": "2024-11-06T09:25:12+00:00"
}, },
{ {
"name": "symfony/service-contracts", "name": "symfony/service-contracts",

View File

@ -58,20 +58,23 @@ class BillFactory
/** @var Bill $bill */ /** @var Bill $bill */
$bill = Bill::create( $bill = Bill::create(
[ [
'name' => $data['name'], 'name' => $data['name'],
'match' => 'MIGRATED_TO_RULES', 'match' => 'MIGRATED_TO_RULES',
'amount_min' => $data['amount_min'], 'amount_min' => $data['amount_min'],
'user_id' => $this->user->id, 'user_id' => $this->user->id,
'user_group_id' => $this->user->user_group_id, 'user_group_id' => $this->user->user_group_id,
'transaction_currency_id' => $currency->id, 'transaction_currency_id' => $currency->id,
'amount_max' => $data['amount_max'], 'amount_max' => $data['amount_max'],
'date' => $data['date'], 'date' => $data['date'],
'end_date' => $data['end_date'] ?? null, 'date_tz' => $data['date']->format('e'),
'extension_date' => $data['extension_date'] ?? null, 'end_date' => $data['end_date'] ?? null,
'repeat_freq' => $data['repeat_freq'], 'end_date_tz' => $data['end_date']?->format('e'),
'skip' => $skip, 'extension_date' => $data['extension_date'] ?? null,
'automatch' => true, 'extension_date_tz' => $data['extension_date']?->format('e'),
'active' => $active, 'repeat_freq' => $data['repeat_freq'],
'skip' => $skip,
'automatch' => true,
'active' => $active,
] ]
); );
} catch (QueryException $e) { } catch (QueryException $e) {

View File

@ -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'))); 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( $availableBudget = new AvailableBudget(
[ [
'user_id' => $budgetLimit->budget->user->id, 'user_id' => $budgetLimit->budget->user->id,
'user_group_id' => $budgetLimit->budget->user->user_group_id, 'user_group_id' => $budgetLimit->budget->user->user_group_id,
'transaction_currency_id' => $budgetLimit->transaction_currency_id, 'transaction_currency_id' => $budgetLimit->transaction_currency_id,
'start_date' => $current, 'start_date' => $current,
'start_date_tz' => $current->format('e'), 'start_date_tz' => $current->format('e'),
'end_date' => $currentEnd, 'end_date' => $currentEnd,
'end_date_tz' => $currentEnd->format('e'), 'end_date_tz' => $currentEnd->format('e'),
'amount' => $amount, 'amount' => $amount,
] ]
); );
$availableBudget->save(); $availableBudget->save();

View File

@ -58,6 +58,7 @@ class PiggyBankEventHandler
'piggy_bank_id' => $event->piggyBank->id, 'piggy_bank_id' => $event->piggyBank->id,
'transaction_journal_id' => $journal?->id, 'transaction_journal_id' => $journal?->id,
'date' => $date->format('Y-m-d'), 'date' => $date->format('Y-m-d'),
'date_tz' => $date->format('e'),
'amount' => $event->amount, 'amount' => $event->amount,
] ]
); );

View File

@ -37,7 +37,9 @@ class PiggyBankObserver
$repetition = new PiggyBankRepetition(); $repetition = new PiggyBankRepetition();
$repetition->piggyBank()->associate($piggyBank); $repetition->piggyBank()->associate($piggyBank);
$repetition->startdate = $piggyBank->startdate; $repetition->startdate = $piggyBank->startdate;
$repetition->startdate_tz = $piggyBank->startdate->format('e');
$repetition->targetdate = $piggyBank->targetdate; $repetition->targetdate = $piggyBank->targetdate;
$repetition->targetdate_tz = $piggyBank->targetdate->format('e');
$repetition->currentamount = '0'; $repetition->currentamount = '0';
$repetition->save(); $repetition->save();
} }

View File

@ -69,6 +69,7 @@ class TriggerController extends Controller
} }
} }
$recurrence->latest_date = $backupDate; $recurrence->latest_date = $backupDate;
$recurrence->latest_date_tz = $backupDate?->format('e');
$recurrence->save(); $recurrence->save();
app('preferences')->mark(); app('preferences')->mark();

View File

@ -395,6 +395,7 @@ class CreateRecurringTransactions implements ShouldQueue
// update recurring thing: // update recurring thing:
$recurrence->latest_date = $date; $recurrence->latest_date = $date;
$recurrence->latest_date_tz = $date?->format('e');
$recurrence->save(); $recurrence->save();
return $group; return $group;

View File

@ -68,6 +68,7 @@ class Bill extends Model
'user_group_id', 'user_group_id',
'amount_max', 'amount_max',
'date', 'date',
'date_tz',
'repeat_freq', 'repeat_freq',
'skip', 'skip',
'automatch', 'automatch',
@ -75,6 +76,8 @@ class Bill extends Model
'transaction_currency_id', 'transaction_currency_id',
'end_date', 'end_date',
'extension_date', 'extension_date',
'end_date_tz',
'extension_date_tz',
]; ];
protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted']; protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted'];

View File

@ -53,7 +53,7 @@ class PiggyBank extends Model
'encrypted' => 'boolean', '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']; protected $hidden = ['targetamount_encrypted', 'encrypted'];

View File

@ -60,7 +60,7 @@ class Recurrence extends Model
]; ];
protected $fillable 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 */ /** @var string The table to store the data in */
protected $table = 'recurrences'; protected $table = 'recurrences';

View File

@ -51,7 +51,7 @@ class TransactionJournal extends Model
use SoftDeletes; use SoftDeletes;
protected $casts protected $casts
= [ = [
'created_at' => 'datetime', 'created_at' => 'datetime',
'updated_at' => 'datetime', 'updated_at' => 'datetime',
'deleted_at' => 'datetime', 'deleted_at' => 'datetime',
@ -66,7 +66,7 @@ class TransactionJournal extends Model
]; ];
protected $fillable protected $fillable
= [ = [
'user_id', 'user_id',
'user_group_id', 'user_group_id',
'transaction_type_id', 'transaction_type_id',
@ -93,10 +93,10 @@ class TransactionJournal extends Model
$journalId = (int) $value; $journalId = (int) $value;
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
/** @var null|TransactionJournal $journal */ /** @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) { if (null !== $journal) {
return $journal; return $journal;
} }
@ -244,14 +244,14 @@ class TransactionJournal extends Model
protected function order(): Attribute protected function order(): Attribute
{ {
return Attribute::make( return Attribute::make(
get: static fn($value) => (int) $value, get: static fn ($value) => (int) $value,
); );
} }
protected function transactionTypeId(): Attribute protected function transactionTypeId(): Attribute
{ {
return Attribute::make( return Attribute::make(
get: static fn($value) => (int) $value, get: static fn ($value) => (int) $value,
); );
} }
} }

View File

@ -198,12 +198,12 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
->where('end_date', $end->format('Y-m-d'))->first() ->where('end_date', $end->format('Y-m-d'))->first()
; ;
if (null === $availableBudget) { if (null === $availableBudget) {
$availableBudget = new AvailableBudget(); $availableBudget = new AvailableBudget();
$availableBudget->user()->associate($this->user); $availableBudget->user()->associate($this->user);
$availableBudget->transactionCurrency()->associate($currency); $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->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->end_date_tz = $end->format('e');
} }
$availableBudget->amount = $amount; $availableBudget->amount = $amount;
@ -237,9 +237,9 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
'transaction_currency_id' => $data['currency_id'], 'transaction_currency_id' => $data['currency_id'],
'amount' => $data['amount'], 'amount' => $data['amount'],
'start_date' => $start->format('Y-m-d'), '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' => $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)) { if (array_key_exists('start', $data)) {
$start = $data['start']; $start = $data['start'];
if ($start instanceof Carbon) { if ($start instanceof Carbon) {
$start = $data['start']->startOfDay(); $start = $data['start']->startOfDay();
$availableBudget->start_date = $start->format('Y-m-d'); $availableBudget->start_date = $start->format('Y-m-d');
$availableBudget->start_date_tz = $start->format('e'); $availableBudget->start_date_tz = $start->format('e');
$availableBudget->save(); $availableBudget->save();
} }
@ -269,8 +269,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
if (array_key_exists('end', $data)) { if (array_key_exists('end', $data)) {
$end = $data['end']; $end = $data['end'];
if ($end instanceof Carbon) { if ($end instanceof Carbon) {
$end = $data['end']->endOfDay(); $end = $data['end']->endOfDay();
$availableBudget->end_date = $end->format('Y-m-d'); $availableBudget->end_date = $end->format('Y-m-d');
$availableBudget->end_date_tz = $end->format('e'); $availableBudget->end_date_tz = $end->format('e');
$availableBudget->save(); $availableBudget->save();
} }

View File

@ -277,7 +277,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
$currency->save(); $currency->save();
// find the budget: // find the budget:
$budget = $this->user->budgets()->find((int)$data['budget_id']); $budget = $this->user->budgets()->find((int) $data['budget_id']);
if (null === $budget) { if (null === $budget) {
throw new FireflyException('200004: Budget does not exist.'); 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->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->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: // if no currency has been provided, use the user's default currency:
$currency = null; $currency = null;
@ -351,7 +358,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
public function updateLimitAmount(Budget $budget, Carbon $start, Carbon $end, string $amount): ?BudgetLimit public function updateLimitAmount(Budget $budget, Carbon $start, Carbon $end, string $amount): ?BudgetLimit
{ {
// count the limits: // 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.start_date', $start->format('Y-m-d 00:00:00'))
->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00'))
->count('budget_limits.*') ->count('budget_limits.*')
@ -360,7 +367,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
// there might be a budget limit for these dates: // there might be a budget limit for these dates:
/** @var null|BudgetLimit $limit */ /** @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.start_date', $start->format('Y-m-d 00:00:00'))
->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00'))
->first(['budget_limits.*']) ->first(['budget_limits.*'])
@ -395,11 +402,13 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
} }
app('log')->debug('No existing budget limit, create a new one'); app('log')->debug('No existing budget limit, create a new one');
// or create one and return it. // or create one and return it.
$limit = new BudgetLimit(); $limit = new BudgetLimit();
$limit->budget()->associate($budget); $limit->budget()->associate($budget);
$limit->start_date = $start->startOfDay(); $limit->start_date = $start->startOfDay();
$limit->end_date = $end->startOfDay(); $limit->start_date_tz = $start->format('e');
$limit->amount = $amount; $limit->end_date = $end->startOfDay();
$limit->end_date_tz = $end->format('e');
$limit->amount = $amount;
$limit->save(); $limit->save();
app('log')->debug(sprintf('Created new budget limit with ID #%d and amount %s', $limit->id, $amount)); app('log')->debug(sprintf('Created new budget limit with ID #%d and amount %s', $limit->id, $amount));

View File

@ -89,11 +89,12 @@ class CurrencyRepository implements CurrencyRepositoryInterface
{ {
return CurrencyExchangeRate::create( return CurrencyExchangeRate::create(
[ [
'user_id' => $this->user->id, 'user_id' => $this->user->id,
'from_currency_id' => $fromCurrency->id, 'from_currency_id' => $fromCurrency->id,
'to_currency_id' => $toCurrency->id, 'to_currency_id' => $toCurrency->id,
'date' => $date, 'date' => $date,
'rate' => $rate, 'date_tz' => $date->format('e'),
'rate' => $rate,
] ]
); );
} }

View File

@ -192,6 +192,9 @@ trait ModifiesPiggyBanks
$piggyData['targetamount'] = '0'; $piggyData['targetamount'] = '0';
} }
$piggyData['startdate_tz'] = $piggyData['startdate']?->format('e');
$piggyData['targetdate_tz'] = $piggyData['targetdate']?->format('e');
try { try {
/** @var PiggyBank $piggyBank */ /** @var PiggyBank $piggyBank */
$piggyBank = PiggyBank::create($piggyData); $piggyBank = PiggyBank::create($piggyData);
@ -374,9 +377,11 @@ trait ModifiesPiggyBanks
} }
if (array_key_exists('targetdate', $data) && '' !== $data['targetdate']) { if (array_key_exists('targetdate', $data) && '' !== $data['targetdate']) {
$piggyBank->targetdate = $data['targetdate']; $piggyBank->targetdate = $data['targetdate'];
$piggyBank->targetdate_tz = $data['targetdate']->format('e');
} }
if (array_key_exists('startdate', $data)) { if (array_key_exists('startdate', $data)) {
$piggyBank->startdate = $data['startdate']; $piggyBank->startdate = $data['startdate'];
$piggyBank->startdate_tz = $data['targetdate']->format('e');
} }
$piggyBank->save(); $piggyBank->save();

View File

@ -276,6 +276,7 @@ class UserRepository implements UserRepositoryInterface
$invitee->email = $email; $invitee->email = $email;
$invitee->redeemed = false; $invitee->redeemed = false;
$invitee->expires = $now; $invitee->expires = $now;
$invitee->expires_tz = $now->format('e');
$invitee->save(); $invitee->save();
return $invitee; return $invitee;

View File

@ -105,10 +105,11 @@ class IsUniqueAccount implements ValidationRule, DataAwareRule
/** /**
* TODO duplicate from old validation class. * TODO duplicate from old validation class.
*/ */
private function validateAccountAnonymously(): void private function validateAccountAnonymously(): bool
{ {
if (!array_key_exists('user_id', $this->data)) { if (!array_key_exists('user_id', $this->data)) {
$this->fail('No user ID provided.'); $this->fail('No user ID provided.');
return false;
} }
/** @var User $user */ /** @var User $user */

View File

@ -145,7 +145,8 @@ class BillUpdateService
$bill->amount_max = $data['amount_max']; $bill->amount_max = $data['amount_max'];
} }
if (array_key_exists('date', $data) && '' !== (string)$data['date']) { 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']) { if (array_key_exists('repeat_freq', $data) && '' !== (string)$data['repeat_freq']) {
$bill->repeat_freq = $data['repeat_freq']; $bill->repeat_freq = $data['repeat_freq'];
@ -157,10 +158,12 @@ class BillUpdateService
$bill->active = $data['active']; $bill->active = $data['active'];
} }
if (array_key_exists('end_date', $data)) { 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)) { 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'; $bill->match = 'EMPTY';

View File

@ -65,9 +65,11 @@ class RecurrenceUpdateService
} }
if (array_key_exists('first_date', $info)) { if (array_key_exists('first_date', $info)) {
$recurrence->first_date = $info['first_date']; $recurrence->first_date = $info['first_date'];
$recurrence->first_date_tz = $info['first_date']?->format('e');
} }
if (array_key_exists('repeat_until', $info)) { if (array_key_exists('repeat_until', $info)) {
$recurrence->repeat_until = $info['repeat_until']; $recurrence->repeat_until = $info['repeat_until'];
$recurrence->repeat_until_tz = $info['repeat_until']?->format('e');
$recurrence->repetitions = 0; $recurrence->repetitions = 0;
} }
if (array_key_exists('nr_of_repetitions', $info)) { if (array_key_exists('nr_of_repetitions', $info)) {

View File

@ -232,16 +232,16 @@ class AccountBalanceCalculator
/** @var AccountBalance $object */ /** @var AccountBalance $object */
$object = $account->accountBalances()->firstOrCreate( $object = $account->accountBalances()->firstOrCreate(
[ [
'title' => 'running_balance', 'title' => 'running_balance',
'balance' => '0', 'balance' => '0',
'transaction_currency_id' => $currencyId, 'transaction_currency_id' => $currencyId,
'date' => $balance[1], 'date' => $balance[1],
'date_tz' => $balance[1]->format('e'), 'date_tz' => $balance[1]->format('e'),
] ]
); );
$object->balance = $balance[0]; $object->balance = $balance[0];
$object->date = $balance[1]; $object->date = $balance[1];
$object->date_tz = $balance[1]->format('e'); $object->date_tz = $balance[1]->format('e');
$object->save(); $object->save();
} }
} }

108
composer.lock generated
View File

@ -3208,16 +3208,16 @@
}, },
{ {
"name": "lcobucci/jwt", "name": "lcobucci/jwt",
"version": "5.4.0", "version": "5.4.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/lcobucci/jwt.git", "url": "https://github.com/lcobucci/jwt.git",
"reference": "aac4fd512681fd5cb4b77d2105ab7ec700c72051" "reference": "848815d2287abd5d3c285482f8e1f501b289a2e7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/lcobucci/jwt/zipball/aac4fd512681fd5cb4b77d2105ab7ec700c72051", "url": "https://api.github.com/repos/lcobucci/jwt/zipball/848815d2287abd5d3c285482f8e1f501b289a2e7",
"reference": "aac4fd512681fd5cb4b77d2105ab7ec700c72051", "reference": "848815d2287abd5d3c285482f8e1f501b289a2e7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3265,7 +3265,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/lcobucci/jwt/issues", "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": [ "funding": [
{ {
@ -3277,7 +3277,7 @@
"type": "patreon" "type": "patreon"
} }
], ],
"time": "2024-10-08T22:06:45+00:00" "time": "2024-11-06T06:16:04+00:00"
}, },
{ {
"name": "league/commonmark", "name": "league/commonmark",
@ -7085,16 +7085,16 @@
}, },
{ {
"name": "symfony/cache", "name": "symfony/cache",
"version": "v7.1.6", "version": "v7.1.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/cache.git", "url": "https://github.com/symfony/cache.git",
"reference": "567ef6de47fdcba56eb6c0b344b857d1fce1cce0" "reference": "23b61c9592ee72233c31625f0ae805dd1571e928"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/cache/zipball/567ef6de47fdcba56eb6c0b344b857d1fce1cce0", "url": "https://api.github.com/repos/symfony/cache/zipball/23b61c9592ee72233c31625f0ae805dd1571e928",
"reference": "567ef6de47fdcba56eb6c0b344b857d1fce1cce0", "reference": "23b61c9592ee72233c31625f0ae805dd1571e928",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7162,7 +7162,7 @@
"psr6" "psr6"
], ],
"support": { "support": {
"source": "https://github.com/symfony/cache/tree/v7.1.6" "source": "https://github.com/symfony/cache/tree/v7.1.7"
}, },
"funding": [ "funding": [
{ {
@ -7178,7 +7178,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-10-25T15:39:55+00:00" "time": "2024-11-05T15:34:55+00:00"
}, },
{ {
"name": "symfony/cache-contracts", "name": "symfony/cache-contracts",
@ -7332,16 +7332,16 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v7.1.6", "version": "v7.1.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "bb5192af6edc797cbab5c8e8ecfea2fe5f421e57" "reference": "3284aafcac338b6e86fd955ee4d794cbe434151a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/bb5192af6edc797cbab5c8e8ecfea2fe5f421e57", "url": "https://api.github.com/repos/symfony/console/zipball/3284aafcac338b6e86fd955ee4d794cbe434151a",
"reference": "bb5192af6edc797cbab5c8e8ecfea2fe5f421e57", "reference": "3284aafcac338b6e86fd955ee4d794cbe434151a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7405,7 +7405,7 @@
"terminal" "terminal"
], ],
"support": { "support": {
"source": "https://github.com/symfony/console/tree/v7.1.6" "source": "https://github.com/symfony/console/tree/v7.1.7"
}, },
"funding": [ "funding": [
{ {
@ -7421,7 +7421,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-10-09T08:46:59+00:00" "time": "2024-11-05T15:34:55+00:00"
}, },
{ {
"name": "symfony/css-selector", "name": "symfony/css-selector",
@ -7557,16 +7557,16 @@
}, },
{ {
"name": "symfony/error-handler", "name": "symfony/error-handler",
"version": "v7.1.6", "version": "v7.1.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/error-handler.git", "url": "https://github.com/symfony/error-handler.git",
"reference": "d60117093c2a9fe667baa8fedf84e8a09b9c592f" "reference": "010e44661f4c6babaf8c4862fe68c24a53903342"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/error-handler/zipball/d60117093c2a9fe667baa8fedf84e8a09b9c592f", "url": "https://api.github.com/repos/symfony/error-handler/zipball/010e44661f4c6babaf8c4862fe68c24a53903342",
"reference": "d60117093c2a9fe667baa8fedf84e8a09b9c592f", "reference": "010e44661f4c6babaf8c4862fe68c24a53903342",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7612,7 +7612,7 @@
"description": "Provides tools to manage errors and ease debugging PHP code", "description": "Provides tools to manage errors and ease debugging PHP code",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/error-handler/tree/v7.1.6" "source": "https://github.com/symfony/error-handler/tree/v7.1.7"
}, },
"funding": [ "funding": [
{ {
@ -7628,7 +7628,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-09-25T14:20:29+00:00" "time": "2024-11-05T15:34:55+00:00"
}, },
{ {
"name": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
@ -7916,16 +7916,16 @@
}, },
{ {
"name": "symfony/http-client", "name": "symfony/http-client",
"version": "v7.1.6", "version": "v7.1.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-client.git", "url": "https://github.com/symfony/http-client.git",
"reference": "274e2f6886b43a36f8bd5dfeb67215f7ebf9e291" "reference": "90ab2a4992dcf5d1f19a9b8737eba36a7c305fd0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-client/zipball/274e2f6886b43a36f8bd5dfeb67215f7ebf9e291", "url": "https://api.github.com/repos/symfony/http-client/zipball/90ab2a4992dcf5d1f19a9b8737eba36a7c305fd0",
"reference": "274e2f6886b43a36f8bd5dfeb67215f7ebf9e291", "reference": "90ab2a4992dcf5d1f19a9b8737eba36a7c305fd0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7990,7 +7990,7 @@
"http" "http"
], ],
"support": { "support": {
"source": "https://github.com/symfony/http-client/tree/v7.1.6" "source": "https://github.com/symfony/http-client/tree/v7.1.7"
}, },
"funding": [ "funding": [
{ {
@ -8006,7 +8006,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-10-22T09:40:50+00:00" "time": "2024-11-05T16:45:54+00:00"
}, },
{ {
"name": "symfony/http-client-contracts", "name": "symfony/http-client-contracts",
@ -8088,16 +8088,16 @@
}, },
{ {
"name": "symfony/http-foundation", "name": "symfony/http-foundation",
"version": "v7.1.6", "version": "v7.1.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-foundation.git", "url": "https://github.com/symfony/http-foundation.git",
"reference": "3d7bbf071b25f802f7d55524d408bed414ea71e2" "reference": "5183b61657807099d98f3367bcccb850238b17a9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/3d7bbf071b25f802f7d55524d408bed414ea71e2", "url": "https://api.github.com/repos/symfony/http-foundation/zipball/5183b61657807099d98f3367bcccb850238b17a9",
"reference": "3d7bbf071b25f802f7d55524d408bed414ea71e2", "reference": "5183b61657807099d98f3367bcccb850238b17a9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -8145,7 +8145,7 @@
"description": "Defines an object-oriented layer for the HTTP specification", "description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/http-foundation/tree/v7.1.6" "source": "https://github.com/symfony/http-foundation/tree/v7.1.7"
}, },
"funding": [ "funding": [
{ {
@ -8161,20 +8161,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-10-11T19:23:14+00:00" "time": "2024-11-06T09:02:46+00:00"
}, },
{ {
"name": "symfony/http-kernel", "name": "symfony/http-kernel",
"version": "v7.1.6", "version": "v7.1.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-kernel.git", "url": "https://github.com/symfony/http-kernel.git",
"reference": "5d8315899cd76b2e7e29179bf5fea103e41bdf03" "reference": "7f137cda31fd41e422edcdc01915f2c095b84399"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/5d8315899cd76b2e7e29179bf5fea103e41bdf03", "url": "https://api.github.com/repos/symfony/http-kernel/zipball/7f137cda31fd41e422edcdc01915f2c095b84399",
"reference": "5d8315899cd76b2e7e29179bf5fea103e41bdf03", "reference": "7f137cda31fd41e422edcdc01915f2c095b84399",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -8259,7 +8259,7 @@
"description": "Provides a structured process for converting a Request into a Response", "description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/http-kernel/tree/v7.1.6" "source": "https://github.com/symfony/http-kernel/tree/v7.1.7"
}, },
"funding": [ "funding": [
{ {
@ -8275,7 +8275,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-10-27T13:54:21+00:00" "time": "2024-11-06T09:54:34+00:00"
}, },
{ {
"name": "symfony/mailer", "name": "symfony/mailer",
@ -9291,16 +9291,16 @@
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v7.1.6", "version": "v7.1.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "6aaa189ddb4ff6b5de8fa3210f2fb42c87b4d12e" "reference": "9b8a40b7289767aa7117e957573c2a535efe6585"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/6aaa189ddb4ff6b5de8fa3210f2fb42c87b4d12e", "url": "https://api.github.com/repos/symfony/process/zipball/9b8a40b7289767aa7117e957573c2a535efe6585",
"reference": "6aaa189ddb4ff6b5de8fa3210f2fb42c87b4d12e", "reference": "9b8a40b7289767aa7117e957573c2a535efe6585",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -9332,7 +9332,7 @@
"description": "Executes commands in sub-processes", "description": "Executes commands in sub-processes",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/process/tree/v7.1.6" "source": "https://github.com/symfony/process/tree/v7.1.7"
}, },
"funding": [ "funding": [
{ {
@ -9348,7 +9348,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-09-25T14:20:29+00:00" "time": "2024-11-06T09:25:12+00:00"
}, },
{ {
"name": "symfony/psr-http-message-bridge", "name": "symfony/psr-http-message-bridge",
@ -9932,16 +9932,16 @@
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
"version": "v7.1.6", "version": "v7.1.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-dumper.git", "url": "https://github.com/symfony/var-dumper.git",
"reference": "cb5bd55a6b8c2c1c7fb68b0aeae0e257948a720c" "reference": "f6ea51f669760cacd7464bf7eaa0be87b8072db1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/cb5bd55a6b8c2c1c7fb68b0aeae0e257948a720c", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/f6ea51f669760cacd7464bf7eaa0be87b8072db1",
"reference": "cb5bd55a6b8c2c1c7fb68b0aeae0e257948a720c", "reference": "f6ea51f669760cacd7464bf7eaa0be87b8072db1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -9995,7 +9995,7 @@
"dump" "dump"
], ],
"support": { "support": {
"source": "https://github.com/symfony/var-dumper/tree/v7.1.6" "source": "https://github.com/symfony/var-dumper/tree/v7.1.7"
}, },
"funding": [ "funding": [
{ {
@ -10011,7 +10011,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-09-25T14:20:29+00:00" "time": "2024-11-05T15:34:55+00:00"
}, },
{ {
"name": "symfony/var-exporter", "name": "symfony/var-exporter",

View File

@ -1,25 +1,26 @@
<?php <?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\QueryException; use Illuminate\Database\QueryException;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
return new class extends Migration { return new class () extends Migration {
private array $tables; private array $tables;
public function __construct() public function __construct()
{ {
$this->tables = [ $this->tables = [
'account_balances' => ['date'], 'account_balances' => ['date'], // done
'available_budgets' => ['start_date', 'end_date'], 'available_budgets' => ['start_date', 'end_date'], // done
'bills' => ['date','end_date', 'extension_date'], 'bills' => ['date', 'end_date', 'extension_date'], // done
'budget_limits' => ['start_date', 'end_date'], 'budget_limits' => ['start_date', 'end_date'], // done
'currency_exchange_rates' => ['date'], 'currency_exchange_rates' => ['date'], // done
'invited_users' => ['expires'], 'invited_users' => ['expires'],
'limit_repetitions' => ['startdate', 'enddate'],
'piggy_bank_events' => ['date'], 'piggy_bank_events' => ['date'],
'piggy_bank_repetitions' => ['startdate', 'targetdate'], 'piggy_bank_repetitions' => ['startdate', 'targetdate'],
'piggy_banks' => ['startdate', 'targetdate'], 'piggy_banks' => ['startdate', 'targetdate'], // done
'recurrences' => ['first_date', 'repeat_until', 'latest_date'], 'recurrences' => ['first_date', 'repeat_until', 'latest_date'],
'tags' => ['date'], 'tags' => ['date'],
'transaction_journals' => ['date'], 'transaction_journals' => ['date'],
@ -29,7 +30,6 @@ return new class extends Migration {
/** /**
* Run the migrations. * Run the migrations.
* TODO journal_meta, all date fields? * TODO journal_meta, all date fields?
*
*/ */
public function up(): void public function up(): void
{ {
@ -56,8 +56,5 @@ return new class extends Migration {
/** /**
* Reverse the migrations. * Reverse the migrations.
*/ */
public function down(): void public function down(): void {}
{
//
}
}; };