Skip to content

Commit

Permalink
Merge pull request #7457 from sjpadgett/patch1_morecherrypicks
Browse files Browse the repository at this point in the history
Patch1 more cherry-picks
  • Loading branch information
sjpadgett committed May 27, 2024
2 parents 01cbcee + 532dd8f commit 452becc
Show file tree
Hide file tree
Showing 29 changed files with 145 additions and 108 deletions.
10 changes: 5 additions & 5 deletions interface/forms/note/new.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@

$(function () {
$('.datepicker').datetimepicker({
<?php $datetimepicker_timepicker = true; ?>
<?php $datetimepicker_showseconds = true; ?>
<?php $datetimepicker_timepicker = false; ?>
<?php $datetimepicker_showseconds = false; ?>
<?php $datetimepicker_formatInput = true; ?>
<?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
<?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
Expand Down Expand Up @@ -83,9 +83,9 @@

<td>
<span class="text"><?php echo xlt('Date'); ?></span>
<input class="datepicker form-control" type='text' size='10' class='datepicker' name='date_of_signature' id='date_of_signature'
value='<?php echo attr(date('Y-m-d', time())); ?>'
title='<?php echo xla('yyyy-mm-dd'); ?>' />
<input class='datepicker form-control' type='text' size='16' name='date_of_signature' id='date_of_signature' autocomplete='off'
value='<?php echo attr(oeFormatShortDate(date('Y-m-d'))); ?>'
title='<?php echo xla('Date of Signature'); ?>' />
</td>
</tr>
</table>
Expand Down
7 changes: 1 addition & 6 deletions interface/forms/note/print.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@
$obj = formFetch("form_" . $form_name, $_GET["id"]);
}

/* remove the time-of-day from the date fields */
if ($obj['date_of_signature'] != "") {
$dateparts = explode(" ", $obj['date_of_signature']);
$obj['date_of_signature'] = $dateparts[0];
}
?>
<html><head>
<title><?php echo "Form: note"?></title>
Expand Down Expand Up @@ -67,7 +62,7 @@
</td><td>
<span class="text"><?php echo xlt('Date'); ?></span>
<input type='text' size='10' name='date_of_signature' id='date_of_signature'
value='<?php echo attr($obj['date_of_signature']); ?>'
value='<?php echo attr(oeFormatShortDate($obj['date_of_signature'])); ?>'
/>
</td></tr>
</table>
Expand Down
2 changes: 2 additions & 0 deletions interface/forms/note/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ function note_report($pid, $encounter, $cols, $id)
print("<tr>\n");
if ($key == "Note Type") {
print "<td><span class=bold>" . xlt($key) . ": </span><span class=text>" . xlt($value) . "</span></td>";
} elseif ($key == "Date Of Signature") {
print "<td><span class=bold>" . xlt($key) . ": </span><span class=text>" . oeFormatShortDate($value) . "</span></td>";
} else {
print "<td><span class=bold>" . xlt($key) . ": </span><span class=text>" . text($value) . "</span></td>";
}
Expand Down
4 changes: 3 additions & 1 deletion interface/forms/note/save.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
$encounter = date("Ymd");
}

$_POST['date_of_signature'] = DateToYYYYMMDD($_POST['date_of_signature']);

if ($_GET["mode"] == "new") {
$newid = formSubmit($table_name, $_POST, $_GET["id"], $userauthorized);
$newid = formSubmit($table_name, $_POST, $_GET["id"] ?? '', $userauthorized);
addForm($encounter, "Work/School Note", $newid, "note", $pid, $userauthorized);
} elseif ($_GET["mode"] == "update") {
$success = formUpdate($table_name, $_POST, $_GET["id"], $userauthorized);
Expand Down
27 changes: 12 additions & 15 deletions interface/forms/note/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
$obj = formFetch("form_" . $form_name, $_GET["id"]);
}

/* remove the time-of-day from the date fields */
if ($obj['date_of_signature'] != "") {
$dateparts = explode(" ", $obj['date_of_signature']);
$obj['date_of_signature'] = $dateparts[0];
}
?>
<html><head>

Expand All @@ -46,6 +41,16 @@
// required for textbox date verification
var mypcc = <?php echo js_escape($GLOBALS['phone_country_code']); ?>;

$(function () {
$('.datepicker').datetimepicker({
<?php $datetimepicker_timepicker = false; ?>
<?php $datetimepicker_showseconds = false; ?>
<?php $datetimepicker_formatInput = true; ?>
<?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
<?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
});
});

function PrintForm() {
newwin = window.open(<?php echo js_escape($rootdir . "/forms/" . $form_name . "/print.php?id=" . urlencode($_GET["id"])); ?>,"mywin");
}
Expand Down Expand Up @@ -86,8 +91,8 @@ function PrintForm() {
</td><td>
<span class="text"><?php echo xlt('Date'); ?></span>
<input type='text' size='10' class='datepicker' name='date_of_signature' id='date_of_signature'
value='<?php echo attr($obj['date_of_signature']); ?>'
title='<?php echo xla('yyyy-mm-dd'); ?>' />
value='<?php echo attr(oeFormatShortDate($obj['date_of_signature'])); ?>'
title='<?php echo xla('Date of Signature'); ?>' />
</td></tr>
</table>

Expand Down Expand Up @@ -116,14 +121,6 @@ function PrintForm() {
$("input").keydown(function() { $(".printform").attr("disabled","disabled"); });
$("select").change(function() { $(".printform").attr("disabled","disabled"); });
$("textarea").keydown(function() { $(".printform").attr("disabled","disabled"); });

$('.datepicker').datetimepicker({
<?php $datetimepicker_timepicker = false; ?>
<?php $datetimepicker_showseconds = false; ?>
<?php $datetimepicker_formatInput = false; ?>
<?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
<?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
});
});

</script>
Expand Down
10 changes: 5 additions & 5 deletions interface/modules/custom_modules/oe-module-weno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

- **Important to note that The Primary Admin Section** will require using the Validate and Save button after completing this section. All other sections will auto save when values are changed.
## Setup Summary
- There are three sections. After entering the required Admin credentials, Weno User ID for all prescribers and the Weno Location ID for the appropriate facility, all of which was received when a Weno account was created, click the **Enable** button to enable the module allowing the start of initial pharmacies download. You may then go to the User Settings page to enter the provider/prescribers credentials. For yourself in this case.
- There are three sections. After entering the required Admin credentials, Weno User ID for all prescribers and the Weno Location ID for the appropriate facility, all of which was received when a Weno account was created, click the **Enable** button to enable the module allowing the start of initial pharmacies download. You may then go to the User Settings page to enter the prescribers credentials. For yourself in this case.
All providers that will be prescribing using Weno eRx must also have their credentials set otherwise the Weno eRx widget will not display.
- After a log out and in or by clicking the **Restart OpenEMR** button in config panel the Weno menu items of **Admin->Other->Weno Management** and **Reports->Clients->Prescription Log** will be enabled.
## Weno Required and Ancillary Setup for OpenEMR
Expand All @@ -24,12 +24,12 @@ There are three sections within the Weno eRx Service Admin Setup that allow the
- If the encryption key is deemed invalid an alert will show and a new Encryption Reset button enabled. First try re-entering the key but if that doesn't work clicking the Reset button will create a new key. This change will also be reflected in the Admins main Weno account and no other actions are needed by the user. You may look on the key as an API token which may be a more familiar term to the reader.
### The Map Weno User Id`s (Required) Section.
- This section presents a table of all authorised users showing their default facility if assigned and an input field to enter their Weno user id Uxxxx. This value is important in order to form a relationship between Weno and the OpenEMR user for tracking prescriptions.
- All values are automatically saved for the user whenever the Weno Provider ID is entered or changed.
- As a convenience, an edit button is supplied to present a dialog containing the Users settings in edit mode. From here user may edit any setting such as assigning a default facility. This would be the same as accessing Users from top menu Admin->Users selected provider.
- All values are automatically saved for the user whenever the Weno User ID is entered or changed.
- As a convenience, an edit button is supplied to present a dialog containing the Users settings in edit mode. From here user may edit any setting such as assigning a default facility. This would be the same as accessing Users from top menu Admin->Users selected Weno Prescriber.
### The Map Weno Facility Id`s (Required) Section.
- This section is pretty self explanatory with perhaps noting this same data may be accessed from top menu Admin->Other->Weno Management as explained below.
- This section also auto saves for convenience.
### Other methods for various set up items accessed from top menu.
- Open **Admin->Users** and select the user associated with the weno user id Uxxx and enter and save the weno user id in the **Weno Provider ID** field.
- Open **Admin->Users** and select the user associated with the weno user id Uxxx and enter and save the weno user id in the **Weno User ID** field.
- Next open **Admin->Other->Weno Management** and enter the assigned Location Id Lxxxxx for the locations facilities.
- Lastly from the top patient bar user icon click **Settings**. Scroll down or find the Weno button and click. Enter your username(email) and password in the **Weno Provider Email and Weno Provider Password** fields and **Save**. **Note** If these credentials are absent or wrong, you will not be able to prescribe prescriptions.
- Lastly from the top patient bar user icon click **Settings**. Scroll down or find the Weno button and click. Enter your username(email) and password in the **Weno User Email and Weno User Password** fields and **Save**. **Note** If these credentials are absent or wrong, you will not be able to prescribe prescriptions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function getUserIdByWenoId($external_provider_id)
return $provider['id'];
} else {
// logged in user is auth weno user so let's ensure a user is set.
return "REQED:{users}" . xlt("Weno Provider Id missing. Select Admin then Users and edit the user to add Weno Provider Id");
return "REQED:{users}" . xlt("Weno User Id missing. Select Admin then Users and edit the user to add Weno User Id");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ public function getProviderEmail(): string|array
if (!empty($provider_info['email'])) {
return $provider_info;
} else {
$error = xlt("Provider email address is missing. Go to User settings Email to add provider's weno registered email address");
$error = xlt("Weno Prescriber email address is missing. Go to User settings Email to add Weno Prescriber's weno registered email address");
error_log(errorLogEscape($error));
TransmitProperties::echoError($error);
}
} elseif ($GLOBALS['weno_admin_username'] ?? false) {
$provider_info["email"] = $GLOBALS['weno_admin_username'];
return $provider_info;
} else {
$error = xlt("Provider email address is missing. Go to User settings Weno tab to add provider's weno registered email address");
$error = xlt("Weno Prescriber email address is missing. Go to User settings Weno tab to add Weno Prescriber's weno registered email address");
error_log($error);
echo TransmitProperties::styleErrors($error);
exit;
Expand All @@ -238,7 +238,7 @@ public function getProviderPassword(): mixed
if (!empty($GLOBALS['weno_admin_password'])) {
return $this->cryptoGen->decryptStandard($GLOBALS['weno_admin_password']);
} else {
echo xlt('Provider Password is missing');
echo xlt('Weno Prescriber Password is missing');
die;
}
} elseif ($GLOBALS['weno_admin_password']) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public static function getAge($dob, $as_of = ''): string
}
$a1 = explode('-', substr($dob, 0, 10));
$a2 = explode('-', substr($as_of, 0, 10));
$age = $a2[0] - $a1[0];
$age = (int)$a2[0] - (int)$a1[0];
if ($a2[1] < $a1[1] || ($a2[1] == $a1[1] && $a2[2] < $a1[2])) {
--$age;
}
Expand Down Expand Up @@ -294,7 +294,7 @@ public function getProviderEmail(): array|string
{
$provider_info = ['email' => ($GLOBALS['weno_provider_email'] ?? '')];
if (empty($provider_info['email'])) {
return "REQED:{user_settings}" . (xlt('Provider Email is missing. Go to User Settings Weno Tab and enter your Weno Provider Email'));
return "REQED:{user_settings}" . (xlt('Weno Prescriber Email is missing. Go to User Settings Weno Tab and enter your Weno User Email'));
} else {
return $provider_info;
}
Expand Down Expand Up @@ -326,7 +326,7 @@ public function getFacilityInfo(): array|null|false
}
if (empty($default_facility['weno_id'])) {
// still no joy so let user know and get it set!
$default_facility['error'] = "REQED:{weno_manage}" . xlt('Facility ID is missing. From Admin select Weno eRx Tools then Weno eRx Service Setup. Enter the Weno ID of your facility');
$default_facility['error'] = "REQED:{weno_manage}" . xlt('Facility ID is missing. From Admin select Weno eRx Tools then Weno eRx Service Setup. Enter the Weno Location ID of your facility');
}
return $default_facility;
}
Expand Down Expand Up @@ -429,11 +429,11 @@ public function getProviderPassword(): mixed
if (!empty($GLOBALS['weno_provider_password'])) {
$ret = $this->cryptoGen->decryptStandard($GLOBALS['weno_provider_password']);
if (!$ret) {
return ("REQED:{user_settings}" . xlt('Your Provider Password fails decryption. Go to User Settings Weno Tab and reenter your Weno Provider Password'));
return ("REQED:{user_settings}" . xlt('Your Weno Prescriber Password fails decryption. Go to User Settings Weno Tab and reenter your Weno User Password'));
}
return $ret;
} else {
return "REQED:{user_settings}" . xlt('Your Provider Password is missing. Go to User Settings Weno Tab and enter your Weno Provider Password');
return "REQED:{user_settings}" . xlt('Your Weno Prescriber Password is missing. Go to User Settings Weno Tab and enter your Weno User Password');
}
}

