Windows uses 3 character locale names in (PHP 5.3.1 atleast) alomg with language_Country.encoding format for LC_CTYPE:

<?php
echo setlocale(LC_ALL, 0) . "\n";
// LC_COLLATE=C;LC_CTYPE=English_United States.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=C

setlocale(LC_CTYPE, 'Bulgarian_Bulgaria.1251');
echo setlocale(LC_ALL, 0) . "\n";
// LC_COLLATE=C;LC_CTYPE=Bulgarian_Bulgaria.1251;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=C

setlocale(LC_CTYPE, 'Tamil_India.1252');
echo setlocale(LC_ALL, 0) . "\n";
// LC_COLLATE=C;LC_CTYPE=Tamil_India.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=C

setlocale(LC_ALL, "fra_fra");
echo strftime("%A %d %B %Y", mktime(0, 0, 0, 12, 22, 1978));
/* Output nld_nld: vrijdag 22 december 1978 */
/* Output deu_deu: Freitag 22 Dezember 1978 */
/* Output fra_fra: vendredi 22 décembre 1978 */

Pay attention to the syntax.
- UTF8 without dash ('-')
- locale.codeset and not locale-codeset.

<?php
$codeset = "UTF8";  // warning ! not UTF-8 with dash '-'
       
// for windows compatibility (e.g. xampp) : theses 3 lines are useless for linux systems

putenv('LANG='.$lang.'.'.$codeset);
putenv('LANGUAGE='.$lang.'.'.$codeset);
bind_textdomain_codeset('mydomain', $codeset);

// set locale
bindtextdomain('mydomain', ABSPATH.'/locale/');
setlocale(LC_ALL, $lang.'.'.$codeset);
textdomain('mydomain');
?>

where directory structure of locale is (for example) :

locale/fr_FR/LC_MESSAGES/mydomain.mo
locale/en_US/LC_MESSAGES/mydomain.mo

and ABSPATH is the absolute path to the locale dir

Further note, under linux systems, it seems to be necessary to create the locale at os level using 'locale-gen'.

Ref:
http://php.net/manual/en/function.setlocale.php
https://msdn.microsoft.com/en-us/library/x99tb11d%28v=vs.140%29.aspx

In XAMPP it will work only if the gettext() function is available to PHP:

<?php
$func = "gettext";
if (function_exists($func)) echo "Yes, $func() exists";
else echo "No, $func() does not exist";

What do your error logs say?

Check how your version of windows perceives your locale names:
https://bugs.php.net/bug.php?id=66265

This ofcourse does not include the scores of deployments that occur in cPanel and other Webpanels besides using OpenVZ and other paravirtualised sites.

GitHub downloads too need to be factored in.

Great show! Thanks to Joe / Janusz for their untiring efforts to keep it on top!

3,779

(2 replies, posted in Report Bugs here)

If most of your database size is due to logs, then arrange to delete them first. With such a large database, the script will timeout on a slow connection. Take a backup using CLI on the terminal.

Use the latest snapshot of the stable version.

Shouldn't this ought to be fixed in the annual expense breakdown report package as well?

Take the en_US-new.sql and modify it for your country and use it. Various charts are listed here for your reference.

@joe: is this the fix?

Does the annual expense breakdown report work okay with line 402:

        $rep->AmountCol2($i, $i + 1, $sales[$i] * -1, $dec, 0, 4, 0, $fill, NULL, 1, true);

?

Sell with 100% discount (0 price).

@Petros: Please provide a backup of the state before the Work Order commences and the steps thereafter to recreate your errors. You should have started from a fresh en_US-new.sql install.

Has anyone connected Joomla to FrontAccounting? If so what issues did you face and what was done about it?

There is a Joomla World Conference at Bangalore, India, scheduled for 06-08 November 2015 where Soren Beck Jensen, Founder, Joomla Component Creator (free too) will be speaking. He has offered key developers a Coupon Code to slash the nearly $80/- fee to just $10/- (JOOMLAIN10) including lunch and drinks for all the 3 days of the conference and 25% off on the premium fee of $299/- (ComponentCreator) which will include dinners as well and special pre and post session meetings.

