2 require_once("{$GLOBALS['srcdir']}/sql.inc");
4 function getTransById ($id, $cols = "*")
6 $row = sqlQuery("SELECT $cols FROM transactions WHERE id = ?", array($id));
7 $fres = sqlStatement("SELECT field_id, field_value FROM lbt_data WHERE form_id = ?", array($id));
8 while ($frow = sqlFetchArray($fres)) {
9 $row[$frow['field_id']] = $frow['field_value'];
14 function getTransByPid ($pid, $cols = "*")
16 $res = sqlStatement("select $cols from transactions where pid = ? " .
17 "order by date DESC", array($pid) );
18 for ($iter = 0; $row = sqlFetchArray($res); $iter++) {
19 $fres = sqlStatement("SELECT field_id, field_value FROM lbt_data WHERE form_id = ?",
21 while ($frow = sqlFetchArray($fres)) {
22 $row[$frow['field_id']] = $frow['field_value'];
29 function newTransaction($pid, $body, $title, $authorized = "0",
30 $status = "1", $assigned_to = "*")
32 $body = add_escape_custom($body);
33 $id = sqlInsert("insert into transactions ( " .
34 "date, title, pid, user, groupname, authorized " .
36 "NOW(), '$title', '$pid', '" . $_SESSION['authUser'] .
37 "', '" . $_SESSION['authProvider'] . "', '$authorized' " .
39 sqlStatement("INSERT INTO lbt_data (form_id, field_id, field_value) VALUES (?, ?, ?)",
40 array($id, 'body', $body));
44 function authorizeTransaction($id, $authorized = "1")
46 sqlQuery("update transactions set authorized = '$authorized' where " .