Make sure event spans multiple days before removing nights, fixes late/overnight events giving negative time.

This commit is contained in:
Nathan Gray 2014-12-11 16:22:55 +00:00
parent 0efd64bb2e
commit 3b6257fed2

View File

@ -73,7 +73,7 @@ class calendar_datasource extends datasource
$ds['pe_planned_time'] = (int) (($ds['pe_planned_end'] - $ds['pe_planned_start'])/60); // time is in minutes
// if the event spans multiple days, we have to substract the nights (24h - daily working time specified in PM)
if (date('Y-m-d',$ds['pe_planned_end']) != date('Y-m-d',$ds['pe_planned_start']))
if (($ds['pe_planned_time']/ 60 > 24) && date('Y-m-d',$ds['pe_planned_end']) != date('Y-m-d',$ds['pe_planned_start']))
{
foreach(array('start','end') as $name)
{