Rename references to native amounts

This commit is contained in:
James Cole
2025-07-31 20:55:30 +02:00
parent da36d84b79
commit ea6addafe6
16 changed files with 60 additions and 61 deletions

View File

@@ -44,10 +44,10 @@ class AccountObserver
public function created(Account $account): void
{
// Log::debug('Observe "created" of an account.');
$this->updateNativeAmount($account);
$this->updatePrimaryCurrencyAmount($account);
}
private function updateNativeAmount(Account $account): void
private function updatePrimaryCurrencyAmount(Account $account): void
{
if (!Amount::convertToPrimary($account->user)) {
return;
@@ -67,7 +67,7 @@ class AccountObserver
$account->native_virtual_balance = null;
}
$account->saveQuietly();
// Log::debug('Account native virtual balance is updated.');
// Log::debug('Account primary currency virtual balance is updated.');
}
/**
@@ -108,6 +108,6 @@ class AccountObserver
public function updated(Account $account): void
{
// Log::debug('Observe "updated" of an account.');
$this->updateNativeAmount($account);
$this->updatePrimaryCurrencyAmount($account);
}
}

View File

@@ -34,10 +34,10 @@ class AutoBudgetObserver
public function created(AutoBudget $autoBudget): void
{
Log::debug('Observe "created" of an auto budget.');
$this->updateNativeAmount($autoBudget);
$this->updatePrimaryCurrencyAmount($autoBudget);
}
private function updateNativeAmount(AutoBudget $autoBudget): void
private function updatePrimaryCurrencyAmount(AutoBudget $autoBudget): void
{
if (!Amount::convertToPrimary($autoBudget->budget->user)) {
return;
@@ -51,12 +51,12 @@ class AutoBudgetObserver
$autoBudget->native_amount = $converter->convert($autoBudget->transactionCurrency, $userCurrency, today(), $autoBudget->amount);
}
$autoBudget->saveQuietly();
Log::debug('Auto budget native amount is updated.');
Log::debug('Auto budget primary currency amount is updated.');
}
public function updated(AutoBudget $autoBudget): void
{
Log::debug('Observe "updated" of an auto budget.');
$this->updateNativeAmount($autoBudget);
$this->updatePrimaryCurrencyAmount($autoBudget);
}
}

View File

@@ -34,13 +34,13 @@ class AvailableBudgetObserver
public function created(AvailableBudget $availableBudget): void
{
// Log::debug('Observe "created" of an available budget.');
$this->updateNativeAmount($availableBudget);
$this->updatePrimaryCurrencyAmount($availableBudget);
}
private function updateNativeAmount(AvailableBudget $availableBudget): void
private function updatePrimaryCurrencyAmount(AvailableBudget $availableBudget): void
{
if (!Amount::convertToPrimary($availableBudget->user)) {
// Log::debug('Do not update native available amount of the available budget.');
// Log::debug('Do not update primary currency available amount of the available budget.');
return;
}
@@ -53,12 +53,12 @@ class AvailableBudgetObserver
$availableBudget->native_amount = $converter->convert($availableBudget->transactionCurrency, $userCurrency, today(), $availableBudget->amount);
}
$availableBudget->saveQuietly();
Log::debug('Available budget native amount is updated.');
Log::debug('Available budget primary currency amount is updated.');
}
public function updated(AvailableBudget $availableBudget): void
{
// Log::debug('Observe "updated" of an available budget.');
$this->updateNativeAmount($availableBudget);
$this->updatePrimaryCurrencyAmount($availableBudget);
}
}

View File

@@ -38,10 +38,10 @@ class BillObserver
public function created(Bill $bill): void
{
// Log::debug('Observe "created" of a bill.');
$this->updateNativeAmount($bill);
$this->updatePrimaryCurrencyAmount($bill);
}
private function updateNativeAmount(Bill $bill): void
private function updatePrimaryCurrencyAmount(Bill $bill): void
{
if (!Amount::convertToPrimary($bill->user)) {
return;
@@ -57,7 +57,7 @@ class BillObserver
$bill->native_amount_max = $converter->convert($bill->transactionCurrency, $userCurrency, today(), $bill->amount_max);
}
$bill->saveQuietly();
Log::debug('Bill native amounts are updated.');
Log::debug('Bill primary currency amounts are updated.');
}
public function deleting(Bill $bill): void
@@ -76,6 +76,6 @@ class BillObserver
public function updated(Bill $bill): void
{
// Log::debug('Observe "updated" of a bill.');
$this->updateNativeAmount($bill);
$this->updatePrimaryCurrencyAmount($bill);
}
}

View File

@@ -34,13 +34,13 @@ class BudgetLimitObserver
public function created(BudgetLimit $budgetLimit): void
{
Log::debug('Observe "created" of a budget limit.');
$this->updateNativeAmount($budgetLimit);
$this->updatePrimaryCurrencyAmount($budgetLimit);
}
private function updateNativeAmount(BudgetLimit $budgetLimit): void
private function updatePrimaryCurrencyAmount(BudgetLimit $budgetLimit): void
{
if (!Amount::convertToPrimary($budgetLimit->budget->user)) {
// Log::debug('Do not update native amount of the budget limit.');
// Log::debug('Do not update primary currency amount of the budget limit.');
return;
}
@@ -53,12 +53,12 @@ class BudgetLimitObserver
$budgetLimit->native_amount = $converter->convert($budgetLimit->transactionCurrency, $userCurrency, today(), $budgetLimit->amount);
}
$budgetLimit->saveQuietly();
Log::debug('Budget limit native amounts are updated.');
Log::debug('Budget limit primary currency amounts are updated.');
}
public function updated(BudgetLimit $budgetLimit): void
{
Log::debug('Observe "updated" of a budget limit.');
$this->updateNativeAmount($budgetLimit);
$this->updatePrimaryCurrencyAmount($budgetLimit);
}
}

View File

@@ -34,10 +34,10 @@ class PiggyBankEventObserver
public function created(PiggyBankEvent $event): void
{
Log::debug('Observe "created" of a piggy bank event.');
$this->updateNativeAmount($event);
$this->updatePrimaryCurrencyAmount($event);
}
private function updateNativeAmount(PiggyBankEvent $event): void
private function updatePrimaryCurrencyAmount(PiggyBankEvent $event): void
{
$user = $event->piggyBank->accounts()->first()?->user;
if (null === $user) {
@@ -57,12 +57,12 @@ class PiggyBankEventObserver
$event->native_amount = $converter->convert($event->piggyBank->transactionCurrency, $userCurrency, today(), $event->amount);
}
$event->saveQuietly();
Log::debug('Piggy bank event native amount is updated.');
Log::debug('Piggy bank event primary currency amount is updated.');
}
public function updated(PiggyBankEvent $event): void
{
Log::debug('Observe "updated" of a piggy bank event.');
$this->updateNativeAmount($event);
$this->updatePrimaryCurrencyAmount($event);
}
}

View File

@@ -38,10 +38,10 @@ class PiggyBankObserver
public function created(PiggyBank $piggyBank): void
{
Log::debug('Observe "created" of a piggy bank.');
$this->updateNativeAmount($piggyBank);
$this->updatePrimaryCurrencyAmount($piggyBank);
}
private function updateNativeAmount(PiggyBank $piggyBank): void
private function updatePrimaryCurrencyAmount(PiggyBank $piggyBank): void
{
$group = $piggyBank->accounts()->first()?->user->userGroup;
if (null === $group) {
@@ -58,7 +58,7 @@ class PiggyBankObserver
$piggyBank->native_target_amount = $converter->convert($piggyBank->transactionCurrency, $userCurrency, today(), $piggyBank->target_amount);
}
$piggyBank->saveQuietly();
Log::debug('Piggy bank native target amount is updated.');
Log::debug('Piggy bank primary currency target amount is updated.');
}
/**
@@ -85,6 +85,6 @@ class PiggyBankObserver
public function updated(PiggyBank $piggyBank): void
{
Log::debug('Observe "updated" of a piggy bank.');
$this->updateNativeAmount($piggyBank);
$this->updatePrimaryCurrencyAmount($piggyBank);
}
}

View File

@@ -45,10 +45,10 @@ class TransactionObserver
AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal);
}
}
$this->updateNativeAmount($transaction);
$this->updatePrimaryCurrencyAmount($transaction);
}
private function updateNativeAmount(Transaction $transaction): void
private function updatePrimaryCurrencyAmount(Transaction $transaction): void
{
if (!Amount::convertToPrimary($transaction->transactionJournal->user)) {
return;
@@ -72,7 +72,7 @@ class TransactionObserver
}
$transaction->saveQuietly();
Log::debug('Transaction native amounts are updated.');
Log::debug('Transaction primary currency amounts are updated.');
}
public function deleting(?Transaction $transaction): void
@@ -90,6 +90,6 @@ class TransactionObserver
AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal);
}
}
$this->updateNativeAmount($transaction);
$this->updatePrimaryCurrencyAmount($transaction);
}
}