diff --git a/interface/modules/custom_modules/oe-module-faxsms/messageUI.php b/interface/modules/custom_modules/oe-module-faxsms/messageUI.php index b3234b5ada0..ead97fac620 100644 --- a/interface/modules/custom_modules/oe-module-faxsms/messageUI.php +++ b/interface/modules/custom_modules/oe-module-faxsms/messageUI.php @@ -190,7 +190,11 @@ function showDocument(_base64, _contentType = 'image/tiff') { 'width=' + width / 1.75 + ', height=' + height + ', top=' + top + ', left=' + left ); - win.document.write(""); + if (win === null) { + alert(xl('Please allow popups for this site')); + } else { + win.document.write(""); + } } function viewDocument(e = '', dataUrl) { @@ -212,7 +216,11 @@ function viewDocument(e = '', dataUrl) { 'width=' + width / 1.75 + ', height=' + height + ', top=' + top + ', left=' + left ); - win.document.write(""); + if (win === null) { + alert(xl('Please allow popups for this site')); + } else { + win.document.write(""); + } } function getDocument(e, docuri, docid, downFlag, deleteFlag = '') { diff --git a/interface/modules/custom_modules/oe-module-weno/templates/pharmacy_list_form.php b/interface/modules/custom_modules/oe-module-weno/templates/pharmacy_list_form.php index 91e9edacb33..7dfd1613e13 100644 --- a/interface/modules/custom_modules/oe-module-weno/templates/pharmacy_list_form.php +++ b/interface/modules/custom_modules/oe-module-weno/templates/pharmacy_list_form.php @@ -194,21 +194,21 @@ let prevAltPharmacy = ; if (pid > 0) { - init(prevPrimPharmacy, prevAltPharmacy); + initPharmacyDisplay(prevPrimPharmacy, prevAltPharmacy); } //checking if weno_pharmacy div exists initialize select2 let pharmacySelector = document.getElementById("weno_pharmacy"); if (pharmacySelector !== null) { createWenoPharmacySelect2(); } - //checking if city div div exists and initialize select2 + //checking if city div exists and initialize select2 var citySelector = document.getElementById("weno_city"); if (citySelector !== null) { createWenoCitySelect2(); } }; - function init(prevPrimPharmacy, prevAltPharmacy) { + function initPharmacyDisplay(prevPrimPharmacy, prevAltPharmacy) { let jsPrim = JSON.parse(prevPrimPharmacy); let jsAlt = JSON.parse(prevAltPharmacy); diff --git a/interface/patient_file/summary/demographics.php b/interface/patient_file/summary/demographics.php index 20c21975bb2..d3ea72620a8 100644 --- a/interface/patient_file/summary/demographics.php +++ b/interface/patient_file/summary/demographics.php @@ -13,10 +13,12 @@ * @author Tyler Wrenn * @author Robert Down * @author Stephen Nielson + * @author Jerry Padgett * @copyright Copyright (c) 2017-2020 Brady Miller * @copyright Copyright (c) 2017 Sharon Cohen * @copyright Copyright (c) 2018-2020 Stephen Waite * @copyright Copyright (c) 2018 Ranganath Pathak + * @copyright Copyright (c) 2018-2024 Jerry Padgett * @copyright Copyright (c) 2020 Tyler Wrenn * @copyright Copyright (c) 2021-2022 Robert Down @@ -47,6 +49,9 @@ use OpenEMR\FHIR\SMART\SmartLaunchController; use OpenEMR\Menu\PatientMenuRole; use OpenEMR\OeUI\OemrUI; +use OpenEMR\Patient\Cards\BillingViewCard; +use OpenEMR\Patient\Cards\DemographicsViewCard; +use OpenEMR\Patient\Cards\InsuranceViewCard; use OpenEMR\Patient\Cards\PortalCard; use OpenEMR\Reminder\BirthdayReminder; use OpenEMR\Services\AllergyIntoleranceService; @@ -269,13 +274,13 @@ function deceasedDays($days_deceased) if ($deceased_days == 0) { $num_of_days = xl("Today"); } elseif ($deceased_days == 1) { - $num_of_days = $deceased_days . " " . xl("day ago"); + $num_of_days = $deceased_days . " " . xl("day ago"); } elseif ($deceased_days > 1 && $deceased_days < 90) { - $num_of_days = $deceased_days . " " . xl("days ago"); + $num_of_days = $deceased_days . " " . xl("days ago"); } elseif ($deceased_days >= 90 && $deceased_days < 731) { - $num_of_days = "~" . round($deceased_days / 30) . " " . xl("months ago"); // function intdiv available only in php7 + $num_of_days = "~" . round($deceased_days / 30) . " " . xl("months ago"); // function intdiv available only in php7 } elseif ($deceased_days >= 731) { - $num_of_days = xl("More than") . " " . round($deceased_days / 365) . " " . xl("years ago"); + $num_of_days = xl("More than") . " " . round($deceased_days / 365) . " " . xl("years ago"); } if (strlen($days_deceased['date_deceased'] ?? '') > 10 && $GLOBALS['date_display_format'] < 1) { @@ -363,7 +368,7 @@ function image_widget($doc_id, $doc_catg) <?php echo xlt("Dashboard{{patient file}}"); ?> @@ -1043,166 +1048,166 @@ function setMyPatient() { ?>
-
- getTwig(); +
+ getTwig(); + + $allergy = (AclMain::aclCheckIssue('allergy') ? 1 : 0) && !in_array('card_allergies', $hiddenCards) ? 1 : 0; + $pl = (AclMain::aclCheckIssue('medical_problem') ? 1 : 0) && !in_array('card_medicalproblems', $hiddenCards) ? 1 : 0; + $meds = (AclMain::aclCheckIssue('medication') ? 1 : 0) && !in_array('card_medication', $hiddenCards) ? 1 : 0; + $rx = !$GLOBALS['disable_prescriptions'] && AclMain::aclCheckCore('patients', 'rx') && !in_array('card_prescriptions', $hiddenCards) ? 1 : 0; + $cards = max(1, ($allergy + $pl + $meds)); + $col = "p-1 "; + $colInt = 12 / $cards; + $col .= "col-md-" . $colInt; + + /** + * Helper function to return only issues with an outcome not equal to resolved + * + * @param array $i An array of issues + * @return array + */ + function filterActiveIssues(array $i): array + { + return array_filter($i, function ($_i) { + return ($_i['outcome'] != 1) && (empty($_i['enddate']) || (strtotime($_i['enddate']) > strtotime('now'))); + }); + } - $allergy = (AclMain::aclCheckIssue('allergy') ? 1 : 0) && !in_array('card_allergies', $hiddenCards) ? 1 : 0; - $pl = (AclMain::aclCheckIssue('medical_problem') ? 1 : 0) && !in_array('card_medicalproblems', $hiddenCards) ? 1 : 0; - $meds = (AclMain::aclCheckIssue('medication') ? 1 : 0) && !in_array('card_medication', $hiddenCards) ? 1 : 0; - $rx = (!$GLOBALS['disable_prescriptions'] && AclMain::aclCheckCore('patients', 'rx')) ? 1 : 0; - $cards = max(1, ($allergy + $pl + $meds)); - $col = "p-1 "; - $colInt = 12 / $cards; - $col .= "col-md-" . $colInt; - - /** - * Helper function to return only issues with an outcome not equal to resolved - * - * @param array $i An array of issues - * @return array - */ - function filterActiveIssues(array $i): array - { - return array_filter($i, function ($_i) { - return ($_i['outcome'] != 1) && (empty($_i['enddate']) || (strtotime($_i['enddate']) > strtotime('now'))); - }); - } + // ALLERGY CARD + if ($allergy === 1) { + $allergyService = new AllergyIntoleranceService(); + $_rawAllergies = filterActiveIssues($allergyService->getAll(['lists.pid' => $pid])->getData()); + $id = 'allergy_ps_expand'; + $viewArgs = [ + 'title' => xl('Allergies'), + 'card_container_class_list' => ['flex-fill', 'mx-1', 'card'], + 'id' => $id, + 'forceAlwaysOpen' => false, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, + 'linkMethod' => "javascript", + 'list' => $_rawAllergies, + 'listTouched' => (!empty(getListTouch($pid, 'allergy'))) ? true : false, + 'auth' => true, + 'btnLabel' => 'Edit', + 'btnLink' => "return load_location('{$GLOBALS['webroot']}/interface/patient_file/summary/stats_full.php?active=all&category=allergy')" + ]; + echo "
"; + echo $t->render('patient/card/allergies.html.twig', $viewArgs); + echo "
"; + } - // ALLERGY CARD - if ($allergy === 1) { - $allergyService = new AllergyIntoleranceService(); - $_rawAllergies = filterActiveIssues($allergyService->getAll(['lists.pid' => $pid])->getData()); - $id = 'allergy_ps_expand'; - $viewArgs = [ - 'title' => xl('Allergies'), - 'card_container_class_list' => ['flex-fill', 'mx-1', 'card'], - 'id' => $id, - 'forceAlwaysOpen' => false, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, - 'linkMethod' => "javascript", - 'list' => $_rawAllergies, - 'listTouched' => (!empty(getListTouch($pid, 'allergy'))) ? true : false, - 'auth' => true, - 'btnLabel' => 'Edit', - 'btnLink' => "return load_location('{$GLOBALS['webroot']}/interface/patient_file/summary/stats_full.php?active=all&category=allergy')" - ]; - echo "
"; - echo $t->render('patient/card/allergies.html.twig', $viewArgs); - echo "
"; - } + $patIssueService = new PatientIssuesService(); - $patIssueService = new PatientIssuesService(); + // MEDICAL PROBLEMS CARD + if ($pl === 1) { + $_rawPL = $patIssueService->search(['lists.pid' => $pid, 'lists.type' => 'medical_problem'])->getData(); + $id = 'medical_problem_ps_expand'; + $viewArgs = [ + 'title' => xl('Medical Problems'), + 'card_container_class_list' => ['flex-fill', 'mx-1', 'card'], + 'id' => $id, + 'forceAlwaysOpen' => false, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, + 'linkMethod' => "javascript", + 'list' => filterActiveIssues($_rawPL), + 'listTouched' => (!empty(getListTouch($pid, 'medical_problem'))) ? true : false, + 'auth' => true, + 'btnLabel' => 'Edit', + 'btnLink' => "return load_location('{$GLOBALS['webroot']}/interface/patient_file/summary/stats_full.php?active=all&category=medical_problem')" + ]; + echo "
"; + echo $t->render('patient/card/medical_problems.html.twig', $viewArgs); + echo "
"; + } - // MEDICAL PROBLEMS CARD - if ($pl === 1) { - $_rawPL = $patIssueService->search(['lists.pid' => $pid, 'lists.type' => 'medical_problem'])->getData(); - $id = 'medical_problem_ps_expand'; - $viewArgs = [ - 'title' => xl('Medical Problems'), - 'card_container_class_list' => ['flex-fill', 'mx-1', 'card'], - 'id' => $id, - 'forceAlwaysOpen' => false, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, - 'linkMethod' => "javascript", - 'list' => filterActiveIssues($_rawPL), - 'listTouched' => (!empty(getListTouch($pid, 'medical_problem'))) ? true : false, - 'auth' => true, - 'btnLabel' => 'Edit', - 'btnLink' => "return load_location('{$GLOBALS['webroot']}/interface/patient_file/summary/stats_full.php?active=all&category=medical_problem')" - ]; - echo "
"; - echo $t->render('patient/card/medical_problems.html.twig', $viewArgs); - echo "
"; - } + // MEDICATION CARD + if ($meds === 1) { + $_rawMedList = $patIssueService->search(['lists.pid' => $pid, 'lists.type' => 'medication'])->getData(); + $id = 'medication_ps_expand'; + $viewArgs = [ + 'title' => xl('Medications'), + 'card_container_class_list' => ['flex-fill', 'mx-1', 'card'], + 'id' => $id, + 'forceAlwaysOpen' => false, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, + 'linkMethod' => "javascript", + 'list' => filterActiveIssues($_rawMedList), + 'listTouched' => (!empty(getListTouch($pid, 'medication'))) ? true : false, + 'auth' => true, + 'btnLabel' => 'Edit', + 'btnLink' => "return load_location('{$GLOBALS['webroot']}/interface/patient_file/summary/stats_full.php?active=all&category=medication')" + ]; + echo "
"; + echo $t->render('patient/card/medication.html.twig', $viewArgs); + echo "
"; + } - // MEDICATION CARD - if ($meds === 1) { - $_rawMedList = $patIssueService->search(['lists.pid' => $pid, 'lists.type' => 'medication'])->getData(); - $id = 'medication_ps_expand'; + // Render the Prescriptions card if turned on + if ($rx === 1) : + if ($GLOBALS['erx_enable'] && $display_current_medications_below == 1) { + $sql = "SELECT * FROM prescriptions WHERE patient_id = ? AND active = '1'"; + $res = sqlStatement($sql, [$pid]); + + $rxArr = []; + while ($row = sqlFetchArray($res)) { + $row['unit'] = generate_display_field(array('data_type' => '1', 'list_id' => 'drug_units'), $row['unit']); + $row['form'] = generate_display_field(array('data_type' => '1', 'list_id' => 'drug_form'), $row['form']); + $row['route'] = generate_display_field(array('data_type' => '1', 'list_id' => 'drug_route'), $row['route']); + $row['interval'] = generate_display_field(array('data_type' => '1', 'list_id' => 'drug_interval'), $row['interval']); + $rxArr[] = $row; + } + $id = "current_prescriptions_ps_expand"; $viewArgs = [ - 'title' => xl('Medications'), - 'card_container_class_list' => ['flex-fill', 'mx-1', 'card'], + 'title' => xl('Current Medications'), 'id' => $id, 'forceAlwaysOpen' => false, 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, - 'linkMethod' => "javascript", - 'list' => filterActiveIssues($_rawMedList), - 'listTouched' => (!empty(getListTouch($pid, 'medication'))) ? true : false, - 'auth' => true, - 'btnLabel' => 'Edit', - 'btnLink' => "return load_location('{$GLOBALS['webroot']}/interface/patient_file/summary/stats_full.php?active=all&category=medication')" + 'auth' => false, + 'rxList' => $rxArr, ]; - echo "
"; - echo $t->render('patient/card/medication.html.twig', $viewArgs); - echo "
"; - } - - // Render the Prescriptions card if turned on - if ($rx === 1) : - if ($GLOBALS['erx_enable'] && $display_current_medications_below == 1) { - $sql = "SELECT * FROM prescriptions WHERE patient_id = ? AND active = '1'"; - $res = sqlStatement($sql, [$pid]); - - $rxArr = []; - while ($row = sqlFetchArray($res)) { - $row['unit'] = generate_display_field(array('data_type' => '1', 'list_id' => 'drug_units'), $row['unit']); - $row['form'] = generate_display_field(array('data_type' => '1', 'list_id' => 'drug_form'), $row['form']); - $row['route'] = generate_display_field(array('data_type' => '1', 'list_id' => 'drug_route'), $row['route']); - $row['interval'] = generate_display_field(array('data_type' => '1', 'list_id' => 'drug_interval'), $row['interval']); - $rxArr[] = $row; - } - $id = "current_prescriptions_ps_expand"; - $viewArgs = [ - 'title' => xl('Current Medications'), - 'id' => $id, - 'forceAlwaysOpen' => false, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, - 'auth' => false, - 'rxList' => $rxArr, - ]; - echo $t->render('patient/card/erx.html.twig', $viewArgs); - } + echo $t->render('patient/card/erx.html.twig', $viewArgs); + } - $id = "prescriptions_ps_expand"; - $viewArgs = [ - 'title' => xl("Prescriptions"), - 'card_container_class_list' => ['flex-fill', 'mx-1', 'card'], - 'id' => $id, - 'forceAlwaysOpen' => false, - 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, - 'btnLabel' => "Edit", - 'auth' => AclMain::aclCheckCore('patients', 'rx', '', ['write', 'addonly']), - ]; + $id = "prescriptions_ps_expand"; + $viewArgs = [ + 'title' => xl("Prescriptions"), + 'card_container_class_list' => ['flex-fill', 'mx-1', 'card'], + 'id' => $id, + 'forceAlwaysOpen' => false, + 'initiallyCollapsed' => (getUserSetting($id) == 0) ? true : false, + 'btnLabel' => "Edit", + 'auth' => AclMain::aclCheckCore('patients', 'rx', '', ['write', 'addonly']), + ]; - if ($GLOBALS['erx_enable']) { - $viewArgs['title'] = 'Prescription History'; - $viewArgs['btnLabel'] = 'Add'; - $viewArgs['btnLink'] = "{$GLOBALS['webroot']}/interface/eRx.php?page=compose"; - } else { - $viewArgs['btnLink'] = "editScripts('{$GLOBALS['webroot']}/controller.php?prescription&list&id=" . attr_url($pid) . "')"; - $viewArgs['linkMethod'] = "javascript"; - $viewArgs['btnClass'] = "iframe"; - } + if ($GLOBALS['erx_enable']) { + $viewArgs['title'] = 'Prescription History'; + $viewArgs['btnLabel'] = 'Add'; + $viewArgs['btnLink'] = "{$GLOBALS['webroot']}/interface/eRx.php?page=compose"; + } else { + $viewArgs['btnLink'] = "editScripts('{$GLOBALS['webroot']}/controller.php?prescription&list&id=" . attr_url($pid) . "')"; + $viewArgs['linkMethod'] = "javascript"; + $viewArgs['btnClass'] = "iframe"; + } - $cwd = getcwd(); - chdir("../../../"); - $c = new Controller(); - // This is a hacky way to get a Smarty template from the controller and injecting it into - // a Twig template. This reduces the amount of refactoring that is required but ideally the - // Smarty template should be upgraded to Twig - ob_start(); - echo $c->act(['prescription' => '', 'fragment' => '', 'patient_id' => $pid]); - $viewArgs['content'] = ob_get_contents(); - ob_end_clean(); - - echo "
"; - echo $t->render('patient/card/rx.html.twig', $viewArgs); // render core prescription card - echo "
"; - endif; - ?> -
+ $cwd = getcwd(); + chdir("../../../"); + $c = new Controller(); + // This is a hacky way to get a Smarty template from the controller and injecting it into + // a Twig template. This reduces the amount of refactoring that is required but ideally the + // Smarty template should be upgraded to Twig + ob_start(); + echo $c->act(['prescription' => '', 'fragment' => '', 'patient_id' => $pid]); + $viewArgs['content'] = ob_get_contents(); + ob_end_clean(); + + echo "
"; + echo $t->render('patient/card/rx.html.twig', $viewArgs); // render core prescription card + echo "
"; + endif; + ?> +
dispatch(new SectionEvent('primary'), SectionEvent::EVENT_HANDLE); $sectionRenderEvents->addCard(new DemographicsViewCard($result, $result2, ['dispatcher' => $ed])); + if (!$GLOBALS['hide_billing_widget']) { $sectionRenderEvents->addCard(new BillingViewCard($pid, $insco_name, $result['billing_note'], $result3, ['dispatcher' => $ed])); } - $sectionRenderEvents->addCard(new InsuranceViewCard($pid, ['dispatcher' => $ed])); + + if (!in_array('card_insurance', $hiddenCards)) { + $sectionRenderEvents->addCard(new InsuranceViewCard($pid, ['dispatcher' => $ed])); + } + // Get the cards to render $sectionCards = $sectionRenderEvents->getCards(); // if anyone wants to render anything before the patient demographic list @@ -1622,7 +1632,7 @@ function filterActiveIssues(array $i): array $displayAppts = true; $current_date2 = date('Y-m-d'); $events = array(); - $apptNum = (int) $GLOBALS['number_of_appts_to_show']; + $apptNum = (int)$GLOBALS['number_of_appts_to_show']; $apptNum2 = ($apptNum != 0) ? abs($apptNum) : 10; $mode1 = !$GLOBALS['appt_display_sets_option']; @@ -1677,7 +1687,7 @@ function filterActiveIssues(array $i): array break; } } - // Break in the loop to improve performance + // Break in the loop to improve performance case 1: $firstApptIndx = 0; for ($i = 1; $i <= $limitApptIndx; ++$i) { @@ -1686,7 +1696,7 @@ function filterActiveIssues(array $i): array break; } } - // Break in the loop to improve performance + // Break in the loop to improve performance } if ($extraApptDate) { @@ -1916,29 +1926,28 @@ function filterActiveIssues(array $i): array endif; ?>
-
-
- - oeBelowContainerDiv(); ?> - + + + + oeBelowContainerDiv(); ?> + dispatch(new RenderEvent($pid), RenderEvent::EVENT_RENDER_POST_PAGELOAD, 10); ?> diff --git a/interface/super/edit_globals.php b/interface/super/edit_globals.php index 7fa928bd852..074b1508d2a 100644 --- a/interface/super/edit_globals.php +++ b/interface/super/edit_globals.php @@ -13,7 +13,7 @@ * @copyright Copyright (c) 2010 Rod Roark * @copyright Copyright (c) 2016-2019 Brady Miller * @copyright Copyright (c) 2019 Ranganath Pathak - * @copyright Copyright (c) 2020 Jerry Padgett + * @copyright Copyright (c) 2020-2024 Jerry Padgett * @copyright Copyright (c) 2022 Discover and Change * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 */ @@ -657,13 +657,14 @@ function checkBackgroundServices() ['card_abrev' => attr('card_allergies'), 'card_name' => xlt('Allergies')], ['card_abrev' => attr('card_amendments'), 'card_name' => xlt('Amendments')], ['card_abrev' => attr('card_disclosure'), 'card_name' => xlt('Disclosures')], + ['card_abrev' => attr('card_insurance'), 'card_name' => xlt('Insurance')], ['card_abrev' => attr('card_lab'), 'card_name' => xlt('Labs')], ['card_abrev' => attr('card_medicalproblems'), 'card_name' => xlt('Medical Problems')], ['card_abrev' => attr('card_medication'), 'card_name' => xlt('Medications')], - //['card_abrev' => 'card_rx', 'card_name' => 'Prescriptions'], // For now don't hide because can be disabled as feature. + ['card_abrev' => 'card_prescriptions', 'card_name' => 'Prescriptions'], // For now don't hide because can be disabled as feature. ['card_abrev' => attr('card_vitals'), 'card_name' => xlt('Vitals')] ); - echo " \n"; foreach ($res as $row) { echo "