Expand Down Expand Up @@ -469,7 +469,7 @@ private function getSubscriber(): mixed
$relation = sqlQuery("select subscriber_relationship from insurance_data where pid = ? and type = 'primary'", [$_SESSION['pid']]);
$relation = $relation ?? ['subscriber_relationship' => ''];

return $relation['subscriber_relationship'];
return $relation['subscriber_relationship'] ?? '';
}

/**
Expand Down Expand Up @@ -533,20 +533,22 @@ public function getWenoProviderId($id = null): mixed
if (empty($id)) {
$id = $_SESSION['authUserID'] ?? '';
}
// get the weno provider id from the user table (weno_prov_id)
// get the Weno User id from the user table (weno_prov_id)
$provider = sqlQuery("SELECT weno_prov_id FROM users WHERE id = ?", [$id]);

if ((!empty($GLOBALS['weno_provider_uid'])) && !empty($provider['weno_prov_id'])) {
$doIt = ($GLOBALS['weno_provider_uid']) != trim($provider['weno_prov_id']);
if ($doIt) {
$GLOBALS['weno_provider_uid'] = $provider['weno_prov_id'];
$provider['weno_prov_id'] = $GLOBALS['weno_provider_uid'];
$sql = "INSERT INTO `user_settings` (`setting_value`, `setting_user`, `setting_label`)
VALUES (?, ?, 'global:weno_provider_uid')
ON DUPLICATE KEY UPDATE `setting_value` = ?";
sqlQuery($sql, [$provider['weno_prov_id'], $id, $provider['weno_prov_id']]);
}

$GLOBALS['weno_provider_uid'] = $GLOBALS['weno_prov_id'] = $provider['weno_prov_id']; // update globals
$GLOBALS['weno_provider_uid'] = $GLOBALS['weno_prov_id'] = $provider['weno_prov_id']; // update users
$sql = "INSERT INTO `users` (`weno_prov_id`, `id`) VALUES (?, ?) ON DUPLICATE KEY UPDATE `weno_prov_id` = ?";
sqlQuery($sql, [$GLOBALS['weno_provider_uid'], $id, $GLOBALS['weno_provider_uid']]);
return $provider['weno_prov_id'];
} elseif (!empty($provider['weno_prov_id'] ?? '') && empty($GLOBALS['weno_provider_uid'])) {
$sql = "INSERT INTO `user_settings` (`setting_value`, `setting_user`, `setting_label`)
Expand All @@ -557,14 +559,13 @@ public function getWenoProviderId($id = null): mixed
$GLOBALS['weno_provider_uid'] = $GLOBALS['weno_prov_id'] = $provider['weno_prov_id'];
return $provider['weno_prov_id'];
} elseif (empty($provider['weno_prov_id'] ?? '') && !empty($GLOBALS['weno_provider_uid'])) {
$sql = "INSERT INTO `users` (`weno_prov_id`, `id`) VALUES (?, ?)
ON DUPLICATE KEY UPDATE `weno_prov_id` = ?";
$sql = "INSERT INTO `users` (`weno_prov_id`, `id`) VALUES (?, ?) ON DUPLICATE KEY UPDATE `weno_prov_id` = ?";
sqlQuery($sql, [$GLOBALS['weno_provider_uid'], $id, $GLOBALS['weno_provider_uid']]);

$provider['weno_prov_id'] = $GLOBALS['weno_prov_id'] = $GLOBALS['weno_provider_uid'];
return $provider['weno_prov_id'];
} else {
return "REQED:{users}" . xlt("Weno Provider Id missing. Select Admin then Users and edit the user to add Weno Provider Id");
return "REQED:{users}" . xlt("Weno User Id missing. Select Admin then Users and edit the user to add Weno User Id");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,22 @@ public function getGlobalSettingSectionConfiguration(): array
, 'user_setting' => false
]*/
self::WENO_PROVIDER_EMAIL => [
'title' => xl('Weno Provider Email')
'title' => xl('Weno Prescriber Email')
, 'description' => xl('')
, 'type' => GlobalSetting::DATA_TYPE_TEXT
, 'default' => ''
, 'user_setting' => true
]
, self::WENO_PROVIDER_PASSWORD => [
'title' => xl('Weno Provider Password')
'title' => xl('Weno Prescriber Password')
, 'description' => xl('')
, 'type' => GlobalSetting::DATA_TYPE_ENCRYPTED
, 'default' => ''
, 'user_setting' => true
]
, self::WENO_PROVIDER_UID => [
'title' => xl('Weno Provider ID')
, 'description' => xl('When a Weno eRx provider, please enter your Weno provider ID here or in your Users setting. If you are not a Weno provider, please leave this field blank.')
'title' => xl('Weno Prescriber ID')
, 'description' => xl('When a Weno eRx Prescriber, please enter your Weno User ID here or in your Users setting. If you are not a Weno Prescriber, please leave this field blank.')
, 'type' => GlobalSetting::DATA_TYPE_TEXT
, 'default' => ''
, 'user_setting' => true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<th><?php print xlt('Facility Name'); ?></th>
<th><?php print xlt('Address'); ?></th>
<th><?php print xlt('City'); ?></th>
<th><?php print xlt('Weno ID'); ?></th>
<th><?php print xlt('Weno Location ID'); ?></th>
</tr>
</thead>
<?php
Expand Down
Loading

0 comments on commit 452becc

Please sign in to comment.