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

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

For me the expected results would be as follows:-

Test 3    0    1    05-12-16        1    05-01-17    05/12/2016 - 04/01/2017.
Test 3    0    1    05-12-16        2    05-02-17    05/01/2017 - 04/02/2017.
Test 3    0    1    05-12-16        3    05-03-17    05/02/2017 - 04/03/2017.
                           
Test 4    0    1    29-12-16        1    29-01-17    29/12/2016 - 28/01/2017.
Test 4    0    1    29-12-16        2    28-02-17    29/01/2017 - 27/02/2017.
Test 4    0    1    29-12-16        3    29-03-17    28/02/2017 - 28/03/2017.
Test 4    0    1    29-12-16        4    29-04-17    29/03/2017 - 28/04/2017.

Test 4    0    1    30-12-16        1    30-01-17    30/12/2016 - 29/01/2017.
Test 4    0    1    30-12-16        2    28-02-17    30/01/2017 - 27/02/2017.
Test 4    0    1    30-12-16        3    30-03-17    28/02/2017 - 29/03/2017.
Test 4    0    1    30-12-16        4    30-04-17    30/03/2017 - 29/04/2017.

Test 4    0    1    31-12-16        1    31-01-17    31/12/2016 - 30/01/2017.
Test 4    0    1    31-12-16        2    28-02-17    31/01/2017 - 27/02/2017.
Test 4    0    1    31-12-16        3    31-03-17    28/02/2017 - 30/03/2017.
Test 4    0    1    31-12-16        4    30-04-17    31/03/2017 - 29/04/2017.
Test 4    0    1    31-12-16        5    31-05-17    30/04/2017 - 30/05/2017.

I think I have that right please check

As I said earlier We can state in the wiki that only start dates to the 28th of the month are permitted

We may be getting a little confused with the objective,

The original code (before the above mods) functioned  if 0 for days and 1 or more entered in months, the start date would then be the billing date going forward. So for dates from the 1st - 28th of the month this works fine, but what happens if you want the 29th, 30th or 31st? It all goes wrong in February (unless its a leap year for the 29th), and stays wrong in march onwards.

We can state in the wiki that only start dates to the 28th of the month are permitted, but...?

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?

Only v5.6.32,

I'll test some other versions as well..

//new function calculate_next
function calculate_next($myrow)
{
    if ($myrow["last_sent"] == '0000-00-00')
        $next = sql2date($myrow["begin"]);
    else
        $next = sql2date($myrow["last_sent"]);
    if ($myrow['days'] == -1 && $myrow['monthly'] > 0) {
        // ignore months when days = -1
            $next = begin_month($next); // to later become last day of previous month
            $myrow['days']=0;
    }
    $next = add_months($next, $myrow['monthly']);
    $next = add_days($next, $myrow['days']);
    return add_days($next,-1);
}

is giving the same result

Test 9e    -1    1    31-12-16        1    30-01-17    31/12/2016 - 29/01/2017.
Test 9e    -1    1    31-12-16        2    27-02-17    30/01/2017 - 26/02/2017.
Test 9e    -1    1    31-12-16        3    26-03-17    27/02/2017 - 25/03/2017.

diff checked, no differences

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

I already changed that back

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?

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);

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

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

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

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

anybody know about xml parsing?

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.

I think just getting a number will be a result! ;-)

function calculate_next($myrow)
{
    if ($myrow["last_sent"] == '0000-00-00')
        $next = sql2date($myrow["begin"]);
    else
        $next = sql2date($myrow["last_sent"]);
    if ($myrow['days'] == -1 && $myrow['monthly'] > 0) {
        // ignore months when days = -1
            $next = add_days(begin_month($next), -1); // last day of previous month
            $myrow['days']=0;
    }
    $next = add_months($next, $myrow['monthly']);
    $next = add_days($next, $myrow['days']);
    return add_days($next,-1);
}

gives

Test 9d    -1    1    31-12-16        1    30-01-17    31/12/2016 - 29/01/2017.
Test 9d    -1    1    31-12-16        2    27-02-17    30/01/2017 - 26/02/2017.
Test 9d    -1    1    31-12-16        3    26-03-17    27/02/2017 - 25/03/2017.

For google and bb only:-

For exchange rates where an expected value is less than 1000, it works perfectly.

The problem is for exchange rates where an expected value is greater than 1000

Is there code which creates a 1000 separator? If so then removing this temporally will prove it?

I presume its $tsep

No faults this time, but hardly any changes in results:-

    CA Dollars    Euro    Pounds    US Dollars    Chilean Peso    Mexican Peso    Peruvian Sol
ECB    Blank    Blank    Blank    Blank    Blank    Blank    Blank
Yahoo    Blank    Blank    Blank    Blank    Blank    Blank    Blank
GOOGLE    2,500    3333.3333333333    3333.3333333333    3333.3333333333    4.4903457566    158.7301587302    909.0909090909
BLOOMBERG    Blank    Blank    Blank    3    4.5964    158.8449    930.6075

With:-

function calculate_next($myrow)
{
    if ($myrow["last_sent"] == '0000-00-00')
        $next = sql2date($myrow["begin"]);
    else
        $next = sql2date($myrow["last_sent"]);
    if ($myrow['days'] == -1) {
        // ignore months when days = -1
            $next = add_days($next, 2); // <-- changed line
            $next = end_month($next);
            return $next;
    } else {
        $next = add_months($next, $myrow['monthly']);
        $next = add_days($next, $myrow['days']);
        return add_days($next,-1);
    }
}

