Project

General

Profile

Patch #777 ยป move_versiondate_2issuedate.txt

Charles-Marie DE GRAEVE, 2008-03-03 16:44

 
diff -Naur trunk_6.3/app/models/issue.rb eads_ver/app/models/issue.rb
--- trunk_6.3/app/models/issue.rb 2007-12-18 19:17:40.000000000 +0100
+++ eads_ver/app/models/issue.rb 2008-02-29 17:28:48.000000000 +0100
@@ -117,7 +117,10 @@
end
end
- def before_save
+ def before_save
+
+ self.due_date = self.fixed_version.effective_date unless self.fixed_version.nil?
+
if @current_journal
# attributes changes
(Issue.column_names - %w(id description)).each {|c|
@@ -143,8 +146,13 @@
def after_save
# Update start/due dates of following issues
- relations_from.each(&:set_issue_to_dates)
-
+ #relations_from.each(&:set_issue_to_dates)
+
+ IssueRelation.find(:all, :conditions => { :issue_to_id => self.id }).collect do |i|
+ i.issue_from.due_date = self.due_date
+ i.issue_from.save
+ end
+
# Close duplicates if the issue was closed
if @issue_before_change && !@issue_before_change.closed? && self.closed?
duplicates.each do |duplicate|
diff -Naur trunk_6.3/app/models/version.rb eads_ver/app/models/version.rb
--- trunk_6.3/app/models/version.rb 2007-12-18 19:17:40.000000000 +0100
+++ eads_ver/app/models/version.rb 2008-02-29 16:47:43.000000000 +0100
@@ -15,7 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-class Version < ActiveRecord::Base
+class Version < ActiveRecord::Base
+
before_destroy :check_integrity
belongs_to :project
has_many :fixed_issues, :class_name => 'Issue', :foreign_key => 'fixed_version_id'
@@ -25,6 +26,13 @@
validates_uniqueness_of :name, :scope => [:project_id]
validates_length_of :name, :maximum => 30
validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => :activerecord_error_not_a_date, :allow_nil => true
+
+ def after_save
+ Issue.find(:all, :conditions => {:fixed_version_id => self.id }).collect do |i|
+ i.due_date = self.effective_date
+ i.save
+ end
+ end
def start_date
effective_date

    (1-1/1)