PHP7 bug fix 4
[openemr.git] / interface / orders / procedure_provider_edit.php
blob4437bffc3a4b11d524aaea57f56cc8968c3ff335
1 <?php
2 /**
3 * Maintenance for the list of procedure providers.
5 * Copyright (C) 2012-2014 Rod Roark <rod@sunsetsystems.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 Rod Roark <rod@sunsetsystems.com>
22 $sanitize_all_escapes = true;
23 $fake_register_globals =false;
25 require_once("../globals.php");
26 require_once("$srcdir/acl.inc");
27 require_once("$srcdir/options.inc.php");
28 require_once("$srcdir/formdata.inc.php");
29 require_once("$srcdir/htmlspecialchars.inc.php");
31 // Collect user id if editing entry
32 $ppid = $_REQUEST['ppid'];
34 $info_msg = "";
36 function invalue($name) {
37 $fld = add_escape_custom(trim($_POST[$name]));
38 return "'$fld'";
42 <html>
43 <head>
44 <title><?php echo $ppid ? xlt('Edit') : xlt('Add New') ?> <?php echo xlt('Procedure Provider'); ?></title>
45 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
46 <script type="text/javascript" src="../../library/js/jquery.1.3.2.js"></script>
48 <style>
49 td { font-size:10pt; }
51 .inputtext {
52 padding-left:2px;
53 padding-right:2px;
56 .button {
57 font-family:sans-serif;
58 font-size:9pt;
59 font-weight:bold;
61 </style>
63 <script language="JavaScript">
64 </script>
66 </head>
68 <body class="body_top">
69 <?php
70 // If we are saving, then save and close the window.
72 if ($_POST['form_save']) {
73 $org_qry = "SELECT organization FROM users WHERE id = ?";
74 $org_res = sqlQuery($org_qry, array($_POST['form_name']));
75 $org_name = $org_res['organization'];
76 $sets =
77 "name = '" .add_escape_custom($org_name). "', " .
78 "lab_director = " . invalue('form_name') . ", " .
79 "npi = " . invalue('form_npi') . ", " .
80 "send_app_id = " . invalue('form_send_app_id') . ", " .
81 "send_fac_id = " . invalue('form_send_fac_id') . ", " .
82 "recv_app_id = " . invalue('form_recv_app_id') . ", " .
83 "recv_fac_id = " . invalue('form_recv_fac_id') . ", " .
84 "DorP = " . invalue('form_DorP') . ", " .
85 "direction = " . invalue('form_direction') . ", " .
86 "protocol = " . invalue('form_protocol') . ", " .
87 "remote_host = " . invalue('form_remote_host') . ", " .
88 "login = " . invalue('form_login') . ", " .
89 "password = " . invalue('form_password') . ", " .
90 "orders_path = " . invalue('form_orders_path') . ", " .
91 "results_path = " . invalue('form_results_path') . ", " .
92 "notes = " . invalue('form_notes');
93 if ($ppid) {
94 $query = "UPDATE procedure_providers SET $sets " .
95 "WHERE ppid = '" . add_escape_custom($ppid) . "'";
96 sqlStatement($query);
98 else {
99 $ppid = sqlInsert("INSERT INTO procedure_providers SET $sets");
102 else if ($_POST['form_delete']) {
103 if ($ppid) {
104 sqlStatement("DELETE FROM procedure_providers WHERE ppid = ?", array($ppid));
108 if ($_POST['form_save'] || $_POST['form_delete']) {
109 // Close this window and redisplay the updated list.
110 echo "<script language='JavaScript'>\n";
111 if ($info_msg) echo " alert('" . addslashes($info_msg) . "');\n";
112 echo " window.close();\n";
113 echo " if (opener.refreshme) opener.refreshme();\n";
114 echo "</script></body></html>\n";
115 exit();
118 if ($ppid) {
119 $row = sqlQuery("SELECT * FROM procedure_providers WHERE ppid = ?", array($ppid));
122 $lab_org_query = "SELECT id, organization FROM users WHERE abook_type = 'ord_lab'";
123 $org_res = sqlStatement($lab_org_query);
124 while ($org_row = sqlFetchArray($org_res)) {
125 $lab_org_name = $org_row['organization'];
126 $selected = '';
127 if ($ppid) {
128 if($row['lab_director'] == $org_row['id']){
129 $selected = "SELECTED";
132 $optionsStr .= "<option value='".attr($org_row['id'])."' $selected>". text($lab_org_name)."</option>";
136 <form method='post' name='theform' action='procedure_provider_edit.php?ppid=<?php echo attr($ppid) ?>'>
137 <center>
139 <table border='0' width='100%'>
141 <tr>
142 <td nowrap><b><?php echo xlt('Name'); ?>:</b></td>
143 <td>
144 <select name='form_name' id='form_name' class='inputtext' style='width:150px'>
145 <?php echo $optionsStr; ?>
146 </select>
147 </td>
148 </tr>
150 <tr>
151 <td nowrap><b><?php echo xlt('NPI'); ?>:</b></td>
152 <td>
153 <input type='text' size='10' name='form_npi' maxlength='10'
154 value='<?php echo attr($row['npi']); ?>' class='inputtext' />
155 </td>
156 </tr>
158 <tr>
159 <td nowrap><b><?php echo xlt('Sender IDs'); ?>:</b></td>
160 <td>
161 <?php echo xlt('Application'); ?>:
162 <input type='text' size='10' name='form_send_app_id' maxlength='100'
163 value='<?php echo attr($row['send_app_id']); ?>'
164 title='<?php echo xla('MSH-3.1'); ?>'
165 class='inputtext' />
166 &nbsp;<?php echo xlt('Facility'); ?>:
167 <input type='text' size='10' name='form_send_fac_id' maxlength='100'
168 value='<?php echo attr($row['send_fac_id']); ?>'
169 title='<?php echo xla('MSH-4.1'); ?>'
170 class='inputtext' />
171 </td>
172 </tr>
174 <tr>
175 <td nowrap><b><?php echo xlt('Receiver IDs'); ?>:</b></td>
176 <td>
177 <?php echo xlt('Application'); ?>:
178 <input type='text' size='10' name='form_recv_app_id' maxlength='100'
179 value='<?php echo attr($row['recv_app_id']); ?>'
180 title='<?php echo xla('MSH-5.1'); ?>'
181 class='inputtext' />
182 &nbsp;<?php echo xlt('Facility'); ?>:
183 <input type='text' size='10' name='form_recv_fac_id' maxlength='100'
184 value='<?php echo attr($row['recv_fac_id']); ?>'
185 title='<?php echo xla('MSH-6.1'); ?>'
186 class='inputtext' />
187 </td>
188 </tr>
190 <tr>
191 <td nowrap><b><?php echo xlt('Usage'); ?>:</b></td>
192 <td>
193 <select name='form_DorP' title='<?php echo xla('MSH-11'); ?>'>
194 <?php
195 foreach(array(
196 'D' => xl('Debugging'),
197 'P' => xl('Production'),
198 ) as $key => $value)
200 echo " <option value='" . attr($key) . "'";
201 if ($key == $row['DorP']) echo " selected";
202 echo ">" . text($value) . "</option>\n";
205 </select>
206 </td>
207 </tr>
209 <tr>
210 <td nowrap><b><?php echo xlt('Protocol'); ?>:</b></td>
211 <td>
212 <select name='form_protocol'>
213 <?php
214 foreach(array(
215 // Add to this list as more protocols are supported.
216 'DL' => xl('Download'),
217 'SFTP' => xl('SFTP'),
218 'FS' => xl('Local Filesystem'),
219 ) as $key => $value)
221 echo " <option value='" . attr($key) . "'";
222 if ($key == $row['protocol']) echo " selected";
223 echo ">" . text($value) . "</option>\n";
226 </select>
227 &nbsp;
228 <select name='form_direction'>
229 <?php
230 foreach(array(
231 'B' => xl('Bidirectional'),
232 'R' => xl('Results Only'),
233 ) as $key => $value)
235 echo " <option value='" . attr($key) . "'";
236 if ($key == $row['direction']) echo " selected";
237 echo ">" . text($value) . "</option>\n";
240 </select>
241 </td>
242 </tr>
244 <tr>
245 <td nowrap><b><?php echo xlt('Remote Host'); ?>:</b></td>
246 <td>
247 <input type='text' size='40' name='form_remote_host' maxlength='255'
248 value='<?php echo attr($row['remote_host']); ?>' class='inputtext' />
249 </td>
250 </tr>
252 <tr>
253 <td nowrap><b><?php echo xlt('Login'); ?>:</b></td>
254 <td>
255 <input type='text' size='20' name='form_login' maxlength='255'
256 value='<?php echo attr($row['login']); ?>' class='inputtext' />
257 </td>
258 </tr>
260 <tr>
261 <td nowrap><b><?php echo xlt('Password'); ?>:</b></td>
262 <td>
263 <input type='text' size='20' name='form_password' maxlength='255'
264 value='<?php echo attr($row['password']); ?>' class='inputtext' />
265 </td>
266 </tr>
268 <tr>
269 <td nowrap><b><?php echo xlt('Orders Path'); ?>:</b></td>
270 <td>
271 <input type='text' size='40' name='form_orders_path' maxlength='255'
272 value='<?php echo attr($row['orders_path']); ?>' class='inputtext' />
273 </td>
274 </tr>
276 <tr>
277 <td nowrap><b><?php echo xlt('Results Path'); ?>:</b></td>
278 <td>
279 <input type='text' size='40' name='form_results_path' maxlength='255'
280 value='<?php echo attr($row['results_path']); ?>' class='inputtext' />
281 </td>
282 </tr>
284 <tr>
285 <td nowrap><b><?php echo xlt('Notes'); ?>:</b></td>
286 <td>
287 <textarea rows='3' cols='40' name='form_notes' style='width:100%'
288 wrap='virtual' class='inputtext' /><?php echo text($row['notes']) ?></textarea>
289 </td>
290 </tr>
292 </table>
294 <br />
296 <input type='submit' name='form_save' value='<?php echo xla('Save'); ?>' />
298 <?php if ($ppid) { ?>
299 &nbsp;
300 <input type='submit' name='form_delete' value='<?php echo xla('Delete'); ?>' style='color:red' />
301 <?php } ?>
303 &nbsp;
304 <input type='button' value='<?php echo xla('Cancel'); ?>' onclick='window.close()' />
305 </p>
307 </center>
308 </form>
309 </body>
310 </html>