3,851

(13 replies, posted in Reporting)

Invoice a "0" cost service with it's name indicating "Usual cost $..." ?

3,852

(16 replies, posted in Reporting)

Unfortunately, this report has not been coded for excel and hence the choice is not there in the menu.

The simulation of the sql in the function getTransactions() in reporting/rep108.php using the en_US-demo.sql Chart of Accounts is illustrated in the attachment herein - it contains the raw table data and the sql results which includes the CUSTCREDIT entries as well. The Simulation SQL is:

SET @date_due := '2014-09-23';
SET @date_now := '2014-07-25';
SET @debtor_no := 3;
SET @dimension_id := 2; -- Dimension 1
-- SET @dimension2_id := 2; -- Dimension 2

-- Taken from defines in includes/types.inc
-- ST_SALESINVOICE = 10
-- ST_CUSTCREDIT   = 11
-- ST_CUSTDELIVERY = 13


SELECT  dt.*,
        (ov_amount + ov_gst + ov_freight + ov_freight_tax + ov_discount) AS TotalAmount, alloc AS Allocated,
    ((TYPE = 10) AND due_date < @date_now) AS OverDue
FROM 1_debtor_trans dt
WHERE tran_date <= @date_due 
  AND debtor_no = @debtor_no
  AND TYPE <> 13
  AND ABS(ov_amount + ov_gst + ov_freight + ov_freight_tax + ov_discount) > 1e-6
-- if (!$show_also_allocated)
-- AND ABS(ABS(ov_amount + ov_gst + ov_freight + ov_freight_tax + ov_discount) - alloc) > 1e-6
-- Dimension 1
 AND dimension_id = @dimension_id
-- Dimension 2
-- AND dimension2_id = @dimension2_id
ORDER BY tran_date;

FLOAT_COMP_DELTA defined as a FA constant in PHP is used instead of 1e-6 in some places.

You may use the above in any MySQL client and execute them all on your database and check the results.

I see no reason why your output does not conform to what is expected. Please clear your report and js cache and try it again and use appropriate values for the constants defined in the code above on your database and verify the results to see if it matches your output.

The dimension name comes from another table and you will have to alter the sql to join it to that table like:

SELECT ....., d1.name AS D1Name
-- Dimension 2 if used
-- , d2. name A D2Name 
FROM 1_debtor_trans dt 
LEFT JOIN 1_dimensions d1 ON (dt.dimension_id=d1.id)
-- Dimension 2 if used
-- LEFT JOIN 1_dimensions d2 ON (dt.dimension2_id=d2.id)
WHERE ......
ORDER BY tran_date;

Then use the D1Name (and D2Name if appropriate) as desired in the report. Experiment with INNER JOIN instead of LEFT JOIN for the first or both instances as desired.

FA 2.3.x is designed for PHP 5 to 5.3 and a few have reported success with PHP 5.4 possibly with some mods.

In case you are testing with PHP 5.6+, please see what functions are deprecated / dropped in 5.4, 5.5 and then 5.6 and make sure you make appropriate changes / replacements.

There is no intention of the devs and myself in supporting any later versions of PHP other than 5.3 for FA v2.3.x. You are pretty much on your own here.

To assist others however, you may post your findings in a separate thread for such later PHP versions. Such findings posted in this thread will only serve to confuse end users - yes, it will make for big consultancy business...... but FA has been designed with simplicity in mind and for self service.

The code portion for activating extensions has not been touched in this fix and if it doesn't work for you now, then it never did in the first place prior to this fix as well.

Fixed it! Pull it in from my repo.

There was a missing function deactivate_hooks() which has now been added.

3,855

(1 replies, posted in Setup)

@joe: Can pull it in from my repo.

@joe: any pointers on the "official" way to get FA to drop tables created by extensions when they get deactivated for a specific company?

The $hooks->deactivate_extension() is not being called anywhere in FA and hence the drop.sql is not being executed when an extension is deactivated. The Ajax on the Web UI just looks after the tick mark in the checkbox and removes the entry in the $installed extensions arrays in the installed_extensions.php files.

Even if $check_only = false;, the $ok fails the test in function update_databases() in includes/hooks.inc as the function check_table() called in it and defined in admin/db/maintenance_db.inc as:

