Rename many references from native to primary.

This commit is contained in:
James Cole
2025-07-31 20:24:19 +02:00
parent 210bd83bd4
commit 6d3f2bd5e7
59 changed files with 128 additions and 146 deletions

View File

@@ -54,7 +54,7 @@ class TransactionGroupEnrichment implements EnrichmentInterface
private array $notes; // @phpstan-ignore-line
private array $tags;
private User $user;
private readonly TransactionCurrency $nativeCurrency;
private readonly TransactionCurrency $primaryCurrency;
private UserGroup $userGroup;
public function __construct()
@@ -66,7 +66,7 @@ class TransactionGroupEnrichment implements EnrichmentInterface
$this->locations = [];
$this->attachmentCount = [];
$this->dateFields = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'invoice_date'];
$this->nativeCurrency = Amount::getNativeCurrency();
$this->primaryCurrency = Amount::getPrimaryCurrency();
}
#[Override]
@@ -198,9 +198,9 @@ class TransactionGroupEnrichment implements EnrichmentInterface
$metaData = $this->metaData;
$locations = $this->locations;
$attachmentCount = $this->attachmentCount;
$nativeCurrency = $this->nativeCurrency;
$primaryCurrency = $this->primaryCurrency;
$this->collection = $this->collection->map(function (array $item) use ($nativeCurrency, $notes, $tags, $metaData, $locations, $attachmentCount) {
$this->collection = $this->collection->map(function (array $item) use ($primaryCurrency, $notes, $tags, $metaData, $locations, $attachmentCount) {
foreach ($item['transactions'] as $index => $transaction) {
$journalId = (int) $transaction['transaction_journal_id'];
@@ -220,13 +220,13 @@ class TransactionGroupEnrichment implements EnrichmentInterface
'zoom_level' => null,
];
// native currency
$item['transactions'][$index]['native_currency'] = [
'id' => (string) $nativeCurrency->id,
'code' => $nativeCurrency->code,
'name' => $nativeCurrency->name,
'symbol' => $nativeCurrency->symbol,
'decimal_places' => $nativeCurrency->decimal_places,
// primary currency
$item['transactions'][$index]['primary_currency'] = [
'id' => (string) $primaryCurrency->id,
'code' => $primaryCurrency->code,
'name' => $primaryCurrency->name,
'symbol' => $primaryCurrency->symbol,
'decimal_places' => $primaryCurrency->decimal_places,
];
// append meta data