quick minor path updates (#1968)
[openemr.git] / interface / fax / fax_dispatch_newpid.php
blobbf499a9a71b4f0fa04c6decac02bcfb0858b15d2
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.
15 require_once("../globals.php");
17 if (!verifyCsrfToken($_GET["csrf_token_form"])) {
18 csrfNotVerified();
21 $res = sqlStatement("SELECT date, encounter, reason FROM form_encounter " .
22 "WHERE pid = ? " .
23 "ORDER BY date DESC, encounter DESC LIMIT 10", array($_GET['p']));
25 echo "var s = document.forms[0].form_copy_sn_visit;\n";
26 echo "s.options.length = 0;\n";
28 while ($row = sqlFetchArray($res)) {
29 echo "s.options[s.options.length] = new Option(" .
30 "'" . attr(substr($row['date'], 0, 10)) . " " .
31 attr(strtr(substr($row['reason'], 0, 40), "\r\n", " ")) . "', " .
32 "'" . attr($row['encounter']) . "'" .
33 ");\n";