Skip to content

Commit

Permalink
Some portal cleanup and fixes (#4221)
Browse files Browse the repository at this point in the history
* Some portal cleanup and fixes
- add portal session destroy in session utils to prevent logging to system log.
- remove unneeded demographics
- fix layout excludes!!!
- default providers to Admin
- only allow/list providers that have portal auth in their users permissions
- fix register again!

* - only allow auth portal providers in mail.

* - add CurrentDate and CurrentTime tags to both template downloads
- fix portal secure messaging
- minor nitpick of utility escaping function vars

* - style compromise between FF, Chrome!
  • Loading branch information
sjpadgett committed Feb 6, 2021
1 parent 5102af2 commit 0685a72
Show file tree
Hide file tree
Showing 16 changed files with 878 additions and 1,036 deletions.
39 changes: 38 additions & 1 deletion interface/patient_file/download_template.php
Expand Up @@ -10,11 +10,13 @@
* @link http://www.open-emr.org
* @author Rod Roark <rod@sunsetsystems.com>
* @author Brady Miller <brady.g.miller@gmail.com>
* @author Ruth Moulton
* @copyright Copyright (c) 2013-2014 Rod Roark <rod@sunsetsystems.com>
* @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/

/* 3-feb-21 RM - addition of {CurrentDate} and {CurrentTime} */
require_once('../globals.php');
require_once($GLOBALS['srcdir'] . '/appointments.inc.php');
require_once($GLOBALS['srcdir'] . '/options.inc.php');
Expand Down Expand Up @@ -207,6 +209,42 @@ function doSubs($s)
$s = keyReplace($s, dataFixup(getIssues('medication'), xl('Medications')));
} elseif (keySearch($s, '{ProblemList}')) {
$s = keyReplace($s, dataFixup(getIssues('medical_problem'), xl('Problem List')));
} elseif (preg_match('/^{CurrentDate:?.*}/', substr($s, $keyLocation), $matches)) {
/* defaults to ISO standard date format yyyy-mm-dd
* modified by string following ':' as follows
* 'global' will use the global date format setting
* 'YYYY-MM-DD', 'MM/DD/YYYY', 'DD/MM/YYYY' overide the global setting
* anything else is ignored
*
* oeFormatShortDate($date = 'today', $showYear = true) - OpenEMR function to format
* date using global setting, defaults to ISO standard yyyy-mm-dd
*/
$keyLength = strlen($matches[0]);
$matched = $matches[0];
$format = 'Y-m-d'; /* default yyyy-mm-dd */
$currentdate = '';
if (preg_match('/GLOBAL/i', $matched, $matches)) {
/* use global setting */
$currentdate = oeFormatShortDate(date('Y-m-d'), true);
} elseif (
/* there's an overiding format */
preg_match('/YYYY-MM-DD/i', $matched, $matches)
) {
/* nothing to do here as this is the default format */
} elseif (preg_match('[MM/DD/YYYY]i', $matched, $matches)) {
$format = 'm/d/Y';
} elseif (preg_match('[DD/MM/YYYY]i', $matched, $matches)) {
$format = 'd/m/Y';
}

if (!$currentdate) {
$currentdate = date($format); /* get the current date in specified format */
}
$s = keyReplace($s, dataFixup($currentdate, xl('Date')));
} elseif (keySearch($s, '{CurrentTime}')) {
$format = 'H:i'; /* 24 hour clock with leading zeros */
$currenttime = date($format); /* format to hh:mm for local time zone */
$s = keyReplace($s, dataFixup($currenttime, xl('Time')));
} elseif (keySearch($s, '{GRP}')) { // This tag indicates the fields from here until {/GRP} are a group
// of fields separated by semicolons. Fields with no data are omitted, and fields with
// data are prepended with their field label from the form layout.
Expand All @@ -217,7 +255,6 @@ function doSubs($s)
if ($groupLevel > 0) {
--$groupLevel;
}

$s = keyReplace($s, '');
} elseif (preg_match('/^\{ITEMSEP\}(.*?)\{\/ITEMSEP\}/', substr($s, $keyLocation), $matches)) {
// This is how we specify the separator between group items in a way that
Expand Down
8 changes: 4 additions & 4 deletions library/js/utility.js
Expand Up @@ -26,20 +26,20 @@ function xl(string) {
// html escaping functions - special case when sending js string to html (see codebase for examples)
// jsText (equivalent to text() )
// jsAttr (equivalent to attr() )
var htmlEscapesText = {
const htmlEscapesText = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;'
};
var htmlEscapesAttr = {
const htmlEscapesAttr = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#x27;'
};
var htmlEscaperText = /[&<>]/g;
var htmlEscaperAttr = /[&<>"']/g;
const htmlEscaperText = /[&<>]/g;
const htmlEscaperAttr = /[&<>"']/g;
jsText = function(string) {
return ('' + string).replace(htmlEscaperText, function(match) {
return htmlEscapesText[match];
Expand Down
2 changes: 1 addition & 1 deletion portal/account/register.php
Expand Up @@ -171,7 +171,7 @@ function restoreSession() {
// need these for validation.
profile.find('select#providerid option:contains("Unassigned")').val('');
// must have a provider for many reasons. w/o save won't work.
profile.find('select#providerid').attr('required', true);
//profile.find('select#providerid').attr('required', true);
profile.find('select#sex option:contains("Unassigned")').val('');
profile.find('select#sex').attr('required', true);

Expand Down
5 changes: 2 additions & 3 deletions portal/home.php
Expand Up @@ -24,7 +24,7 @@
use OpenEMR\Core\Header;

if (isset($_SESSION['register']) && $_SESSION['register'] === true) {
require_once(dirname(__FILE__) . "/../src/Common/Session/SessionUtil.php");
require_once(__DIR__ . "/../src/Common/Session/SessionUtil.php");
OpenEMR\Common\Session\SessionUtil::portalSessionCookieDestroy();
header('Location: ' . $landingpage . '&w');
exit();
Expand Down Expand Up @@ -405,8 +405,7 @@ function startAssessment(param, assessmentOID) {
<i class="fa fa-user"></i>
</div>
<div class="float-left info">
<p><?php echo xlt('Welcome') . ' ' . text($result['fname'] . " " . $result['lname']); ?></p>
<a href="#"><i class="fa fa-circle text-success"></i> <?php echo xlt('Online'); ?></a>
<p><?php echo xlt('Welcome') . ' ' . text($result['fname']); ?></p>
</div>
</div>
<!-- css class was sidebar-menu -->
Expand Down
39 changes: 38 additions & 1 deletion portal/lib/download_template.php
Expand Up @@ -4,7 +4,7 @@
* Document Template Download Module.
*
* Copyright (C) 2013-2014 Rod Roark <rod@sunsetsystems.com>
* Copyright (C) 2016-2020 Jerry Padgett <sjpadgett@gmail.com>
* Copyright (C) 2016-2021 Jerry Padgett <sjpadgett@gmail.com>
*
* LICENSE: This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand All @@ -20,6 +20,7 @@
* @package OpenEMR
* @author Rod Roark <rod@sunsetsystems.com>
* @author Jerry Padgett <sjpadgett@gmail.com>
* @author Ruth Moulton
* @link http://www.open-emr.org
*/

Expand Down Expand Up @@ -378,6 +379,42 @@ function doSubs($s)
}
}
$s = keyReplace($s, dataFixup($data, $title));
} elseif (preg_match('/^{CurrentDate:?.*}/', substr($s, $keyLocation), $matches)) {
/* defaults to ISO standard date format yyyy-mm-dd
* modified by string following ':' as follows
* 'global' will use the global date format setting
* 'YYYY-MM-DD', 'MM/DD/YYYY', 'DD/MM/YYYY' override the global setting
* anything else is ignored
*
* oeFormatShortDate($date = 'today', $showYear = true) - OpenEMR function to format
* date using global setting, defaults to ISO standard yyyy-mm-dd
*/
$keyLength = strlen($matches[0]);
$matched = $matches[0];
$format = 'Y-m-d'; /* default yyyy-mm-dd */
$currentdate = '';
if (preg_match('/GLOBAL/i', $matched, $matches)) {
/* use global setting */
$currentdate = oeFormatShortDate(date('Y-m-d'), true);
} elseif (
/* there's an overiding format */
preg_match('/YYYY-MM-DD/i', $matched, $matches)
) {
/* nothing to do here as this is the default format */
} elseif (preg_match('[MM/DD/YYYY]i', $matched, $matches)) {
$format = 'm/d/Y';
} elseif (preg_match('[DD/MM/YYYY]i', $matched, $matches)) {
$format = 'd/m/Y';
}

if (!$currentdate) {
$currentdate = date($format); /* get the current date in specified format */
}
$s = keyReplace($s, dataFixup($currentdate, xl('Date')));
} elseif (keySearch($s, '{CurrentTime}')) {
$format = 'H:i'; /* 24 hour clock with leading zeros */
$currenttime = date($format); /* format to hh:mm for local time zone */
$s = keyReplace($s, dataFixup($currenttime, xl('Time')));
}
} // End if { character found.

Expand Down

0 comments on commit 0685a72

Please sign in to comment.