Rename "native" to "primary".

This commit is contained in:
James Cole
2025-08-01 06:12:36 +02:00
parent ea6addafe6
commit 084ce02c21
51 changed files with 296 additions and 296 deletions

View File

@@ -109,7 +109,7 @@ class BillController extends Controller
$cache = new CacheProperties();
$cache->addProperty('chart.bill.single');
$cache->addProperty($bill->id);
$cache->addProperty($this->convertToNative);
$cache->addProperty($this->convertToPrimary);
if ($cache->has()) {
return response()->json($cache->get());
}
@@ -134,8 +134,8 @@ class BillController extends Controller
}
);
$currency = $bill->transactionCurrency;
if ($this->convertToNative) {
$currency = $this->defaultCurrency;
if ($this->convertToPrimary) {
$currency = $this->primaryCurrency;
}
$chartData = [
@@ -164,7 +164,7 @@ class BillController extends Controller
$currencyId = $bill->transaction_currency_id;
$amountMin = $bill->amount_min;
$amountMax = $bill->amount_max;
if ($this->convertToNative && $currencyId !== $this->defaultCurrency->id) {
if ($this->convertToPrimary && $currencyId !== $this->primaryCurrency->id) {
$amountMin = $bill->native_amount_min;
$amountMax = $bill->native_amount_max;
}
@@ -178,11 +178,11 @@ class BillController extends Controller
$chartData[2]['entries'][$date] = '0';
}
$amount = bcmul((string) $journal['amount'], '-1');
if ($this->convertToNative && $currencyId !== $journal['currency_id']) {
$amount = bcmul($journal['native_amount'] ?? '0', '-1');
if ($this->convertToPrimary && $currencyId !== $journal['currency_id']) {
$amount = bcmul($journal['pc_amount'] ?? '0', '-1');
}
if ($this->convertToNative && $currencyId === $journal['foreign_currency_id']) {
$amount = bcmul((string) $journal['foreign_amount'], '-1');
if ($this->convertToPrimary && $currencyId === $journal['foreign_currency_id']) {
$amount = bcmul((string) $journal['pc_amount'], '-1');
}
$chartData[2]['entries'][$date] = bcadd($chartData[2]['entries'][$date], $amount); // amount of journal