Revision: 2259
          http://mrbs.svn.sourceforge.net/mrbs/?rev=2259&view=rev
Author:   cimorrison
Date:     2012-01-27 12:03:29 +0000 (Fri, 27 Jan 2012)
Log Message:
-----------
Fixed bug where reports could use periods when they should have used times (fix 
should maybe have gone into the trunk?)

Modified Paths:
--------------
    mrbs/branches/ics_import/web/functions.inc
    mrbs/branches/ics_import/web/functions_view.inc
    mrbs/branches/ics_import/web/mrbs_sql.inc
    mrbs/branches/ics_import/web/report.php

Modified: mrbs/branches/ics_import/web/functions.inc
===================================================================
--- mrbs/branches/ics_import/web/functions.inc  2012-01-27 11:15:03 UTC (rev 
2258)
+++ mrbs/branches/ics_import/web/functions.inc  2012-01-27 12:03:29 UTC (rev 
2259)
@@ -347,13 +347,12 @@
 //
 // Returns an array indexed by 'duration' and 'dur_units'
 //
-//    $start_time   int     start time as a Unix timestamp
-//    $end_time     int     end time as a Unix timestamp
-//    $translate    boolean whether to translate into the browser language
-function get_duration($start_time, $end_time, $translate=TRUE)
+//    $start_time     int     start time as a Unix timestamp
+//    $end_time       int     end time as a Unix timestamp
+//    $enable_periods boolean whether we are using periods
+//    $translate      boolean whether to translate into the browser language
+function get_duration($start_time, $end_time, $enable_periods, $translate=TRUE)
 {
-  global $enable_periods;
-  
   $result = array();
   $result['duration'] = $end_time - $start_time;
   // Need to make DST correct in opposite direction to entry creation

Modified: mrbs/branches/ics_import/web/functions_view.inc
===================================================================
--- mrbs/branches/ics_import/web/functions_view.inc     2012-01-27 11:15:03 UTC 
(rev 2258)
+++ mrbs/branches/ics_import/web/functions_view.inc     2012-01-27 12:03:29 UTC 
(rev 2259)
@@ -46,7 +46,7 @@
   if (!isset($data['duration']))
   {
     // We will translate the units later
-    $d = get_duration($data['start_time'], $data['end_time'], FALSE);
+    $d = get_duration($data['start_time'], $data['end_time'], $enable_periods, 
FALSE);
     $data['duration'] = $d['duration'];
     $data['dur_units'] = $d['dur_units'];
   }

Modified: mrbs/branches/ics_import/web/mrbs_sql.inc
===================================================================
--- mrbs/branches/ics_import/web/mrbs_sql.inc   2012-01-27 11:15:03 UTC (rev 
2258)
+++ mrbs/branches/ics_import/web/mrbs_sql.inc   2012-01-27 12:03:29 UTC (rev 
2259)
@@ -862,7 +862,7 @@
 function mrbsGetBookingInfo($id, $series, $silent=FALSE)
 {
   global $tbl_entry, $tbl_repeat, $tbl_room, $tbl_area;
-  global $approval_enabled;
+  global $approval_enabled, $enable_periods;
 
   // Check that we've got an id
   if (!isset($id))
@@ -981,7 +981,7 @@
   
   // Now get the duration.
   // Don't translate the units at this stage.   We'll translate them later.
-  $d = get_duration($row['start_time'], $row['end_time'], FALSE);
+  $d = get_duration($row['start_time'], $row['end_time'], $enable_periods, 
FALSE);
   $row['duration'] = $d['duration'];
   $row['dur_units'] = $d['dur_units'];
     

Modified: mrbs/branches/ics_import/web/report.php
===================================================================
--- mrbs/branches/ics_import/web/report.php     2012-01-27 11:15:03 UTC (rev 
2258)
+++ mrbs/branches/ics_import/web/report.php     2012-01-27 12:03:29 UTC (rev 
2259)
@@ -200,7 +200,7 @@
   global $custom_fields, $field_natures, $field_lengths, $tbl_entry;
   global $approval_somewhere, $confirmation_somewhere;
   global $strftime_format;
-  global $select_options, $enable_periods;
+  global $select_options;
   
   // If we're capable of delivering an Ajax request and this is not Ajax 
request,
   // then don't do anything.  We're going to save sending the data until we 
actually
@@ -230,7 +230,7 @@
   $values[] = escape($row['room_name']);
   
   // Start date
-  if ($enable_periods)
+  if ($row['enable_periods'])
   {
     list($start_period, $start_date) =  period_date_string($row['start_time']);
   }
@@ -250,7 +250,7 @@
   }
   
   // End date
-  if ($enable_periods)
+  if ($row['enable_periods'])
   {
     list( , $end_date) =  period_date_string($row['end_time'], -1);
   }
@@ -274,7 +274,7 @@
   // changes so that the user sees what he expects to see
   $duration_seconds = $row['end_time'] - $row['start_time'];
   $duration_seconds -= cross_dst($row['start_time'], $row['end_time']);
-  $d = get_duration($row['start_time'], $row['end_time']);
+  $d = get_duration($row['start_time'], $row['end_time'], 
$row['enable_periods']);
   $d_string = $d['duration'] . ' ' . $d['dur_units'];
   if ($output_as_csv)
   {

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


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to