db_query($sql, "Cannot add audit info");
// all audit records beside just inserted one should have gl_seq set to NULL
// to avoid need for subqueries (not existing in MySQL 3) all over the code
$sql = "UPDATE ".TB_PREF."audit_trail audit LEFT JOIN ".TB_PREF."fiscal_year year ON year.begin<='$date' AND year.end>='$date'
SET audit.gl_seq = IF(audit.id=".db_insert_id().", 0, NULL),"
db_query($sql, "Cannot add audit info");
// all audit records beside just inserted one should have gl_seq set to NULL
// to avoid need for subqueries (not existing in MySQL 3) all over the code
$sql = "UPDATE ".TB_PREF."audit_trail audit LEFT JOIN ".TB_PREF."fiscal_year year ON year.begin<='$date' AND year.end>='$date'
SET audit.gl_seq = IF(audit.id=".db_insert_id().", 0, NULL),"