I'm getting the following:-
Input to recurrent invoices                        Create and Print Recurrent Invoices   
Name    Days    Monthly    Begin        Invoice #    Invoice date    Recurrent Invoice covers period
Test 1c    7    0    01-12-16        1    08-12-16    01/12/2016 - 07/12/2016.
Test 1c    7    0    01-12-16        2    15-12-16    08/12/2016 - 14/12/2016.
       "    "    "           "        "           "                       "
Test 1c    7    0    01-12-16        12?    23-02-17    16/02/2017 - 22/02/2017.
Test 1c    7    0    01-12-16        13?    02-03-17    23/02/2017 - 01/03/2017.
                           
Test 2c    0    1    01-12-16        1    01-01-17    01/12/2016 - 31/12/2016.
Test 2c    0    1    01-12-16        2    01-02-17    01/01/2017 - 31/01/2017.
Test 2c    0    1    01-12-16        3    01-03-17    01/02/2017 - 28/02/2017.
Test 2c    0    1    01-12-16        4    01-04-17    01/03/2017 - 31/03/2017.
                           
Test 5c    0    1    31-12-16        1    31-01-17    31/12/2016 - 30/01/2017.
Test 5c    0    1    31-12-16        2    28-02-17    31/01/2017 - 27/02/2017.
Test 5c    0    1    31-12-16        3    28-03-17    28/02/2017 - 27/03/2017.
                           
Test 9    -1    0    31-12-16        1    30-12-16    31/12/2016 - 29/12/2016.
Test 9    -1    0    31-12-16        2    29-12-16    30/12/2016 - 28/12/2016.
Test 9    -1    0    31-12-16        3    28-12-16    29/12/2016 - 27/12/2016.

Ah... !
Ok, will retest with updated function, maybe today, probably tomorrow.

So, new install.
Currency decimal places set to 10
default theme
default currency COP
Servers in USA and i'm in...well you know where I am.

Just in case your dyslexic and cannot make head or tail of my beautifully formatted table below you can view a screenshot here ;-)

I'm very puzzled by the inconsistency of the results, google & Bloomberg get it right with some, but not with others?????

    Fault                       
ECB    None                       
Yahoo except euro

number_format() expects parameter 1 to be double, string given in file: /includes/current_user.inc at line 318

                       
GOOGLE None                       
BLOOMBERG euro and USD only

A non well formed numeric value encountered in file: /includes/current_user.inc at line 318

                       
                                                   
     CA Dollars    Euro                    Pounds    US Dollars    Chilean Peso    Mexican Peso    Peruvian Sol
ECB     Blank           1.1230000001    Blank    Blank    Blank            Blank             Blank

Yahoo Blank           1.1230000001    Blank     Blank     Blank             Blank              Blank
         + Above fault                           + Above fault+ Above fault+ Above fault+ Above fault+ Above fault

GOOGLE
     2500.0000000000    3333.3333333333 3333.3333333333 3333.3333333333 4.5024763620 156.2500000000    909.0909090909


BLOOMBERG   
        Blank             3.                     Blank         3.              4.5928              158.9162              930.6326
                      + Above Fault                      + Above Fault   
                           
MXN    1 Mexican Peso equals                       
    159.31     Colombian Peso        0.0062770699           
                           
PEN    1 Peruvian Sol equals                       
    935.48     Colombian Peso        0.0010689699           
                           
USD    1 US Dollar equals                       
    3016.02     Colombian Peso        0.0003315628           
                           
CLP    1 Chilean Peso equals                       
    4.61     Colombian Peso        0.2169197397           
                           
EUR    1 Euro equals                       
    3548.5     Colombian Peso        0.0002818092           
                           
CAD    1 Canadian Dollar equals                       
    2347.55     Colombian Peso        0.0004259760           
                           
GBP    1 British Pound equals                       
    4037.24     Colombian Peso        0.0002476940

so with

//new function calculate_next
function calculate_next($myrow)
{
    if ($myrow['days'] == -1) {
// ignore months when days = -1
    $next = add_days($next, 1);
    $next = end_month($next);
    return $next;
} else {
    $next = add_months($next, $myrow['monthly']);
    $next = add_days($next, $myrow['days']);
    return add_days($next,-1);
}
}

I'm getting:-

Test 7    30    0    01-12-16        1    31-12-16    01/12/2016 - 30/12/2016.
Test 7    30    0    01-12-16        2    30-01-17    31/12/2016 - 29/01/2017.
Test 7    30    0    01-12-16        3    01-03-17    30/01/2017 - 28/02/2017.
                           
Test 8    30    0    31-12-16        1    30-01-17    31/12/2016 - 29/01/2017.
Test 8    30    0    31-12-16        2    01-03-17    30/01/2017 - 28/02/2017.
Test 8    30    0    31-12-16        3    31-03-17    01/03/2017 - 30/03/2017.

@apmuthu -

I'm using 2.43 + these extras from Release 2.4.3

apmuthu said...

Re: Release 2.4.3

Post Release FA 2.4.3+ fixes attached herein.

FA24_post_release_fixes_2017-12-09.zip 279.6 kb

That post was edited today? Have you changed something?

I'll create another clean install and test properly tomorrow.