2 // This program is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU General Public License
4 // as published by the Free Software Foundation; either version 2
5 // of the License, or (at your option) any later version.
6 require_once("../globals.php");
7 require_once("../../library/acl.inc");
8 require_once("$srcdir/calendar.inc");
9 require_once("$srcdir/options.inc.php");
10 require_once("$srcdir/erx_javascript.inc.php");
12 $facilityService = new \services\
FacilityService();
14 if (!$_GET["id"] ||
!acl_check('admin', 'users'))
17 if ($_GET["mode"] == "update") {
18 if ($_GET["username"]) {
19 // $tqvar = addslashes(trim($_GET["username"]));
20 $tqvar = trim(formData('username','G'));
21 $user_data = sqlFetchArray(sqlStatement("select * from users where id={$_GET["id
"]}"));
22 sqlStatement("update users set username='$tqvar' where id={$_GET["id
"]}");
23 sqlStatement("update groups set user='$tqvar' where user='". $user_data["username"] ."'");
24 //echo "query was: " ."update groups set user='$tqvar' where user='". $user_data["username"] ."'" ;
27 $tqvar = formData('taxid','G');
28 sqlStatement("update users set federaltaxid='$tqvar' where id={$_GET["id
"]}");
30 if ($_GET["drugid"]) {
31 $tqvar = formData('drugid','G');
32 sqlStatement("update users set federaldrugid='$tqvar' where id={$_GET["id
"]}");
35 $tqvar = formData('upin','G');
36 sqlStatement("update users set upin='$tqvar' where id={$_GET["id
"]}");
39 $tqvar = formData('npi','G');
40 sqlStatement("update users set npi='$tqvar' where id={$_GET["id
"]}");
42 if ($_GET["taxonomy"]) {
43 $tqvar = formData('taxonomy','G');
44 sqlStatement("update users set taxonomy = '$tqvar' where id= {$_GET["id
"]}");
47 $tqvar = formData('lname','G');
48 sqlStatement("update users set lname='$tqvar' where id={$_GET["id
"]}");
51 $tqvar = formData('job','G');
52 sqlStatement("update users set specialty='$tqvar' where id={$_GET["id
"]}");
55 $tqvar = formData('mname','G');
56 sqlStatement("update users set mname='$tqvar' where id={$_GET["id
"]}");
58 if ($_GET["facility_id"]) {
59 $tqvar = formData('facility_id','G');
60 sqlStatement("update users set facility_id = '$tqvar' where id = {$_GET["id
"]}");
61 //(CHEMED) Update facility name when changing the id
62 sqlStatement("UPDATE users, facility SET users.facility = facility.name WHERE facility.id = '$tqvar' AND users.id = {$_GET["id
"]}");
65 if ($GLOBALS['restrict_user_facility'] && $_GET["schedule_facility"]) {
66 sqlStatement("delete from users_facility
67 where tablename='users'
68 and table_id={$_GET["id
"]}
69 and facility_id not in (" . implode(",", $_GET['schedule_facility']) . ")");
70 foreach($_GET["schedule_facility"] as $tqvar) {
71 sqlStatement("replace into users_facility set
72 facility_id = '$tqvar',
74 table_id = {$_GET["id
"]}");
78 $tqvar = formData('fname','G');
79 sqlStatement("update users set fname='$tqvar' where id={$_GET["id
"]}");
82 if (isset($_GET['default_warehouse'])) {
83 sqlStatement("UPDATE users SET default_warehouse = '" .
84 formData('default_warehouse','G') .
85 "' WHERE id = '" . formData('id','G') . "'");
88 if (isset($_GET['irnpool'])) {
89 sqlStatement("UPDATE users SET irnpool = '" .
90 formData('irnpool','G') .
91 "' WHERE id = '" . formData('id','G') . "'");
94 if ($_GET["newauthPass"] && $_GET["newauthPass"] != "d41d8cd98f00b204e9800998ecf8427e") { // account for empty
95 $tqvar = formData('newauthPass','G');
96 sqlStatement("update users set password='$tqvar' where id={$_GET["id
"]}");
99 $tqvar = $_GET["authorized"] ?
1 : 0;
100 $actvar = $_GET["active"] ?
1 : 0;
101 $calvar = $_GET["calendar"] ?
1 : 0;
103 sqlStatement("UPDATE users SET authorized = $tqvar, active = $actvar, " .
104 "calendar = $calvar, see_auth = '" . $_GET['see_auth'] . "' WHERE " .
105 "id = {$_GET["id
"]}");
107 if ($_GET["comments"]) {
108 $tqvar = formData('comments','G');
109 sqlStatement("update users set info = '$tqvar' where id = {$_GET["id
"]}");
112 if (isset($phpgacl_location) && acl_check('admin', 'acl')) {
113 // Set the access control group of user
114 $user_data = sqlFetchArray(sqlStatement("select username from users where id={$_GET["id
"]}"));
115 set_user_aro($_GET['access_group'], $user_data["username"],
116 formData('fname','G'), formData('mname','G'), formData('lname','G'));
119 /*Dont move usergroup_admin (1).php just close window
120 // On a successful update, return to the users list.
121 include("usergroup_admin.php");
124 <script type="text/javascript">
126 parent.$.fn.fancybox.close();
133 $res = sqlStatement("select * from users where id=?",array($_GET["id"]));
134 for ($iter = 0;$row = sqlFetchArray($res);$iter++
)
135 $result[$iter] = $row;
139 if (isset($_POST["mode"])) {
141 <script type="text/javascript">
143 parent.$.fn.fancybox.close();
156 <link rel
="stylesheet" href
="<?php echo $css_header; ?>" type
="text/css">
157 <script type
="text/javascript" src
="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
158 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative'] ?>/jquery-min-1-9-1/index.js"></script
>
159 <script type
="text/javascript" src
="../../library/js/common.js"></script
>
161 <script src
="checkpwd_validation.js" type
="text/javascript"></script
>
163 <!-- validation library
-->
164 <!--//Not lbf forms use the new validation, please make sure you have the corresponding values in the list Page validation-->
165 <?php
$use_validate_js = 1;?
>
166 <?php
require_once($GLOBALS['srcdir'] . "/validation/validation_script.js.php"); ?
>
168 //Gets validation rules from Page Validation list.
169 //Note that for technical reasons, we are bypassing the standard validateUsingPageRules() call.
170 $collectthis = collectValidationPageRules("/interface/usergroup/user_admin.php");
171 if (empty($collectthis)) {
172 $collectthis = "undefined";
175 $collectthis = $collectthis["user_form"]["rules"];
179 <script language
="JavaScript">
182 * validation on the form with new client side validation (using validate.js).
183 * this enable to add new rules for this form in the pageValidation list.
185 var collectvalidation
= <?php
echo($collectthis); ?
>;
187 function checkChange()
189 alert("<?php echo addslashes(xl('If you change e-RX Role for ePrescription, it may affect the ePrescription workflow. If you face any difficulty, contact your ePrescription vendor.'));?>");
191 function submitform() {
193 var valid
= submitme(1, undefined
, 'user_form', collectvalidation
);
196 top
.restoreSession();
198 <?php
if(!$GLOBALS['use_active_directory']){ ?
>
199 if(document
.forms
[0].clearPass
.value
!="")
201 //Checking for the strong password if the 'secure password' feature is enabled
202 if(document
.forms
[0].secure_pwd
.value
== 1)
204 var pwdresult
= passwordvalidate(document
.forms
[0].clearPass
.value
);
207 alert("<?php echo xl('The password must be at least eight characters, and should'); echo '\n'; echo xl('contain at least three of the four following items:'); echo '\n'; echo xl('A number'); echo '\n'; echo xl('A lowercase letter'); echo '\n'; echo xl('An uppercase letter'); echo '\n'; echo xl('A special character');echo '('; echo xl('not a letter or number'); echo ').'; echo '\n'; echo xl('For example:'); echo ' healthCare@09'; ?>");
212 }//If pwd null ends here
214 //Request to reset the user password if the user was deactived once the password expired.
215 if((document
.forms
[0].pwd_expires
.value
!= 0) && (document
.forms
[0].clearPass
.value
== "")) {
216 if((document
.forms
[0].user_type
.value
!= "Emergency Login") && (document
.forms
[0].pre_active
.value
== 0) && (document
.forms
[0].active
.checked
== 1) && (document
.forms
[0].grace_time
.value
!= "") && (document
.forms
[0].current_date
.value
) > (document
.forms
[0].grace_time
.value
))
219 document
.getElementById('error_message').innerHTML
="<?php xl('Please reset the password.','e') ?>";
223 if (document
.forms
[0].access_group_id
) {
224 var sel
= getSelected(document
.forms
[0].access_group_id
.options
);
225 for (var item in sel
) {
226 if (sel
[item
].value
== "Emergency Login") {
227 document
.forms
[0].check_acl
.value
= 1;
232 <?php
if($GLOBALS['erx_enable']){ ?
>
235 for(i
=0;i
<f
.length
;i++
){
236 if(f
[i
].type
=='text' && f
[i
].value
)
238 if(f
[i
].name
== 'fname' || f
[i
].name
== 'mname' || f
[i
].name
== 'lname')
240 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,35);
241 alertMsg +
= checkUsername(f
[i
].name
,f
[i
].value
);
243 else if(f
[i
].name
== 'taxid')
245 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,10);
246 alertMsg +
= checkFederalEin(f
[i
].name
,f
[i
].value
);
248 else if(f
[i
].name
== 'state_license_number')
250 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,10);
251 alertMsg +
= checkStateLicenseNumber(f
[i
].name
,f
[i
].value
);
253 else if(f
[i
].name
== 'npi')
255 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,10);
256 alertMsg +
= checkTaxNpiDea(f
[i
].name
,f
[i
].value
);
258 else if(f
[i
].name
== 'drugid')
260 alertMsg +
= checkLength(f
[i
].name
,f
[i
].value
,30);
261 alertMsg +
= checkAlphaNumeric(f
[i
].name
,f
[i
].value
);
272 document
.forms
[0].submit();
273 parent
.$
.fn
.fancybox
.close();
276 //Getting the list of selected item in ACL
277 function getSelected(opt
) {
278 var selected
= new Array();
280 for (var intLoop
= 0; intLoop
< opt
.length
; intLoop++
) {
281 if ((opt
[intLoop
].selected
) ||
282 (opt
[intLoop
].checked
)) {
283 index
= selected
.length
;
284 selected
[index
] = new Object;
285 selected
[index
].value
= opt
[intLoop
].value
;
286 selected
[index
].index
= intLoop
;
292 function authorized_clicked() {
293 var f
= document
.forms
[0];
294 f
.calendar
.disabled
= !f
.authorized
.checked
;
295 f
.calendar
.checked
= f
.authorized
.checked
;
299 <style type
="text/css">
300 .physician_type_class
{
301 width
: 150px
!important
;
305 <body
class="body_top">
307 <span
class="title"><?php
xl('Edit User','e'); ?
></span
> 
;
309 <a
class="css_button" name
='form_save' id
='form_save' href
='#' onclick
='return submitform()'> <span
><?php
xl('Save','e');?
></span
> </a
>
310 <a
class="css_button" id
='cancel' href
='#'><span
><?php
xl('Cancel','e');?
></span
></a
>
314 <FORM NAME
="user_form" id
="user_form" METHOD
="POST" ACTION
="usergroup_admin.php" target
="_parent" onsubmit
='return top.restoreSession()'>
316 <input type
=hidden name
="pwd_expires" value
="<?php echo $GLOBALS['password_expiration_days']; ?>" >
317 <input type
=hidden name
="pre_active" value
="<?php echo $iter["active
"]; ?>" >
318 <input type
=hidden name
="exp_date" value
="<?php echo $iter["pwd_expiration_date
"]; ?>" >
319 <input type
=hidden name
="get_admin_id" value
="<?php echo $GLOBALS['Emergency_Login_email']; ?>" >
320 <input type
=hidden name
="admin_id" value
="<?php echo $GLOBALS['Emergency_Login_email_id']; ?>" >
321 <input type
=hidden name
="check_acl" value
="">
323 //Calculating the grace time
324 $current_date = date("Y-m-d");
325 $password_exp=$iter["pwd_expiration_date"];
326 if($password_exp != "0000-00-00")
328 $grace_time1 = date("Y-m-d", strtotime($password_exp . "+".$GLOBALS['password_grace_time'] ."days"));
331 <input type
=hidden name
="current_date" value
="<?php echo strtotime($current_date); ?>" >
332 <input type
=hidden name
="grace_time" value
="<?php echo strtotime($grace_time1); ?>" >
333 <!-- Get the
list ACL
for the user
-->
335 $acl_name=acl_get_group_titles($iter["username"]);
337 $bg_count=count($acl_name);
338 for($i=0;$i<$bg_count;$i++
){
339 if($acl_name[$i] == "Emergency Login")
340 $bg_name=$acl_name[$i];
343 <input type
=hidden name
="user_type" value
="<?php echo $bg_name; ?>" >
345 <TABLE border
=0 cellpadding
=0 cellspacing
=0>
347 <TD style
="width:180px;"><span
class=text
><?php
xl('Username','e'); ?
>: </span
></TD
>
348 <TD style
="width:270px;"><input type
=entry name
=username style
="width:150px;" value
="<?php echo $iter["username
"]; ?>" disabled
></td
>
349 <?php
if(!$GLOBALS['use_active_directory']){ ?
>
350 <TD style
="width:200px;"><span
class=text
><?php
xl('Your Password','e'); ?
>: </span
></TD
>
351 <TD
class='text' style
="width:280px;"><input type
='password' name
=adminPass style
="width:150px;" value
="" autocomplete
='off'><font
class="mandatory">*</font
></TD
>
354 <?php
if(!$GLOBALS['use_active_directory']){ ?
>
356 <TD style
="width:180px;"><span
class=text
></span
></TD
>
357 <TD style
="width:270px;"></td
>
358 <TD style
="width:200px;"><span
class=text
><?php
xl('User\'s New Password','e'); ?
>: </span
></TD
>
359 <TD
class='text' style
="width:280px;"> <input type
=text name
=clearPass style
="width:150px;" value
=""><font
class="mandatory">*</font
></td
>
363 <TR height
="30" style
="valign:middle;">
364 <td
><span
class="text"> 
;</span
></td
><td
> 
;</td
>
365 <td colspan
="2"><span
class=text
><?php
xl('Provider','e'); ?
>:
366 <input type
="checkbox" name
="authorized" onclick
="authorized_clicked()"<?php
367 if ($iter["authorized"]) echo " checked"; ?
> />
368  
; 
;<span
class='text'><?php
xl('Calendar','e'); ?
>:
369 <input type
="checkbox" name
="calendar"<?php
370 if ($iter["calendar"]) echo " checked";
371 if (!$iter["authorized"]) echo " disabled"; ?
> />
372  
; 
;<span
class='text'><?php
xl('Active','e'); ?
>:
373 <input type
="checkbox" name
="active"<?php
if ($iter["active"]) echo " checked"; ?
> />
378 <TD
><span
class=text
><?php
xl('First Name','e'); ?
>: </span
></TD
>
379 <TD
><input type
=entry name
=fname id
=fname style
="width:150px;" value
="<?php echo $iter["fname
"]; ?>"><span
class="mandatory"> 
;*</span
></td
>
380 <td
><span
class=text
><?php
xl('Middle Name','e'); ?
>: </span
></TD
><td
><input type
=entry name
=mname style
="width:150px;" value
="<?php echo $iter["mname
"]; ?>"></td
>
384 <td
><span
class=text
><?php
xl('Last Name','e'); ?
>: </span
></td
><td
><input type
=entry name
=lname id
=lname style
="width:150px;" value
="<?php echo $iter["lname
"]; ?>"><span
class="mandatory"> 
;*</span
></td
>
385 <td
><span
class=text
><?php
xl('Default Facility','e'); ?
>: </span
></td
><td
><select name
=facility_id style
="width:150px;" >
387 $fres = $facilityService->getAllBillingLocations();
389 for ($iter2 = 0; $iter2 < sizeof($fres); $iter2++
)
390 $result[$iter2] = $fres[$iter2];
391 foreach($result as $iter2) {
393 <option value
="<?php echo $iter2['id']; ?>" <?php
if ($iter['facility_id'] == $iter2['id']) echo "selected"; ?
>><?php
echo htmlspecialchars($iter2['name']); ?
></option
>
401 <?php
if ($GLOBALS['restrict_user_facility']) { ?
>
403 <td colspan
=2> 
;</td
>
404 <td
><span
class=text
><?php
xl('Schedule Facilities:', 'e');?
></td
>
406 <select name
="schedule_facility[]" multiple style
="width:150px;" >
408 $userFacilities = getUserFacilities($_GET['id']);
410 foreach($userFacilities as $uf)
412 $fres = $facilityService->getAllServiceLocations();
414 foreach($fres as $frow):
416 <option
<?php
echo in_array($frow['id'], $ufid) ||
$frow['id'] == $iter['facility_id'] ?
"selected" : null ?
>
417 value
="<?php echo $frow['id'] ?>"><?php
echo htmlspecialchars($frow['name']) ?
></option
>
428 <TD
><span
class=text
><?php
xl('Federal Tax ID','e'); ?
>: </span
></TD
><TD
><input type
=text name
=taxid style
="width:150px;" value
="<?php echo $iter["federaltaxid
"]?>"></td
>
429 <TD
><span
class=text
><?php
xl('Federal Drug ID','e'); ?
>: </span
></TD
><TD
><input type
=text name
=drugid style
="width:150px;" value
="<?php echo $iter["federaldrugid
"]?>"></td
>
433 <td
><span
class="text"><?php
xl('UPIN','e'); ?
>: </span
></td
><td
><input type
="text" name
="upin" style
="width:150px;" value
="<?php echo $iter["upin
"]?>"></td
>
434 <td
class='text'><?php
xl('See Authorizations','e'); ?
>: </td
>
435 <td
><select name
="see_auth" style
="width:150px;" >
437 foreach (array(1 => xl('None'), 2 => xl('Only Mine'), 3 => xl('All')) as $key => $value)
439 echo " <option value='$key'";
440 if ($key == $iter['see_auth']) echo " selected";
441 echo ">$value</option>\n";
448 <td
><span
class="text"><?php
xl('NPI','e'); ?
>: </span
></td
><td
><input type
="text" name
="npi" style
="width:150px;" value
="<?php echo $iter["npi
"]?>"></td
>
449 <td
><span
class="text"><?php
xl('Job Description','e'); ?
>: </span
></td
><td
><input type
="text" name
="job" style
="width:150px;" value
="<?php echo $iter["specialty
"]?>"></td
>
453 <td
><span
class="text"><?php
xl('Taxonomy','e'); ?
>: </span
></td
>
454 <td
><input type
="text" name
="taxonomy" style
="width:150px;" value
="<?php echo $iter["taxonomy
"]?>"></td
>
455 <td
> 
;</td
><td
> 
;</td
></tr
>
458 <td
><span
class="text"><?php
xl('State License Number','e'); ?
>: </span
></td
>
459 <td
><input type
="text" name
="state_license_number" style
="width:150px;" value
="<?php echo $iter["state_license_number
"]?>"></td
>
460 <td
class='text'><?php
xl('NewCrop eRX Role','e'); ?
>:</td
>
462 <?php
echo generate_select_list("erxrole", "newcrop_erx_role", $iter['newcrop_user_role'],'',xl('Select Role'),'','','',array('style'=>'width:150px')); ?
>
467 <td
><span
class="text"><?php
xl('Provider Type','e'); ?
>: </span
></td
>
468 <td
><?php
echo generate_select_list("physician_type", "physician_type", $iter['physician_type'],'',xl('Select Type'),'physician_type_class','','',''); ?
></td
>
470 <?php
if ($GLOBALS['inhouse_pharmacy']) { ?
>
472 <td
class="text"><?php
xl('Default Warehouse','e'); ?
>: </td
>
475 echo generate_select_list('default_warehouse', 'warehouse',
476 $iter['default_warehouse'], '');
479 <td
class="text"><?php
xl('Invoice Refno Pool','e'); ?
>: </td
>
482 echo generate_select_list('irnpool', 'irnpool', $iter['irnpool'],
483 xl('Invoice reference number pool, if used'));
490 // Collect the access control group of user
491 if (isset($phpgacl_location) && acl_check('admin', 'acl')) {
494 <td
class='text'><?php
xl('Access Control','e'); ?
>:</td
>
495 <td
><select id
="access_group_id" name
="access_group[]" multiple style
="width:150px;" >
497 $list_acl_groups = acl_get_group_title_list();
498 $username_acl_groups = acl_get_group_titles($iter["username"]);
499 foreach ($list_acl_groups as $value) {
500 if (($username_acl_groups) && in_array($value,$username_acl_groups)) {
501 // Modified 6-2009 by BM - Translate group name if applicable
502 echo " <option value='$value' selected>" . xl_gacl_group($value) . "</option>\n";
505 // Modified 6-2009 by BM - Translate group name if applicable
506 echo " <option value='$value'>" . xl_gacl_group($value) . "</option>\n";
511 <td
><span
class=text
><?php
xl('Additional Info','e'); ?
>:</span
></td
>
512 <td
><textarea style
="width:150px;" name
="comments" wrap
=auto rows
=4 cols
=25><?php
echo $iter["info"];?
></textarea
></td
>
515 <tr height
="20" valign
="bottom">
516 <td colspan
="4" class="text">
517 <font
class="mandatory">*</font
> <?php
xl('You must enter your own password to change user passwords. Leave blank to keep password unchanged.','e'); ?
>
519 Display red alert
if entered password matched one of last three passwords
/Display red alert
if user password was expired
and the user was inactivated previously
521 <div
class="redtext" id
="error_message"> 
;</div
>
529 <INPUT TYPE
="HIDDEN" NAME
="id" VALUE
="<?php echo attr($_GET["id
"]); ?>">
530 <INPUT TYPE
="HIDDEN" NAME
="mode" VALUE
="update">
531 <INPUT TYPE
="HIDDEN" NAME
="privatemode" VALUE
="user_admin">
533 <INPUT TYPE
="HIDDEN" NAME
="secure_pwd" VALUE
="<?php echo $GLOBALS['secure_password']; ?>">
535 <script language
="JavaScript">
536 $
(document
).ready(function(){
537 $
("#cancel").click(function() {
538 parent
.$
.fn
.fancybox
.close();
548 // d41d8cd98f00b204e9800998ecf8427e == blank