diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-01-09 17:32:46 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-01-09 17:32:46 +0000 |
commit | 6768bec4560e3c9a31578e2879f345f4c9e77a17 (patch) | |
tree | 88a5794488f55efae223104bcbec645f747149ab /lib/redmine | |
parent | c0f44db4f705e45127cd2352cd86abdbfa0ec1d1 (diff) | |
download | redmine-6768bec4560e3c9a31578e2879f345f4c9e77a17.tar.gz redmine-6768bec4560e3c9a31578e2879f345f4c9e77a17.zip |
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
Diffstat (limited to 'lib/redmine')
-rw-r--r-- | lib/redmine/core_ext/string/conversions.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/redmine/core_ext/string/conversions.rb b/lib/redmine/core_ext/string/conversions.rb index 41149f5ea..68fbcde75 100644 --- a/lib/redmine/core_ext/string/conversions.rb +++ b/lib/redmine/core_ext/string/conversions.rb @@ -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 |