Skip to content

Commit

Permalink
feat: expose suffix and valedictory in user admin and esign (openemr#…
Browse files Browse the repository at this point in the history
…6814)

* feat: introduce phpstan

* implement missing billing generator interface

* separate last name and first name with comma and add valedictory aka credential

* fix prior typo

* expose valedictory

* display valedictory in esign

* add valedictory to encounter form and reports

* revert other pr stuff

* consistent use of comma for encounter edit

* add suffix

* add user
  • Loading branch information
stephenwaite committed Aug 31, 2023
1 parent 16705ae commit 30d94bb
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 8 deletions.
5 changes: 3 additions & 2 deletions interface/forms/newpatient/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,9 @@ function cancelClickedOld() {
if ((int)$provider_id === $p_id) {
echo "selected";
}
echo ">" . text($activeUser['lname']) . ' ' .
text($activeUser['fname']) . ' ' . text($activeUser['mname']) . $flag_it . "</option>\n";
echo ">" . text($activeUser['lname']) . ', ' . text($activeUser['suffix']) . ', ' .
text($activeUser['valedictory']) . ', ' . text($activeUser['fname']) . ', ' .
text($activeUser['mname']) . $flag_it . "</option>\n";
}
?>
</select>
Expand Down
3 changes: 2 additions & 1 deletion interface/forms/newpatient/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ function newpatient_report($pid, $encounter, $cols, $id)
$rawRefProvider = $userService->getUser($result["referring_provider_id"]);
$calendar_category = (new AppointmentService())->getOneCalendarCategory($result['pc_catid']);
$reason = (!$hasAccess) ? false : $result['reason'];
$provider = (!$hasAccess) ? false : $rawProvider['fname'] . " " . $rawProvider['lname'];
$provider = (!$hasAccess) ? false : $rawProvider['fname'] . " " . $rawProvider['lname']
. ", " . $rawProvider['suffix'] . ", " . $rawProvider['valedictory'];
$referringProvider = (!$hasAccess || !$rawRefProvider) ? false : $rawRefProvider['fname'] . " " . $rawRefProvider['lname'];
$posCode = (!$hasAccess) ? false : sprintf('%02d', trim($result['pos_code'] ?? false));
$posCode = ($posCode && $posCode != '00') ? $posCode : false;
Expand Down
5 changes: 3 additions & 2 deletions interface/patient_file/encounter/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ function findPosY(obj) {
}

// $form_info = getFormInfoById($iter['id']);
$form_class_list = (strtolower(substr($ite['form_name'], 0, 5)) == 'camos') ? "" : "text onerow";
$form_class_list = (strtolower(substr($iter['form_name'], 0, 5)) == 'camos') ? "" : "text onerow";
echo '<div id="' . attr($formdir) . '~' . attr($iter['form_id']) . '" title="' . xla("Edit Form") . '" class="form-holder ' . $form_class_list . '">';

$acl_groups = AclMain::aclCheckCore("groups", "glog", false, 'write') ? true : false;
Expand All @@ -880,7 +880,8 @@ function findPosY(obj) {

// Figure out the correct author (encounter authors are the '$providerNameRes', while other
// form authors are the '$user['fname'] . " " . $user['lname']').
$form_author = ($formdir == 'newpatient') ? $providerNameRes : ($user['fname'] ?? '') . " " . ($user['lname'] ?? '');
$form_author = ($formdir == 'newpatient') ? $providerNameRes : ($user['fname'] ?? '') . " " .
($user['lname'] ?? '') . ", " . ($user['suffix'] ?? '') . ", " . ($user['valedictory'] ?? '');
$div_nums_attr = attr($divnos);
$title = xla("Expand/Collapse this form");
$display = text($form_name) . " " . xlt("by") . " " . text($form_author);
Expand Down
5 changes: 5 additions & 0 deletions interface/usergroup/user_admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ function toggle_password() {

<TR>
<td><span class=text><?php echo xlt('Last Name'); ?>: </span></td><td><input type="text" name=lname id=lname style="width:150px;" class="form-control" value="<?php echo attr($iter["lname"]); ?>"><span class="mandatory"></span></td>
<td><span class=text><?php echo xlt('Suffix'); ?>: </span></td><td><input type="text" name=suffix id=suffix style="width:150px;" class="form-control" value="<?php echo attr($iter["suffix"]); ?>"></td>
</tr>
<tr>
<td><span class=text><?php echo xlt('Valedictory'); ?>: </span></td><td><input type="text" name=valedictory id=valedictory style="width:150px;" class="form-control" value="<?php echo attr($iter["valedictory"]); ?>"></td>
<td><span class=text><?php echo xlt('Default Facility'); ?>: </span></td><td><select name=facility_id style="width:150px;" class="form-control">
<?php
$fres = $facilityService->getAllServiceLocations();
Expand All @@ -368,6 +372,7 @@ function toggle_password() {
}
?>
</select></td>

</tr>

<?php if ($GLOBALS['restrict_user_facility']) { ?>
Expand Down
10 changes: 10 additions & 0 deletions interface/usergroup/usergroup_admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@
sqlStatement("update users set lname=? where id= ? ", array($_POST["lname"], $_POST["id"]));
}

if ($_POST["suffix"]) {
sqlStatement("update users set suffix=? where id= ? ", array($_POST["suffix"], $_POST["id"]));
}

if ($_POST["valedictory"]) {
sqlStatement("update users set valedictory=? where id= ? ", array($_POST["valedictory"], $_POST["id"]));
}

if ($_POST["job"]) {
sqlStatement("update users set specialty=? where id= ? ", array($_POST["job"], $_POST["id"]));
}
Expand Down Expand Up @@ -348,6 +356,8 @@
"', fname = '" . add_escape_custom(trim((isset($_POST['fname']) ? $_POST['fname'] : ''))) .
"', mname = '" . add_escape_custom(trim((isset($_POST['mname']) ? $_POST['mname'] : ''))) .
"', lname = '" . add_escape_custom(trim((isset($_POST['lname']) ? $_POST['lname'] : ''))) .
"', suffix = '" . add_escape_custom(trim((isset($_POST['suffix']) ? $_POST['suffix'] : ''))) .
"', valedictory = '" . add_escape_custom(trim((isset($_POST['valedictory']) ? $_POST['valedictory'] : ''))) .
"', federaltaxid = '" . add_escape_custom(trim((isset($_POST['federaltaxid']) ? $_POST['federaltaxid'] : ''))) .
"', state_license_number = '" . add_escape_custom(trim((isset($_POST['state_license_number']) ? $_POST['state_license_number'] : ''))) .
"', newcrop_user_role = '" . add_escape_custom(trim((isset($_POST['erxrole']) ? $_POST['erxrole'] : ''))) .
Expand Down
4 changes: 4 additions & 0 deletions interface/usergroup/usergroup_admin_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ function authorized_clicked() {
</tr>
<tr>
<td><span class="text"><?php echo xlt('Last Name'); ?>: </span></td><td><input type="text" name='lname' id='lname' style="width:120px;" class="form-control"><span class="mandatory"></span></td>
<td><span class=text><?php echo xlt('Suffix'); ?>: </span></td><td><input type="text" name=suffix id=suffix style="width:150px;" class="form-control"></td>
</tr>
<tr>
<td><span class=text><?php echo xlt('Valedictory'); ?>: </span></td><td><input type="text" name=valedictory id=valedictory style="width:150px;" class="form-control"></td>
<td><span class="text"><?php echo xlt('Default Facility'); ?>: </span></td>
<td>
<select style="width:120px;" name=facility_id class="form-control">
Expand Down
4 changes: 3 additions & 1 deletion library/ESign/DbRow/Signable.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getSignatures()
{
$this->_signatures = array();

$statement = "SELECT E.id, E.tid, E.table, E.uid, U.fname, U.lname, E.datetime, E.is_lock, E.amendment, E.hash, E.signature_hash FROM esign_signatures E ";
$statement = "SELECT E.id, E.tid, E.table, E.uid, U.fname, U.lname, U.suffix, U.valedictory, E.datetime, E.is_lock, E.amendment, E.hash, E.signature_hash FROM esign_signatures E ";
$statement .= "JOIN users U ON E.uid = U.id ";
$statement .= "WHERE E.tid = ? AND E.table = ? ";
$statement .= "ORDER BY E.datetime ASC";
Expand All @@ -62,6 +62,8 @@ public function getSignatures()
$row['uid'],
$row['fname'],
$row['lname'],
$row['suffix'],
$row['valedictory'],
$row['datetime'],
$row['hash'],
$row['amendment'],
Expand Down
12 changes: 12 additions & 0 deletions library/ESign/Signature.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class Signature implements SignatureIF
private $uid; // user id of the signer
private $firstName; // first name of signer
private $lastName; // last name of signer
private $suffix; // suffix of signer
private $valedictory; // aka credential of signer
private $datetime; // date and time of the signature
private $hash; // hash of the thing being signed on (SignableIF)
private $signatureHash = null; // hash of data in this signature
Expand Down Expand Up @@ -106,6 +108,16 @@ public function getLastName()
return $this->lastName;
}

public function getSuffix()
{
return $this->suffix;
}

public function getValedictory()
{
return $this->valedictory;
}

public function getDatetime()
{
return $this->datetime;
Expand Down
1 change: 1 addition & 0 deletions library/ESign/SignatureIF.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function getId();
public function getUid();
public function getFirstName();
public function getLastName();
public function getValedictory();
public function getDatetime();
public function isLock();
public function getAmendment();
Expand Down
4 changes: 3 additions & 1 deletion library/ESign/views/default/esign_signature_log.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@

<div class="esign-log-row">
<div class="esign-log-element span3"><span><?php echo text($signature->getFirstName()); ?></span></div>
<div class="esign-log-element span3"><span><?php echo text($signature->getLastName()); ?></span></div>
<div class="esign-log-element span3"><span><?php echo text($signature->getLastName()); ?></span></div>
<div class="esign-log-element span3"><span><?php echo text($signature->getSuffix()); ?></span></div>
<div class="esign-log-element span3"><span><?php echo text($signature->getValedictory()); ?></span></div>
<div class="esign-log-element span3"><span><?php echo text($signature->getDatetime()); ?></span></div>
</div>

Expand Down
6 changes: 5 additions & 1 deletion library/patient.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ function getProviderInfo($providerID = "%", $providers_only = true, $facility =
}

// removing active from query since is checked above with $providers_only argument
$query = "select distinct id, username, lname, fname, authorized, info, facility, suffix " .
$query = "select distinct id, username, lname, fname, authorized, info, facility, suffix, valedictory " .
"from users where username != '' and id $command '" .
add_escape_custom($providerID) . "' " . $param1 . $param2;
// sort by last name -- JRM June 2008
Expand Down Expand Up @@ -332,6 +332,10 @@ function getProviderName($providerID, $provider_only = 'any')
$pi[0]["lname"] .= ", " . $pi[0]["suffix"];
}

if (!empty($pi[0]["valedictory"]) && (strlen($pi[0]["valedictory"]) > 0)) {
$pi[0]["lname"] .= ", " . $pi[0]["valedictory"];
}

return $pi[0]['fname'] . " " . $pi[0]['lname'];
}

Expand Down

0 comments on commit 30d94bb

Please sign in to comment.