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=$type AND id=$type_no";
18 return db_query($sql, "could not query comments transaction table");
21 //--------------------------------------------------------------------------------------------------
23 function add_comments($type, $type_no, $date_, $memo_)
25 if ($memo_ != null && $memo_ != "")
27 $date = date2sql($date_);
28 $sql = "INSERT INTO ".TB_PREF."comments (type, id, date_, memo_)
29 VALUES ($type, $type_no, '$date', ".db_escape($memo_).")";
31 db_query($sql, "could not add comments transaction entry");
35 //--------------------------------------------------------------------------------------------------
37 function update_comments($type, $id, $date_, $memo_)
41 delete_comments($type, $id);
42 add_comments($type, $id, Today(), $memo_);
46 $date = date2sql($date_);
47 $sql = "UPDATE ".TB_PREF."comments SET memo_=".db_escape($memo_)." WHERE type=$type AND id=$id AND date_='$date'";
48 db_query($sql, "could not update comments");
52 //--------------------------------------------------------------------------------------------------
54 function delete_comments($type, $type_no)
56 $sql = "DELETE FROM ".TB_PREF."comments WHERE type=$type AND id=$type_no";
58 db_query($sql, "could not delete from comments transaction table");
61 //--------------------------------------------------------------------------------------------------