<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — No exchange rate working in FA now]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=7718</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7718&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in No exchange rate working in FA now.]]></description>
		<lastBuildDate>Tue, 07 Sep 2021 09:18:55 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: No exchange rate working in FA now]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=39980#p39980</link>
			<description><![CDATA[<p>Thanks @boxygen.</p><p>Fixed and committed to stable repo.</p><p>A fixed file can be downloaded and replaced.</p><p>/Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Tue, 07 Sep 2021 09:18:55 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=39980#p39980</guid>
		</item>
		<item>
			<title><![CDATA[Re: No exchange rate working in FA now]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=39978#p39978</link>
			<description><![CDATA[<p>Hello, Recently due to some changes in output of EXCHANGE-RATES.ORG the current code is not retrieving Exchange Rate. </p><p>Following fix is needed.</p><p><strong>/gl/includes/db/gl_db_rates.inc</strong><br />Line # 240 Replace <br /></p><div class="codebox"><pre><code>$val = getInnerStr($contents, &#039;&lt;span id=&quot;ctl00_M_lblToAmount&quot;&gt;&#039;, &#039;&lt;&#039;);
        $val = str_replace (&#039;,&#039;, &#039;&#039;, $val);</code></pre></div><p>with<br /></p><div class="codebox"><pre><code>        $val = getInnerStr($contents, &quot;1 $curr_b = &quot;,$curr_a);</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Mon, 06 Sep 2021 16:55:20 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=39978#p39978</guid>
		</item>
		<item>
			<title><![CDATA[Re: No exchange rate working in FA now]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=34507#p34507</link>
			<description><![CDATA[<p>This has been <a href="https://github.com/FrontAccountingERP/FA/commit/f4161d2985268fc4333f968b215ed0c6a53b731c#commitcomment-32876991">committed</a> to stable repo. Thank you @notrinos for providing this.</p><p>Remember to change the settings in <strong>config.php</strong> also.</p><p>/Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Thu, 21 Mar 2019 21:35:25 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=34507#p34507</guid>
		</item>
		<item>
			<title><![CDATA[Re: No exchange rate working in FA now]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=34505#p34505</link>
			<description><![CDATA[<p>Updated new <strong>gl_db_rates.inc</strong></p><p>- Removed CCA, (currencyconverterapi.com) is no longer working<br />- Updated url from google api</p><p>Fixed file <a href="https://drive.google.com/open?id=1xUnhlHKOLT4s6WwA5G894ArKRUt9YgMB">here</a></p><p>And new config.default.php content<br /></p><div class="codebox"><pre><code>$xr_providers = array(&quot;ECB&quot;, &quot;EXCHANGE-RATES.ORG&quot;, &quot;GOOGLE&quot;, &quot;YAHOO&quot;, &quot;BLOOMBERG&quot;);</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (notrinos)]]></author>
			<pubDate>Thu, 21 Mar 2019 17:27:35 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=34505#p34505</guid>
		</item>
		<item>
			<title><![CDATA[Re: No exchange rate working in FA now]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33705#p33705</link>
			<description><![CDATA[<p>The 3 Providers, ECB, CCA and EXCHANGE-RATES.ORG is working now and the /gl/includes/db/gl_db_rates.inc is committed as well as config.default.php.<br />They can be downloaded <a href="https://sourceforge.net/p/frontaccounting/git/ci/master/tree/gl/includes/db/gl_db_rates.inc">here</a> and <a href="https://sourceforge.net/p/frontaccounting/git/ci/master/tree/config.default.php">here</a>.</p><p>Please copy the $xr_providers array from config.default.php to your config.php.</p><p>/Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Thu, 20 Dec 2018 12:09:37 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33705#p33705</guid>
		</item>
		<item>
			<title><![CDATA[Re: No exchange rate working in FA now]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33704#p33704</link>
			<description><![CDATA[<p>Hello @notrinos</p><p>I got the following errors when using<br /></p><div class="codebox"><pre><code>Yahoo
Undefined offset: 1 in file: C:\wamp3\www\account24\gl\includes\db\gl_db_rates.inc at line 228
Google
Cannot retrieve exchange rate for currency GBP. Please adjust approximate rate if needed.
Bloomberg
Cannot retrieve exchange rate for currency GBP. Please adjust approximate rate if needed.</code></pre></div><p>I think we could just commit it. The 3 first providers works OK. We can then investigate further on the others, right?</p><p>/Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Thu, 20 Dec 2018 11:48:27 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33704#p33704</guid>
		</item>
		<item>
			<title><![CDATA[Re: No exchange rate working in FA now]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33703#p33703</link>
			<description><![CDATA[<p>Sure @notrinos. Thanks for the investigation.</p><p>I will just test them all and commit them later.</p><p>/Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Thu, 20 Dec 2018 11:29:20 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33703#p33703</guid>
		</item>
		<item>
			<title><![CDATA[Re: No exchange rate working in FA now]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33702#p33702</link>
			<description><![CDATA[<p>Fixed file gl_db_rates.inc for ECB and included CCA can be download <a href="https://drive.google.com/open?id=1mr_SR_aYzjqrMjPEiS9s_1NF1oZOpHs5">here</a></p><p>for config file:<br /></p><div class="codebox"><pre><code>$xr_providers = array(&quot;ECB&quot;, &quot;EXCHANGE-RATES.ORG&quot;, &quot;CCA&quot;, &quot;YAHOO&quot;, &quot;GOOGLE&quot;, &quot;BLOOMBERG&quot;);</code></pre></div><p>A well-known financial institution should be default so I moved ECB to first position.</p>]]></description>
			<author><![CDATA[null@example.com (notrinos)]]></author>
			<pubDate>Thu, 20 Dec 2018 07:04:09 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33702#p33702</guid>
		</item>
		<item>
			<title><![CDATA[Re: No exchange rate working in FA now]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33701#p33701</link>
			<description><![CDATA[<p>Hello @boxygen,</p><p>Your code for CCA doesn&#039;t work. It gives no rates. Will you give it a check, please? Thanks.</p><p>/Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Wed, 19 Dec 2018 23:04:48 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33701#p33701</guid>
		</item>
		<item>
			<title><![CDATA[Re: No exchange rate working in FA now]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33697#p33697</link>
			<description><![CDATA[<p>Hello @apmuthu,</p><p>Yes I will include your fix and @boxygen&#039;s provider in FA later this evening.</p><p>Joe</p>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Wed, 19 Dec 2018 17:50:35 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33697#p33697</guid>
		</item>
		<item>
			<title><![CDATA[Re: No exchange rate working in FA now]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33696#p33696</link>
			<description><![CDATA[<p>@joe: Please include the fixes to ECB in my previous post and @boxygen&#039;s currencyconverterapi.com (CCA) as exchange providers.</p><p>CCA&#039;s output of:<br /></p><div class="codebox"><pre><code>https://free.currencyconverterapi.com/api/v5/convert?q=USD_EUR&amp;compact=y</code></pre></div><p>is a json value formatted like:<br /></p><div class="codebox"><pre><code>{&quot;USD_EUR&quot;:{&quot;val&quot;:0.875505}}</code></pre></div><p>The reverse currency rate check for large decimal differences like IDR =&gt; KWD is not accounted for in it as yet.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Wed, 19 Dec 2018 17:41:40 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33696#p33696</guid>
		</item>
		<item>
			<title><![CDATA[Re: No exchange rate working in FA now]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33691#p33691</link>
			<description><![CDATA[<p>https://free.currencyconverterapi.com/</p><p>They allow 100 Requests Per Hour for Free.</p><p>This is also a good option</p><p>config.php changes<br /></p><div class="codebox"><pre><code>$xr_providers = array(&quot;ECB&quot;, &quot;YAHOO&quot;, &quot;GOOGLE&quot;, &quot;BLOOMBERG&quot;, &quot;CCA&quot;);</code></pre></div><br /><p>gl_db_rates.inc changes as follows.</p><div class="codebox"><pre><code>function get_extern_rate($curr_b, $provider = &#039;ECB&#039;, $date)
{
    global    $path_to_root;

    if ($date != Today())    // no historical rates available
        return 0;

    $contents = &#039;&#039;;
    $proto = &#039;http://&#039;;
    $curr_a = get_company_pref(&#039;curr_default&#039;);
    if ($provider == &#039;ECB&#039;)
    {
        $filename = &quot;/stats/eurofxref/eurofxref-daily.xml&quot;;
        $site = &quot;www.ecb.europa.eu&quot;;
        $site_ip=&quot;172.230.157.137&quot;;
    }
    elseif ($provider == &#039;YAHOO&#039;)
    {
        $filename = &quot;/d/quotes.csv?s={$curr_a}{$curr_b}=X&amp;f=sl1d1t1ba&amp;e=.csv&quot;; // new URL&#039;s for YAHOO
        $site = &quot;download.finance.yahoo.com&quot;;
        $site_ip=&quot;203.84.220.151&quot;;
    }
    elseif ($provider == &#039;GOOGLE&#039;)
    {
        $filename = &quot;/bctzjpnsun/converter?a=1&amp;from={$curr_a}&amp;to={$curr_b}&quot;;
        $site = &quot;finance.google.com&quot;;
    }
    elseif ($provider == &#039;BLOOMBERG&#039;)
    {
        $filename = &quot;/quote/{$curr_b}{$curr_a}:CUR&quot;;
        $site = &quot;www.bloomberg.com&quot;;
        $proto = &#039;https://&#039;;
        $contents=file_get_contents($proto.$site.$filename);
    }
    elseif ($provider == &#039;CCA&#039;) //free.currencyconverterapi.com
    {
        $filename = &quot;/api/v5/convert?q={$curr_b}_{$curr_a}&amp;compact=y&quot;;
        $site = &quot;free.currencyconverterapi.com&quot;;
        $proto = &#039;https://&#039;;

    }
    if (empty($contents)) {
        if (function_exists(&#039;curl_init&#039;))
        {    // first check with curl as we can set short timeout;
            $retry = 1;
             do {
                   $ch = curl_init();
                   curl_setopt ($ch, CURLOPT_URL, $proto.$site.$filename);
                   curl_setopt ($ch, CURLOPT_COOKIEJAR, VARLIB_PATH.&quot;/cookie.txt&quot;);
                   curl_setopt ($ch, CURLOPT_HEADER, 0);
                   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
                   // prevent warning while safe_mode/open_basedir on (redirection doesn&#039;t occur at least on ECB page)
                   if (!ini_get(&#039;safe_mode&#039;) &amp;&amp; !ini_get(&#039;open_basedir&#039;))
                       curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
                   curl_setopt ($ch, CURLOPT_TIMEOUT, 3);
                   $contents = curl_exec ($ch);
                   curl_close($ch);
                // due to resolver bug in some curl versions (e.g. 7.15.5)
                // try again for constant IP.
                if (isset($site_ip))
                       $site=$site_ip;
               } while( ($contents == &#039;&#039;) &amp;&amp; $retry--);
        } else {
            $contents = url_get_contents($proto.$site.$filename);
        }
    }
    $val = &#039;&#039;;
    if ($provider == &#039;ECB&#039;)
    {
        $contents = str_replace (&quot;&lt;Cube currency=&#039;USD&#039;&quot;, &quot; &lt;Cube currency=&#039;EUR&#039; rate=&#039;1&#039;/&gt; &lt;Cube currency=&#039;USD&#039;&quot;, $contents);
        $from_mask = &quot;|&lt;Cube\s*currency=\&#039;&quot; . $curr_a . &quot;\&#039;\s*rate=\&#039;([\d.,]*)\&#039;\s*/&gt;|i&quot;;
        preg_match ( $from_mask, $contents, $out );
        $val_a = isset($out[1]) ? $out[1] : 0;
        $val_a = str_replace ( &#039;,&#039;, &#039;&#039;, $val_a );
        $to_mask = &quot;|&lt;Cube\s*currency=\&#039;&quot; . $curr_b . &quot;\&#039;\s*rate=\&#039;([\d.,]*)\&#039;\s*/&gt;|i&quot;;
        preg_match ( $to_mask, $contents, $out );
        $val_b = isset($out[1]) ? $out[1] : 0;
        $val_b = str_replace ( &#039;,&#039;, &#039;&#039;, $val_b );
        if ($val_b)
        {
            $val = $val_a / $val_b;
        }
        else
        {
            $val = 0;
        }
    }
    elseif ($provider == &#039;YAHOO&#039;)
    {
        $array = explode(&#039;,&#039;,$contents); // New operations for YAHOO. Safer.
        $val = $array[1];
        if ($val != 0)
            $val = 1 / $val;
    }
    elseif ($provider == &#039;GOOGLE&#039;)
    {
        $val = getInnerStr($contents, &#039;&lt;span class=bld&gt;&#039;, &#039; &#039;);
        if (empty($val) || $val+0 &lt;= 0.0001) {
            // reverse lookup on could not convert for too small values
            $filename = &quot;/bctzjpnsun/converter?a=1&amp;from={$curr_b}&amp;to={$curr_a}&quot;;
            $contents = url_get_contents($proto.$site.$filename);
            $val = getInnerStr($contents, &#039;&lt;span class=bld&gt;&#039;, &#039; &#039;);
        } else {
            if ($val != 0)
                $val = 1 / $val;
        }
    }
    elseif ($provider == &#039;BLOOMBERG&#039;)
    {
        $val = getInnerStr($contents, &#039;,&quot;price&quot;:&#039;, &#039;,&quot;&#039;);
    }
    elseif ($provider == &#039;CCA&#039;)
    {
        $rates = json_decode($contents, true);
        $val = $rates[$curr_b.&#039;_&#039;.$curr_a][&#039;val&#039;];
      }
    return $val;
}  /* end function get_extern_rate */</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (boxygen)]]></author>
			<pubDate>Wed, 19 Dec 2018 03:35:52 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33691#p33691</guid>
		</item>
		<item>
			<title><![CDATA[Re: No exchange rate working in FA now]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33689#p33689</link>
			<description><![CDATA[<p>Exchange-rates.org is absolutely fine one.&nbsp; It supports major 30 currencies in the world. But we have FA users from many small countries. We need to look up them as well. </p><p>So what I am suggesting is to adapt one more exchange rate provider. https://currencylayer.com or fixer.io to work on 168 currencies. They allow 1000 request per month for free of cost .&nbsp; I hope that&#039;s more than enough for them. Because we keep existing exchange rates for next requests. So let&#039;s provide them one more as well. Also we can provide them functionality to go premium to get extra. But that&#039;s their choice. Hope Joe and janusz will think of it..</p>]]></description>
			<author><![CDATA[null@example.com (kvvaradha)]]></author>
			<pubDate>Wed, 19 Dec 2018 02:55:00 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33689#p33689</guid>
		</item>
		<item>
			<title><![CDATA[Re: No exchange rate working in FA now]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33688#p33688</link>
			<description><![CDATA[<p>ECB exchange rate can be fixed by modifying from line 139 onwards in <strong>gl/includes/db/gl_db_rates.inc</strong>:<br /></p><div class="codebox"><pre><code>    if ($provider == &#039;ECB&#039;)
    {
        $filename = &quot;/stats/eurofxref/eurofxref-daily.xml&quot;;
        $site = &quot;www.ecb.europa.eu&quot;;
        $proto = &#039;https://&#039;;
        $site_ip=&quot;172.230.157.137&quot;;
        $contents=file_get_contents($proto.$site.$filename);
    }</code></pre></div><p>Also remove the trailing tab character in the config.default.php file for the $xr_providers line.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Wed, 19 Dec 2018 02:43:02 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33688#p33688</guid>
		</item>
		<item>
			<title><![CDATA[Re: No exchange rate working in FA now]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=33687#p33687</link>
			<description><![CDATA[<p>https://fx-rate.net/USD/GBP/<br />Shows rate for 1000 units of source currency</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Wed, 19 Dec 2018 02:27:23 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=33687#p33687</guid>
		</item>
	</channel>
</rss>
