in some php versions touch will give an error, error output supressed by @
[openemr.git] / library / transactions.inc
blobba2ca7a648a1b7174bd156e0b864972ab2272e7c
1 <?php
2 require_once("{$GLOBALS['srcdir']}/sql.inc");
4 function getTransById ($id, $cols = "*")
6         return sqlQuery("select $cols from transactions where id='$id' order by date DESC limit 0,1");
9 function getTransByPid ($pid, $cols = "*")
11         $res = sqlStatement("select $cols from transactions where pid='$pid' order by date DESC");
12         for ($iter = 0;$row = sqlFetchArray($res);$iter++)
13                 $all[$iter] = $row;
14         return $all;
17 function newTransaction($pid, $body, $title, $authorized = "0")
19         $body = mysql_escape_string($body);
20         return sqlInsert("insert into transactions (date, title, body, pid, user, groupname, authorized) values (NOW(), '$title', '$body', '$pid', '". $_SESSION['authUser'] ."', '". $_SESSION['authProvider'] ."', '$authorized')");
23 function authorizeTransaction($id, $authorized = "1")
25         sqlQuery("update transactions set authorized = '$authorized' where id = '$id'");