function check_table($pref, $table, $field=null, $properties=null)
{
    $tables = @db_query("SHOW TABLES LIKE '".$pref.$table."'");
    if (!db_num_rows($tables))
        return 1;        // no such table or error

    $fields = @db_query("SHOW COLUMNS FROM ".$pref.$table);
    if (!isset($field)) 
        return 0;        // table exists

    while( $row = db_fetch_assoc($fields)) 
    {
        if ($row['Field'] == $field) 
        {
            if (!isset($properties)) 
                return 0;
            foreach($properties as $property => $value) 
            {
                if ($row[$property] != $value) 
                    return 3;    // failed type/length check
            }
            return 0; // property check ok.
        }
    }
    return 2; // field not found
}

attempts to evaluate $fields = SHOW COLUMNS FROM... even when there is no $field argument available when dropping tables during deactivate_extensions! Hence the said function should be corrected to be:

function check_table($pref, $table, $field=null, $properties=null)
{
    $tables = @db_query("SHOW TABLES LIKE '".$pref.$table."'");
    if (!db_num_rows($tables))
        return 1;        // no such table or error

    if (!isset($field)) 
        return 0;        // table exists
    $fields = @db_query("SHOW COLUMNS FROM ".$pref.$table);

    while( $row = db_fetch_assoc($fields)) 
    {
        if ($row['Field'] == $field) 
        {
            if (!isset($properties)) 
                return 0;
            foreach($properties as $property => $value) 
            {
                if ($row[$property] != $value) 
                    return 3;    // failed type/length check
            }
            return 0; // property check ok.
        }
    }
    return 2; // field not found
}

Please confirm it being a fix.

3,859

(0 replies, posted in Setup)

Listing all FA files ending in multiple newlines:

$ find -type f -exec sh -c '[ -z "$(sed -n "\$p" "$1")" ] && echo "$1"' _ {} \;

./access/logout.php
./doc/2.2_Beta.txt
./doc/access_levels.txt
./doc/calculate_price.txt
./doc/CHANGELOG.old.txt
./doc/license.txt
./gl/inquiry/balance_sheet.php
./gl/inquiry/gl_trial_balance.php
./includes/db/sql_functions.inc
./install/lang/ar_EG/LC_MESSAGES/ar_EG.po
./install/lang/da_DK/LC_MESSAGES/da_DK.po
./install/lang/de_DE/LC_MESSAGES/de_DE.po
./install/lang/el_GR/LC_MESSAGES/el_GR.po
./install/lang/es_MX/LC_MESSAGES/es_MX.po
./install/lang/fr_FR/LC_MESSAGES/fr_FR.po
./install/lang/id_ID/LC_MESSAGES/id_ID.po
./install/lang/it_IT/LC_MESSAGES/it_IT.po
./install/lang/ka_GE/LC_MESSAGES/ka_GE.po
./install/lang/new_language_template/LC_MESSAGES/empty.po
./install/lang/nl_BE/LC_MESSAGES/nl_BE.po
./install/lang/pl_PL/LC_MESSAGES/pl_PL.po
./install/lang/pt_BR/LC_MESSAGES/pt_BR.po
./install/lang/pt_PT/LC_MESSAGES/pt_PT.po
./install/lang/sv_SE/LC_MESSAGES/sv_SE.po
./install/lang/zh_CN/LC_MESSAGES/zh_CN.po
./js/JsHttpRequest.js
./manufacturing/view/wo_issue_view.php
./manufacturing/view/wo_production_view.php
./purchasing/po_receive_items.php
./sales/inquiry/sales_deliveries_view.php
./sql/alter.sql
./sql/alter2.1.sql
./sql/en_US-new.sql
./taxes/db/tax_groups_db.inc

