minor bug fix
[openemr.git] / library / pid.inc
blob44bd3c77bd1edf42a4a437acc98e73dac2834533
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   // Be careful not to clear the encounter unless the pid is really changing.
15   if (!isset($_SESSION['pid']) || $pid != $new_pid || $pid != $_SESSION['pid']) {
16     $_SESSION['encounter'] = $encounter = 0;
17   }
19   $_SESSION['pid'] = $new_pid;
20   $pid = $new_pid;
22   newEvent("view", $_SESSION["authUser"], $_SESSION["authProvider"], 1, $pid);