4,801

(7 replies, posted in Installation)

Adjust Apache conf files in all VPS/KVMs:
* For Wheezy/Squeeze and earlier - http://httpd.apache.org/docs/2.2/ssl/ssl_howto.html
* For Jessie and later - http://httpd.apache.org/docs/2.4/ssl/ssl_howto.html
* General - https://wiki.mozilla.org/Security/Server_Side_TLS

4,802

(7 replies, posted in Installation)

You will need a separate virtual host config stanza for it in the apache conf file with it's own ssl keys.
Otherwise you will have to access your FA as a subfolder of the main url and not as a subdomain.

Just finished updating the Create/Update Companies Wiki page with copy/paste-able sql code for removing all tables for a single company in one go.

4,804

(4 replies, posted in FA Modifications)

The wiki page for Ajax in FA is ready for updation.

4,805

(4 replies, posted in FA Modifications)

There appears to be a lack of documentation (even in the wiki) regarding Ajax as used in FrontAccounting. Before making a wiki page for it, those in the know can contribute to this thread from where it will be distilled into the wiki.

If on the change of value of any FA form element, some ajax work needs to be done (like other form elements getting updated or some function being executed), then a $_POST array element needs to be set and sent.

The $_POST array element must bear a name that embeds the ajax requesting element's name attribute as seen in Lines 300 to 307 in the function list_updated($name) in includes/ui/ui_lists.inc file:

/*
    Helper function.
    Returns true if selector $name is subject to update.
*/
function list_updated($name)
{
    return isset($_POST['_'.$name.'_update']) || isset($_POST['_'.$name.'_button']);
}

Hence if the ajax requesting form element is stock_id then the hidden form elemet that is sent over for an ajax call in FA would either be:
$_POST['_stock_id_update']
or
$_POST['_stock_id_button']
for the function list_updated($name) to trigger the ajax response.

To get the response inside a target form element, it's name attribute is passed on like $Ajax->activate('price').

This is seen for example in lines 506-511 in sales/includes/ui/sales_order_ui.inc:

        if (list_updated('stock_id')) {
                $Ajax->activate('price');
                $Ajax->activate('units');
                $Ajax->activate('qty');
                $Ajax->activate('line_total');
        }

All functions that assist ajax responses are in includes\ui\ui_lists.inc.

4,806

(7 replies, posted in Installation)

That must be configured in your WebServer config like in apache conf file. It has nothing to do with FA.

4,807

