comparison app/models/.svn/text-base/issue.rb.svn-base @ 210:0579821a129a

Update to Redmine trunk rev 4802
author Chris Cannam
date Tue, 08 Feb 2011 13:51:46 +0000
parents 07fa8a8b56a8
children 051f544170fe
comparison
equal deleted inserted replaced
128:07fa8a8b56a8 210:0579821a129a
32 has_and_belongs_to_many :changesets, :order => "#{Changeset.table_name}.committed_on ASC, #{Changeset.table_name}.id ASC" 32 has_and_belongs_to_many :changesets, :order => "#{Changeset.table_name}.committed_on ASC, #{Changeset.table_name}.id ASC"
33 33
34 has_many :relations_from, :class_name => 'IssueRelation', :foreign_key => 'issue_from_id', :dependent => :delete_all 34 has_many :relations_from, :class_name => 'IssueRelation', :foreign_key => 'issue_from_id', :dependent => :delete_all
35 has_many :relations_to, :class_name => 'IssueRelation', :foreign_key => 'issue_to_id', :dependent => :delete_all 35 has_many :relations_to, :class_name => 'IssueRelation', :foreign_key => 'issue_to_id', :dependent => :delete_all
36 36
37 acts_as_nested_set :scope => 'root_id' 37 acts_as_nested_set :scope => 'root_id', :dependent => :destroy
38 acts_as_attachable :after_remove => :attachment_removed 38 acts_as_attachable :after_remove => :attachment_removed
39 acts_as_customizable 39 acts_as_customizable
40 acts_as_watchable 40 acts_as_watchable
41 acts_as_searchable :columns => ['subject', "#{table_name}.description", "#{Journal.table_name}.notes"], 41 acts_as_searchable :columns => ['subject', "#{table_name}.description", "#{Journal.table_name}.notes"],
42 :include => [:project, :journals], 42 :include => [:project, :journals],
87 } 87 }
88 88
89 before_create :default_assign 89 before_create :default_assign
90 before_save :close_duplicates, :update_done_ratio_from_issue_status 90 before_save :close_duplicates, :update_done_ratio_from_issue_status
91 after_save :reschedule_following_issues, :update_nested_set_attributes, :update_parent_attributes, :create_journal 91 after_save :reschedule_following_issues, :update_nested_set_attributes, :update_parent_attributes, :create_journal
92 after_destroy :destroy_children
93 after_destroy :update_parent_attributes 92 after_destroy :update_parent_attributes
94 93
95 # Returns true if usr or current user is allowed to view the issue 94 # Returns true if usr or current user is allowed to view the issue
96 def visible?(usr=nil) 95 def visible?(usr=nil)
97 (usr || User.current).allowed_to?(:view_issues, self.project) 96 (usr || User.current).allowed_to?(:view_issues, self.project)
756 # ancestors will be recursively updated 755 # ancestors will be recursively updated
757 p.save(false) 756 p.save(false)
758 end 757 end
759 end 758 end
760 759
761 def destroy_children
762 unless leaf?
763 children.each do |child|
764 child.destroy
765 end
766 end
767 end
768
769 # Update issues so their versions are not pointing to a 760 # Update issues so their versions are not pointing to a
770 # fixed_version that is not shared with the issue's project 761 # fixed_version that is not shared with the issue's project
771 def self.update_versions(conditions=nil) 762 def self.update_versions(conditions=nil)
772 # Only need to update issues with a fixed_version from 763 # Only need to update issues with a fixed_version from
773 # a different project and that is not systemwide shared 764 # a different project and that is not systemwide shared