Precede-Follow relation should move following issues earlier when rescheduling issue earlier (#4590).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10878 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-11-24 13:43:52 +00:00
parent 29fc292b18
commit b94c971755
2 changed files with 43 additions and 4 deletions
+8 -3
View File
@@ -869,9 +869,10 @@ class Issue < ActiveRecord::Base
(start_date && due_date) ? working_days(start_date, due_date) : 0
end
def soonest_start
def soonest_start(reload=false)
@soonest_start = nil if reload
@soonest_start ||= (
relations_to.collect{|relation| relation.successor_soonest_start} +
relations_to(reload).collect{|relation| relation.successor_soonest_start} +
ancestors.collect(&:soonest_start)
).compact.max
end
@@ -890,7 +891,11 @@ class Issue < ActiveRecord::Base
def reschedule_on!(date)
return if date.nil?
if leaf?
if start_date.nil? || start_date < date
if start_date.nil? || start_date != date
if start_date && start_date > date
# Issue can not be moved earlier than its soonest start date
date = [soonest_start(true), date].compact.max
end
reschedule_on(date)
begin
save