Fixed bug where session encounter is not cleared when selecting a new patient, and...
[openemr.git] / library / pid.inc
bloba17e0d6f89c9713d4aba5346d853a94f8da15c22
1 <?php
2 // This program is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU General Public License
4 // as published by the Free Software Foundation; either version 2
5 // of the License, or (at your option) any later version.
7 require_once("$srcdir/../interface/globals.php");
8 require_once("$srcdir/log.inc");
10 // Function called to set the global session variable for patient id (pid) number.
11 function setpid($new_pid) {
12   global $pid, $encounter;
14   if (isset($_SESSION['pid']) && $pid == $new_pid && $pid == $_SESSION['pid'])
15     return;
17   $_SESSION['pid'] = $new_pid;
18   $pid = $new_pid;
20   $_SESSION['encounter'] = $encounter = 0;
22   newEvent("view", $_SESSION["authUser"], $_SESSION["authProvider"], $pid);