2 /**********************************************************************
3 Copyright (C) FrontAccounting, LLC.
4 Released under the terms of the GNU General Public License, GPL,
5 as published by the Free Software Foundation, either version 3
6 of the License, or (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
13 function add_audit_trail($trans_type, $trans_no, $trans_date, $descr='')
15 $sql = "INSERT INTO ".TB_PREF."audit_trail"
16 . " (type, trans_no, user, fiscal_year, gl_date, description)
17 VALUES($trans_type, $trans_no,"
18 . $_SESSION["wa_current_user"]->user. ","
19 . get_company_pref('f_year') .","
20 . "'". date2sql($trans_date) ."',"
21 . db_escape($descr). ")";
23 db_query($sql, "Cannot add audit info");
26 function get_audit_trail_all($trans_type, $trans_no)
28 $sql = "SELECT * FROM ".TB_PREF."audit_trail"
29 ." WHERE type=$trans_type AND trans_no=$trans_no";
31 return db_query($sql, "Cannot get all audit info for transaction");
34 function get_audit_trail_last($trans_type, $trans_no)
36 $sql = "SELECT * FROM ".TB_PREF."audit_trail"
37 ." WHERE type=$trans_type AND trans_no=$trans_no ORDER BY id desc";
39 $res = db_query($sql, "Cannot get last audit info for transaction");
41 $row = db_fetch($res);