updated adodb package to work with php 7.1
[openemr.git] / library / transactions.inc
blob7b6142dc2d7a560a13be2b8672e45a8eabae1d68
1 <?php
3 function getTransById ($id, $cols = "*")
5   $row = sqlQuery("SELECT $cols 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'];
9   }
10   return $row;
13 function getTransByPid ($pid, $cols = "*")
15   $res = sqlStatement("select $cols from transactions where pid = ? " .
16     "order by date DESC", array($pid) );
17   for ($iter = 0; $row = sqlFetchArray($res); $iter++) {
18     $fres = sqlStatement("SELECT field_id, field_value FROM lbt_data WHERE form_id = ?",
19       array($row['id']));
20     while ($frow = sqlFetchArray($fres)) {
21       $row[$frow['field_id']] = $frow['field_value'];
22     }
23     $all[$iter] = $row;
24   }
25   return $all;
28 function newTransaction($pid, $body, $title, $authorized = "0",
29   $status = "1", $assigned_to = "*")
31   $body = add_escape_custom($body);
32   $id = sqlInsert("insert into transactions ( " .
33     "date, title, pid, user, groupname, authorized " .
34     ") values ( " .
35     "NOW(), '$title', '$pid', '" . $_SESSION['authUser'] .
36     "', '" . $_SESSION['authProvider'] . "', '$authorized' " .
37     ")");
38   sqlStatement("INSERT INTO lbt_data (form_id, field_id, field_value) VALUES (?, ?, ?)",
39     array($id, 'body', $body));
40   return $id;
43 function authorizeTransaction($id, $authorized = "1")
45   sqlQuery("update transactions set authorized = '$authorized' where " .
46     "id = '$id'");