Skip to content

Commit

Permalink
Visolve: Clear Active Patient Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
visolve-openemr authored and bradymiller committed Dec 28, 2012
1 parent 1b701ba commit 94456a5
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
22 changes: 20 additions & 2 deletions interface/main/left_nav.php
Expand Up @@ -551,6 +551,23 @@ function goHome() {
top.frames['RBot'].location='messages/messages.php?form_active=1';
}

//Function to clear active patient and encounter in the server side
function clearactive() {
top.restoreSession();
//Ajax call to clear active patient in session
$.ajax({
type: "POST",
url: "<?php echo $GLOBALS['webroot'] ?>/library/ajax/unset_session_ajax.php",
data: { func: "unset_pid"},
success:function( msg ) {
clearPatient();
top.frames['RTop'].location='<?php echo $GLOBALS['default_top_pane']?>';
top.frames['RBot'].location='messages/messages.php?form_active=1';
}
});

$(parent.Title.document.getElementById('clear_active')).hide();
}
// Reference to the search.php window.
var my_window;

Expand Down Expand Up @@ -713,6 +730,7 @@ function setPatient(pname, pid, pubpid, frname, str_dob) {
}

reloadIssues(pid);
$(parent.Title.document.getElementById('clear_active')).show();//To display Clear Active Patient button on selecting a patient
}
function setPatientEncounter(EncounterIdArray,EncounterDateArray,CalendarCategoryArray) {
//This function lists all encounters of the patient.
Expand Down Expand Up @@ -790,9 +808,9 @@ function clearPatient() {
active_pid = 0;
active_encounter = 0;
setDivContent('current_patient', '<b><?php xl('None','e'); ?></b>');
setTitleContent('current_patient', '<b><?php xl('None','e'); ?></b>');
$(parent.Title.document.getElementById('current_patient_block')).hide();
top.window.parent.Title.document.getElementById('past_encounter').innerHTML='';
top.window.parent.Title.document.getElementById('current_encounter').innerHTML="<b><?php echo htmlspecialchars( xl('None'), ENT_QUOTES) ?></b>";
$(parent.Title.document.getElementById('current_encounter_block')).hide();
reloadPatient('');
syncRadios();
}
Expand Down
3 changes: 3 additions & 0 deletions interface/main/main_title.php
Expand Up @@ -79,6 +79,9 @@ function showhideMenu() {
<tr><td style="vertical-align:text-bottom;">
<a href='' class="css_button_small" style="margin:0px;vertical-align:top;" id='new0' onClick=" return top.window.parent.left_nav.loadFrame2('new0','RTop','new/new.php')">
<span><?php echo htmlspecialchars( xl('NEW PATIENT'), ENT_QUOTES); ?></span></a>
&nbsp;
<a href='' class="css_button_small" style="margin:0px;vertical-align:top;display:none;" id='clear_active' onClick="javascript:parent.left_nav.clearactive();return false;">
<span><?php echo htmlspecialchars( xl('CLEAR ACTIVE PATIENT'), ENT_QUOTES); ?></span></a>
</td></tr>
<?php } //end of acl_check('patients','demo','',array('write','addonly') if ?>

Expand Down
33 changes: 33 additions & 0 deletions library/ajax/unset_session_ajax.php
@@ -0,0 +1,33 @@
<?php
/**
* library/ajax/unset_session_ajax.php Clear active patient on the server side.
*
* Copyright (C) 2012 Visolve <services@visolve.com>
*
* LICENSE: This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
*
* @package OpenEMR
* @author Visolve <services@visolve.com>
* @link http://www.open-emr.org
*/
$fake_register_globals=false;
$sanitize_all_escapes=true;

require_once("../../interface/globals.php");
require_once("../pid.inc");

//Setpid function is called on receiving an ajax request.
if(($_POST['func']=="unset_pid"))
{
setpid(0);
}
?>

0 comments on commit 94456a5

Please sign in to comment.