mysql 8 fixes (#1639)
[openemr.git] / library / ajax / document_helpers.php
blobe278f9d1cf08a13eae25d1f2b4302fd4a142befe
1 <?php
2 /**
3 * Document Helper Functions for New Documents Module.
5 * Copyright (C) 2017-2018 Jerry Padgett <sjpadgett@gmail.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>.
18 * @package OpenEMR
19 * @author Jerry Padgett <sjpadgett@gmail.com>
20 * @link http://www.open-emr.org
24 require_once(dirname(__FILE__) . "/../../interface/globals.php");
26 $term = isset($_GET["term"]) ? filter_input(INPUT_GET, 'term') : '';
28 function get_patients_list($term)
30 $term = "%" . $term . "%";
31 $clear = "- " . xl("Reset to no patient") . " -";
32 $response = sqlStatement("SELECT Concat(patient_data.fname, ' ',patient_data.lname) as label, patient_data.pid as value FROM patient_data HAVING label LIKE ? ORDER BY patient_data.lname ASC", array($term));
33 $resultpd[] = array(
34 'label' => $clear,
35 'value' => '00'
37 while ($row = sqlFetchArray($response)) {
38 if ($GLOBALS['pid'] == $row['value']) {
39 $row['value'] = "00";
40 $row['label'] = xl("Locked") . "-" . xl("In Use") . ":" . $row['label'];
43 $resultpd[] = $row;
46 echo json_encode($resultpd);
49 get_patients_list($term);