Ejegg has uploaded a new change for review.
https://gerrit.wikimedia.org/r/223973
Change subject: Use static data as ultimate forex fallback
......................................................................
Use static data as ultimate forex fallback
Change-Id: I7c9e62c6cead4a2912d1551132991a3a74aa5f90
---
M sites/all/modules/exchange_rates/exchange_rates.module
1 file changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm
refs/changes/73/223973/1
diff --git a/sites/all/modules/exchange_rates/exchange_rates.module
b/sites/all/modules/exchange_rates/exchange_rates.module
index 0e7ab6b..0bbe533 100644
--- a/sites/all/modules/exchange_rates/exchange_rates.module
+++ b/sites/all/modules/exchange_rates/exchange_rates.module
@@ -147,6 +147,15 @@
if (!$rate) {
$rate = db_query_range('SELECT value_in_usd FROM {exchange_rates} WHERE
currency = :currency ORDER BY bank_update', 0, 1, array( ':currency' =>
$from_currency ))->fetchField();
}
+
+ // Still nothin? Check the static data from DonationInterface
+ if (!$rate) {
+ $hardcoded = CurrencyRates::getCurrencyRates();
+ if ( !empty( $hardcoded[$from_currency] ) ) {
+ // DontationInterface holds the inverse of what we want here
+ $rate = 1 / $hardcoded[$from_currency];
+ }
+ }
if (!$rate) {
throw new ExchangeRatesException(t("No conversion available for currency
!cur", array("!cur" => $from_currency)));
--
To view, visit https://gerrit.wikimedia.org/r/223973
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c9e62c6cead4a2912d1551132991a3a74aa5f90
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits