2 // Copyright (C) 2006 Rod Roark <rod@sunsetsystems.com>
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 include_once("../globals.php");
10 include_once("$srcdir/acl.inc");
12 $userid = $_REQUEST['userid'];
16 function QuotedOrNull($fld) {
18 if (!get_magic_quotes_gpc()) $fld = addslashes($fld);
19 if ($fld) return "'$fld'";
23 function invalue($name) {
24 $fld = trim($_POST[$name]);
25 if (!get_magic_quotes_gpc()) $fld = addslashes($fld);
29 function rbinput($name, $value, $desc, $colname) {
31 $ret = "<input type='radio' name='$name' value='$value'";
32 if ($row[$colname] == $value) $ret .= " checked";
37 function rbvalue($rbname) {
38 $tmp = $_POST[$rbname];
39 if (! $tmp) $tmp = '0';
46 <title
><?php
echo $userid ?
"Edit" : "Add New" ?
> Person
</title
>
47 <link rel
=stylesheet href
='<?php echo $css_header ?>' type
='text/css'>
50 td
{ font
-size
:10pt
; }
54 font-family:monospace;
59 border-color: #000000;
60 background-color:transparent;
67 font
-family
:sans
-serif
;
73 <script language
="JavaScript">
78 <body
<?
echo $top_bg_line;?
>>
80 // If we are saving, then save and close the window.
82 if ($_POST['form_save']) {
86 $query = "UPDATE users SET " .
87 "title = " . invalue('form_title') . ", " .
88 "fname = " . invalue('form_fname') . ", " .
89 "lname = " . invalue('form_lname') . ", " .
90 "mname = " . invalue('form_mname') . ", " .
91 "specialty = " . invalue('form_specialty') . ", " .
92 "assistant = " . invalue('form_assistant') . ", " .
93 "federaltaxid = " . invalue('form_federaltaxid') . ", " .
94 "upin = " . invalue('form_upin') . ", " .
95 "npi = " . invalue('form_npi') . ", " .
96 "email = " . invalue('form_email') . ", " .
97 "url = " . invalue('form_url') . ", " .
98 "street = " . invalue('form_street') . ", " .
99 "city = " . invalue('form_city') . ", " .
100 "state = " . invalue('form_state') . ", " .
101 "zip = " . invalue('form_zip') . ", " .
102 "street2 = " . invalue('form_street2') . ", " .
103 "city2 = " . invalue('form_city2') . ", " .
104 "state2 = " . invalue('form_state2') . ", " .
105 "zip2 = " . invalue('form_zip2') . ", " .
106 "phone = " . invalue('form_phone') . ", " .
107 "phonew1 = " . invalue('form_phonew1') . ", " .
108 "phonew2 = " . invalue('form_phonew2') . ", " .
109 "phonecell = " . invalue('form_phonecell') . ", " .
110 "fax = " . invalue('form_fax') . " " .
111 "WHERE id = '$userid'";
112 sqlStatement($query);
116 $userid = sqlInsert("INSERT INTO users ( " .
117 "username, password, authorized, info, source, " .
118 "title, fname, lname, mname, " .
119 "federaltaxid, federaldrugid, upin, facility, see_auth, active, " .
120 "npi, specialty, assistant, billname, email, url, " .
121 "street, city, state, zip, " .
122 "street2, city2, state2, zip2, " .
123 "phone, phonew1, phonew2, phonecell, fax " .
127 "0, " . // authorized
130 invalue('form_title') . ", " .
131 invalue('form_fname') . ", " .
132 invalue('form_lname') . ", " .
133 invalue('form_mname') . ", " .
134 invalue('form_federaltaxid') . ", " .
135 "'', " . // federaldrugid
136 invalue('form_upin') . ", " .
140 invalue('form_npi') . ", " .
141 invalue('form_specialty') . ", " .
142 invalue('form_assistant') . ", " .
144 invalue('form_email') . ", " .
145 invalue('form_url') . ", " .
146 invalue('form_street') . ", " .
147 invalue('form_city') . ", " .
148 invalue('form_state') . ", " .
149 invalue('form_zip') . ", " .
150 invalue('form_street2') . ", " .
151 invalue('form_city2') . ", " .
152 invalue('form_state2') . ", " .
153 invalue('form_zip2') . ", " .
154 invalue('form_phone') . ", " .
155 invalue('form_phonew1') . ", " .
156 invalue('form_phonew2') . ", " .
157 invalue('form_phonecell') . ", " .
158 invalue('form_fax') . " " .
164 else if ($_POST['form_delete']) {
167 // Be careful not to delete internal users.
168 sqlStatement("DELETE FROM users WHERE id = '$userid' AND username = ''");
173 if ($_POST['form_save'] ||
$_POST['form_delete']) {
174 // Close this window and redisplay the updated list.
175 echo "<script language='JavaScript'>\n";
176 if ($info_msg) echo " alert('$info_msg');\n";
177 echo " window.close();\n";
178 echo " if (opener.refreshme) opener.refreshme();\n";
179 echo "</script></body></html>\n";
184 $row = sqlQuery("SELECT * FROM users WHERE id = '$userid'");
187 <form method
='post' name
='theform' action
='addrbook_edit.php?userid=<?php echo $userid ?>'>
190 <table border
='0' width
='100%'>
193 <td width
='1%' nowrap
><b
><?php
xl('Name','e'); ?
>:</b
></td
>
195 <select name
='form_title'>
196 <option value
=''></option
>
198 foreach (array('Mr.', 'Mrs.', 'Ms.', 'Dr.') as $value) {
199 echo " <option value='$value'";
200 if ($value == $row['title']) echo " selected";
201 echo ">$value</option>\n";
205 <b
>Last
:</b
><input type
='text' size
='10' name
='form_lname' class='inputtext'
206 maxlength
='50' value
='<?php echo $row['lname
'] ?>'/> 
;
207 <b
>First
:</b
> <input type
='text' size
='10' name
='form_fname' class='inputtext'
208 maxlength
='50' value
='<?php echo $row['fname
'] ?>' /> 
;
209 <b
>Middle
:</b
> <input type
='text' size
='4' name
='form_mname' class='inputtext'
210 maxlength
='50' value
='<?php echo $row['mname
'] ?>' />
215 <td nowrap
><b
><?php
xl('Specialty','e'); ?
>:</b
></td
>
217 <input type
='text' size
='40' name
='form_specialty' maxlength
='250'
218 value
='<?php echo $row['specialty
'] ?>'
219 style
='width:100%' class='inputtext' />
224 <td nowrap
><b
><?php
xl('Home Phone','e'); ?
>:</b
></td
>
226 <input type
='text' size
='11' name
='form_phone' value
='<?php echo $row['phone
'] ?>'
227 maxlength
='30' class='inputtext' /> 
;
228 <b
>Mobile
:</b
><input type
='text' size
='11' name
='form_phonecell'
229 maxlength
='30' value
='<?php echo $row['phonecell
'] ?>' class='inputtext' />
234 <td nowrap
><b
><?php
xl('Work Phone','e'); ?
>:</b
></td
>
236 <input type
='text' size
='11' name
='form_phonew1' value
='<?php echo $row['phonew1
'] ?>'
237 maxlength
='30' class='inputtext' /> 
;
238 <b
>2nd
:</b
><input type
='text' size
='11' name
='form_phonew2' value
='<?php echo $row['phonew2
'] ?>'
239 maxlength
='30' class='inputtext' /> 
;
240 <b
>Fax
:</b
> <input type
='text' size
='11' name
='form_fax' value
='<?php echo $row['fax
'] ?>'
241 maxlength
='30' class='inputtext' />
246 <td nowrap
><b
><?php
xl('Assistant','e'); ?
>:</b
></td
>
248 <input type
='text' size
='40' name
='form_assistant' maxlength
='250'
249 value
='<?php echo $row['assistant
'] ?>'
250 style
='width:100%' class='inputtext' />
255 <td nowrap
><b
><?php
xl('Email','e'); ?
>:</b
></td
>
257 <input type
='text' size
='40' name
='form_email' maxlength
='250'
258 value
='<?php echo $row['email
'] ?>'
259 style
='width:100%' class='inputtext' />
264 <td nowrap
><b
><?php
xl('Website','e'); ?
>:</b
></td
>
266 <input type
='text' size
='40' name
='form_url' maxlength
='250'
267 value
='<?php echo $row['url
'] ?>'
268 style
='width:100%' class='inputtext' />
273 <td nowrap
><b
><?php
xl('Main Address','e'); ?
>:</b
></td
>
275 <input type
='text' size
='40' name
='form_street' maxlength
='60'
276 value
='<?php echo $row['street
'] ?>'
277 style
='width:100%' class='inputtext' />
282 <td nowrap
><b
><?php
xl('City','e'); ?
>:</b
></td
>
284 <input type
='text' size
='10' name
='form_city' maxlength
='30'
285 value
='<?php echo $row['city
'] ?>' class='inputtext' /> 
;
286 <b
>State
/county
:</b
> <input type
='text' size
='10' name
='form_state' maxlength
='30'
287 value
='<?php echo $row['state
'] ?>' class='inputtext' /> 
;
288 <b
>Postal code
:</b
> <input type
='text' size
='10' name
='form_zip' maxlength
='20'
289 value
='<?php echo $row['zip
'] ?>' class='inputtext' />
294 <td nowrap
><b
><?php
xl('Alt Address','e'); ?
>:</b
></td
>
296 <input type
='text' size
='40' name
='form_street2' maxlength
='60'
297 value
='<?php echo $row['street2
'] ?>'
298 style
='width:100%' class='inputtext' />
303 <td nowrap
><b
><?php
xl('City','e'); ?
>:</b
></td
>
305 <input type
='text' size
='10' name
='form_city2' maxlength
='30'
306 value
='<?php echo $row['city2
'] ?>' class='inputtext' /> 
;
307 <b
>State
/county
:</b
> <input type
='text' size
='10' name
='form_state2' maxlength
='30'
308 value
='<?php echo $row['state2
'] ?>' class='inputtext' /> 
;
309 <b
>Postal code
:</b
> <input type
='text' size
='10' name
='form_zip2' maxlength
='20'
310 value
='<?php echo $row['zip2
'] ?>' class='inputtext' />
315 <td nowrap
><b
><?php
xl('UPIN','e'); ?
>:</b
></td
>
317 <input type
='text' size
='6' name
='form_upin' maxlength
='6'
318 value
='<?php echo $row['upin
'] ?>' class='inputtext' /> 
;
319 <b
>NPI
:</b
> <input type
='text' size
='10' name
='form_npi' maxlength
='10'
320 value
='<?php echo $row['npi
'] ?>' class='inputtext' /> 
;
321 <b
>TIN
:</b
> <input type
='text' size
='10' name
='form_federaltaxid' maxlength
='10'
322 value
='<?php echo $row['federaltaxid
'] ?>' class='inputtext' />
330 <input type
='submit' name
='form_save' value
='Save' />
332 <?php
if ($userid && !$row['username']) { ?
>
334 <input type
='submit' name
='form_delete' value
='Delete' style
='color:red' />
338 <input type
='button' value
='Cancel' onclick
='window.close()' />