Hide dashboard card 2 (#7423)
[openemr.git] / library / transactions.inc.php
blob4d98b415b6b8817aa12ec64c7343a3fb1cbe32bc
1 <?php
3 function getTransById($id, $cols = "*")
5 $row = sqlQuery("SELECT " . escape_sql_column_name(process_cols_escape($cols), array('transactions')) . " FROM transactions WHERE id = ?", array($id));
6 $fres = sqlStatement("SELECT field_id, field_value FROM lbt_data WHERE form_id = ?", array($id));
7 while ($frow = sqlFetchArray($fres)) {
8 $row[$frow['field_id']] = $frow['field_value'];
11 return $row;
14 function getTransByPid($pid, $cols = "*")
16 $res = sqlStatement("select " . escape_sql_column_name(process_cols_escape($cols), array('transactions')) . " from transactions where pid = ? " .
17 "order by date DESC", array($pid));
19 $all = [];
21 for ($iter = 0; $row = sqlFetchArray($res); $iter++) {
22 $fres = sqlStatement(
23 "SELECT field_id, field_value FROM lbt_data WHERE form_id = ?",
24 array($row['id'])
26 while ($frow = sqlFetchArray($fres)) {
27 $row[$frow['field_id']] = $frow['field_value'];
30 $all[$iter] = $row;
33 return $all;
36 function newTransaction(
37 $pid,
38 $body,
39 $title,
40 $authorized = "0",
41 $status = "1",
42 $assigned_to = "*"
43 ) {
45 $body = add_escape_custom($body);
46 $id = sqlInsert("insert into transactions ( " .
47 "date, title, pid, user, groupname, authorized " .
48 ") values ( " .
49 "NOW(), '$title', '$pid', '" . $_SESSION['authUser'] .
50 "', '" . $_SESSION['authProvider'] . "', '$authorized' " .
51 ")");
52 sqlStatement(
53 "INSERT INTO lbt_data (form_id, field_id, field_value) VALUES (?, ?, ?)",
54 array($id, 'body', $body)
56 return $id;
59 function authorizeTransaction($id, $authorized = "1")
61 sqlQuery("update transactions set authorized = ? where " .
62 "id = ?", array($authorized, $id));