diff --git a/app/models/rb_story.rb b/app/models/rb_story.rb
index 1845ca675..0f31e8683 100644
--- a/app/models/rb_story.rb
+++ b/app/models/rb_story.rb
@@ -396,11 +396,15 @@ def list_with_gaps_scope_condition(options={})
end
def story_follow_task_state
- return if Setting.plugin_redmine_backlogs[:story_follow_task_status] != 'close' && Setting.plugin_redmine_backlogs[:story_follow_task_status] != 'loose'
+ return if Setting.plugin_redmine_backlogs[:story_follow_task_status] != 'close' &&
+ Setting.plugin_redmine_backlogs[:story_follow_task_status] != 'loose' &&
+ Setting.plugin_redmine_backlogs[:story_follow_task_status] != 'inprogress'
return if self.status.is_closed? #bail out if we are closed
self.reload #we might be stale at this point
case Setting.plugin_redmine_backlogs[:story_follow_task_status]
+ when 'inprogress'
+ set_story_status_if_following_to_close_or_to_in_progress
when 'close'
set_closed_status_if_following_to_close
when 'loose'
@@ -434,6 +438,19 @@ def set_closed_status_if_following_to_close
end
end
+ def set_story_status_if_following_to_close_or_to_in_progress
+ resolved_status_id = 3
+ in_progress_status_id = 2
+
+ tasks.each{|task|
+ self.journalized_update_attributes :status_id => in_progress_status_id unless task.status.is_default?
+ }
+ tasks.each{|task|
+ return unless task.status.is_closed?
+ }
+ self.journalized_update_attributes :status_id => resolved_status_id #update, but no need to position
+ end
+
private
def calc_total_auto(p,days,in_release_first)
diff --git a/app/views/backlogs/_settings.html.erb b/app/views/backlogs/_settings.html.erb
index 6bb90ee34..a8e0950d6 100644
--- a/app/views/backlogs/_settings.html.erb
+++ b/app/views/backlogs/_settings.html.erb
@@ -162,6 +162,9 @@
<%= radio_button_tag("settings[story_follow_task_status]", 'close',
Backlogs.setting[:story_follow_task_status] == 'close' ) %><%= l(:backlogs_story_follow_task_status_close) %>
+ <%= radio_button_tag("settings[story_follow_task_status]", 'inprogress',
+ Backlogs.setting[:story_follow_task_status] == 'inprogress' ) %><%= "Resolved when all Tasks are closed.\n In Progress when even one Task is not new." %>
+
<%= radio_button_tag("settings[story_follow_task_status]", 'loose',
Backlogs.setting[:story_follow_task_status] == 'loose' ) %><%= l(:backlogs_story_follow_task_status_loose) %>
<%= l(:backlogs_story_follows_task_loose_explanation) %>