From a84b37716aff69dd3a08ac205b202087822bc46a Mon Sep 17 00:00:00 2001 From: "Alan J. Pippin" Date: Sun, 13 Apr 2008 19:22:52 -0600 Subject: [PATCH] Fixed bug in attendance tool in quarter boundary calculation. The attendance tool was not displaying "quarters" of data properly. There was a bug in the algorithm that was calculating the quarter window of time, causing it to be 2 months instead of 3. This is a fix for that issue. --- inc/class.eq.inc.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/inc/class.eq.inc.php b/inc/class.eq.inc.php index 3cbb028..342f65b 100644 --- a/inc/class.eq.inc.php +++ b/inc/class.eq.inc.php @@ -1,7 +1,8 @@ = 4 && $current_month <= 6) { $current_month=6; } else if($current_month >= 7 && $current_month <= 9) { $current_month=9; } else if($current_month >= 10 && $current_month <= 12) { $current_month=12; } - + $sql = "SELECT * FROM eq_elder where valid=1"; $this->db->query($sql,__LINE__,__FILE__); $i=0; @@ -3157,10 +3158,10 @@ class eq $i=0; $last_time = 0; $found_sunday = 0; - $sunday_list[0]['date'] = date("Y-m-d", mktime(0, 0, 0, $current_month-$num_months, 1, date("y"))); + $sunday_list[0]['date'] = date("Y-m-d", mktime(0, 0, 0, ($current_month-$num_months)+1, 1, date("y"))); $last_date = explode("-",$sunday_list[0]['date']); $last_time = mktime(0, 0, 0, $last_date[1], $last_date[2], $last_date[0]); - $time_limit = mktime(0, 0, 0, date("m"), date("t"), date("y")); + $time_limit = mktime(0, 0, 0, $current_month, 31, date("y")); while($last_time < $time_limit) { $day = date("w",$last_time); @@ -3171,7 +3172,8 @@ class eq $sunday_list[$i]['day'] = $last_date[2]; $sunday_list[$i]['month'] = date("M",$last_time); $sunday_list[$i]['year'] = $last_date[0]; - $found_sunday = 1; + $found_sunday = 1; + $last_date = $sunday_list[$i]['date']; } $last_time += 90000; if($found_sunday) { $i++; $found_sunday=0; } -- 2.34.1