These excess newlines can be removed for atleast those files other than docs/*.* and *.po files.

3,860

(1 replies, posted in Setup)

A look at tmp/error.log in FA (on XAMPP in Windows) will show:

0::logout.php:50: session_destroy() [<a href='function.session-destroy'>function.session-destroy</a>]: Session object destruction failed

each time one logs out.

This is because session_destroy() is attempted after a session_unset() in access/logout.php - the "@" notwithstanding. If this is required for some installations, then the following can replace the last 2 statements in it:

session_unset();
if (session_id() != '') session_destroy();

For PHP 5.4+, use the following:

session_unset();
if (session_status() == PHP_SESSION_ACTIVE) session_destroy();

The variable $no_check_edit_conflicts can now be removed from FA and the file sales/includes/sales_ui.inc can have it's last function:

function check_edit_conflicts($cartname='Items')
{
    global $Ajax, $no_check_edit_conflicts;

    if ((!isset($no_check_edit_conflicts) || $no_check_edit_conflicts==0) && get_post('cart_id') && $_POST['cart_id'] != $_SESSION[$cartname]->cart_id) {
        display_error(_('This edit session has been abandoned by opening sales document in another browser tab. You cannot edit more than one sales document at once.'));
        $Ajax->activate('_page_body');
        display_footer_exit();
    }
}

changed to:

function check_edit_conflicts($cartname='Items')
{
    global $Ajax;

    if (!empty($_SESSION[$cartname]->cart_id) && get_post('cart_id') && $_POST['cart_id'] != $_SESSION[$cartname]->cart_id) {
        display_error(_('This edit session has been abandoned by opening sales document in another browser tab. You cannot edit more than one sales document at once.'));
        $Ajax->activate('_page_body');
        display_footer_exit();
    }
}

Steps to check in a fresh FA v2.3 install on Windows XAMPP using en_US-demo.sql:
Sales => Direct Invoice => Customer => Ghostbusters
No error should crop up.

3,862

(3 replies, posted in Setup)

Any Updates?

You can put in the Address in the Comments for now.

Another solution would be to make a Cash Customer and keep editing their address in it before choosing it in Direct Invoice each time.

3,864

(3 replies, posted in Setup)

Check if you have the file C:\xampp\htdocs\account\sales\includes\cart_class.inc.
If so, then try to hardcode the path into line 23 of C:\xampp\htdocs\account\sales\sales_order_entry.php like:

include_once("C:/xampp/htdocs/account/sales/includes/cart_class.inc");

and report the results.

Also state what menu sequence of clicks lead to such a situation.

First, close all browser instances, clear browser cache and try it - only if it fails should you need to try the above.

Have a Salary Account where the $113/- Salary+Taxes of all Musicians are debited and the respective musicians accounts get credited with 89.5% (100-2-8.5) of the salaries whilst 8.5% gets credited to the Pension Plan Account and 2% gets credited to the Musicians Union Account. Also credit the GST payable Account with 5% and credit the PST Payable Account with 8%. All of this can be a single Journal Voucher probably made for each week / month / event.

Unless you have PayRoll module made and customised for your needs (Musicians payout rates, etc), QuickEntries would be a cludge of a substitute, a tad better than making a set of direct SQL executions generated from some spreadsheet (=CONCATENATE("INSERT INTO...) and possibly programmed into a trigger in MySQL. PM me for assistance in implementing the latter.

Raising a Supplier (Govt Body, Pension plans, etc) Invoice for services (withheld tax/deductions) and settlement under normal means would qualify as a Standard Operating Procedure in FA. Recurrent Invoices will need editing amounts....

3,866

(2 replies, posted in Accounts Receivable)

Wikied under FAQs.

Wiki-ed it.

Checked out the 3rd company with the above credentials - you're pretty competent to get it done yourself. Open a GitHub account and post your extensions there so that the community can assist you in coding and testing as well. Also you may want to upgrade to v2.3.24+ from the v2.3.22 you are using (136 files in 48 folders have changed).

It is possible to make all Reference fields in new element forms to be readonly. The attached screenshots are for making just one form (Direct Invoice) or all forms to have their Reference field as non-editable.

Apart from being defined in includes/ui/ui_input.inc, there are 17 files that use the function ref_row - once each. The said function is currently not used in any standard extension.

Placed on Wiki.

The before and after depiction of the code changes suggested for pass 1 of the function synch is attached herein.

3,871

(5 replies, posted in Dimensions)

Dimensions are generally used for cost centres. Try Tags first before using dimensions - these are just for groups of transactions pertaining to a specific deal.

It remains sticky for the nice discussions in it and it being a work-in-progress for FA 2.4.

3,873

(7 replies, posted in Setup)

Wiki-ed it.

The same could have been achieved easily with a flag based readonly attribute in the input tag.

I have re-factored the includes/ui/ui_input.inc 's text_cells and text_cells_ex functions to have the same argument names and bunching similar code for ease of understanding before the inclusion of the $inparams in the latter function where the readonly can be inserted. This will also server to clarify the code.

The real solution will be to have a flag in the sys_prefs table that removes the field altogether and in the processing script acquires the next reference and then populates the tables, showing the end result in the browser.

Short of creating an extension for your extended CRM needs with a 1:1 table mapped to an existing branch/person FA table, the non field db data method "abusing" large fields like notes will be the "documented" way out.

Use a permanent holding table (managed externally with the likes of Adminer or phpMyEdit) or a spreadsheet for your separate fields and combine them into the large FA field each time anything changes!