26 (edited by apmuthu 12/12/2017 06:50:01 am)

Re: FA2.4.2 error getting exchange rate from Google

It appears that both php-curl and the FA function url_get_contents() fail for BLOOMBERG exchange rate provider now that they insist on https:// and also have a second colon in the url, the parsing of the url causes some problems.

The attached fix also overcomes the locale based thousands separator in the rate, mitigated by acquiring another string from the file that has no separators.

Re: FA2.4.2 error getting exchange rate from Google

Hi, apmuthu,

For Bloomberg, pounds - GBP  and  canadian dollars - CAD are still giving blanks. (euros & usd are now giving good results)
Others no change.

I have left   $num = number_format(floatval(trim($number)), $dec, $dsep, $tsep); as it is? Do I need to change this back to original.

Comment, very surprised at yahoo's policy, you'd have thought in their situation they would want to promote their services as much as possible.

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: FA2.4.2 error getting exchange rate from Google

This may be of interest.... https://stackoverflow.com/a/1732454/2200168

anybody know about xml parsing?

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: FA2.4.2 error getting exchange rate from Google

No need to bother with the number_format statement. The Bloomberg fix uses another part of the page which does not have any locale formatting. I have changed it a bit and re-uploaded it. If you were the first to download it then download it again.

PHP Simple XML Parsing

Re: FA2.4.2 error getting exchange rate from Google

I think this could be solution for google....

https://stackoverflow.com/a/19838533/2200168

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: FA2.4.2 error getting exchange rate from Google

Seems i already had the updated one, so my results stand as above

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: FA2.4.2 error getting exchange rate from Google

Both Google and Bloomberg Exchange rates work with the new fix attached herewith.

Post's attachments

fa_bloomberg_google_xchg.zip 7.4 kb, 3 downloads since 2017-12-12 

You don't have the permssions to download the attachments of this post.

Re: FA2.4.2 error getting exchange rate from Google

@joe: Thanks for the Bloomberg commit.

The incremental patch file for the Google fix is attached herewith.

Post's attachments

fa_bloomberg_google_xchg_1.zip 6.6 kb, 4 downloads since 2017-12-12 

You don't have the permssions to download the attachments of this post.

Re: FA2.4.2 error getting exchange rate from Google

apmuthu, I'm still getting the same results?

Can you confim I leave this code as it is or revert to original?...

$num = number_format(floatval(trim($number)), $dec, $dsep, $tsep);

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: FA2.4.2 error getting exchange rate from Google

I can confirm that the new way to compute the Google rate does not need to depend on any locale specific inputs and hence the latest commit in the gl_db_rates.inc will take care of it.

Clear your browser cache and company js_cache and login afresh in a sole instance of a new browser and see what gives. I have tested it extensively in PHP 5.3.1 on Windows and PHP 5.3.3 on Debian Squeeze. I will be building a fresh OpenVZ template for it on Debian Squeeze and will test on that as well.

YAHOO Exchange rate is broken due to upstreamn blockage. They rely on OFX, a Yahoo Widget.

Those who wish to see a backport if they are still using FA 2.3.x, let me know. There may be some die hard fans of FA 2.3.x - if it ain't broke why fix it - who may need extended support - they can contact the FA support facilitators.

Re: FA2.4.2 error getting exchange rate from Google

So I've tried clearing browser cache and js_cache X 10
Tried different browsers X 4
Tried a different PC
and on  my phone.

Still getting same results.

Apmutu, what PHP version are you using? Any other suggestions?

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: FA2.4.2 error getting exchange rate from Google

The existing code does not use floatval.

Line 318 of includes/current_user.inc should be:

    $num = number_format($number, $dec, $dsep, $tsep);

Like I said, the locale specific (like comma) separators do not have any say in the current exchange rate extraction.

Re: FA2.4.2 error getting exchange rate from Google

I already changed that back

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: FA2.4.2 error getting exchange rate from Google

Do a Winmerge diff check on your FA install root and the Github master codebase and see if there are any other file differences.

You can also use online diff tools like:

https://www.diffnow.com/
https://www.diffchecker.com/
http://www.comparemyfiles.com/

40 (edited by poncho1234 12/13/2017 06:26:06 pm)

Re: FA2.4.2 error getting exchange rate from Google

I changed php to v 7.0.26

For CAD & GBP using bloomberg, I'm getting blank and this fault:-

number_format() expects parameter 2 to be integer, float given in file: /includes/current_user.inc at line 319

Other currencies listed above are working.


For google same results, under 1000 working fine, over gives weird rates as above

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: FA2.4.2 error getting exchange rate from Google

diff checked, no differences

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: FA2.4.2 error getting exchange rate from Google

What versions of PHP did you check earlier?

Re: FA2.4.2 error getting exchange rate from Google

Only v5.6.32,

I'll test some other versions as well..

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

44 (edited by poncho1234 12/14/2017 03:04:41 pm)

Re: FA2.4.2 error getting exchange rate from Google

For v7.1.12

I'm getting these faults for CAD & GBP using Bloomberg and the exchange rate is blank:- (Obviously the currency code changes accordingly in the fault)

file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in file: /gl/includes/db/gl_db_rates.inc at line 161
file_get_contents(https://www.bloomberg.com/quote/CADCOP:CUR): failed to open stream: no suitable wrapper could be found in file: /gl/includes/db/gl_db_rates.inc at line 161
number_format() expects parameter 2 to be integer, float given in file: /includes/current_user.inc at line 319

For CLP, euro, MXN, PEN & USD using Bloomberg these faults, but the correct exchange rate:-(Obviously the currency code changes accordingly in the fault)

file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in file: /gl/includes/db/gl_db_rates.inc at line 161
file_get_contents(https://www.bloomberg.com/quote/CLPCOP:CUR): failed to open stream: no suitable wrapper could be found in file: /gl/includes/db/gl_db_rates.inc at line 161

Google gives the same results, under 1000 working fine, over gives weird rates as above

I only have access to change PHP versions to:

v5.6.32
v7.0.26
v7.1.12

Although I can go backwards, but don't think thats applicable - unless you tell me otherwise?

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: FA2.4.2 error getting exchange rate from Google

Looks like you have a php.ini issue as well.

Set in php.ini: allow_url_fopen=1 and restart your webserver.
It works well in PHP 5.3.1, 5.3.3 and 5.5.

46 (edited by poncho1234 12/15/2017 03:44:46 pm)

Re: FA2.4.2 error getting exchange rate from Google

Done that, php info is giving the following:-

Directive    Local Value    Master Value
allow_url_fopen    On    On
allow_url_include    Off    Off

so fopen is enabled

fopen faults now do not appear

But I'm am still getting the same results

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: FA2.4.2 error getting exchange rate from Google

So, if your installations are functioning, it would seem I have additional setup issues with my servers, any ideas on fault finding?

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: FA2.4.2 error getting exchange rate from Google

OpenSSL issue?

Re: FA2.4.2 error getting exchange rate from Google

Open ssl would affect all exchange rates? Its working for some, but not for others?

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: FA2.4.2 error getting exchange rate from Google

Then Google must be playing random tricks for your IP range....
Their search results have become very diluted in the last 6 months or so.
Time for a brand new human vetted one sans corporate control.
I will revert when I ave a new test OpenVZ install ready.
You can PM me a temporary PPTP VPN for your ISP for me to test.