From: Joe Hunt Date: Thu, 20 Dec 2018 12:01:02 +0000 (+0100) Subject: No exchange rate working in FA now. Fixed ECB, CCA and EXCHANGE-RATES.ORG. @notrinos. X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=d025fc1f712592f0707e8ed980f51d5e2252174c No exchange rate working in FA now. Fixed ECB, CCA and EXCHANGE-RATES.ORG. @notrinos. --- diff --git a/config.default.php b/config.default.php index 461a1be7..a1089866 100644 --- a/config.default.php +++ b/config.default.php @@ -178,7 +178,7 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ Choose Exchange Rate Provider Default is ECB for backwards compatibility */ - $xr_providers = array("EXCHANGE-RATES.ORG", "ECB", "YAHOO", "GOOGLE", "BLOOMBERG"); + $xr_providers = array("ECB", "EXCHANGE-RATES.ORG", "CCA", "YAHOO", "GOOGLE", "BLOOMBERG"); $dflt_xr_provider = 0; /* diff --git a/gl/includes/db/gl_db_rates.inc b/gl/includes/db/gl_db_rates.inc index 2702c659..f067254c 100644 --- a/gl/includes/db/gl_db_rates.inc +++ b/gl/includes/db/gl_db_rates.inc @@ -137,11 +137,13 @@ function get_extern_rate($curr_b, $provider = 'ECB', $date) $proto = 'http://'; $curr_a = get_company_pref('curr_default'); if ($provider == 'ECB') - { - $filename = "/stats/eurofxref/eurofxref-daily.xml"; - $site = "www.ecb.europa.eu"; - $site_ip="172.230.157.137"; - } + { + $filename = "/stats/eurofxref/eurofxref-daily.xml"; + $site = "www.ecb.europa.eu"; + $proto = 'https://'; + $site_ip="172.230.157.137"; + $contents=file_get_contents($proto.$site.$filename); + } elseif ($provider == 'YAHOO') { $filename = "/d/quotes.csv?s={$curr_a}{$curr_b}=X&f=sl1d1t1ba&e=.csv"; // new URL's for YAHOO @@ -167,6 +169,13 @@ function get_extern_rate($curr_b, $provider = 'ECB', $date) $proto = 'https://'; $contents=file_get_contents($proto.$site.$filename); } + elseif ($provider == 'CCA') + { + $filename = "/api/v6/convert?q={$curr_b}_{$curr_a}&compact=y&callback=sampleCallback"; + $site = "free.currencyconverterapi.com"; + $proto = 'https://'; + $contents=file_get_contents($proto.$site.$filename); + } if (empty($contents)) { if (function_exists('curl_init')) { // first check with curl as we can set short timeout; @@ -240,7 +249,11 @@ function get_extern_rate($curr_b, $provider = 'ECB', $date) elseif ($provider == 'EXCHANGE-RATES.ORG') { $val = getInnerStr($contents, '', '<'); - } + } + elseif ($provider == 'CCA') + { + $val = getInnerStr($contents, '"val":', '}'); + } return $val; } /* end function get_extern_rate */