From 46e7276b148ad99d1dff046fc7c45bcea9433900 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Sat, 2 May 2026 03:19:14 +0200 Subject: [PATCH] dsdf --- modules/fx-rates/pages/currencies.php | 49 ++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/modules/fx-rates/pages/currencies.php b/modules/fx-rates/pages/currencies.php index ecec922..1187368 100644 --- a/modules/fx-rates/pages/currencies.php +++ b/modules/fx-rates/pages/currencies.php @@ -209,15 +209,56 @@ $tabs = [ snapshotByFetchId((int) ($fetch['id'] ?? 0), $displayBaseCurrency, $tableCurrencies); - $rates = is_array($snapshot['rates'] ?? null) ? $snapshot['rates'] : []; + $fetchBaseCurrency = strtoupper(trim((string) ($fetch['base_currency'] ?? ''))); + $snapshot = $service->snapshotByFetchId((int) ($fetch['id'] ?? 0), $fetchBaseCurrency, $tableCurrencies); + $originalRates = is_array($snapshot['rates'] ?? null) ? $snapshot['rates'] : []; + $displayBaseRate = $displayBaseCurrency === $fetchBaseCurrency + ? 1.0 + : (is_numeric($originalRates[$displayBaseCurrency] ?? null) ? (float) $originalRates[$displayBaseCurrency] : null); + $tableRates = []; + foreach ($tableCurrencies as $currency) { + $currency = strtoupper(trim((string) $currency)); + if ($currency === '') { + continue; + } + if ($currency === $displayBaseCurrency) { + $tableRates[$currency] = 1.0; + continue; + } + if ($displayBaseRate === null || $displayBaseRate <= 0) { + $tableRates[$currency] = null; + continue; + } + if ($currency === $fetchBaseCurrency) { + $tableRates[$currency] = 1 / $displayBaseRate; + continue; + } + $rawRate = $originalRates[$currency] ?? null; + $tableRates[$currency] = is_numeric($rawRate) ? ((float) $rawRate / $displayBaseRate) : null; + } + $infoTitle = sprintf( + 'Basis: %s | Provider: %s | Ausloeser: %s', + (string) ($fetch['base_currency'] ?? '-'), + (string) ($fetch['provider'] ?? '-'), + (string) ($fetch['trigger_source_label'] ?? $fetch['trigger_source'] ?? '-') + ); ?> - + +
+ + +
+ - +