Allow blank value for IssueStatus#default_done_ratio.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3157 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2009-12-12 10:33:12 +00:00
parent d72778619f
commit d905f2ce7e
3 changed files with 4 additions and 3 deletions

View File

@ -220,8 +220,8 @@ class Issue < ActiveRecord::Base
# Set the done_ratio using the status if that setting is set. This will keep the done_ratios
# even if the user turns off the setting later
def update_done_ratio_from_issue_status
if Issue.use_status_for_done_ratio? && !self.status.default_done_ratio.blank?
self.done_ratio = self.status.default_done_ratio
if Issue.use_status_for_done_ratio? && status && status.default_done_ratio?
self.done_ratio = status.default_done_ratio
end
end

View File

@ -24,6 +24,7 @@ class IssueStatus < ActiveRecord::Base
validates_uniqueness_of :name
validates_length_of :name, :maximum => 30
validates_format_of :name, :with => /^[\w\s\'\-]*$/i
validates_inclusion_of :default_done_ratio, :in => 0..100, :allow_nil => true
def after_save
IssueStatus.update_all("is_default=#{connection.quoted_false}", ['id <> ?', id]) if self.is_default?

View File

@ -7,7 +7,7 @@
<% if Issue.use_status_for_done_ratio? %>
<p><label for="issue_done_ratio"><%=l(:field_done_ratio)%></label>
<%= select 'issue_status', :default_done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p>
<%= select 'issue_status', :default_done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }), :include_blank => true %></p>
<% end %>
<p><label for="issue_status_is_closed"><%=l(:field_is_closed)%></label>