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 ***********************************************************************/
12 //--------------------------------------------------------------------------------------------------
14 function get_comments($type, $type_no)
16 $sql = "SELECT * FROM ".TB_PREF."comments WHERE type="
17 .db_escape($type)." AND id=".db_escape($type_no);
19 return db_query($sql, "could not query comments transaction table");
22 //--------------------------------------------------------------------------------------------------
24 function add_comments($type, $type_no, $date_, $memo_)
26 if ($memo_ != null && $memo_ != "")
28 $date = date2sql($date_);
29 $sql = "INSERT INTO ".TB_PREF."comments (type, id, date_, memo_)
30 VALUES (".db_escape($type).", ".db_escape($type_no)
31 .", '$date', ".db_escape($memo_).")";
33 db_query($sql, "could not add comments transaction entry");
37 //--------------------------------------------------------------------------------------------------
39 function update_comments($type, $id, $date_, $memo_)
43 delete_comments($type, $id);
44 add_comments($type, $id, Today(), $memo_);
48 $date = date2sql($date_);
49 $sql = "UPDATE ".TB_PREF."comments SET memo_=".db_escape($memo_)
50 ." WHERE type=".db_escape($type)." AND id=".db_escape($id)
51 ." AND date_='$date'";
52 db_query($sql, "could not update comments");
56 //--------------------------------------------------------------------------------------------------
58 function delete_comments($type, $type_no)
60 $sql = "DELETE FROM ".TB_PREF."comments WHERE type=".db_escape($type)
61 ." AND id=".db_escape($type_no);
63 db_query($sql, "could not delete from comments transaction table");
66 //--------------------------------------------------------------------------------------------------