If there are any FA developers around Bangalore and / or any who can make it to the event, brainstorm with him on creating a similar FA Component Creator!

@Petros: does this work on a new install as desired?
Even if so, what are the standard operating procedures to be followed for Advanced Manufacturing?
Should we set the config flag $use_costed_values?
Are there any advantages prior to using code prior to these last 2 commits?

3,788

(1 replies, posted in Items and Inventory)

Treat yourself as a supplier and buy your produce from yourself!

@Petros: Please try @itronics latest fix and revert with your findings.

@itronics: Please note that the same deprecated function in your fix is present in purchasing/includes/supp_trans_class.inc and check whether the same should be done there and the old function removed in it's entirety everywhere. The deprecated taxfree_charge_price() method/function is not being used in any standard extension.

Which item's location code/name do you want to display?
Each item can have same or different location code/name.
Is it necessary for the customer to be aware of the location code/name?
You can enter it in the memo / text line or hack the report t do so.

3,791

(5 replies, posted in Accounts Receivable)

Which version of FA are you using (use v2.3.24+).Also study the session values in both companies and see if some setting is missing or there is a difference in the schema of the charts used.

I envisage that a module to create a FA module already exists in the hands of key FA users in their private domains.

For the public domain, here is what I would consider user friendly to design and proffer for the end user:

User inputs like:

Module Name:
Short Name:
Constants:
Settings, Types and Default values:
Pages: Menu Link names, Target File Names, Link Category, Link Side (Left/Right) => Position order is taken from order of entry.
New tables/table fields to be added / removed on activation / deactivation with initial values.

should be able to write the FA Module skeleton for us.

Standard functionality for page types like Add / Update / View / List can be added as parameters to pages later.

Security labels and their standard role permissions too can be part of it.

Facility to generate a pkg for signed / unsigned hosting would be a bonus.

@itronics: probably only you can fathom the mountain of code to get this done, now that @Petros has a clear understanding to be able to test it out. Have linked it into the Wiki FWIW.

Please post your version of the modified file that works with standard settings in preferences so that it's effect may be studies in the sales and other portions it may possibly affect.

@joe / @itronics: your insights please.

3,795

(2 replies, posted in Installation)

The Wiki has the variables inspected but may not be relevant here except as a means to investigate.

The function user_def_print_orientation() is present only in FA v2.4.x beta and not in FA v2.3.x.

If you want the modded and backported version of the said file, then take it from my FAMods.

None of the errors in log have anything to do with FA. They are possibly from LiveProjects.

Since you are using Linux Mint 17.1 which is the equivalent of Ubuntu 14.04 (Trusty Tahr) which in turn is based on Debian 8.0 (jessie), you will not be using PHP v5.3.x for which FA 2.3 has been designed. It is also possible that your .htaccess file (which is for Apache 2.2) may be invalid for Apache 2.4 you are using. Remove the .htaccess file temporarily and see if it works. MySQLi driver is being used in these later versions of PHP instead of MySQL - you will need FA v2.4.x for use with MySQLi or backport them.

State your PHP / MySQL / Apache versions and what is in your FA_webroot/tmp/error.log file.

Ubuntu <=> Debian equivalents:

15.04  vivid      jessie
14.10  utopic     jessie
14.04  trusty     jessie
13.10  saucy      wheezy
13.04  raring     wheezy
12.10  quantal    wheezy
12.04  precise    wheezy
11.10  oneiric    wheezy
11.04  natty      squeeze
10.10  maverick   squeeze
10.04  lucid      squeeze

@Petros: In file taxes/tax_calc.inc the functions get_tax_free_price_for_item() and get_tax_for_items() use the formula for calculation you stated.

Please see if these are the places you would like to change.

Rounding is done for consistent storage value in the db to persist across version changes of the db server.

Other places where such code is available are listed below.

In file purchasing/includes/db/supp_payment_db.inc lines 114 to 116 when $rate <> 0:

        $supp_amount = round($amount / $rate, user_price_dec());
        $supp_discount = round($discount / $rate, user_price_dec());
        $supp_charge = round($charge / $rate, user_price_dec());

In file purchasing/includes/db/invoice_db.inc lines 129 to 133:

    foreach ($taxes as $n => $taxitem)
    {
        $taxes[$n]['Value'] =  round2($taxitem['Value'], user_price_dec());
        $tax_total += $taxes[$n]['Value'];
    }

and lines 137 to 143:

    $item_added_tax = 0;
    if (!$supp_trans->tax_included)
    {
        $taxes = $supp_trans->get_taxes($supp_trans->tax_group_id);
        foreach ($taxes as $n => $taxitem)
            $item_added_tax += isset($taxitem['Override']) ? $taxitem['Override'] : round2($taxitem['Value'], user_price_dec());
    }

In file purchasing/includes/supp_trans_class.inc lines 112 to 117:

        foreach ($this->grn_items as $ln_itm) 
        {
            $items[] = $ln_itm->item_code;
            $prices[] =round( ($ln_itm->this_quantity_inv * $ln_itm->chg_price),
                user_price_dec());
        }

lines 160 to 162:

        foreach ($this->grn_items as $ln_itm)
            $total += round(($ln_itm->this_quantity_inv * $ln_itm->taxfree_charge_price($tax_group_id, $tax_group)),
             user_price_dec());

lines 176 to 177:

        foreach ($this->grn_items as $ln_itm)
            $total += round($ln_itm->this_quantity_inv * $ln_itm->chg_price, user_price_dec());

In file purchasing/includes/po_class.inc lines 141 to 144:

        foreach ($this->line_items as $ln_itm) {
            $items[] = $ln_itm->stock_id;
            $prices[] = round($ln_itm->price * ($receival ? $ln_itm->receive_qty : $ln_itm->quantity),  user_price_dec());
        }

lines 164 to 184:

    function get_trans_total() {
        
        $total = 0;
        $dec = user_price_dec();

        foreach ($this->line_items as $ln_itm) {
            $items[] = $ln_itm->stock_id;
            $value = round($ln_itm->quantity * $ln_itm->price, $dec);
            $prices[] =$value;
            $total += $value;
        }

        if (!$this->tax_included ) {
            $taxes = get_tax_for_items($items, $prices, 0, $this->tax_group_id,
            $this->tax_included,  $this->tax_group_array);

            foreach($taxes as $tax)
                $total += round($tax['Value'], $dec);
        }
        return $total;
    }

In file purchasing/po_entry_items.php lines 465 to 470:

            foreach($cart->line_items as $key => $line) {
                $inv->add_grn_to_trans($line->grn_item_id, $line->po_detail_rec, $line->stock_id,
                    $line->item_description, $line->receive_qty, 0, $line->receive_qty,
                    $line->price, $line->price, true, get_standard_cost($line->stock_id), '');
                $inv->ov_amount += round2(($line->receive_qty * $line->price), user_price_dec());
            }

3,799

(2 replies, posted in Installation)

If a user uploads a module into the modules folder, there will be no corresponding _init/config file in the modules/_cache folder. Installing the module goes without any issue (since it is already in place, but will benefit from such a check as well) but uninstalling it causes the error: "Cannot download repo index file.".

This is because the function uninstall() in includes/packages.inc attempts:

        $ctrl = get_control_file("$cachepath/_init/config");

without checking if the file exists!

Preceding it with the following and encompassing the next few statements within it should alleviate it:

if (file_exists("$cachepath/_init/config")) {
        $ctrl = get_control_file("$cachepath/_init/config");

        $targetdir = $path_to_root.'/'.$ctrl['InstallPath'];

        $dpackage = new package("$cachepath/_data", $targetdir);

        $flist = $dpackage->extract_files(true);

        $success &= copy_files($flist, "$cachepath/_back", $targetdir, true);
}

This will of course not purge the module from the modules folder ($ctrl['InstallPath'] is undefined) but will remove the module's entry from the installed_extensions.php files.


@joe: please verify and incorporate in the stable repo.

What platform are you on - Linux / Windows?
Have you enabled the various file functions in php.ini?
What does your Apache Error log say and are there any clues in your tmp/error.log file?