(66 replies, posted in Modules Add-on's)

@Farhaj: What do you mean by "nothing in his code"?

4,808

(0 replies, posted in FA Modifications)

In the file inventory/prices.php lines 127 to 137 are:

if (list_updated('stock_id')) {
    $Ajax->activate('price_table');
    $Ajax->activate('price_details');
}
if (list_updated('stock_id') || isset($_POST['_curr_abrev_update']) || isset($_POST['_sales_type_id_update'])) {
    // after change of stock, currency or salestype selector
    // display default calculated price for new settings. 
    // If we have this price already in db it is overwritten later.
    unset($_POST['price']);
    $Ajax->activate('price_details');
}

We see that for the list_updated() is executed twice and the $Ajax->activate('price_details'); is also executed twice for it's being checked. Is this necessary?

Where is the code that manages the Ajax return functionality for the various trigger values such as 'price_details' ?

All prices in the #_prices table have only the stock_id references. If we put in new prices with item_code as the stock_id which is different from the original stock_id, then the Price before Tax in the Direct Invoice gets populated correctly!. But prices added/edited thru' FA in the Items => Sales Pricing form will bear only the stock_id.

This workaround will cause lookup clashes when the item_code of one item matches the stock_id of another item.

Hence all lookups must be based only on the stock_id in the js/ajax code that auto populates the Price before Tax field in the Direct Invoice form even for foreign items having a different value for the item_code than it's stock_id!

4,810

(8 replies, posted in Translations)

Now in my GitHub Repo - Unofficial Translation of 251/2996 strings.

Auto population of Price before Tax will happen only if Setup => Display Setup => Show Item Codes is checked.

Set up an item and fill in retail and wholesale prices (wholesale price is set as base value) and customer default is retail pricing.
Now enter a direct invoice and choose the item. The price before tax does not get auto filled (FF 33 and IE 6).

Have any recent changes broken this functionality?

The Foreign Codes Wiki page states:

No need to have each item in stock_master also in item_codes, but uncheck the Edit Description for the Items.

Is this still valid or does it need some clarification? Creating a new item automatically creates a record in both item_codes and stock_master tables. It also creates entries for the item for all the currently available warehouse locations in the loc_stock table!

How do we add in the item_code during Item creation (stock_id=item_code during creation) to be different from the stock_id?
Also where is the UPC/EAN code entered during Item creation? It is quote common to have stock_id (internel ref), item_code (suppliers ref) and UPC/EAN (barcoding) for each item - how is this achieved for new Item creation?

In the current Foreign Item entry form, the quantity field is mandatory - it should be able to accept 0 as the default!

When we enter a Foreign Item Code without a quantity, the wrong error text is displayed as price instead of quantity - the code fragment that needs to be corrected is in inventory/manage/item_codes.php lines 38 to 43:

       elseif (!input_num('quantity'))
       {
          $input_error = 1;
          display_error( _("The price entered was not positive number."));
        set_focus('quantity');
       }

which should be:

       elseif (!input_num('quantity'))
       {
          $input_error = 1;
          display_error( _("The quantity entered was not positive number."));
        set_focus('quantity');
       }

This should also allow if a zero (0) is entered as the quantity.

Updated the Wiki with the stock_id and item_code table relationships.

Item Coding:

  • Any combination of numbers and letter is fine as long as it is in the Item Short Label field (item_code / stock_id)

  • The table item_codes is used to store normal items (stock_id = item_code)

  • It is also used to store foreign items (stock_id need not be the same as item_code), a flag for is_foreign is set

  • In any case, the id field should be unique and will be an auto generated unsigned integer value

  • The combination of stock_id and item_code should be unique

  • item_code and stock_id are VARCHAR(20)

  • Vendor and PO searches are by item_code and warehouse lookups use stock_id

  • Hence "stock_id" is "our" inventory code and "item_code" is for "vendor/account" based reference.

  • All bought out items come into foreign items type with their own UPC/EAN/ISBN type numbering

  • All items must first be entered as Normal Items and then assign them as foreign items if needed.

  • Foreign Item's data cannot be entered if it does not exist as a normal item in the table.

  • Apart from the item_codes table, the item_code field is used in Goods Receipt Notes (grn_items) and in the purch_order_details tables.

  • Hence item_code is limited to the accounting side. Definitely your vendors are not going to understand your own item references (stock_id). Hence you need to use their reference numbers (item_code) when interacting with them. Although your stock_id referencing may be similar to those from your vendors, yours may/can have some prefixed characters to denote the vendor you are referring to, to alleviate the condition when the same part number straddles across vendors possibly denoting even eniterly different items.

  • Please note that there is no reference to any stock_id where item_code is used except in the item_codes lookup table.

4,815

(8 replies, posted in Setup)

List what permissions your DB User has for the specific FA DB.
Provide versions of PHP, MySQL and Apache used and what platform / OS your server is on (Windows, Linux, etc)?
What is the file ownerships and permissions of the folders / files in the webroot and what is your webserver user:group?
Apache error logs will be based on your apache conf file used - check in /var/log/apache2/error*log or /var/log/httpd/error*log in Linux. PHP Errors in FA are generally found in tmp/ folder under the webroot.

4,816

(8 replies, posted in Translations)

Thanks @maulana - have wiki-ed your advice on logout and login again for changed language to take effect. wink

This has now been partially committed today.

The balance of the diff needs to be committed as below:

--- old/js/inserts.js    Sat Nov 22 16:50:29 2014
+++ new/js/inserts.js    Sat Nov 22 16:54:09 2014
@@ -289,7 +289,7 @@
                       ev = ev||window.event;
                       key = ev.keyCode||ev.which;
                        if(key == 13) {
-                        if(e.className == 'searchbox') e.onblur();
+                        if(string_contains(e.className, 'searchbox')) e.onblur();
                         return false;
                     }
                     return true;
@@ -443,10 +443,10 @@
             }
         }
         // prevent unneeded transaction entry abortion
-        if (e.className == 'shortcut'
-         || e.className == 'menu_option'
-         || e.className == 'menu_tab'
-          || e.className == 'selected')
+        if (string_contains(e.className, 'shortcut')
+         || string_contains(e.className, 'menu_option')
+         || string_contains(e.className, 'menu_tab')
+          || string_contains(e.className, 'selected'))
             e.onclick = function(ev) {
                 if (_validate._processing
                  && _validate._modified

4,818

(8 replies, posted in Translations)

The database restore fix is also used for unpacking archives for language packages as well.

You have not properly setup utf-8 and folders and permissions in your webroot. Here is a possible workaround to stay in iso-8859-1 itself.

Attached is the id_ID lang in iso-8859-1 encoding. Just overwrite (or create the necessary folders and put them in) the files in lang/id_ID/LC_MESSAGES/ folder.

Don't forget to update the lang/installed_languages.inc file with the necessary encodings.

4,819

(8 replies, posted in Translations)

A recent fix for windows package extraction may fix your errors.

Attached is your language icon to click to install.

Attached is the fix for the Javascript commit done.

--- old/js/utils.js    Sat Nov 22 03:08:34 2014
+++ new/js/utils.js    Sat Nov 22 03:10:08 2014
@@ -356,5 +356,6 @@
 }
 
 function string_contains(haystack, needle) {
-  return haystack.indexOf(needle) > -1;
+  var words = haystack.split(' ');
+  return words.indexOf(needle) > -1;
 }
--- old/js/inserts.js    Sat Nov 22 03:07:55 2014
+++ new/js/inserts.js    Sat Nov 22 03:20:42 2014
@@ -162,7 +162,7 @@
                 event.returnValue = false;
                     return false;
               }
-            if (box && (key == 32) && (this.className == 'combo2')) {
+            if (box && (key == 32) && (string_contains(this.className, 'combo2'))) {
                 this.style.display = 'none';
                 box.style.display = 'inline';
                 box.value='';
@@ -276,11 +276,11 @@
         if(e.onfocus==undefined) {
             e.onfocus = function() {
                 save_focus(this);
-                if (this.className == 'combo' || this.className == 'combo3')
+                if (string_contains(this.className, 'combo') || string_contains(this.className, 'combo3'))
                     this.select();
             };
         }
-        if (e.className == 'combo' || e.className == 'combo2' || e.className == 'combo3') {
+        if (string_contains(e.className, 'combo') || string_contains(e.className, 'combo2') || string_contains(e.className, 'combo3')) {
                 _set_combo_input(e);
         }
         else
@@ -289,7 +289,7 @@
                       ev = ev||window.event;
                       key = ev.keyCode||ev.which;
                        if(key == 13) {
-                        if(e.className == 'searchbox') e.onblur();
+                        if(string_contains(e.className, 'searchbox')) e.onblur();
                         return false;
                     }
                     return true;
@@ -443,10 +443,10 @@
             }
         }
         // prevent unneeded transaction entry abortion
-        if (e.className == 'shortcut'
-         || e.className == 'menu_option'
-         || e.className == 'menu_tab'
-          || e.className == 'selected')
+        if (string_contains(e.className, 'shortcut')
+         || string_contains(e.className, 'menu_option')
+         || string_contains(e.className, 'menu_tab')
+          || string_contains(e.className, 'selected'))
             e.onclick = function(ev) {
                 if (_validate._processing
                  && _validate._modified

I meant for new installs for endusers. They would not have any backward compatibility issues.

A generic set of attributes in the sysprefs table may be okay for company wide variables but a per table field name / value pair in an attribute table (new) will be okay for now. The following fields:

Table name (without prefix),
Primary_Foreign_Key_Ref,
Attribute_Field_N,
Attribute_Field_N_Value,
Attribute_Value_jsons

An example record in it would be:

items
1
1
Short
{"Color":"blue", "Texture":"Soft"}

4,822

(1 replies, posted in Setup)

FA comes with Each and Hours as Units of Measure.
The following will add common Units of Measure:

INSERT INTO `0_item_units` (`abbr`,`name`,`decimals`,`inactive`) VALUES
('pc','Pieces',0,0),
('lb','Pounds',0,0),
('kg','Kgs',0,0),
('cwt','CentWt',0,0),
('gm','Grams',0,0),
('ltr','Litres',0,0),
('gal','Gallons',1,0),
('km','Kilometres',0,0),
('mtr','Metres',0,0),
('cm','Centimetres',0,0),
('ctn','Cartons',0,0),
('box','Boxes',0,0),
('ctr','Containers',0,0),
('brl','Barrels',0,0),
('drm','Drums',0,0),
('ton','Tons',2,0);

Replace the Company prefix for the table in the above statement to suit your install or append it to your CoA sql file before company creation.

@joe: will extending tables with new nullable fields upset any insert/update sqls in FA?

On 2014-11-13, a commit was made with the following title:
Javascript now works with multiple classes on elements.
This is erroneous as

indexOf on arrays uses "==" on each element where as indexOf on string will treat the string as an array of char which effectively will do substring

It has since been corrected by the author in his github repo along with other missing replacements.

Please revert the commit or update it with the authors corrected files.

4,825

(4 replies, posted in FA Modifications)

Enable it in the config.php file