Redmine 4.1.1
This commit is contained in:
parent
33e7b881a5
commit
3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -31,6 +33,7 @@ class IssueRelation < ActiveRecord::Base
|
|||
end
|
||||
|
||||
include Redmine::SafeAttributes
|
||||
include Redmine::Utils::DateCalculation
|
||||
|
||||
belongs_to :issue_from, :class_name => 'Issue'
|
||||
belongs_to :issue_to, :class_name => 'Issue'
|
||||
|
@ -72,16 +75,19 @@ class IssueRelation < ActiveRecord::Base
|
|||
validates_uniqueness_of :issue_to_id, :scope => :issue_from_id
|
||||
validate :validate_issue_relation
|
||||
|
||||
attr_protected :issue_from_id, :issue_to_id
|
||||
before_save :handle_issue_order
|
||||
after_create :call_issues_relation_added_callback
|
||||
after_destroy :call_issues_relation_removed_callback
|
||||
|
||||
safe_attributes 'relation_type',
|
||||
'delay',
|
||||
'issue_to_id'
|
||||
'delay',
|
||||
'issue_to_id'
|
||||
|
||||
def safe_attributes=(attrs, user=User.current)
|
||||
if attrs.respond_to?(:to_unsafe_hash)
|
||||
attrs = attrs.to_unsafe_hash
|
||||
end
|
||||
|
||||
return unless attrs.is_a?(Hash)
|
||||
attrs = attrs.deep_dup
|
||||
|
||||
|
@ -146,9 +152,11 @@ class IssueRelation < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def label_for(issue)
|
||||
TYPES[relation_type] ?
|
||||
TYPES[relation_type][(self.issue_from_id == issue.id) ? :name : :sym_name] :
|
||||
:unknow
|
||||
if TYPES[relation_type]
|
||||
TYPES[relation_type][(self.issue_from_id == issue.id) ? :name : :sym_name]
|
||||
else
|
||||
:unknow
|
||||
end
|
||||
end
|
||||
|
||||
def to_s(issue=nil)
|
||||
|
@ -186,7 +194,7 @@ class IssueRelation < ActiveRecord::Base
|
|||
def successor_soonest_start
|
||||
if (TYPE_PRECEDES == self.relation_type) && delay && issue_from &&
|
||||
(issue_from.start_date || issue_from.due_date)
|
||||
(issue_from.due_date || issue_from.start_date) + 1 + delay
|
||||
add_working_days((issue_from.due_date || issue_from.start_date), (1 + delay))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue