The Audit Trail tables ERD has been placed in the wiki.

4,177

(9 replies, posted in Reporting)

Which is the nearest equivalent report you wish to customise or use as a basis for yours. All report screenshots are in the Wiki.

4,178

(10 replies, posted in Report Bugs here)

Please verify that the same result occurs when a different browser is used. Thanks for your patience in providing valuable feedback.

4,179

(10 replies, posted in Report Bugs here)

Try to save the file from the URL in centos using wget and see if the blank line appears.

Also examine the file in a hex editor to see if it is a CRLF or just LF - (0D 0A or just 0A).

Then we can programattically remove it if it exists as the first character(s).

Attaching your screenshot for the forum.

4,180

(3 replies, posted in Report Bugs here)

A new install of FA 2.3.24+ was done in WinXP SP3 and XAMPP 1.7.3.
A Bank Payment was done to Insurance.
DB Backup Taken.
The said Bank Payment Journal Entry was edited and the expense Account changed to Licences.
DB Backup Taken.
The 2 DB Backups were compared.

Attached is the screenshots and backup files and comparisons done.

The next_reference field in sys_types table gets decremented - is this intended?
The existing entries have their amounts zeroed out.
New entries are created.
The voided entry (#9 here) is recorded in voided table.
A new entry number (#10 here) is given to the edited version of the entry.

All entries balance out perfectly. Where is the bug?

Is it only in the "reporting?

Attempting to use the url with trans_no=9 yields no data now and is as it should be.

4,181

(14 replies, posted in Banking and General Ledger)

Have you entered all opening balances using a single Journal Voucher in FA before beginning to use it? Since a balance sheet balances out, all credits = all debits, all account entries in the balance sheet can safely populate the FA database. If you are in the middle of a year, then make a dummy debiting the bank account and crediting some suspense account for the contra which will appear to be a creditor for the company unless it is directed to the true source of the monies.

4,182

(6 replies, posted in Reporting)

Yes, the Journal Entry is the way to go.... good catch. Data outside of the FA dataset must needs be addressed in this way.

4,183

(14 replies, posted in FA Modifications)

@MarkAndrew: You're right, the stock throws the balance sheet off. The report must have a flag to include service items as well.

@joe: any closure?

4,184

(10 replies, posted in Report Bugs here)

The attached file is what you should get for the Chart of Accounts for the demo data in en_US-demo.sql CoA.

It is possible that you imported your customer without an entry in the debtors_master table or more likely your debtor_trans table's import did not go well.

Your SQL has been reformatted for execution in the en_US-demo CoA as Company 1:

SELECT trans.*
      ,ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount AS Total
      ,cust.name AS DebtorName
      , cust.address
      , cust.curr_code
      , cust.tax_id
      , com.memo_
      , bank_act
      , bank_accounts.bank_name
      , bank_accounts.bank_account_name
      , bank_accounts.account_type AS BankTransType
      , bank_accounts.bank_curr_code
      , bank_trans.amount AS bank_amount 
FROM 1_debtor_trans trans 
    LEFT JOIN 1_comments com ON trans.type=com.type AND trans.trans_no=com.id 
    LEFT JOIN 1_shippers shippers ON shippers.shipper_id=trans.ship_via
    , 1_debtors_master cust
    , 1_bank_trans bank_trans
    , 1_bank_accounts bank_accounts
WHERE trans.trans_no='360' 
  AND trans.type='2' 
  AND trans.debtor_no=cust.debtor_no 
  AND bank_trans.trans_no ='360' 
  AND bank_trans.type=2 
  AND bank_trans.amount != 0 
  AND bank_accounts.id=bank_trans.bank_act;

The source of this SQL is in the file core/sales/includes/db/cust_trans_db.inc in function get_customer_trans($trans_id, $trans_type). The said error comes up only when $go_debug = 1 is set in config.php.

4,186

(14 replies, posted in Banking and General Ledger)

When you start FA, you must enter all Opening Balances as per your balance sheet using a single Journal Voucher. Your Bank Opening Balance is part of it.

4,187

(6 replies, posted in Reporting)

Try entering he credit note from the supplier menu.

4,188

(10 replies, posted in Report Bugs here)

What language and fonts are you using and are they enabled in your CentOS?
Is it a browser mangling issue?

Try making the demo company print standard reports first before troubleshooting other issues.

Attached your Screenshot here.

It looks like you are using Arial font. See if your CentOS has that installed.

If you are in Windows, Use a text editor that is UNIX aware and UTF-8 aware like NotePad++ and set the text editor mode to UTF-8 without BOM. You will now be able to type in valid replacements for "?" characters.

4,190

(3 replies, posted in Report Bugs here)

This is done so that partial allocation can be done across both the old and the new accounts I presume..... Dealing with GL Entries manually must be done with utmost care and understanding....you are pretty much on your own here.

When the Journal Inquiry is done, first the total number of records is (COUNT) queried to determine the page links (Next/Prev/Total...). If it is a GROUP BY query, and one of the GROUP BY fields is NULL, then the total number of records count returned is 0 (Operation on NULL).

The full fix is given in this Forum Post but the real fix would be when the input data is consistent with all NULLs removed by defining appropriate defaults (blank string, 0, etc) in the table structure itself.

4,192

(48 replies, posted in Setup)

Changes in the FA 2.4 Unstable branch till 2015-04-08:

The error reported in the 22nd post in this thread is still present in this snapshot.

The Security Role fix has yet to be ported in from FA 2.3.

1. Removed $type in argument of function add_stock_transfer()
2. $line_item->qty from form field used instead of $increase from POST in Inventory Adjustments
3. Reorganised many SQLs to have table aliases
4. Field stock_move.person_id now no longer in rep3xx.php Inventory Reports and stock movements inquiry
5. function get_stock_movements() moved from inventory/includes/db/movement_types_db.inc to inventory/includes/inventory_db.inc
6. Removed Inventory &Movement Types Menu item from Inventory menu
7. Moved Inventory &Locations Menu link from left side to right side.
8. Removed files inventory/includes/db/movement_types_db.inc
9. Removed inventory/manage/movement_types.php
10. Removed stock_movement functions
11. item cart is now updated directly from the form field's $line_item->stock_id

Removed stock_move.person_id field

ALTER TABLE `0_stock_moves` DROP COLUMN `person_id`;

Removed 0_movement_types table

DROP TABLE IF EXISTS `0_movement_types`;

The following is the main fix for the journal inquiry issue since we need to remove NULLs in the SQLs:

--- gl/includes/db/gl_db_trans.inc    Fri Jan 16 08:56:28 1970
+++ gl/includes/db/gl_db_trans.inc    Fri Jan 16 08:56:28 1970
@@ -605,14 +605,14 @@
 function get_sql_for_journal_inquiry($filter, $from, $to, $ref='', $memo='', $alsoclosed=false)
 {
 
-    $sql = "SELECT    IF(ISNULL(a.gl_seq),0,a.gl_seq) as gl_seq,
+    $sql = "SELECT    COALESCE(a.gl_seq,0) as gl_seq,
         gl.tran_date,
         gl.type,
         gl.type_no,
-        refs.reference,
+        COALESCE(refs.reference,'') AS reference,
         SUM(IF(gl.amount>0, gl.amount,0)) as amount,
-        com.memo_,
-        IF(ISNULL(u.user_id),'',u.user_id) as user_id
+        COALESCE(com.memo_,'') AS memo_,
+        COALESCE(u.user_id,'') as user_id
         FROM ".TB_PREF."gl_trans as gl
          LEFT JOIN ".TB_PREF."audit_trail as a ON
             (gl.type=a.type AND gl.type_no=a.trans_no)
@@ -625,11 +625,11 @@
         WHERE gl.tran_date >= '" . date2sql($from) . "'
         AND gl.tran_date <= '" . date2sql($to) . "'
         AND gl.amount!=0";
-    if ($ref) {
-        $sql .= " AND reference LIKE ". db_escape("%$ref%");
+    if (!empty($ref)) {
+        $sql .= " AND refs.reference LIKE '%". db_escape($ref) . "%'";
     }
-    if ($memo) {
-        $sql .= " AND com.memo_ LIKE ". db_escape("%$memo%");
+    if (!empty($memo)) {
+        $sql .= " AND com.memo_ LIKE '%". db_escape($memo) . "%'";
     }
     if ($filter != -1) {
         $sql .= " AND gl.type=".db_escape($filter);

Now we also need to tolerate NULLs in fields in GROUP BY statements which otherwise evaluate to a count of 0 records in the db_pager.inc and make sure that no negative LIMIT is part of the SELECT clause since the first value of the page is 0 and on deducting 1 for previous page will return a negative number causing the sql to end in LIMIT -10, 10:

--- includes/db_pager.inc    Fri Jan 16 08:56:28 1970
+++ includes/db_pager.inc    Fri Jan 16 08:56:28 1970
@@ -325,6 +325,7 @@
 
         $page_len = $this->page_len;
         $offset = ($this->curr_page - 1) * $page_len;
+        $offset = ($offset < 0 ? 0 : $offset);
 
         $sql .= " LIMIT $offset, $page_len";
 
@@ -345,11 +346,19 @@
                 return false;
             $row = db_fetch_row($result);
             $this->rec_count = $row[0];
+             // 2015-04-09 apmuthu: try original sql since count = 0 if group by clause has NULLs
+            if (!$row[0] && !empty($this->group)) {
+                $sql = $this->_sql_gen(false);
+                $result = db_query($sql, 'Error reading record set');
+                if ($result == false) 
+                    return false;
+                $this->rec_count = db_num_rows($result);
+            }
               $this->max_page = $this->page_len ?
                 ceil($this->rec_count/$this->page_len) : 0;
         
             if ($go_debug) { // FIX - need column name parsing, but for now:
-                // check if field names are set explicite in col def
+                // check if field names are set explicitly in col def
                 // for all initially ordered columns
                 foreach ($this->columns as $col) {
                        if (isset($col['ord']) && $col['ord'] != '' 

4,194

(0 replies, posted in Misc. Charts of Accounts)

FA 2.3 database fixes and notes:

1. 0_comments table has no primary key. Correct it with:

ALTER TABLE `0_comments` ADD PRIMARY KEY (`type`, `id`), DROP INDEX `type_and_id`;

2. Table field 0_gl_trans.person_id is tinyblob Nullable. In some cases it is a blank string and in others it is 0 when not a valid integer.

3. Table field 0_gl_trans.person_type_id is 1, 2, or 3 and NULL.

4,195

(4 replies, posted in Accounts Receivable)

Try them in tandem with Recurring Invoices.

Modify your function get_gl_trans_memo as follows:

function get_gl_trans_memo($account, $type, $trans_no)
{
    $sql = "SELECT COALESCE(memo_, '') AS memo_ FROM ".TB_PREF."gl_trans WHERE account="
    .db_escape($account)." AND type=".db_escape($type)
    ." AND type_no=".db_escape($trans_no);

    $result = db_query($sql, "query for gl memo_ failed");

    $row = db_fetch_row($result);
    return $row[0];
}

This will help if the memo_ field is NULL.

The sql default for listing the Journal Vouchers is:

SELECT COUNT(DISTINCT gl.tran_date, a.gl_seq, gl.type, gl.type_no) FROM 1_gl_trans as gl
         LEFT JOIN 1_audit_trail as a ON
            (gl.type=a.type AND gl.type_no=a.trans_no)
         LEFT JOIN 1_comments as com ON
            (gl.type=com.type AND gl.type_no=com.id)
         LEFT JOIN 1_refs as refs ON
            (gl.type=refs.type AND gl.type_no=refs.id)
         LEFT JOIN 1_users as u ON
            a.user=u.id
      WHERE (gl.tran_date >= '2015-03-08'
        AND gl.tran_date <= '2015-04-08'
        AND gl.amount!=0 AND gl.type='0');

In such display, when any element in the GROUP part of the SQL is null, the COUNT evaluates to NULL. The function sql_gen() in includes/db_pager.inc has:

            return "SELECT COUNT($group) FROM $from $where";

The comments table does not have any primary key and is the current order of fields correct?

CREATE TABLE `1_comments` (
  `type` int(11) NOT NULL DEFAULT '0',
  `id` int(11) NOT NULL DEFAULT '0',
  `date_` date DEFAULT '0000-00-00',
  `memo_` tinytext,
  KEY `type_and_id` (`type`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

@joe: possible updation should be tried first before insertion or there is a primary key issue that is not satisfied in the query....

For those attempting to use FA on Ubuntu 14.04, replace all instances of gzopen with gzopen64 to get it working.

The following should be self-explanatory:

php -r 'var_dump(function_exists("gzfile"));' 
bool(true) 
php -r 'var_dump(function_exists("gzopen"));' 
bool(false) 
php -r 'var_dump(function_exists("gzopen64"));' 
bool(true)

The following posts are useful references:
generateSitemap.php gzopen() fatal error on Ubuntu 14.04 (replace gzopen() by gzopen64())
Zlib functions (gzopen etc.) are undefined while gzopen64 etc. exist
Bug #20246     Broken with php 5.5.9

4,200

(48 replies, posted in Setup)

All changes in the unstable FA 2.4 branch on and after 2015-03-31 till and including 2015-04-06 have been checked out and committed to my Unofficial GitHub Repo.

The error reported in the 22nd post in this thread is still present in this snapshot.

The Security Role fix has yet to be ported in from FA 2.3.

Here is a summary of changes:

Foreign language characters in password now allowed
0_sys_prefs.value changed from tinytext in FA 2.3 to TEXT NOT NULL default ''
demo data fiscal year and transactions moved from 2013-2014 to 2014-2015

Prices adjusted for discount directly from form field
Existing entries adjusted with:

UPDATE `0_stock_moves` SET + price = price*(1-discount_percent);

Removed fields:

  • stock_moves.visible,

  • stock_moves.discount_percent

API functions and CoAs adjusted accordingly.

  • Sales Kits: 3rd parameter in function update_component($kit_code, $selected_item) dropped

  • function get_mb_flag($stock_id) moved from includes/db/manufacturing_db.inc to includes/db/inventory_db.inc

  • Adjusted file includes accordingly everywhere

  • Renamed includes/manufacturing.inc to includes\inventory.inc