4 * Document Helper Functions for New Documents Module.
7 * @link https://www.open-emr.org
8 * @author Jerry Padgett <sjpadgett@gmail.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2017-2018 Jerry Padgett <sjpadgett@gmail.com>
11 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once(dirname(__FILE__
) . "/../../interface/globals.php");
17 use OpenEMR\Common\Csrf\CsrfUtils
;
20 if (!CsrfUtils
::verifyCsrfToken($_GET["csrf_token_form"])) {
21 CsrfUtils
::csrfNotVerified();
25 'term' => (isset($_GET["term"]) ?
filter_input(INPUT_GET
, 'term') : ''),
26 'sql_limit' => (isset($_GET["limit"]) ?
filter_input(INPUT_GET
, 'limit') : 20),
29 function get_patients_list($req)
31 $term = "%" . $req['term'] . "%";
32 $clear = "- " . xl("Reset to no patient") . " -";
33 $response = sqlStatement(
34 "SELECT CONCAT(fname, ' ',lname,IF(IFNULL(deceased_date,0)=0,'','*')) as label, pid as value
37 ORDER BY IF(IFNULL(deceased_date,0)=0, 0, 1) ASC, IFNULL(deceased_date,0) DESC, lname ASC, fname ASC
38 LIMIT " . escape_limit($req['sql_limit']),
45 while ($row = sqlFetchArray($response)) {
46 if ($GLOBALS['pid'] == $row['value']) {
48 $row['label'] = xl("Locked") . "-" . xl("In Use") . ":" . $row['label'];
54 echo json_encode($resultpd);
57 get_patients_list($req);