Fixed: no error is raised when entering invalid hours on the issue update form (#2465).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2251 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2009-01-09 17:32:46 +00:00
1 parent c0f44db4f7
commit 6768bec456
4 files changed
+25 -4

No files matched your search

+3 -1
View File
@@ -24,7 +24,9 @@ module Redmine #:nodoc:
def to_hours
s = self.dup
s.strip!
unless s =~ %r{^[\d\.,]+$}
if s =~ %r{^(\d+([.,]\d+)?)h?$}
s = $1
else
# 2:30 => 2.5
s.gsub!(%r{^(\d+):(\d+)$}) { $1.to_i + $2.to_i / 60.0 }
# 2h30, 2h, 30m => 2.5, 2, 0.5