more organization of autoloaded files (#424)
[openemr.git] / interface / fax / fax_dispatch_newpid.php
blobd1e09aeda563933aa0401eb245a6b46e42199c21
1 <?php
2 // Copyright (C) 2008, 2010 Rod Roark <rod@sunsetsystems.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 // This is invoked via a jQuery getScript() from fax_dispatch.php.
10 // Its purpose is to return JavaScript that will set up patient-
11 // specific data when a patient is selected. Currently this data
12 // is just the caller's selection list of recent encounters.
14 $fake_register_globals=false;
15 $sanitize_all_escapes=true;
17 require_once("../globals.php");
19 $res = sqlStatement("SELECT date, encounter, reason FROM form_encounter " .
20 "WHERE pid = ? " .
21 "ORDER BY date DESC, encounter DESC LIMIT 10", array($_GET['p']));
23 echo "var s = document.forms[0].form_copy_sn_visit;\n";
24 echo "s.options.length = 0;\n";
26 while ($row = sqlFetchArray($res)) {
27 echo "s.options[s.options.length] = new Option(" .
28 "'" . substr($row['date'], 0, 10) . " " .
29 addslashes(strtr(substr($row['reason'], 0, 40), "\r\n", " ")) . "', " .
30 "'" . $row['encounter'] . "'" .
31 ");\n";