Revision: 2972
https://sourceforge.net/p/mrbs/code/2972/
Author: cimorrison
Date: 2015-01-21 14:18:47 +0000 (Wed, 21 Jan 2015)
Log Message:
-----------
Fixed bug that caused the number of periods in the Report Summary to be
incorrectly calculated if the report start or end date happened to fall in the
middle of a multi-day booking.
Modified Paths:
--------------
mrbs/trunk/web/report.php
Modified: mrbs/trunk/web/report.php
===================================================================
--- mrbs/trunk/web/report.php 2015-01-21 13:34:37 UTC (rev 2971)
+++ mrbs/trunk/web/report.php 2015-01-21 14:18:47 UTC (rev 2972)
@@ -857,8 +857,10 @@
function accumulate(&$row, &$count, &$hours, $report_start, $report_end,
&$room_hash, &$name_hash)
{
- global $output_format;
+ global $output_format, $periods;
+ $periods_per_day = count($periods);
+
$row['enable_periods']; ////////////////////////
// Use brief description, created by or type as the name:
$name = get_sumby_name_from_row($row);
@@ -871,8 +873,20 @@
// Accumulate hours/periods used, clipped to report range dates:
if ($row['enable_periods'])
{
- $increment = getPeriodInterval(max($row['start_time'], $report_start),
- min($row['end_time'], $report_end));
+ // We need to set the start and end of the report to the start and end of
periods
+ // on those days. Otherwise if the report starts or ends in the middle
of a multi-day
+ // booking we'll get all those spurious minutes before noon or between the
end of
+ // the last period and midnight
+ $startDate = new DateTime();
+ $startDate->setTimestamp($report_start)->modify('12:00');
+
+ $endDate = new DateTime();
+ $endDate->setTimestamp($report_end)->modify('12:00');
+ $endDate->sub(new DateInterval('P1D')); // Go back one day because the
$report_end is at 00:00 the day after
+ $endDate->add(new DateInterval('PT' . $periods_per_day . 'M'));
+
+ $increment = getPeriodInterval(max($row['start_time'],
$startDate->getTimestamp()),
+ min($row['end_time'],
$endDate->getTimestamp()));
$room_hash[$room] = MODE_PERIODS;
}
else
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits