minor bug fix
[openemr.git] / library / transactions.inc
blobafc29678bdc8c875755d14b0d4cf4873cdc01319
1 <?php
2 require_once("{$GLOBALS['srcdir']}/sql.inc");
4 function getTransById ($id, $cols = "*")
6   return sqlQuery("select $cols from transactions where id=? " .
7     "order by date DESC limit 0,1", array($id) );
10 function getTransByPid ($pid, $cols = "*")
12   $res = sqlStatement("select $cols from transactions where pid=? " .
13     "order by date DESC", array($pid) );
14   for ($iter = 0; $row = sqlFetchArray($res); $iter++)
15     $all[$iter] = $row;
16   return $all;
19 function newTransaction($pid, $body, $title, $authorized = "0",
20   $status = "1", $assigned_to = "*")
22   $body = mysql_escape_string($body);
23   return sqlInsert("insert into transactions ( " .
24     "date, title, body, pid, user, groupname, authorized " .
25     ") values ( " .
26     "NOW(), '$title', '$body', '$pid', '". $_SESSION['authUser'] .
27     "', '". $_SESSION['authProvider'] . "', '$authorized' " .
28     ")");
31 function authorizeTransaction($id, $authorized = "1")
33   sqlQuery("update transactions set authorized = '$authorized' where " .
34     "id = '$id'");