Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Contributor Dan Cameron

    (@dancameron)

    That’s an interesting warning. When you create an invoice does the money value get formatted correctly?

    I also wonder if your server supports localeconv correctly.

    Thread Starter burrebista

    (@burrebista)

    Hello,

    Firstly thanks for your fast response!

    That is: was a problem with my server configuration (mon_decimal_point).
    I install the plugin on another server and everything is fine.

    Thank you very much !

    Awesome plugin!

    Regards,

    Plugin Contributor Dan Cameron

    (@dancameron)

    You’re very welcome.

    Bobby

    (@justforyoastseo)

    Hi Dan,

    Just as an FYI I am also getting this error. I have installed on a localhost environment if that helps. It looks like the money values aren’t formatted correctly as you stated above.

    Cheers.

    Plugin Contributor Dan Cameron

    (@dancameron)

    Did you adjust your server configuration to support mon_decimal_point, also check if your server supports localeconv. If not let me know and I can help with a resolution.

    Bobby

    (@justforyoastseo)

    I’m using xampp on Windows. Unfortunately I can’t find any information that will tell me if either of these settings are supported in the environment. I suspect that is Windows that is causing the issue.

    I tested the following code:

    <?php
    print_r(localeconv());
    ?>

    which returend:
    Array ( [decimal_point] => . [thousands_sep] => [int_curr_symbol] => [currency_symbol] => [mon_decimal_point] => [mon_thousands_sep] => [positive_sign] => [negative_sign] => [int_frac_digits] => 127 [frac_digits] => 127 [p_cs_precedes] => 127 [p_sep_by_space] => 127 [n_cs_precedes] => 127 [n_sep_by_space] => 127 [p_sign_posn] => 127 [n_sign_posn] => 127 [grouping] => Array ( ) [mon_grouping] => Array ( ) )
    Not sure if this is helpful or not.

    Once I’ve got it working and can configure it on my local host, i’ll purchase the full version once ready for go live.

    Plugin Contributor Dan Cameron

    (@dancameron)

    Interesting, where is this error shown?

    Bobby

    (@justforyoastseo)

    The error:
    Warning: implode(): Invalid arguments passed in \wp-content\plugins\sprout-invoices\template-tags\utility.php on line 467
    Appears at the top of all pages.
    But also appears in the line items when adding an estimate or an invoice.

    Plugin Contributor Dan Cameron

    (@dancameron)

    Are you planning on running Sprout Invoices locally on a Windows machine? If not I recommend you start test/using it on a server that you will be using it on.

    I don’t have a Windows desktop to test this issue right now and I’m afraid that it’s something to do with the xampp configuration; which is something that I’m not familiar with at all.

    Sorry about this.

    Bobby

    (@justforyoastseo)

    Thanks Dan,
    It’s definitely a Windows based issue. Looking around it looks like localeconv has issues on Windows, possibly a UTF problem.

    When I replace $locale on line 403 with the currency array mannually it works. i.e:

    $locale = array(
            'decimal_point'        => '.',
            'thousands_sep'        => '',
            'int_curr_symbol'    => 'EUR',
            'currency_symbol'    => '€',
            'mon_decimal_point'    => ',',
            'mon_thousands_sep'    => '.',
            'positive_sign'        => '',
            'negative_sign'     => '-',
            'int_frac_digits'    => 2,
            'frac_digits'        => 2,
            'p_cs_precedes'        => 0,
            'p_sep_by_space'    => 1,
            'p_sign_posn'        => 1,
            'n_sign_posn'        => 1,
            'grouping'            => array(),
            'mon_grouping'        => array(0 => 3, 1 => 3)
    
        );

    This will do for me while I work on it on my local environment until go live time at which point I’ll re-install.

    Plugin Contributor Dan Cameron

    (@dancameron)

    In a future version I’m going to wrap that function around a filter, that way you can add the array manually without ruining any upgrade path.

    Alternative Fix:

    Change Line 393:
    $locale = apply_filters( ‘sa_set_monetary_locale’, get_locale() );

    To This:
    $locale = apply_filters( ‘sa_set_monetary_locale’, (get_locale() == ‘en_US’) ? ‘usa’ : get_locale() );

    Explanation:
    get_locale returns a value from a database in the OS. Windows, however, doesn’t recognize “en_US” as a value, and thus returns blank. To correct this, we have to detect if the locale is “en_US”, and change it to a value that Windows recognizes (in this case, “usa”).

    See: https://msdn.microsoft.com/en-us/library/cdax410z(v=vs.90).aspx

    Plugin Contributor Dan Cameron

    (@dancameron)

    I like the idea but that would only work for US users. Instead everyone should just filter that function that returns the localeconv values for money_format…if they need to.

    Here’s an example snippet that will help – https://gist.github.com/dancameron/253e04c6884f8fceaa78#file-functions-php

    If the locale cannot be found, it defaults to en_US, which is not being picked up by windows systems. I’m unaware if windows does or does not recognize other locales, however the fix I mentioned is applicable for the “default” and for US users. A more appropriate fix would be to compare the windows locales (see link above) against the php locales and apply them accordingly with a simple replace function filter. However, there may be other issues that arise when publishing from a localhost platform to a live server.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Warning error in utility.php on line 467’ is closed to new replies.