Skip to content

Commit

Permalink
Merge branch 'openemr:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
claimrevolution committed Apr 28, 2024
2 parents ef31bd8 + 1d0e579 commit ed332d3
Show file tree
Hide file tree
Showing 74 changed files with 3,882 additions and 1,993 deletions.
4 changes: 2 additions & 2 deletions _rest_routes.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -6533,7 +6533,7 @@
* description="The type or category of OpenEMR insurance policy, 'primary', 'secondary', or 'tertiary'. If this field is missing it will default to 'primary'.",
* type="string"
* ),
* required={"provider", "policy_number", "subscriber_fname", "subscriber_lname", "subscriber_relationship", "subscriber_ss", "subscriber_DOB", "subscriber_street", "subscriber_postal_code", "subscriber_city", "subscriber_state", "subscriber_country", "subscriber_sex", "accept_assignment"},
* required={"provider", "policy_number", "subscriber_fname", "subscriber_lname", "subscriber_relationship", "subscriber_ss", "subscriber_DOB", "subscriber_street", "subscriber_postal_code", "subscriber_city", "subscriber_state", "subscriber_sex", "accept_assignment"},
* example={
* "provider": "33",
* "plan_name": "Some Plan",
Expand Down Expand Up @@ -12110,7 +12110,7 @@
// for the currently logged in user
if ($request->getRequestUserUUIDString() == $uuid) {
$return = (new FhirPersonRestController())->getOne($uuid);
} else if (!$request->isPatientRequest()) {
} elseif (!$request->isPatientRequest()) {
// not a patient ,make sure we have access to the users ACL
RestConfig::authorization_check("admin", "users");
$return = (new FhirPersonRestController())->getOne($uuid);
Expand Down
66 changes: 44 additions & 22 deletions controllers/C_Document.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use OpenEMR\Services\FacilityService;
use OpenEMR\Services\PatientService;
use OpenEMR\Events\PatientDocuments\PatientDocumentTreeViewFilterEvent;
use OpenEMR\Events\PatientDocuments\PatientRetrieveOffsiteDocument;

class C_Document extends Controller
{
Expand Down Expand Up @@ -768,32 +769,53 @@ public function retrieve_action(string $patient_id = null, $document_id, $as_fil
//strip url of protocol handler
$url = preg_replace("|^(.*)://|", "", $url);

//change full path to current webroot. this is for documents that may have
//been moved from a different filesystem and the full path in the database
//is not current. this is also for documents that may of been moved to
//different patients. Note that the path_depth is used to see how far down
//the path to go. For example, originally the path_depth was always 1, which
//only allowed things like documents/1/<file>, but now can have more structured
//directories. For example a path_depth of 2 can give documents/encounters/1/<file>
// etc.
// change full path to current webroot. this is for documents that may have
// been moved from a different filesystem and the full path in the database
// is not current. this is also for documents that may of been moved to
// different patients. Note that the path_depth is used to see how far down
// the path to go. For example, originally the path_depth was always 1, which
// only allowed things like documents/1/<file>, but now can have more structured
// directories. For example a path_depth of 2 can give documents/encounters/1/<file>
// etc.
// NOTE that $from_filename and basename($url) are the same thing
$from_all = explode("/", $url);
$from_filename = array_pop($from_all);
$from_pathname_array = array();
for ($i = 0; $i < $d->get_path_depth(); $i++) {
$from_pathname_array[] = array_pop($from_all);
}
$from_pathname_array = array_reverse($from_pathname_array);
$from_pathname = implode("/", $from_pathname_array);
if ($couch_docid && $couch_revid) {
//for couchDB no URL is available in the table, hence using the foreign_id which is patientID
$temp_url = $GLOBALS['OE_SITE_DIR'] . '/documents/temp/' . $d->get_foreign_id() . '_' . $from_filename;
} else {
$temp_url = $GLOBALS['OE_SITE_DIR'] . '/documents/' . $from_pathname . '/' . $from_filename;
}
// no point in doing any of these checks if $from_filename is empty which can lead to false positives on file_exists
if (!empty($from_filename)) {
$from_pathname_array = array();
for ($i = 0; $i < $d->get_path_depth(); $i++) {
$from_pathname_array[] = array_pop($from_all);
}
$from_pathname_array = array_reverse($from_pathname_array);
$from_pathname = implode("/", $from_pathname_array);
if ($couch_docid && $couch_revid) {
//for couchDB no URL is available in the table, hence using the foreign_id which is patientID
$temp_url = $GLOBALS['OE_SITE_DIR'] . '/documents/temp/' . $d->get_foreign_id() . '_' . $from_filename;
} else {
$temp_url = $GLOBALS['OE_SITE_DIR'] . '/documents/' . $from_pathname . '/' . $from_filename;
}

if (file_exists($temp_url)) {
$url = $temp_url;
if (file_exists($temp_url)) {
$url = $temp_url;
}

$retrieveOffsiteDocument = new PatientRetrieveOffsiteDocument($d->get_url(), $d);
$updatedOffsiteDocumentEvent = $GLOBALS['kernel']->getEventDispatcher()->dispatch(
$retrieveOffsiteDocument,
PatientRetrieveOffsiteDocument::REMOTE_DOCUMENT_LOCATION
);
// if a module writer has an independent offsite storage mechanism used this accomdoates that.
// If the file is not found locally, it will be found remotely. Systems like s3, blob stores, etc, can
// be tied and and use those urls. Note NO security is handled here so any kind of security mechanism must
// be handled on the receiving end's URL (s3/azure for example use signed urls with signature verification)
if (
$updatedOffsiteDocumentEvent instanceof PatientRetrieveOffsiteDocument
&& $updatedOffsiteDocumentEvent->getOffsiteUrl() != null
) {
header('Content-Description: File Transfer');
header("Location: " . $updatedOffsiteDocumentEvent->getOffsiteUrl());
exit;
}
}

if (!file_exists($url)) {
Expand Down
2 changes: 1 addition & 1 deletion interface/billing/sl_eob_process.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ function era_callback(&$out)
// processed by the primary payer so try to deal with that
if (!$prev) {
if (!$svc['mod']) {
if (in_array($svc['code'], $cpts)) {
if (in_array($svc['code'], $cpts ?? [])) {
foreach ($cpts as $k => $v) {
if ($v == $codekey) {
$codekey = $cpt . ':' . implode(':', $mods[$v]);
Expand Down
21 changes: 21 additions & 0 deletions interface/forms/group_attendance/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function participant_insertions($form_id, $therapy_group, $group_encounter_data,
*/
function insert_into_tgpa_table($form_id, $pid, $participantData)
{

$sql_for_table_tgpa = "INSERT INTO therapy_groups_participant_attendance (form_id, pid, meeting_patient_comment, meeting_patient_status) " .
"VALUES(?,?,?,?);";
sqlStatement($sql_for_table_tgpa, array($form_id, $pid, $participantData['comment'], $participantData['status']));
Expand Down Expand Up @@ -152,6 +153,19 @@ function get_appt_data($encounter_id)
return $result;
}

function getGroupAttendance($form_id): array
{
$participants_sql = "SELECT tgpa.*, p.fname, p.lname " .
"FROM therapy_groups_participant_attendance as tgpa " .
"JOIN patient_data as p ON tgpa.pid = p.id " .
"WHERE tgpa.form_id = ?;";
$result = sqlStatement($participants_sql, array($form_id));
$participants = array();
while ($p = sqlFetchArray($result)) {
$participants[] = $p;
}
return $participants;
}
/**
* Gets group encounter data
* @param $encounter_id
Expand All @@ -177,6 +191,13 @@ function if_to_create_for_patient($status)
return $to_create;
}

function getAttendanceStatus($status)
{
$sql = 'SELECT title FROM list_options WHERE list_id = \'attendstat\' AND option_id = ?';
$result = sqlQuery($sql, array($status));
return $result['title'];
}

/**
* Returns the number after the greatest id number in the table
* @param $table
Expand Down
9 changes: 1 addition & 8 deletions interface/forms/group_attendance/new.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,7 @@


if ($form_id) {//If editing a form or the form already exists (inwhich case will automatically go into edit mode for existing form)
$participants_sql = "SELECT tgpa.*, p.fname, p.lname " .
"FROM therapy_groups_participant_attendance as tgpa " .
"JOIN patient_data as p ON tgpa.pid = p.id " .
"WHERE tgpa.form_id = ?;";
$result = sqlStatement($participants_sql, array($form_id));
while ($p = sqlFetchArray($result)) {
$participants[] = $p;
}
$participants = getGroupAttendance($form_id);
} else {//new form
$participants = getParticipants($therapy_group, true);
}
Expand Down
38 changes: 35 additions & 3 deletions interface/forms/group_attendance/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@
require_once(__DIR__ . "/../../globals.php");
require_once($GLOBALS["srcdir"] . "/api.inc.php");
require_once("{$GLOBALS['srcdir']}/group.inc.php");

require_once("functions.php");
function group_attendance_report($pid, $encounter, $cols, $id)
{

global $therapy_group;

$encounter = $_SESSION["encounter"];
$sql = "SELECT * FROM `form_group_attendance` WHERE id=? AND group_id = ? AND encounter_id = ?";
$res = sqlStatement($sql, array($id,$therapy_group, $_SESSION["encounter"]));
$res = sqlStatement($sql, array($id,$therapy_group, $encounter));
$form_data = sqlFetchArray($res);
$group_data = getGroup($therapy_group);
$group_name = $group_data['group_name'];
$result = get_form_id_of_existing_attendance_form($encounter, $therapy_group);

$form_id = $result['form_id'];
$participants = getGroupAttendance($form_id);
if ($form_data) { ?>
<table class="table table-bordered w-100">
<tr class="text-center">
Expand All @@ -38,6 +41,35 @@ function group_attendance_report($pid, $encounter, $cols, $id)
<td><span class='text'><?php echo text($group_name); ?></span></td>
</tr>
</table>
<table class="table table-bordered w-100">
<tr>
<td><span class='font-weight-bold'><?php echo xlt('Participant'); ?></span></td>
<td><span class='font-weight-bold'><?php echo xlt('Status'); ?></span></td>
<td><span class='font-weight-bold'><?php echo xlt('Comments'); ?></span></td>
</tr>
<?php
if ($participants) {
foreach ($participants as $participant) {
$name = $participant['lname'] . ', ' . $participant['fname'];
$attnStatus = getAttendanceStatus($participant['meeting_patient_status'])
?>
<tr>
<td><span class='text'><?php echo text($name); ?></span></td>
<td><span class='text'><?php echo text(xl_list_label($attnStatus)); ?></span></td>
<td width="65%"><span
class='text'><?php echo text($participant['meeting_patient_comment']); ?></span></td>
</tr>
<?php
}
} else {
?>
<tr>
<td colspan="3"><span class='text'><?php echo xlt('No participants'); ?></span></td>
</tr>
<?php
}
?>
</table>
<?php
}
}
Expand Down
4 changes: 2 additions & 2 deletions interface/logview/logview.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ function setpatient(pid, lname, fname, dob) {
}
?>
<tr>
<td><?php echo text(oeFormatDateTime($iter["date"])); ?></td>
<td><?php echo text(oeFormatDateTime($iter["date"], 'global', true)); ?></td>
<td><?php echo text(preg_replace('/select$/', 'Query', $iter["event"])); //Convert select term to Query for MU2 requirements ?></td>
<td><?php echo text($iter["category"]); ?></td>
<td><?php echo text($iter["user"]); ?></td>
Expand Down Expand Up @@ -412,7 +412,7 @@ function setpatient(pid, lname, fname, dob) {
$comments = xl('Recipient Name') . ":" . $iter["recipient"] . ";" . xl('Disclosure Info') . ":" . $iter["description"];
?>
<tr>
<td><?php echo text(oeFormatDateTime($iter["date"])); ?></td>
<td><?php echo text(oeFormatDateTime($iter["date"], 'global', true)); ?></td>
<td><?php echo xlt($iter["event"]); ?></td>
<td><?php echo xlt($iter["category"] ?? ''); ?></td>
<td><?php echo text($iter["user"]); ?></td>
Expand Down
33 changes: 16 additions & 17 deletions interface/main/messages/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -768,22 +768,17 @@ function deselectRow(row) {
</div><!--end of recalls div-->
<?php } ?>
<div class="row tab-pane" role="tabpanel" id="sms-div">
<div class="col-sm-12">
<div class="jumbotron jumbotron-fluid p-2">
<?php if ($logged_in) { ?>
<div class="col-sm-4 col-md-4 col-lg-4">
<span class="title"><?php echo xlt('SMS Zone'); ?></span>
<br/><br/>
<form id="smsForm" class="input-group">
<select id="SMS_patient" type="text" class="form-control m-0 w-100" placeholder="<?php echo xla("Patient Name"); ?>" > </select>
<span class="input-group-addon" onclick="SMS_direct();"><i class="fas fa-phone"></i></span>
<input type="hidden" id="sms_pid" />
<input type="hidden" id="sms_mobile" value="" />
<input type="hidden" id="sms_allow" value="" />
</form>
</div>
<?php } ?>
</div>
<div class="col-sm-4 col-md-4 col-lg-4">
<?php if ($logged_in) { ?>
<h4><?php echo xlt('SMS Zone'); ?></h4>
<form id="smsForm" class="input-group">
<select id="SMS_patient" type="text" class="form-control m-0 w-100" placeholder="<?php echo xla("Patient Name"); ?>"></select>
<span class="input-group-addon" onclick="SMS_direct();">&nbsp;&nbsp;<i id='open-sms-tooltip' class="fas fa-2x fa-phone"></i></span>
<input type="hidden" id="sms_pid" />
<input type="hidden" id="sms_mobile" value="" />
<input type="hidden" id="sms_allow" value="" />
</form>
<?php } ?>
</div>
</div><!--end of sms div-->
</div>
Expand Down Expand Up @@ -849,6 +844,7 @@ function deselectRow(row) {
$(function () {
$('#see-all-tooltip').attr({"title": <?php echo xlj('Click to show messages for all users'); ?>, "data-toggle":"tooltip", "data-placement":"bottom"}).tooltip();
$('#just-mine-tooltip').attr({"title": <?php echo xlj('Click to show messages for only the current user'); ?>, "data-toggle":"tooltip", "data-placement":"bottom"}).tooltip();
$('#open-sms-tooltip').attr({"title": <?php echo xlj('Click to open SMS for patient'); ?>, "data-toggle":"tooltip", "data-placement":"bottom"}).tooltip();
});
$(function () {
var f = $("#smsForm");
Expand Down Expand Up @@ -877,7 +873,10 @@ function deselectRow(row) {
};
},
cache: true
}
},
dropdownAutoWidth: true,
placeholder: xl('Search for patient...'),
theme: 'bootstrap4'
})

$('#SMS_patient').on('select2:select', function (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function moduleManagerAction($methodName, $modId, string $currentActionSt

/**
* Required method to return namespace
* If namespace isn't provided return empty
* If namespace isn't provided return empty string
* and register namespace at top of this script..
*
* @return string
Expand Down Expand Up @@ -107,11 +107,9 @@ private function install($modId, $currentActionStatus): mixed
private function help_requested($modId, $currentActionStatus): mixed
{
// must call a script that implements a dialog to show help.
// I can't find a way to override the Laminas UI except using a dialog.
try {
include 'show_help.php';
} catch (Exception $e) {
return $e->getMessage();
// I can't find a way to override the Lamina's UI except using a dialog.
if (file_exists(__DIR__ . '/show_help.php')) {
include __DIR__ . '/show_help.php';
}
return $currentActionStatus;
}
Expand Down Expand Up @@ -166,6 +164,45 @@ private function unregister($modId, $currentActionStatus): mixed
return $currentActionStatus;
}

/**
* @param $modId
* @param $currentActionStatus
* @return mixed
*/
private function reset_module($modId, $currentActionStatus): mixed
{
$rtn = true;
$modService = new ModuleService();
$logMessage = ''; // Initialize an empty string to store log messages

if (!$modService::getModuleState($modId)) {
$sql = "DELETE FROM `user_settings` WHERE `setting_label` LIKE 'global:weno%'";
$rtn = sqlQuery($sql);
$logMessage .= "DELETE FROM `user_settings`: " . (empty($rtn) ? "Success" : "Failed") . "\n";

$sql = "DELETE FROM `globals` WHERE `gl_name` LIKE 'weno%'";
$rtn = sqlQuery($sql);
$logMessage .= "DELETE FROM `globals`: " . (empty($rtn) ? "Success" : "Failed") . "\n";

$sql = "DROP TABLE IF EXISTS `weno_pharmacy`";
$rtn = sqlQuery($sql);
$logMessage .= "DROP TABLE `weno_pharmacy`: " . (empty($rtn) ? "Success" : "Failed") . "\n";

$sql = "DROP TABLE IF EXISTS `weno_assigned_pharmacy`";
$rtn = sqlQuery($sql);
$logMessage .= "DROP TABLE `weno_assigned_pharmacy`: " . (empty($rtn) ? "Success" : "Failed") . "\n";

$sql = "DROP TABLE IF EXISTS `weno_download_log`";
$rtn = sqlQuery($sql);
$logMessage .= "DROP TABLE `weno_download_log`: " . (empty($rtn) ? "Success" : "Failed") . "\n";

error_log(text($logMessage));
}

// return log messages to the MM to show user.
return text($logMessage);
}

/**
* @param $modId
* @param $currentActionStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
/**
*
* @package OpenEMR Weno Module
* @link https://online.wenoexchange.com
*
* @author Jerry Padgett <sjpadgett@gmail.com>
* @author Kofi Appiah <kkappiah@medsov.com>
* Copyright (c) 2023 Omega Systems Group Corp <omegasystemsgroup.com>
* Copyright (c) 2023 Omega Systems Group Corp <omegasystemsgroup.com>
* @license GNU General Public License 3
*
*/

namespace OpenEMR\Modules\WenoModule;

use OpenEMR\Core\ModulesClassLoader;

/**
* @global OpenEMR\Core\ModulesClassLoader $classLoader
*/
Expand Down
Loading

0 comments on commit ed332d3

Please sign in to comment.