fix empty custom start- or end-date is displayed as 1970-01-01 in app-header and just selecting a start to get week starting from that day got wrong enddate

This commit is contained in:
Ralf Becker 2014-08-25 18:22:50 +00:00
parent 300263e534
commit 4e044c5bde
2 changed files with 41 additions and 37 deletions

View File

@ -384,7 +384,7 @@ class timesheet_bo extends so_sql_cf
}
else
{
$end = $start + 8*24*60*60;
$end = $start + 7*24*60*60;
}
}
else
@ -433,8 +433,9 @@ class timesheet_bo extends so_sql_cf
$start = $weekstart + $sweek*7*24*60*60;
$end = $weekstart + $eweek*7*24*60*60;
}
$end_param = $end - 24*60*60;
}
$end_param = $end - 24*60*60;
//echo "<p align='right'>date_filter($name,$start,$end) today=".date('l, Y-m-d H:i',$this->today)." ==> ".date('l, Y-m-d H:i:s',$start)." <= date < ".date('l, Y-m-d H:i:s',$end)."</p>\n";
// convert start + end from user to servertime for the filter
return '('.($start-$this->tz_offset_s).' <= ts_start AND ts_start < '.($end-$this->tz_offset_s).')';

View File

@ -481,6 +481,8 @@ class timesheet_ui extends timesheet_bo
{
$date_filter = $this->date_filter($query_in['filter'],$query_in['startdate'],$query_in['enddate']);
if ($query_in['startdate'])
{
$start = explode('-',date('Y-m-d',$query_in['startdate']+12*60*60));
$end = explode('-',date('Y-m-d',$query_in['enddate'] ? $query_in['enddate'] : $query_in['startdate']+7.5*24*60*60));
@ -516,6 +518,7 @@ class timesheet_ui extends timesheet_bo
$this->show_sums[] = 'day';
}
}
}
//echo "<p align=right>show_sums=".print_r($this->show_sums,true)."</p>\n";
if (!$id_only && !$query_in['csv_export']) $GLOBALS['egw']->session->appsession('index',TIMESHEET_APP,$query_in);
@ -651,7 +654,7 @@ class timesheet_ui extends timesheet_bo
$GLOBALS['egw_info']['flags']['app_header'] .= ' - ' . date('W',$query['enddate']-36*60*60) . '/' . $end[0];
}
}
else
elseif ($query['startdate'])
{
$df = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'];
$GLOBALS['egw_info']['flags']['app_header'] .= ': ' . common::show_date($query['startdate']+12*60*60,$df,false);