Revision: 2325
          http://mrbs.svn.sourceforge.net/mrbs/?rev=2325&view=rev
Author:   cimorrison
Date:     2012-07-10 14:59:56 +0000 (Tue, 10 Jul 2012)
Log Message:
-----------
Removed the need for the error suppression operator when calculating the 
summary table, thus simplifying debugging by allowing development using 
error_reporting(-1).

Modified Paths:
--------------
    mrbs/trunk/web/report.php

Modified: mrbs/trunk/web/report.php
===================================================================
--- mrbs/trunk/web/report.php   2012-07-10 14:41:23 UTC (rev 2324)
+++ mrbs/trunk/web/report.php   2012-07-10 14:59:56 UTC (rev 2325)
@@ -399,6 +399,20 @@
 }
 
 
+// Increments a two dimensional array by $increment
+function increment_count(&$array, $index1, $index2, $increment)
+{
+  if (!isset($array[$index1]))
+  {
+    $array[$index1] = array();
+  }
+  if (!isset($array[$index1][$index2]))
+  {
+    $array[$index1][$index2] = 0;
+  }
+  $array[$index1][$index2] += $increment;
+}
+
 // Collect summary statistics on one entry. See below for columns in $row[].
 // This also builds hash tables of all unique names and rooms. When sorted,
 // these will become the column and row headers of the summary table.
@@ -417,7 +431,7 @@
   $room .= ($output_format == OUTPUT_CSV) ? '/' : "<br>";
   $room .= escape($row['room_name']);
   // Accumulate the number of bookings for this room and name:
-  @$count[$room][$name]++;
+  increment_count($count, $room, $name, 1);
   // Accumulate hours/periods used, clipped to report range dates:
   if ($row['enable_periods'])
   {
@@ -432,7 +446,7 @@
                   max((int)$row['start_time'], $report_start)) / 3600.0;
     $room_hash[$room] = MODE_TIMES;
   }
-  @$hours[$room][$name] += $increment;
+  increment_count($hours, $room, $name, $increment);
   $name_hash[$name] = 1;
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to