From 9a0352e28cd576bd8c3293671b09a63bd0443dc5 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 19 Oct 2006 18:52:18 +0000 Subject: [PATCH] added error if starttime is after endtime, which would lead to negative times --- timesheet/inc/class.uitimesheet.inc.php | 6 +++++- timesheet/setup/phpgw_de.lang | 1 + timesheet/setup/phpgw_en.lang | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/timesheet/inc/class.uitimesheet.inc.php b/timesheet/inc/class.uitimesheet.inc.php index 7e1efd5d26..56a79cd8f0 100644 --- a/timesheet/inc/class.uitimesheet.inc.php +++ b/timesheet/inc/class.uitimesheet.inc.php @@ -91,7 +91,7 @@ class uitimesheet extends botimesheet { $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 list($button) = @each($content['button']); $view = $content['view']; @@ -118,6 +118,10 @@ class uitimesheet extends botimesheet { $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_title']) $this->data['ts_title'] = $this->data['ts_title_blur']; if (!$this->data['ts_title']) diff --git a/timesheet/setup/phpgw_de.lang b/timesheet/setup/phpgw_de.lang index ce5fe15c36..9813694142 100644 --- a/timesheet/setup/phpgw_de.lang +++ b/timesheet/setup/phpgw_de.lang @@ -39,6 +39,7 @@ select a price timesheet de Preis ausw select a project timesheet de Projekt auswählen start timesheet de Start starttime timesheet de Startzeit +starttime has to be before endtime !!! timesheet de Startzeit muss vor der Endzeit liegen !!! sum %1: timesheet de Summe %1: this month timesheet de Diesen Monat this week timesheet de Diese Woche diff --git a/timesheet/setup/phpgw_en.lang b/timesheet/setup/phpgw_en.lang index 194f7d237e..2e10e56738 100644 --- a/timesheet/setup/phpgw_en.lang +++ b/timesheet/setup/phpgw_en.lang @@ -39,6 +39,7 @@ select a price timesheet en Select a price select a project timesheet en Select a project start timesheet en Start starttime timesheet en Starttime +starttime has to be before endtime !!! timesheet en Starttime has to be before endtime !!! sum %1: timesheet en Sum %1: this month timesheet en This month this week timesheet en This week