quick minor path updates (#1968)
[openemr.git] / library / encounter.inc
blob72123e84d0b2f2a3ad69a37ae79f3ea82caf02a5
1 <?php
2 include_once("../../globals.php");
3 include_once("$srcdir/forms.inc");
5 //function called to set the global session variable for encounter number
6 function setencounter($enc)
9     // Escape $enc by forcing it to an integer to protect from sql injection
10     $enc = intval($enc);
12     $return_val = 1;
13     global $encounter;
14     global $pid;
15     global $attendant_type;
17     $attendant_id = $attendant_type == 'pid' ? $pid : $_SESSION['therapy_group'];
18     if ($enc == "") {
19         $enc = date("Ymd");
20         if (getFormByEncounter($attendant_id, $enc)) {
21             //there is an encounter enterred for today
22         } else {
23             //addForm($enc, "New Patient Encounter", 0, $pid, 1);
24             $return_val = 0;
25         }
26     }
28     $_SESSION['encounter']=$enc;
29     $encounter=$enc;
30     
31     
32     //returns 1 on successful global set, or 0 if there was no
33     //current encounter, signifying that the interface should load
34     //the screen for a new encounter
35     return $return_val;
39 //fetches encounter pc_catid by encounter number
40 function fetchCategoryIdByEncounter($encounter)
42     global $attendant_type;
43     $table = $attendant_type == 'pid' ? 'form_encounter' : 'form_groups_encounter';
44     $sql = "select pc_catid from $table where encounter=? limit 1";
45     $result = sqlQuery($sql, array($encounter));
46     return $result['pc_catid'];