mark0300 wrote:

I found a problem with error message after I voided a customer payment.  This problem has been encountered by other users:

Ref: https://frontaccounting.com/punbb/viewtopic.php?id=4892

When attempt to open a voided customer payment by clicking on the Customer Payment #, the following error message appeared:

DATABASE ERROR : no debtor trans found for given params
sql that failed was : 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,0_bank_accounts.bank_name, 0_bank_accounts.bank_account_name, 0_bank_accounts.account_type AS BankTransType, 0_bank_accounts.bank_curr_code, 0_bank_trans.amount as bank_amount FROM 0_debtor_trans trans LEFT JOIN 0_comments com ON trans.type=com.type AND trans.trans_no=com.id LEFT JOIN 0_shippers ON 0_shippers.shipper_id=trans.ship_via, 0_debtors_master cust, 0_bank_trans, 0_bank_accounts WHERE trans.trans_no='22' AND trans.type='12' AND trans.debtor_no=cust.debtor_no AND 0_bank_trans.trans_no ='22' AND 0_bank_trans.type=12 AND 0_bank_trans.amount != 0 AND 0_bank_accounts.id=0_bank_trans.bank_act

I managed to find a line in  sales/includes/db/cust_trans_db.inc that somehow caused the database error.

    if ($trans_type == ST_CUSTPAYMENT || $trans_type == ST_BANKDEPOSIT) {
        // it's a payment so also get the bank account
        $sql .= " AND ".TB_PREF."bank_trans.trans_no =".db_escape($trans_id)."
            AND ".TB_PREF."bank_trans.type=$trans_type
            AND ".TB_PREF."bank_trans.amount != 0  <<== the "!=" is causing the issue
            AND ".TB_PREF."bank_accounts.id=".TB_PREF."bank_trans.bank_act ";

As stated above, this != 0 is causing the problem.  If I remove "!", then the voided payment will appear normal.  But the normal customer payment will have the same error.

Due to my limited php knowledge, I am not able to fix it. 

I hope this can be fixed as soon as possible or it looks ugly when the user click on the transaction.

Thanks!

/Mark

======================
Hi @apmuthu,

I am novice in programming and I encountered the same problem in version 2.3.25.

When the said line mentioned by Mark0300 is removed, the error disappeared.  But I couldn't figure out why that line would cause the error as it is just a “if” condition.

/KH

Hi there

I have been trying to add the salesman phone number and email to the quotation form.  I wish to add this information below the "SALES QUOTATION - Payment term..." and read like this:

Your Sales Contact is: Phone: XXXXXXX and email XXX@XXXX.com

I have been going through the doctext.inc, header2.inc and rep111.php and I was unable to fetch the relevant salesman's email and phone from the 0_salesman database and I couldn't figure out where to put the program code for the salesman info.

Would someone kind enough to provide some guidance to help me to add this information?

Many thanks in advance.

Hi anoopmb,

I would also like to have the source code.  I have similar needs here for the license and expiry date too.
Kindly PM me.

Thank you.

4

(9 replies, posted in Setup)

Hi TM,

I agree with you too.  Database backup file should not be tempered and to prevent that, prevent download and view is one of the ways I could do for now.

Hi APMuthu,

The codes work fine.   Thank you so much.

5

(9 replies, posted in Setup)

Dear APMuthu,

I will be testing the scripts and I will let you know how it goes...  Many thanks.

Dear TM,

Thanks for responding to this post.

I noted a major security issue if we have the tables 0_users, 0_security_roles etc included in the backup sql files. The 0_users encrypted password can be replaced (by users who is familiar with the encryption) and the roles can be changed. If the data base is then restored, the admin/users' passwords can be compromised.  I have tested it and I found that this is a real vulnerability.

To the minimum, I feel that there should be 2 types of backups provided.  1. "Full back up" including all the tables and only to be done by the authorized personnel such as system administrator or the head of the company.  Ordinary users should not be allowed to perform this backup.  2.  "User data backup" for "undo" purpose and this should exclude the tables that contain the login, passwords and access control.

6

(9 replies, posted in Setup)

Dear APMuthu,

Thanks very much for the codes and Wiki'ed it.

I have added the codes provided and test run it, the few excluded tables still exist in the backup .sql file (please see the appended codes).  I inspected the few variables and arrays and I couldn't spot the issue.  I need your advise on this....

Another potential issue which is related to the restoration of this modified backup file.  As stated in the Wiki, the restore functions will first drop all the tables before being recreated and populated.

Wiki: "On restoration, these tables will first be dropped before being recreated and populated."

If the tables are excluded, unless the backup .sql totally ignore these excluded tables and they are not dropped during restoration.  (I hope this is the case).  Otherwise the Restoration of these excluded tables will be "emptied" and it will make the FA not functioning as the data are missing (for example, the users will not be able to login since the user table is empty).   

I'm sorry I could not contribute to the coding but I could only share my thoughts with regards to this issue.  Your help is very much appreciated.

Thank you!

KH

=====================
   $res = db_query("show table status");
    $all_tables = array();
    while($row = db_fetch($res))
    {
        if (($conn["tbpref"] == "" && !preg_match('/[0-9]+_/', $row['Name'])) ||
            ($conn["tbpref"] != "" && strpos($row['Name'], $conn["tbpref"]) === 0))
            $all_tables[] = $row;
    }
   
//Skip tables during backup:  The codes below skipped the few tables that may cause security issues such as '0_users', 'seicurity_roles' etc.

$skip_tables_list = Array('users', 'security_roles', 'sql_trail');

    foreach ($skip_tables_list as $skip_table_name) {
        if (($key = array_search($conn["tbpref"].$skip_table_name, $all_tables)) !== false) {
            unset($all_tables[$key]);
        }
    }
// End Skip Files during backup   
   
        // get table structures
    foreach ($all_tables as $table)
    {
        $res1 = db_query("SHOW CREATE TABLE `" . $table['Name'] . "`");
        $tmp = db_fetch($res1);
        $table_sql[$table['Name']] = $tmp["Create Table"];
    }
===========================

7

(9 replies, posted in Setup)

Hi there,

I would like to exclude a few tables such as '0_users' or `0_security_roles` when running the backup.  I attempt to make changes to admin/db/maintenance_db.inc to exclude these tables, but due to my limited knowledge in php, I was unable to put this function "--ignore-table" at the right place.

Could someone provide some guidance?

Thanks.

KH

apmuthu wrote:

Roles permissions must be enabled for the user

Thanks apmuthu.  I actually have the role permission of Admin and has checked all the items and I login to admin.  The issue is I did not see an item of OScommerce  for me to check.

Any further advise you could provide?  Thanks again.

Best regards
KH

Hi there,

I have installed FA 2.3.19.   And I have installed/activated Extension "osCommerce Order and Customer Import Module".  Under the Install/activate Extension Tab, I have activated it by selecting the Campany name.    However, I cannot see this extension under Access Setup for me to provide the access permission (I have the Administrator access rights).  When I comb through all the tabs, I also cannot find any navigation items pertaining to this module/extension.

When I go to the www.domain.com/modules/osc_orders/osCommerce.php, it shows me this message:

"The security settings on your account do not permit you to access this function"

I would appreciate if anyone could share or advise how I could get this extension setup.

Thanks!

10

(9 replies, posted in Setup)

I installed FA and have the same experience.  Each link I have to login.  The system is unusable (until the issue is fixed).

This is a bug need to be fixed.  I have used many php system and I have never encounter such session timeout issue.

My webhost is godaddy.  I have made the changes to the session.inc based on what I have read from the forum but none resolve the problem.

I will wait for godaddy's support to get back to me if they are able to find anything I will share...

KH