added error if starttime is after endtime, which would lead to negative times

This commit is contained in:
Ralf Becker 2006-10-19 18:52:18 +00:00
parent 9ab93a73a2
commit 9a0352e28c
3 changed files with 7 additions and 1 deletions

View File

@ -91,7 +91,7 @@ class uitimesheet extends botimesheet
{ {
$content['ts_start'] += $content['end_time'] - 60*$content['ts_duration']; $content['ts_start'] += $content['end_time'] - 60*$content['ts_duration'];
} }
if ($content['ts_duration']) unset($content['end_time']); if ($content['ts_duration'] > 0) unset($content['end_time']);
// now we only deal with start (date+time) and duration // now we only deal with start (date+time) and duration
list($button) = @each($content['button']); list($button) = @each($content['button']);
$view = $content['view']; $view = $content['view'];
@ -118,6 +118,10 @@ class uitimesheet extends botimesheet
{ {
$etpl->set_validation_error('ts_quantity',lang('Field must not be empty !!!')); $etpl->set_validation_error('ts_quantity',lang('Field must not be empty !!!'));
} }
if ($this->data['ts_quantity'] < 0)
{
$etpl->set_validation_error('ts_quantity',lang('Starttime has to be before endtime !!!'));
}
if (!$this->data['ts_project']) $this->data['ts_project'] = $this->data['ts_project_blur']; if (!$this->data['ts_project']) $this->data['ts_project'] = $this->data['ts_project_blur'];
if (!$this->data['ts_title']) $this->data['ts_title'] = $this->data['ts_title_blur']; if (!$this->data['ts_title']) $this->data['ts_title'] = $this->data['ts_title_blur'];
if (!$this->data['ts_title']) if (!$this->data['ts_title'])

View File

@ -39,6 +39,7 @@ select a price timesheet de Preis ausw
select a project timesheet de Projekt auswählen select a project timesheet de Projekt auswählen
start timesheet de Start start timesheet de Start
starttime timesheet de Startzeit starttime timesheet de Startzeit
starttime has to be before endtime !!! timesheet de Startzeit muss vor der Endzeit liegen !!!
sum %1: timesheet de Summe %1: sum %1: timesheet de Summe %1:
this month timesheet de Diesen Monat this month timesheet de Diesen Monat
this week timesheet de Diese Woche this week timesheet de Diese Woche

View File

@ -39,6 +39,7 @@ select a price timesheet en Select a price
select a project timesheet en Select a project select a project timesheet en Select a project
start timesheet en Start start timesheet en Start
starttime timesheet en Starttime starttime timesheet en Starttime
starttime has to be before endtime !!! timesheet en Starttime has to be before endtime !!!
sum %1: timesheet en Sum %1: sum %1: timesheet en Sum %1:
this month timesheet en This month this month timesheet en This month
this week timesheet en This week this week timesheet en This week