mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 19:01:58 +00:00
First fixes for level 7.
This commit is contained in:
@@ -89,12 +89,13 @@ class RemovesEmptyJournals extends Command
|
|||||||
$set = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
$set = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->groupBy('transaction_journals.id')
|
->groupBy('transaction_journals.id')
|
||||||
->whereNull('transactions.transaction_journal_id')
|
->whereNull('transactions.transaction_journal_id')
|
||||||
->get(['transaction_journals.id'])
|
->get(['transaction_journals.id']);
|
||||||
;
|
|
||||||
|
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
try {
|
try {
|
||||||
TransactionJournal::find($entry->id)->delete();
|
/** @var TransactionJournal|null $journal */
|
||||||
|
$journal = TransactionJournal::find($entry->id);
|
||||||
|
$journal?->delete();
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
app('log')->info(sprintf('Could not delete entry: %s', $e->getMessage()));
|
app('log')->info(sprintf('Could not delete entry: %s', $e->getMessage()));
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
|
@@ -264,7 +264,9 @@ class ForcesDecimalSize extends Command
|
|||||||
$pow = 10 ** $currency->decimal_places;
|
$pow = 10 ** $currency->decimal_places;
|
||||||
$correct = bcdiv((string) round($value * $pow), (string) $pow, 12);
|
$correct = bcdiv((string) round($value * $pow), (string) $pow, 12);
|
||||||
$this->friendlyInfo(sprintf('Account #%d has %s with value "%s", this has been corrected to "%s".', $account->id, $field, $value, $correct));
|
$this->friendlyInfo(sprintf('Account #%d has %s with value "%s", this has been corrected to "%s".', $account->id, $field, $value, $correct));
|
||||||
Account::find($account->id)->update([$field => $correct]);
|
/** @var Account|null $updateAccount */
|
||||||
|
$updateAccount = Account::find($account->id);
|
||||||
|
$updateAccount?->update([$field => $correct]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -313,7 +315,9 @@ class ForcesDecimalSize extends Command
|
|||||||
$pow = 10 ** $currency->decimal_places;
|
$pow = 10 ** $currency->decimal_places;
|
||||||
$correct = bcdiv((string) round($value * $pow), (string) $pow, 12);
|
$correct = bcdiv((string) round($value * $pow), (string) $pow, 12);
|
||||||
$this->friendlyWarning(sprintf('%s #%d has %s with value "%s", this has been corrected to "%s".', $table, $item->id, $field, $value, $correct));
|
$this->friendlyWarning(sprintf('%s #%d has %s with value "%s", this has been corrected to "%s".', $table, $item->id, $field, $value, $correct));
|
||||||
$class::find($item->id)->update([$field => $correct]);
|
/** @var Model|null $model */
|
||||||
|
$model = $class::find($item->id);
|
||||||
|
$model?->update([$field => $correct]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -365,7 +369,9 @@ class ForcesDecimalSize extends Command
|
|||||||
$this->friendlyWarning(
|
$this->friendlyWarning(
|
||||||
sprintf('Piggy bank event #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct)
|
sprintf('Piggy bank event #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct)
|
||||||
);
|
);
|
||||||
PiggyBankEvent::find($item->id)->update([$field => $correct]);
|
/** @var PiggyBankEvent|null $event */
|
||||||
|
$event = PiggyBankEvent::find($item->id);
|
||||||
|
$event?->update([$field => $correct]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -418,7 +424,9 @@ class ForcesDecimalSize extends Command
|
|||||||
$this->friendlyWarning(
|
$this->friendlyWarning(
|
||||||
sprintf('Piggy bank repetition #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct)
|
sprintf('Piggy bank repetition #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct)
|
||||||
);
|
);
|
||||||
PiggyBankRepetition::find($item->id)->update([$field => $correct]);
|
/** @var PiggyBankRepetition|null $repetition */
|
||||||
|
$repetition = PiggyBankRepetition::find($item->id);
|
||||||
|
$repetition->update([$field => $correct]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -467,7 +475,9 @@ class ForcesDecimalSize extends Command
|
|||||||
$pow = 10 ** $currency->decimal_places;
|
$pow = 10 ** $currency->decimal_places;
|
||||||
$correct = bcdiv((string) round($value * $pow), (string) $pow, 12);
|
$correct = bcdiv((string) round($value * $pow), (string) $pow, 12);
|
||||||
$this->friendlyWarning(sprintf('Piggy bank #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct));
|
$this->friendlyWarning(sprintf('Piggy bank #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct));
|
||||||
PiggyBank::find($item->id)->update([$field => $correct]);
|
/** @var PiggyBank|null $piggyBank */
|
||||||
|
$piggyBank = PiggyBank::find($item->id);
|
||||||
|
$piggyBank?->update([$field => $correct]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -500,7 +510,9 @@ class ForcesDecimalSize extends Command
|
|||||||
$pow = (float) 10 ** $currency->decimal_places;
|
$pow = (float) 10 ** $currency->decimal_places;
|
||||||
$correct = bcdiv((string) round((float) $value * $pow), (string) $pow, 12);
|
$correct = bcdiv((string) round((float) $value * $pow), (string) $pow, 12);
|
||||||
$this->friendlyWarning(sprintf('Transaction #%d has amount with value "%s", this has been corrected to "%s".', $item->id, $value, $correct));
|
$this->friendlyWarning(sprintf('Transaction #%d has amount with value "%s", this has been corrected to "%s".', $item->id, $value, $correct));
|
||||||
Transaction::find($item->id)->update(['amount' => $correct]);
|
/** @var Transaction|null $transaction */
|
||||||
|
$transaction = Transaction::find($item->id);
|
||||||
|
$transaction?->update(['amount' => $correct]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// select all transactions with this FOREIGN currency and issue.
|
// select all transactions with this FOREIGN currency and issue.
|
||||||
@@ -530,7 +542,9 @@ class ForcesDecimalSize extends Command
|
|||||||
$this->friendlyWarning(
|
$this->friendlyWarning(
|
||||||
sprintf('Transaction #%d has foreign amount with value "%s", this has been corrected to "%s".', $item->id, $value, $correct)
|
sprintf('Transaction #%d has foreign amount with value "%s", this has been corrected to "%s".', $item->id, $value, $correct)
|
||||||
);
|
);
|
||||||
Transaction::find($item->id)->update(['foreign_amount' => $correct]);
|
/** @var Transaction|null $transaction */
|
||||||
|
$transaction = Transaction::find($item->id);
|
||||||
|
$transaction?->update(['foreign_amount' => $correct]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -53,9 +53,11 @@ class BudgetLimitHandler
|
|||||||
private function updateAvailableBudget(BudgetLimit $budgetLimit): void
|
private function updateAvailableBudget(BudgetLimit $budgetLimit): void
|
||||||
{
|
{
|
||||||
Log::debug(sprintf('Now in updateAvailableBudget(limit #%d)', $budgetLimit->id));
|
Log::debug(sprintf('Now in updateAvailableBudget(limit #%d)', $budgetLimit->id));
|
||||||
|
/** @var Budget|null $budget */
|
||||||
$budget = Budget::find($budgetLimit->budget_id);
|
$budget = Budget::find($budgetLimit->budget_id);
|
||||||
if (null === $budget) {
|
if (null === $budget) {
|
||||||
Log::warning('Budget is null, probably deleted, find deleted version.');
|
Log::warning('Budget is null, probably deleted, find deleted version.');
|
||||||
|
/** @var Budget|null $budget */
|
||||||
$budget = Budget::withTrashed()->find($budgetLimit->budget_id);
|
$budget = Budget::withTrashed()->find($budgetLimit->budget_id);
|
||||||
}
|
}
|
||||||
if (null === $budget) {
|
if (null === $budget) {
|
||||||
|
@@ -37,7 +37,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', '')),
|
'stateful' => explode(',', (string) env('SANCTUM_STATEFUL_DOMAINS', '')),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user