Include safe methods and require the correct package.

This commit is contained in:
James Cole
2025-05-11 14:19:07 +02:00
parent 4af2aadc48
commit 9a02739251
61 changed files with 295 additions and 294 deletions

View File

@@ -68,16 +68,16 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte
$set
= TransactionJournalMeta::where(static function (Builder $q1) use ($recurrence): void {
$q1->where('name', 'recurrence_id');
$q1->where('data', json_encode((string) $recurrence->id));
$q1->where('data', \Safe\json_encode((string) $recurrence->id));
})->get(['journal_meta.transaction_journal_id']);
// there are X journals made for this recurrence. Any of them meant for today?
foreach ($set as $journalMeta) {
$count = TransactionJournalMeta::where(static function (Builder $q2) use ($date): void {
$string = (string) $date;
app('log')->debug(sprintf('Search for date: %s', json_encode($string)));
app('log')->debug(sprintf('Search for date: %s', \Safe\json_encode($string)));
$q2->where('name', 'recurrence_date');
$q2->where('data', json_encode($string));
$q2->where('data', \Safe\json_encode($string));
})
->where('transaction_journal_id', $journalMeta->transaction_journal_id)
->count()
@@ -232,7 +232,7 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte
return TransactionJournalMeta::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id')
->where('transaction_journals.user_id', $this->user->id)
->where('journal_meta.name', '=', 'recurrence_id')
->where('journal_meta.data', '=', json_encode((string) $recurrence->id))
->where('journal_meta.data', '=', \Safe\json_encode((string) $recurrence->id))
->get(['journal_meta.transaction_journal_id'])->pluck('transaction_journal_id')->toArray()
;
}
@@ -272,7 +272,7 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte
/** @var RecurrenceMeta $meta */
foreach ($transaction->recurrenceTransactionMeta as $meta) {
if ('tags' === $meta->name && '' !== $meta->value) {
$tags = json_decode($meta->value, true, 512, JSON_THROW_ON_ERROR);
$tags = \Safe\json_decode($meta->value, true, 512, JSON_THROW_ON_ERROR);
}
}
@@ -285,7 +285,7 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte
->whereNull('transaction_journals.deleted_at')
->where('transaction_journals.user_id', $this->user->id)
->where('name', 'recurrence_id')
->where('data', json_encode((string) $recurrence->id))
->where('data', \Safe\json_encode((string) $recurrence->id))
->get()->pluck('transaction_journal_id')->toArray()
;
$search = [];
@@ -311,7 +311,7 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte
->whereNull('transaction_journals.deleted_at')
->where('transaction_journals.user_id', $this->user->id)
->where('name', 'recurrence_id')
->where('data', json_encode((string) $recurrence->id))
->where('data', \Safe\json_encode((string) $recurrence->id))
->get()->pluck('transaction_journal_id')->toArray()
;
$search = [];