Syntax fixes - static methods, call by reference and undefined variables
authorKevin Yeh <kevinyeh@alum.mit.edu>
Tue, 9 Apr 2013 16:00:00 +0000 (9 12:00 -0400)
committerKevin Yeh <kevinyeh@alum.mit.edu>
Tue, 9 Apr 2013 16:05:47 +0000 (9 12:05 -0400)
gacl/gacl.class.php
interface/main/calendar/modules/PostCalendar/common.api.php
interface/main/calendar/modules/PostCalendar/pnincludes/Date/Calc.php
interface/main/calendar/modules/PostCalendar/pnuser.php
interface/main/calendar/modules/PostCalendar/pnuserapi.php
interface/patient_file/encounter/encounter_top.php
interface/patient_file/encounter/forms.php
library/classes/Address.class.php
library/classes/PhoneNumber.class.php
library/classes/Prescription.class.php
library/log.inc

index b4f3017..cda2e48 100644 (file)
@@ -34,6 +34,7 @@
 /*
  * Path to ADODB.
  */
+
 if ( !defined('ADODB_DIR') ) {
        define('ADODB_DIR', dirname(__FILE__).'/adodb');
 }
@@ -496,19 +497,19 @@ class gacl {
                        }
 
                         if ($return_all) {
-                                while ($arr =& $rs->fetchRow()) {
+                                while ($arr = $rs->FetchRow()) {
                                         $row[] = $arr;
                                 }
                         }
                         else {
-                               $row =& $rs->FetchRow();
+                               $row = $rs->FetchRow();
                         }
 
 
                        /*
                         * Return ACL ID. This is the key to "hooking" extras like pricing assigned to ACLs etc... Very useful.
                         */
-                       if (is_array($row)) {
+                       if (isset($row) && is_array($row)) {
 
                                 if ($return_all) {
                                         foreach ($row as $single_row) {
@@ -556,7 +557,7 @@ class gacl {
                {
                        $this->debug_text("<b>acl_query():</b> ACO Section: $aco_section_value ACO Value: $aco_value ARO Section: $aro_section_value ARO Value $aro_value ACL ID: ". $retarr['acl_id'] .' Result: '. $retarr['allow']);
                }
-               
+       
                return $retarr;
        }
 
index e211d0c..cae1b11 100755 (executable)
@@ -196,7 +196,7 @@ function postcalendar_removeScriptTags($in)
     return preg_replace("/<script.*?>(.*?)<\/script>/","",$in);
 }
 
-function &postcalendar_getDate($format='%Y%m%d')
+function postcalendar_getDate($format='%Y%m%d')
 {
     list($Date, $jumpday, $jumpmonth, $jumpyear, $jumpdate) =
         pnVarCleanFromInput('Date', 'jumpday', 'jumpmonth', 'jumpyear', 'jumpdate');
index 5739833..34dbbde 100644 (file)
@@ -42,7 +42,7 @@ class Date_Calc {
      * @return string the current date in specified format
      */
 
-    function dateNow($format="%Y%m%d")
+    static function dateNow($format="%Y%m%d")
     {
         return(strftime($format,time()));
 
@@ -60,7 +60,7 @@ class Date_Calc {
      * @return boolean true/false
      */
 
-    function isValidDate($day, $month, $year)
+    static function isValidDate($day, $month, $year)
     {
 
         if(empty($year) || empty($month) || empty($day))
@@ -85,7 +85,7 @@ class Date_Calc {
 
     } // end func isValidDate
 
-    function isLeapYear($year="")
+    static function isLeapYear($year="")
     {
 
         if(empty($year))
@@ -113,7 +113,7 @@ class Date_Calc {
      * @return boolean true/false
      */
 
-    function isFutureDate($day,$month,$year)
+    static function isFutureDate($day,$month,$year)
     {
         $this_year = Date_Calc::dateNow("%Y");
         $this_month = Date_Calc::dateNow("%m");
@@ -145,7 +145,7 @@ class Date_Calc {
      * @return boolean true/false
      */
 
-    function isPastDate($day,$month,$year)
+    static function isPastDate($day,$month,$year)
     {
         $this_year = Date_Calc::dateNow("%Y");
         $this_month = Date_Calc::dateNow("%m");
@@ -177,7 +177,7 @@ class Date_Calc {
      * @return int $weekday_number
      */
 
-    function dayOfWeek($day="",$month="",$year="")
+    static function dayOfWeek($day="",$month="",$year="")
     {
 
         if(empty($year))
@@ -219,7 +219,7 @@ class Date_Calc {
      * @return integer $week_number
      */
 
-    function weekOfYear($day,$month,$year)
+    static function weekOfYear($day,$month,$year)
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -251,7 +251,7 @@ class Date_Calc {
      * @return int $julian
      */
 
-    function julianDate($day="",$month="",$year="")
+    static function julianDate($day="",$month="",$year="")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -283,7 +283,7 @@ class Date_Calc {
      * @return int $year_quarter
      */
 
-    function quarterOfYear($day="",$month="",$year="")
+    static function quarterOfYear($day="",$month="",$year="")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -311,7 +311,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function beginOfNextMonth($day="",$month="",$year="",$format="%Y%m%d")
+    static function beginOfNextMonth($day="",$month="",$year="",$format="%Y%m%d")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -349,7 +349,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function endOfNextMonth($day="",$month="",$year="",$format="%Y%m%d")
+    static function endOfNextMonth($day="",$month="",$year="",$format="%Y%m%d")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -388,7 +388,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function beginOfPrevMonth($day="",$month="",$year="",$format="%Y%m%d")
+    static function beginOfPrevMonth($day="",$month="",$year="",$format="%Y%m%d")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -426,7 +426,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function endOfPrevMonth($day="",$month="",$year="",$format="%Y%m%d")
+    static function endOfPrevMonth($day="",$month="",$year="",$format="%Y%m%d")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -465,7 +465,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function nextWeekday($day="",$month="",$year="",$format="%Y%m%d")
+    static function nextWeekday($day="",$month="",$year="",$format="%Y%m%d")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -501,7 +501,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function prevWeekday($day="",$month="",$year="",$format="%Y%m%d")
+    static function prevWeekday($day="",$month="",$year="",$format="%Y%m%d")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -539,7 +539,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function nextDayOfWeek($dow,$day="",$month="",$year="",$format="%Y%m%d",$onOrAfter=false)
+    static function nextDayOfWeek($dow,$day="",$month="",$year="",$format="%Y%m%d",$onOrAfter=false)
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -581,7 +581,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function prevDayOfWeek($dow,$day="",$month="",$year="",$format="%Y%m%d",$onOrBefore=false)
+    static function prevDayOfWeek($dow,$day="",$month="",$year="",$format="%Y%m%d",$onOrBefore=false)
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -622,7 +622,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function nextDayOfWeekOnOrAfter($dow,$day="",$month="",$year="",$format="%Y%m%d")
+    static function nextDayOfWeekOnOrAfter($dow,$day="",$month="",$year="",$format="%Y%m%d")
     {
         return(Date_Calc::nextDayOfWeek($dow,$day="",$month="",$year="",$format="%Y%m%d",true));
     } // end func nextDayOfWeekOnOrAfter
@@ -642,7 +642,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function prevDayOfWeekOnOrBefore($dow,$day="",$month="",$year="",$format="%Y%m%d")
+    static function prevDayOfWeekOnOrBefore($dow,$day="",$month="",$year="",$format="%Y%m%d")
     {
         return(Date_Calc::prevDayOfWeek($dow,$day="",$month="",$year="",$format="%Y%m%d",true));
 
@@ -661,7 +661,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function nextDay($day="",$month="",$year="",$format="%Y%m%d")
+    static function nextDay($day="",$month="",$year="",$format="%Y%m%d")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -689,7 +689,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function prevDay($day="",$month="",$year="",$format="%Y%m%d")
+    static function prevDay($day="",$month="",$year="",$format="%Y%m%d")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -715,7 +715,7 @@ class Date_Calc {
      * @return string 4 digit year
      */
 
-    function defaultCentury($year)
+    static function defaultCentury($year)
     {
         if(strlen($year) == 1)
             $year = "0$year";
@@ -742,7 +742,7 @@ class Date_Calc {
      *      -1 if there is an error.
      */
 
-    function dateDiff($day1,$month1,$year1,$day2,$month2,$year2)
+    static function dateDiff($day1,$month1,$year1,$day2,$month2,$year2)
     {
         if(!Date_Calc::isValidDate($day1,$month1,$year1))
             return -1;
@@ -764,7 +764,7 @@ class Date_Calc {
      * @return int number of days
      */
 
-    function daysInMonth($month="",$year="")
+    static function daysInMonth($month="",$year="")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -798,7 +798,7 @@ class Date_Calc {
      * @return int number of weeks
      */
 
-    function weeksInMonth($month="",$year="")
+    static function weeksInMonth($month="",$year="")
     {
         if(empty($year)) {
             $year = Date_Calc::dateNow("%Y");
@@ -838,7 +838,7 @@ class Date_Calc {
      * @return int number of weekday for the first day, 0=Sunday
      */
 
-    function firstOfMonthWeekday($month="",$year="")
+    static function firstOfMonthWeekday($month="",$year="")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -861,7 +861,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function beginOfMonth($month="",$year="",$format="%Y%m%d")
+    static function beginOfMonth($month="",$year="",$format="%Y%m%d")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -886,7 +886,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function beginOfWeek($day="",$month="",$year="",$format="%Y%m%d")
+    static function beginOfWeek($day="",$month="",$year="",$format="%Y%m%d")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -932,7 +932,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function endOfWeek($day="",$month="",$year="",$format="%Y%m%d")
+    static function endOfWeek($day="",$month="",$year="",$format="%Y%m%d")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -964,7 +964,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function beginOfNextWeek($day="",$month="",$year="",$format="%Y%m%d")
+    static function beginOfNextWeek($day="",$month="",$year="",$format="%Y%m%d")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -1002,7 +1002,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function beginOfPrevWeek($day="",$month="",$year="",$format="%Y%m%d")
+    static function beginOfPrevWeek($day="",$month="",$year="",$format="%Y%m%d")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -1039,7 +1039,7 @@ class Date_Calc {
      * @return array $week[$weekday]
      */
 
-    function getCalendarWeek($day="",$month="",$year="",$format="%Y%m%d")
+    static function getCalendarWeek($day="",$month="",$year="",$format="%Y%m%d")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -1077,7 +1077,7 @@ class Date_Calc {
      * @return array $month[$row][$col]
      */
 
-    function getCalendarMonth($month="",$year="",$format="%Y%m%d")
+    static function getCalendarMonth($month="",$year="",$format="%Y%m%d")
     {
         if(empty($year)) $year = Date_Calc::dateNow("%Y");
         if(empty($month)) $month = Date_Calc::dateNow("%m");
@@ -1129,7 +1129,7 @@ class Date_Calc {
      * @return array $year[$month][$row][$col]
      */
 
-    function getCalendarYear($year="",$format="%Y%m%d")
+    static function getCalendarYear($year="",$format="%Y%m%d")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -1156,7 +1156,7 @@ class Date_Calc {
      * @return integer number of days
      */
 
-    function dateToDays($day,$month,$year)
+    static function dateToDays($day,$month,$year)
     {
 
         $century = substr($year,0,2);
@@ -1194,7 +1194,7 @@ class Date_Calc {
      * @return string date in specified format
      */
 
-    function daysToDate($days,$format="%Y%m%d")
+    static function daysToDate($days,$format="%Y%m%d")
     {
 
         $days         -=     1721119;
@@ -1244,7 +1244,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function NWeekdayOfMonth($occurance,$dayOfWeek,$month,$year,$format="%Y%m%d")    {
+    static function NWeekdayOfMonth($occurance,$dayOfWeek,$month,$year,$format="%Y%m%d")    {
 
         $year = sprintf("%04d",$year);
         $month = sprintf("%02d",$month);
@@ -1301,7 +1301,7 @@ class Date_Calc {
      * @return string date in given format
      */
 
-    function dateFormat($day,$month,$year,$format)
+    static function dateFormat($day,$month,$year,$format)
     {
         if(!Date_Calc::isValidDate($day,$month,$year))
         {
@@ -1390,7 +1390,7 @@ class Date_Calc {
      * @return string year in format CCYY
      */
 
-    function getYear()
+    static function getYear()
     {
         return Date_Calc::dateNow("%Y");
 
@@ -1404,7 +1404,7 @@ class Date_Calc {
      * @return string month in format MM
      */
 
-    function getMonth()
+    static function getMonth()
     {
         return Date_Calc::dateNow("%m");
 
@@ -1418,7 +1418,7 @@ class Date_Calc {
      * @return string day in format DD
      */
 
-    function getDay()
+    static function getDay()
     {
         return Date_Calc::dateNow("%d");
 
@@ -1434,7 +1434,7 @@ class Date_Calc {
      * @return string full month name
      */
 
-    function getMonthFullname($month)
+    static function getMonthFullname($month)
     {
         $month = (int)$month;
 
@@ -1460,7 +1460,7 @@ class Date_Calc {
      * @see Date_Calc::getMonthFullname
      */
 
-    function getMonthAbbrname($month,$length=3)
+    static function getMonthAbbrname($month,$length=3)
     {
         $month = (int)$month;
 
@@ -1481,7 +1481,7 @@ class Date_Calc {
      * @return string full month name
      */
 
-    function getWeekdayFullname($day="",$month="",$year="")
+    static function getWeekdayFullname($day="",$month="",$year="")
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -1511,7 +1511,7 @@ class Date_Calc {
      * @see Date_Calc::getWeekdayFullname
      */
 
-    function getWeekdayAbbrname($day="",$month="",$year="",$length=3)
+    static function getWeekdayAbbrname($day="",$month="",$year="",$length=3)
     {
         if(empty($year))
             $year = Date_Calc::dateNow("%Y");
@@ -1531,7 +1531,7 @@ class Date_Calc {
     * @param    string  month name
     * @return   integer month number
     */
-    function getMonthFromFullName($month){
+    static function getMonthFromFullName($month){
         $month = strtolower($month);
         $months = Date_Calc::getMonthNames();
         while(list($id, $name) = each($months)){
@@ -1551,7 +1551,7 @@ class Date_Calc {
     *
     * @returns array An array of month names
     */
-    function getMonthNames(){
+    static function getMonthNames(){
         for($i=1;$i<13;$i++){
             $months[$i] = strftime('%B', mktime(0, 0, 0, $i, 1, 2001));
         }
@@ -1567,7 +1567,7 @@ class Date_Calc {
     *
     * @returns array An array of week day names
     */
-    function getWeekDays(){
+    static function getWeekDays(){
         for($i=0;$i<7;$i++){
             $weekdays[$i] = strftime('%A', mktime(0, 0, 0, 1, $i, 2001));
         }
index ffb1d5d..dfaf318 100644 (file)
@@ -69,7 +69,7 @@ function postcalendar_user_view()
                                           'jumpday',
                                           'jumpmonth',
                                           'jumpyear');
-    $Date =postcalendar_getDate();
+    $Date =postcalendar_getDate();
     if(!isset($viewtype))   $viewtype = _SETTING_DEFAULT_VIEW;
     
     // added to allow the view & providers to remain as the user last saw it -- JRM
index 591ae4c..b10f631 100644 (file)
@@ -115,7 +115,7 @@ function postcalendar_userapi_buildView($args)
        //=================================================================
        //  set the correct date
        //=================================================================
-       $Date =postcalendar_getDate();
+       $Date =postcalendar_getDate();
 
        //=================================================================
        //  get the current view
@@ -498,7 +498,7 @@ function postcalendar_userapi_buildView($args)
                $tpl->assign_by_ref('MONTH_END_DATE',$month_view_end);
                $tpl->assign_by_ref('TODAY_DATE',$today_date);
                $tpl->assign_by_ref('DATE',$Date);
-               $tpl->assign_by_ref('SCHEDULE_BASE_URL', pnModURL(__POSTCALENDAR__,'user','submit'));
+               $tpl->assign('SCHEDULE_BASE_URL', pnModURL(__POSTCALENDAR__,'user','submit'));
                $tpl->assign_by_ref('interval',$intervals);
         };
 
@@ -1239,7 +1239,7 @@ function &postcalendar_userapi_pcGetEvents($args)
     $s_keywords = $s_category = $s_topic = '';
     extract($args);
        
-    $date =postcalendar_getDate();
+    $date =postcalendar_getDate();
     $cy = substr($date,0,4);
     $cm = substr($date,4,2);
     $cd = substr($date,6,2);
@@ -1269,20 +1269,20 @@ function &postcalendar_userapi_pcGetEvents($args)
     
     if ($faFlag && !isset($events)) {
         $a = array('faFlag' => true,'start'=>$start_date,'end'=>$end_date,'s_keywords'=>$s_keywords,'s_category'=>$s_category,'s_topic'=>$s_topic,'viewtype'=>$viewtype, 'provider_id' => $provider_id, 'event_status' => $event_status);
-        $events =& pnModAPIFunc(__POSTCALENDAR__,'user','<strong></strong>pcQueryEventsFA',$a);
+        $events = pnModAPIFunc(__POSTCALENDAR__,'user','<strong></strong>pcQueryEventsFA',$a);
     }
     elseif ($collideFlag && !isset($events)) {
         $a = array('collideFlag' => true,'start'=>$start_date,'end'=>$end_date, 'provider_id' => $provider_id, 'collide_stime' => $stime, 'collide_etime' => $etime);
-        $events =& pnModAPIFunc(__POSTCALENDAR__,'user','pcQueryEventsFA',$a);
+        $events = pnModAPIFunc(__POSTCALENDAR__,'user','pcQueryEventsFA',$a);
     }
     elseif ($listappsFlag && !isset($events)) {
         $a = array('listappsFlag' => true,'start'=>$start_date,'end'=>$end_date, 'patient_id' => $patient_id, 's_keywords' => $s_keywords);
-        $events =& pnModAPIFunc(__POSTCALENDAR__,'user','pcQueryEvents',$a);
+        $events = pnModAPIFunc(__POSTCALENDAR__,'user','pcQueryEvents',$a);
     }
     else if(!isset($events)) {
         if(!isset($s_keywords)) $s_keywords = '';
         $a = array('start'=>$start_date,'end'=>$end_date,'s_keywords'=>$s_keywords,'s_category'=>$s_category,'s_topic'=>$s_topic,'viewtype'=>$viewtype, "sort" => "pc_startTime ASC, a.pc_duration ASC ",'providerID' => $providerID, 'provider_id' => $provider_id);
-        $events =& pnModAPIFunc(__POSTCALENDAR__,'user','pcQueryEvents',$a);
+        $events = pnModAPIFunc(__POSTCALENDAR__,'user','pcQueryEvents',$a);
     }
 
     //==============================================================
@@ -1309,7 +1309,7 @@ function &postcalendar_userapi_pcGetEvents($args)
 // fill days with events (recurring is the challenge)
 //===========================
 function calculateEvents($days,$events,$viewtype) {
-  $date =postcalendar_getDate();
+  $date =postcalendar_getDate();
   $cy = substr($date,0,4);
   $cm = substr($date,4,2);
   $cd = substr($date,6,2);
index 7400f04..b7e8fa0 100644 (file)
@@ -7,7 +7,18 @@ include_once("$srcdir/encounter.inc");
 
 if (isset($_GET["set_encounter"])) {
  // The billing page might also be setting a new pid.
- $set_pid = $_GET["set_pid"] ? $_GET["set_pid"] : $_GET["pid"];
+ if(isset($_GET["set_pid"]))
+ {
+     $set_pid=$_GET["set_pid"];
+ }
+ else if(isset($_GET["pid"]))
+ {
+     $set_pid=$_GET["pid"];
+ }
+ else
+ {
+     $set_pid=false;
+ }
  if ($set_pid && $set_pid != $_SESSION["pid"]) {
   setpid($set_pid);
  }
index 02b80f7..6ee1806 100644 (file)
@@ -366,9 +366,6 @@ if (is_numeric($pid)) {
 // jQuery stuff to make the page a little easier to use
 
 $(document).ready(function(){
-    $(".save").click(function() { top.restoreSession(); document.my_form.submit(); });
-    $(".dontsave").click(function() { location.href='<?php echo "$rootdir/patient_file/encounter/$returnurl";?>'; });
-
     $(".onerow").mouseover(function() { $(this).toggleClass("highlight"); });
     $(".onerow").mouseout(function() { $(this).toggleClass("highlight"); });
     $(".onerow").click(function() { GotoForm(this); });
index aeb21f8..4f3851d 100644 (file)
@@ -44,7 +44,7 @@ class Address extends ORDataObject{
 
 
        }
-       function factory_address($foreign_id = "") {
+       static function factory_address($foreign_id = "") {
                if (empty($foreign_id)) {
                         $foreign_id= "like '%'";
                }
index 8172fc4..5825791 100644 (file)
@@ -46,7 +46,7 @@ class PhoneNumber extends ORDataObject{
 
        }
 
-       function factory_phone_numbers($foreign_id = "") {
+       static function factory_phone_numbers($foreign_id = "") {
                if (empty($foreign_id)) {
                         $foreign_id= "like '%'";
                }
index fe0f0d7..4980c23 100644 (file)
@@ -615,7 +615,7 @@ class Prescription extends ORDataObject {
         return $string;
     }
     
-    function prescriptions_factory($patient_id,
+    static function prescriptions_factory($patient_id,
                             $order_by = "active DESC, date_modified DESC, date_added DESC")
     {
         $prescriptions = array();
index 428d9fc..b0f751c 100644 (file)
@@ -703,6 +703,7 @@ function auditSQLEvent($statement, $outcome, $binds=NULL)
     // ViSolve : Don't log sequences - to avoid the affect due to GenID calls
     if (strpos($comments, "sequences") !== FALSE) return;
 
+    $SSL_CLIENT_S_DN_CN=isset($_SERVER['SSL_CLIENT_S_DN_CN']) ? $_SERVER['SSL_CLIENT_S_DN_CN'] : '';
     $sql = "insert into log (date, event, user, groupname, comments, patient_id, success, checksum,crt_user) " .
          "values ( NOW(), " . 
          $adodb->qstr($event) . ", " .
@@ -712,7 +713,7 @@ function auditSQLEvent($statement, $outcome, $binds=NULL)
          $adodb->qstr($pid) . "," .
          $adodb->qstr($success) . "," . 
          $adodb->qstr($checksum) . "," .
-         $adodb->qstr($_SERVER['SSL_CLIENT_S_DN_CN']) .")";
+         $adodb->qstr($SSL_CLIENT_S_DN_CN) .")";
 
     sqlInsertClean_audit($sql);
     send_atna_audit_msg($user, $group, $event, $pid, $success, $comments);