##// END OF EJS Templates
Default target version for new issues (#1828)....
Jean-Philippe Lang -
r14404:9178d4748f19
parent child
Show More

The requested changes are too big and content was truncated. Show full diff

@@ -0,0 +1,12
1 class AddProjectsDefaultVersionId < ActiveRecord::Migration
2 def self.up
3 # Don't try to add the column if redmine_default_version plugin was used
4 unless column_exists?(:projects, :default_version_id, :integer)
5 add_column :projects, :default_version_id, :integer, :default => nil
6 end
7 end
8
9 def self.down
10 remove_column :projects, :default_version_id
11 end
12 end
@@ -1,115 +1,123
1 # encoding: utf-8
1 # encoding: utf-8
2 #
2 #
3 # Redmine - project management software
3 # Redmine - project management software
4 # Copyright (C) 2006-2015 Jean-Philippe Lang
4 # Copyright (C) 2006-2015 Jean-Philippe Lang
5 #
5 #
6 # This program is free software; you can redistribute it and/or
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
9 # of the License, or (at your option) any later version.
10 #
10 #
11 # This program is distributed in the hope that it will be useful,
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
14 # GNU General Public License for more details.
15 #
15 #
16 # You should have received a copy of the GNU General Public License
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
19
20 module ProjectsHelper
20 module ProjectsHelper
21 def project_settings_tabs
21 def project_settings_tabs
22 tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural},
22 tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural},
23 {:name => 'modules', :action => :select_project_modules, :partial => 'projects/settings/modules', :label => :label_module_plural},
23 {:name => 'modules', :action => :select_project_modules, :partial => 'projects/settings/modules', :label => :label_module_plural},
24 {:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural},
24 {:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural},
25 {:name => 'versions', :action => :manage_versions, :partial => 'projects/settings/versions', :label => :label_version_plural},
25 {:name => 'versions', :action => :manage_versions, :partial => 'projects/settings/versions', :label => :label_version_plural},
26 {:name => 'categories', :action => :manage_categories, :partial => 'projects/settings/issue_categories', :label => :label_issue_category_plural},
26 {:name => 'categories', :action => :manage_categories, :partial => 'projects/settings/issue_categories', :label => :label_issue_category_plural},
27 {:name => 'wiki', :action => :manage_wiki, :partial => 'projects/settings/wiki', :label => :label_wiki},
27 {:name => 'wiki', :action => :manage_wiki, :partial => 'projects/settings/wiki', :label => :label_wiki},
28 {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural},
28 {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural},
29 {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural},
29 {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural},
30 {:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities}
30 {:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities}
31 ]
31 ]
32 tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
32 tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
33 end
33 end
34
34
35 def parent_project_select_tag(project)
35 def parent_project_select_tag(project)
36 selected = project.parent
36 selected = project.parent
37 # retrieve the requested parent project
37 # retrieve the requested parent project
38 parent_id = (params[:project] && params[:project][:parent_id]) || params[:parent_id]
38 parent_id = (params[:project] && params[:project][:parent_id]) || params[:parent_id]
39 if parent_id
39 if parent_id
40 selected = (parent_id.blank? ? nil : Project.find(parent_id))
40 selected = (parent_id.blank? ? nil : Project.find(parent_id))
41 end
41 end
42
42
43 options = ''
43 options = ''
44 options << "<option value=''>&nbsp;</option>" if project.allowed_parents.include?(nil)
44 options << "<option value=''>&nbsp;</option>" if project.allowed_parents.include?(nil)
45 options << project_tree_options_for_select(project.allowed_parents.compact, :selected => selected)
45 options << project_tree_options_for_select(project.allowed_parents.compact, :selected => selected)
46 content_tag('select', options.html_safe, :name => 'project[parent_id]', :id => 'project_parent_id')
46 content_tag('select', options.html_safe, :name => 'project[parent_id]', :id => 'project_parent_id')
47 end
47 end
48
48
49 def render_project_action_links
49 def render_project_action_links
50 links = []
50 links = []
51 if User.current.allowed_to?(:add_project, nil, :global => true)
51 if User.current.allowed_to?(:add_project, nil, :global => true)
52 links << link_to(l(:label_project_new), new_project_path, :class => 'icon icon-add')
52 links << link_to(l(:label_project_new), new_project_path, :class => 'icon icon-add')
53 end
53 end
54 if User.current.allowed_to?(:view_issues, nil, :global => true)
54 if User.current.allowed_to?(:view_issues, nil, :global => true)
55 links << link_to(l(:label_issue_view_all), issues_path)
55 links << link_to(l(:label_issue_view_all), issues_path)
56 end
56 end
57 if User.current.allowed_to?(:view_time_entries, nil, :global => true)
57 if User.current.allowed_to?(:view_time_entries, nil, :global => true)
58 links << link_to(l(:label_overall_spent_time), time_entries_path)
58 links << link_to(l(:label_overall_spent_time), time_entries_path)
59 end
59 end
60 links << link_to(l(:label_overall_activity), activity_path)
60 links << link_to(l(:label_overall_activity), activity_path)
61 links.join(" | ").html_safe
61 links.join(" | ").html_safe
62 end
62 end
63
63
64 # Renders the projects index
64 # Renders the projects index
65 def render_project_hierarchy(projects)
65 def render_project_hierarchy(projects)
66 render_project_nested_lists(projects) do |project|
66 render_project_nested_lists(projects) do |project|
67 s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
67 s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
68 if project.description.present?
68 if project.description.present?
69 s << content_tag('div', textilizable(project.short_description, :project => project), :class => 'wiki description')
69 s << content_tag('div', textilizable(project.short_description, :project => project), :class => 'wiki description')
70 end
70 end
71 s
71 s
72 end
72 end
73 end
73 end
74
74
75 # Returns a set of options for a select field, grouped by project.
75 # Returns a set of options for a select field, grouped by project.
76 def version_options_for_select(versions, selected=nil)
76 def version_options_for_select(versions, selected=nil)
77 grouped = Hash.new {|h,k| h[k] = []}
77 grouped = Hash.new {|h,k| h[k] = []}
78 versions.each do |version|
78 versions.each do |version|
79 grouped[version.project.name] << [version.name, version.id]
79 grouped[version.project.name] << [version.name, version.id]
80 end
80 end
81
81
82 selected = selected.is_a?(Version) ? selected.id : selected
82 selected = selected.is_a?(Version) ? selected.id : selected
83 if grouped.keys.size > 1
83 if grouped.keys.size > 1
84 grouped_options_for_select(grouped, selected)
84 grouped_options_for_select(grouped, selected)
85 else
85 else
86 options_for_select((grouped.values.first || []), selected)
86 options_for_select((grouped.values.first || []), selected)
87 end
87 end
88 end
88 end
89
89
90 def project_default_version_options(project)
91 versions = project.shared_versions.open.to_a
92 if project.default_version && !versions.include?(project.default_version)
93 versions << project.default_version
94 end
95 version_options_for_select(versions, project.default_version)
96 end
97
90 def format_version_sharing(sharing)
98 def format_version_sharing(sharing)
91 sharing = 'none' unless Version::VERSION_SHARINGS.include?(sharing)
99 sharing = 'none' unless Version::VERSION_SHARINGS.include?(sharing)
92 l("label_version_sharing_#{sharing}")
100 l("label_version_sharing_#{sharing}")
93 end
101 end
94
102
95 def render_api_includes(project, api)
103 def render_api_includes(project, api)
96 api.array :trackers do
104 api.array :trackers do
97 project.trackers.each do |tracker|
105 project.trackers.each do |tracker|
98 api.tracker(:id => tracker.id, :name => tracker.name)
106 api.tracker(:id => tracker.id, :name => tracker.name)
99 end
107 end
100 end if include_in_api_response?('trackers')
108 end if include_in_api_response?('trackers')
101
109
102 api.array :issue_categories do
110 api.array :issue_categories do
103 project.issue_categories.each do |category|
111 project.issue_categories.each do |category|
104 api.issue_category(:id => category.id, :name => category.name)
112 api.issue_category(:id => category.id, :name => category.name)
105 end
113 end
106 end if include_in_api_response?('issue_categories')
114 end if include_in_api_response?('issue_categories')
107
115
108 api.array :enabled_modules do
116 api.array :enabled_modules do
109 project.enabled_modules.each do |enabled_module|
117 project.enabled_modules.each do |enabled_module|
110 api.enabled_module(:id => enabled_module.id, :name => enabled_module.name)
118 api.enabled_module(:id => enabled_module.id, :name => enabled_module.name)
111 end
119 end
112 end if include_in_api_response?('enabled_modules')
120 end if include_in_api_response?('enabled_modules')
113
121
114 end
122 end
115 end
123 end
@@ -1,1680 +1,1689
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2015 Jean-Philippe Lang
2 # Copyright (C) 2006-2015 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 class Issue < ActiveRecord::Base
18 class Issue < ActiveRecord::Base
19 include Redmine::SafeAttributes
19 include Redmine::SafeAttributes
20 include Redmine::Utils::DateCalculation
20 include Redmine::Utils::DateCalculation
21 include Redmine::I18n
21 include Redmine::I18n
22 before_save :set_parent_id
22 before_save :set_parent_id
23 include Redmine::NestedSet::IssueNestedSet
23 include Redmine::NestedSet::IssueNestedSet
24
24
25 belongs_to :project
25 belongs_to :project
26 belongs_to :tracker
26 belongs_to :tracker
27 belongs_to :status, :class_name => 'IssueStatus'
27 belongs_to :status, :class_name => 'IssueStatus'
28 belongs_to :author, :class_name => 'User'
28 belongs_to :author, :class_name => 'User'
29 belongs_to :assigned_to, :class_name => 'Principal'
29 belongs_to :assigned_to, :class_name => 'Principal'
30 belongs_to :fixed_version, :class_name => 'Version'
30 belongs_to :fixed_version, :class_name => 'Version'
31 belongs_to :priority, :class_name => 'IssuePriority'
31 belongs_to :priority, :class_name => 'IssuePriority'
32 belongs_to :category, :class_name => 'IssueCategory'
32 belongs_to :category, :class_name => 'IssueCategory'
33
33
34 has_many :journals, :as => :journalized, :dependent => :destroy, :inverse_of => :journalized
34 has_many :journals, :as => :journalized, :dependent => :destroy, :inverse_of => :journalized
35 has_many :visible_journals,
35 has_many :visible_journals,
36 lambda {where(["(#{Journal.table_name}.private_notes = ? OR (#{Project.allowed_to_condition(User.current, :view_private_notes)}))", false])},
36 lambda {where(["(#{Journal.table_name}.private_notes = ? OR (#{Project.allowed_to_condition(User.current, :view_private_notes)}))", false])},
37 :class_name => 'Journal',
37 :class_name => 'Journal',
38 :as => :journalized
38 :as => :journalized
39
39
40 has_many :time_entries, :dependent => :destroy
40 has_many :time_entries, :dependent => :destroy
41 has_and_belongs_to_many :changesets, lambda {order("#{Changeset.table_name}.committed_on ASC, #{Changeset.table_name}.id ASC")}
41 has_and_belongs_to_many :changesets, lambda {order("#{Changeset.table_name}.committed_on ASC, #{Changeset.table_name}.id ASC")}
42
42
43 has_many :relations_from, :class_name => 'IssueRelation', :foreign_key => 'issue_from_id', :dependent => :delete_all
43 has_many :relations_from, :class_name => 'IssueRelation', :foreign_key => 'issue_from_id', :dependent => :delete_all
44 has_many :relations_to, :class_name => 'IssueRelation', :foreign_key => 'issue_to_id', :dependent => :delete_all
44 has_many :relations_to, :class_name => 'IssueRelation', :foreign_key => 'issue_to_id', :dependent => :delete_all
45
45
46 acts_as_attachable :after_add => :attachment_added, :after_remove => :attachment_removed
46 acts_as_attachable :after_add => :attachment_added, :after_remove => :attachment_removed
47 acts_as_customizable
47 acts_as_customizable
48 acts_as_watchable
48 acts_as_watchable
49 acts_as_searchable :columns => ['subject', "#{table_name}.description"],
49 acts_as_searchable :columns => ['subject', "#{table_name}.description"],
50 :preload => [:project, :status, :tracker],
50 :preload => [:project, :status, :tracker],
51 :scope => lambda {|options| options[:open_issues] ? self.open : self.all}
51 :scope => lambda {|options| options[:open_issues] ? self.open : self.all}
52
52
53 acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id} (#{o.status}): #{o.subject}"},
53 acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id} (#{o.status}): #{o.subject}"},
54 :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}},
54 :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}},
55 :type => Proc.new {|o| 'issue' + (o.closed? ? ' closed' : '') }
55 :type => Proc.new {|o| 'issue' + (o.closed? ? ' closed' : '') }
56
56
57 acts_as_activity_provider :scope => preload(:project, :author, :tracker),
57 acts_as_activity_provider :scope => preload(:project, :author, :tracker),
58 :author_key => :author_id
58 :author_key => :author_id
59
59
60 DONE_RATIO_OPTIONS = %w(issue_field issue_status)
60 DONE_RATIO_OPTIONS = %w(issue_field issue_status)
61
61
62 attr_reader :current_journal
62 attr_reader :current_journal
63 delegate :notes, :notes=, :private_notes, :private_notes=, :to => :current_journal, :allow_nil => true
63 delegate :notes, :notes=, :private_notes, :private_notes=, :to => :current_journal, :allow_nil => true
64
64
65 validates_presence_of :subject, :project, :tracker
65 validates_presence_of :subject, :project, :tracker
66 validates_presence_of :priority, :if => Proc.new {|issue| issue.new_record? || issue.priority_id_changed?}
66 validates_presence_of :priority, :if => Proc.new {|issue| issue.new_record? || issue.priority_id_changed?}
67 validates_presence_of :status, :if => Proc.new {|issue| issue.new_record? || issue.status_id_changed?}
67 validates_presence_of :status, :if => Proc.new {|issue| issue.new_record? || issue.status_id_changed?}
68 validates_presence_of :author, :if => Proc.new {|issue| issue.new_record? || issue.author_id_changed?}
68 validates_presence_of :author, :if => Proc.new {|issue| issue.new_record? || issue.author_id_changed?}
69
69
70 validates_length_of :subject, :maximum => 255
70 validates_length_of :subject, :maximum => 255
71 validates_inclusion_of :done_ratio, :in => 0..100
71 validates_inclusion_of :done_ratio, :in => 0..100
72 validates :estimated_hours, :numericality => {:greater_than_or_equal_to => 0, :allow_nil => true, :message => :invalid}
72 validates :estimated_hours, :numericality => {:greater_than_or_equal_to => 0, :allow_nil => true, :message => :invalid}
73 validates :start_date, :date => true
73 validates :start_date, :date => true
74 validates :due_date, :date => true
74 validates :due_date, :date => true
75 validate :validate_issue, :validate_required_fields
75 validate :validate_issue, :validate_required_fields
76 attr_protected :id
76 attr_protected :id
77
77
78 scope :visible, lambda {|*args|
78 scope :visible, lambda {|*args|
79 joins(:project).
79 joins(:project).
80 where(Issue.visible_condition(args.shift || User.current, *args))
80 where(Issue.visible_condition(args.shift || User.current, *args))
81 }
81 }
82
82
83 scope :open, lambda {|*args|
83 scope :open, lambda {|*args|
84 is_closed = args.size > 0 ? !args.first : false
84 is_closed = args.size > 0 ? !args.first : false
85 joins(:status).
85 joins(:status).
86 where("#{IssueStatus.table_name}.is_closed = ?", is_closed)
86 where("#{IssueStatus.table_name}.is_closed = ?", is_closed)
87 }
87 }
88
88
89 scope :recently_updated, lambda { order("#{Issue.table_name}.updated_on DESC") }
89 scope :recently_updated, lambda { order("#{Issue.table_name}.updated_on DESC") }
90 scope :on_active_project, lambda {
90 scope :on_active_project, lambda {
91 joins(:project).
91 joins(:project).
92 where("#{Project.table_name}.status = ?", Project::STATUS_ACTIVE)
92 where("#{Project.table_name}.status = ?", Project::STATUS_ACTIVE)
93 }
93 }
94 scope :fixed_version, lambda {|versions|
94 scope :fixed_version, lambda {|versions|
95 ids = [versions].flatten.compact.map {|v| v.is_a?(Version) ? v.id : v}
95 ids = [versions].flatten.compact.map {|v| v.is_a?(Version) ? v.id : v}
96 ids.any? ? where(:fixed_version_id => ids) : where('1=0')
96 ids.any? ? where(:fixed_version_id => ids) : where('1=0')
97 }
97 }
98 scope :assigned_to, lambda {|arg|
98 scope :assigned_to, lambda {|arg|
99 arg = Array(arg).uniq
99 arg = Array(arg).uniq
100 ids = arg.map {|p| p.is_a?(Principal) ? p.id : p}
100 ids = arg.map {|p| p.is_a?(Principal) ? p.id : p}
101 ids += arg.select {|p| p.is_a?(User)}.map(&:group_ids).flatten.uniq
101 ids += arg.select {|p| p.is_a?(User)}.map(&:group_ids).flatten.uniq
102 ids.compact!
102 ids.compact!
103 ids.any? ? where(:assigned_to_id => ids) : none
103 ids.any? ? where(:assigned_to_id => ids) : none
104 }
104 }
105
105
106 before_validation :clear_disabled_fields
106 before_validation :clear_disabled_fields
107 before_create :default_assign
107 before_create :default_assign
108 before_save :close_duplicates, :update_done_ratio_from_issue_status,
108 before_save :close_duplicates, :update_done_ratio_from_issue_status,
109 :force_updated_on_change, :update_closed_on, :set_assigned_to_was
109 :force_updated_on_change, :update_closed_on, :set_assigned_to_was
110 after_save {|issue| issue.send :after_project_change if !issue.id_changed? && issue.project_id_changed?}
110 after_save {|issue| issue.send :after_project_change if !issue.id_changed? && issue.project_id_changed?}
111 after_save :reschedule_following_issues, :update_nested_set_attributes,
111 after_save :reschedule_following_issues, :update_nested_set_attributes,
112 :update_parent_attributes, :create_journal
112 :update_parent_attributes, :create_journal
113 # Should be after_create but would be called before previous after_save callbacks
113 # Should be after_create but would be called before previous after_save callbacks
114 after_save :after_create_from_copy
114 after_save :after_create_from_copy
115 after_destroy :update_parent_attributes
115 after_destroy :update_parent_attributes
116 after_create :send_notification
116 after_create :send_notification
117 # Keep it at the end of after_save callbacks
117 # Keep it at the end of after_save callbacks
118 after_save :clear_assigned_to_was
118 after_save :clear_assigned_to_was
119
119
120 # Returns a SQL conditions string used to find all issues visible by the specified user
120 # Returns a SQL conditions string used to find all issues visible by the specified user
121 def self.visible_condition(user, options={})
121 def self.visible_condition(user, options={})
122 Project.allowed_to_condition(user, :view_issues, options) do |role, user|
122 Project.allowed_to_condition(user, :view_issues, options) do |role, user|
123 if user.id && user.logged?
123 if user.id && user.logged?
124 case role.issues_visibility
124 case role.issues_visibility
125 when 'all'
125 when 'all'
126 nil
126 nil
127 when 'default'
127 when 'default'
128 user_ids = [user.id] + user.groups.map(&:id).compact
128 user_ids = [user.id] + user.groups.map(&:id).compact
129 "(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
129 "(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
130 when 'own'
130 when 'own'
131 user_ids = [user.id] + user.groups.map(&:id).compact
131 user_ids = [user.id] + user.groups.map(&:id).compact
132 "(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
132 "(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
133 else
133 else
134 '1=0'
134 '1=0'
135 end
135 end
136 else
136 else
137 "(#{table_name}.is_private = #{connection.quoted_false})"
137 "(#{table_name}.is_private = #{connection.quoted_false})"
138 end
138 end
139 end
139 end
140 end
140 end
141
141
142 # Returns true if usr or current user is allowed to view the issue
142 # Returns true if usr or current user is allowed to view the issue
143 def visible?(usr=nil)
143 def visible?(usr=nil)
144 (usr || User.current).allowed_to?(:view_issues, self.project) do |role, user|
144 (usr || User.current).allowed_to?(:view_issues, self.project) do |role, user|
145 if user.logged?
145 if user.logged?
146 case role.issues_visibility
146 case role.issues_visibility
147 when 'all'
147 when 'all'
148 true
148 true
149 when 'default'
149 when 'default'
150 !self.is_private? || (self.author == user || user.is_or_belongs_to?(assigned_to))
150 !self.is_private? || (self.author == user || user.is_or_belongs_to?(assigned_to))
151 when 'own'
151 when 'own'
152 self.author == user || user.is_or_belongs_to?(assigned_to)
152 self.author == user || user.is_or_belongs_to?(assigned_to)
153 else
153 else
154 false
154 false
155 end
155 end
156 else
156 else
157 !self.is_private?
157 !self.is_private?
158 end
158 end
159 end
159 end
160 end
160 end
161
161
162 # Returns true if user or current user is allowed to edit or add a note to the issue
162 # Returns true if user or current user is allowed to edit or add a note to the issue
163 def editable?(user=User.current)
163 def editable?(user=User.current)
164 attributes_editable?(user) || user.allowed_to?(:add_issue_notes, project)
164 attributes_editable?(user) || user.allowed_to?(:add_issue_notes, project)
165 end
165 end
166
166
167 # Returns true if user or current user is allowed to edit the issue
167 # Returns true if user or current user is allowed to edit the issue
168 def attributes_editable?(user=User.current)
168 def attributes_editable?(user=User.current)
169 user.allowed_to?(:edit_issues, project)
169 user.allowed_to?(:edit_issues, project)
170 end
170 end
171
171
172 def initialize(attributes=nil, *args)
172 def initialize(attributes=nil, *args)
173 super
173 super
174 if new_record?
174 if new_record?
175 # set default values for new records only
175 # set default values for new records only
176 self.priority ||= IssuePriority.default
176 self.priority ||= IssuePriority.default
177 self.watcher_user_ids = []
177 self.watcher_user_ids = []
178 end
178 end
179 end
179 end
180
180
181 def create_or_update
181 def create_or_update
182 super
182 super
183 ensure
183 ensure
184 @status_was = nil
184 @status_was = nil
185 end
185 end
186 private :create_or_update
186 private :create_or_update
187
187
188 # AR#Persistence#destroy would raise and RecordNotFound exception
188 # AR#Persistence#destroy would raise and RecordNotFound exception
189 # if the issue was already deleted or updated (non matching lock_version).
189 # if the issue was already deleted or updated (non matching lock_version).
190 # This is a problem when bulk deleting issues or deleting a project
190 # This is a problem when bulk deleting issues or deleting a project
191 # (because an issue may already be deleted if its parent was deleted
191 # (because an issue may already be deleted if its parent was deleted
192 # first).
192 # first).
193 # The issue is reloaded by the nested_set before being deleted so
193 # The issue is reloaded by the nested_set before being deleted so
194 # the lock_version condition should not be an issue but we handle it.
194 # the lock_version condition should not be an issue but we handle it.
195 def destroy
195 def destroy
196 super
196 super
197 rescue ActiveRecord::StaleObjectError, ActiveRecord::RecordNotFound
197 rescue ActiveRecord::StaleObjectError, ActiveRecord::RecordNotFound
198 # Stale or already deleted
198 # Stale or already deleted
199 begin
199 begin
200 reload
200 reload
201 rescue ActiveRecord::RecordNotFound
201 rescue ActiveRecord::RecordNotFound
202 # The issue was actually already deleted
202 # The issue was actually already deleted
203 @destroyed = true
203 @destroyed = true
204 return freeze
204 return freeze
205 end
205 end
206 # The issue was stale, retry to destroy
206 # The issue was stale, retry to destroy
207 super
207 super
208 end
208 end
209
209
210 alias :base_reload :reload
210 alias :base_reload :reload
211 def reload(*args)
211 def reload(*args)
212 @workflow_rule_by_attribute = nil
212 @workflow_rule_by_attribute = nil
213 @assignable_versions = nil
213 @assignable_versions = nil
214 @relations = nil
214 @relations = nil
215 @spent_hours = nil
215 @spent_hours = nil
216 @total_spent_hours = nil
216 @total_spent_hours = nil
217 @total_estimated_hours = nil
217 @total_estimated_hours = nil
218 base_reload(*args)
218 base_reload(*args)
219 end
219 end
220
220
221 # Overrides Redmine::Acts::Customizable::InstanceMethods#available_custom_fields
221 # Overrides Redmine::Acts::Customizable::InstanceMethods#available_custom_fields
222 def available_custom_fields
222 def available_custom_fields
223 (project && tracker) ? (project.all_issue_custom_fields & tracker.custom_fields) : []
223 (project && tracker) ? (project.all_issue_custom_fields & tracker.custom_fields) : []
224 end
224 end
225
225
226 def visible_custom_field_values(user=nil)
226 def visible_custom_field_values(user=nil)
227 user_real = user || User.current
227 user_real = user || User.current
228 custom_field_values.select do |value|
228 custom_field_values.select do |value|
229 value.custom_field.visible_by?(project, user_real)
229 value.custom_field.visible_by?(project, user_real)
230 end
230 end
231 end
231 end
232
232
233 # Copies attributes from another issue, arg can be an id or an Issue
233 # Copies attributes from another issue, arg can be an id or an Issue
234 def copy_from(arg, options={})
234 def copy_from(arg, options={})
235 issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg)
235 issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg)
236 self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on")
236 self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on")
237 self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
237 self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
238 self.status = issue.status
238 self.status = issue.status
239 self.author = User.current
239 self.author = User.current
240 unless options[:attachments] == false
240 unless options[:attachments] == false
241 self.attachments = issue.attachments.map do |attachement|
241 self.attachments = issue.attachments.map do |attachement|
242 attachement.copy(:container => self)
242 attachement.copy(:container => self)
243 end
243 end
244 end
244 end
245 @copied_from = issue
245 @copied_from = issue
246 @copy_options = options
246 @copy_options = options
247 self
247 self
248 end
248 end
249
249
250 # Returns an unsaved copy of the issue
250 # Returns an unsaved copy of the issue
251 def copy(attributes=nil, copy_options={})
251 def copy(attributes=nil, copy_options={})
252 copy = self.class.new.copy_from(self, copy_options)
252 copy = self.class.new.copy_from(self, copy_options)
253 copy.attributes = attributes if attributes
253 copy.attributes = attributes if attributes
254 copy
254 copy
255 end
255 end
256
256
257 # Returns true if the issue is a copy
257 # Returns true if the issue is a copy
258 def copy?
258 def copy?
259 @copied_from.present?
259 @copied_from.present?
260 end
260 end
261
261
262 def status_id=(status_id)
262 def status_id=(status_id)
263 if status_id.to_s != self.status_id.to_s
263 if status_id.to_s != self.status_id.to_s
264 self.status = (status_id.present? ? IssueStatus.find_by_id(status_id) : nil)
264 self.status = (status_id.present? ? IssueStatus.find_by_id(status_id) : nil)
265 end
265 end
266 self.status_id
266 self.status_id
267 end
267 end
268
268
269 # Sets the status.
269 # Sets the status.
270 def status=(status)
270 def status=(status)
271 if status != self.status
271 if status != self.status
272 @workflow_rule_by_attribute = nil
272 @workflow_rule_by_attribute = nil
273 end
273 end
274 association(:status).writer(status)
274 association(:status).writer(status)
275 end
275 end
276
276
277 def priority_id=(pid)
277 def priority_id=(pid)
278 self.priority = nil
278 self.priority = nil
279 write_attribute(:priority_id, pid)
279 write_attribute(:priority_id, pid)
280 end
280 end
281
281
282 def category_id=(cid)
282 def category_id=(cid)
283 self.category = nil
283 self.category = nil
284 write_attribute(:category_id, cid)
284 write_attribute(:category_id, cid)
285 end
285 end
286
286
287 def fixed_version_id=(vid)
287 def fixed_version_id=(vid)
288 self.fixed_version = nil
288 self.fixed_version = nil
289 write_attribute(:fixed_version_id, vid)
289 write_attribute(:fixed_version_id, vid)
290 end
290 end
291
291
292 def tracker_id=(tracker_id)
292 def tracker_id=(tracker_id)
293 if tracker_id.to_s != self.tracker_id.to_s
293 if tracker_id.to_s != self.tracker_id.to_s
294 self.tracker = (tracker_id.present? ? Tracker.find_by_id(tracker_id) : nil)
294 self.tracker = (tracker_id.present? ? Tracker.find_by_id(tracker_id) : nil)
295 end
295 end
296 self.tracker_id
296 self.tracker_id
297 end
297 end
298
298
299 # Sets the tracker.
299 # Sets the tracker.
300 # This will set the status to the default status of the new tracker if:
300 # This will set the status to the default status of the new tracker if:
301 # * the status was the default for the previous tracker
301 # * the status was the default for the previous tracker
302 # * or if the status was not part of the new tracker statuses
302 # * or if the status was not part of the new tracker statuses
303 # * or the status was nil
303 # * or the status was nil
304 def tracker=(tracker)
304 def tracker=(tracker)
305 if tracker != self.tracker
305 if tracker != self.tracker
306 if status == default_status
306 if status == default_status
307 self.status = nil
307 self.status = nil
308 elsif status && tracker && !tracker.issue_status_ids.include?(status.id)
308 elsif status && tracker && !tracker.issue_status_ids.include?(status.id)
309 self.status = nil
309 self.status = nil
310 end
310 end
311 @custom_field_values = nil
311 @custom_field_values = nil
312 @workflow_rule_by_attribute = nil
312 @workflow_rule_by_attribute = nil
313 end
313 end
314 association(:tracker).writer(tracker)
314 association(:tracker).writer(tracker)
315 self.status ||= default_status
315 self.status ||= default_status
316 self.tracker
316 self.tracker
317 end
317 end
318
318
319 def project_id=(project_id)
319 def project_id=(project_id)
320 if project_id.to_s != self.project_id.to_s
320 if project_id.to_s != self.project_id.to_s
321 self.project = (project_id.present? ? Project.find_by_id(project_id) : nil)
321 self.project = (project_id.present? ? Project.find_by_id(project_id) : nil)
322 end
322 end
323 self.project_id
323 self.project_id
324 end
324 end
325
325
326 # Sets the project.
326 # Sets the project.
327 # Unless keep_tracker argument is set to true, this will change the tracker
327 # Unless keep_tracker argument is set to true, this will change the tracker
328 # to the first tracker of the new project if the previous tracker is not part
328 # to the first tracker of the new project if the previous tracker is not part
329 # of the new project trackers.
329 # of the new project trackers.
330 # This will clear the fixed_version is it's no longer valid for the new project.
330 # This will:
331 # This will clear the parent issue if it's no longer valid for the new project.
331 # * clear the fixed_version is it's no longer valid for the new project.
332 # This will set the category to the category with the same name in the new
332 # * clear the parent issue if it's no longer valid for the new project.
333 # project if it exists, or clear it if it doesn't.
333 # * set the category to the category with the same name in the new
334 # project if it exists, or clear it if it doesn't.
335 # * for new issue, set the fixed_version to the project default version
336 # if it's a valid fixed_version.
334 def project=(project, keep_tracker=false)
337 def project=(project, keep_tracker=false)
335 project_was = self.project
338 project_was = self.project
336 association(:project).writer(project)
339 association(:project).writer(project)
337 if project_was && project && project_was != project
340 if project_was && project && project_was != project
338 @assignable_versions = nil
341 @assignable_versions = nil
339
342
340 unless keep_tracker || project.trackers.include?(tracker)
343 unless keep_tracker || project.trackers.include?(tracker)
341 self.tracker = project.trackers.first
344 self.tracker = project.trackers.first
342 end
345 end
343 # Reassign to the category with same name if any
346 # Reassign to the category with same name if any
344 if category
347 if category
345 self.category = project.issue_categories.find_by_name(category.name)
348 self.category = project.issue_categories.find_by_name(category.name)
346 end
349 end
347 # Keep the fixed_version if it's still valid in the new_project
350 # Keep the fixed_version if it's still valid in the new_project
348 if fixed_version && fixed_version.project != project && !project.shared_versions.include?(fixed_version)
351 if fixed_version && fixed_version.project != project && !project.shared_versions.include?(fixed_version)
349 self.fixed_version = nil
352 self.fixed_version = nil
350 end
353 end
351 # Clear the parent task if it's no longer valid
354 # Clear the parent task if it's no longer valid
352 unless valid_parent_project?
355 unless valid_parent_project?
353 self.parent_issue_id = nil
356 self.parent_issue_id = nil
354 end
357 end
355 @custom_field_values = nil
358 @custom_field_values = nil
356 @workflow_rule_by_attribute = nil
359 @workflow_rule_by_attribute = nil
357 end
360 end
361 # Set fixed_version to the project default version if it's valid
362 if new_record? && fixed_version.nil? && project && project.default_version_id?
363 if project.shared_versions.open.exists?(project.default_version_id)
364 self.fixed_version_id = project.default_version_id
365 end
366 end
358 self.project
367 self.project
359 end
368 end
360
369
361 def description=(arg)
370 def description=(arg)
362 if arg.is_a?(String)
371 if arg.is_a?(String)
363 arg = arg.gsub(/(\r\n|\n|\r)/, "\r\n")
372 arg = arg.gsub(/(\r\n|\n|\r)/, "\r\n")
364 end
373 end
365 write_attribute(:description, arg)
374 write_attribute(:description, arg)
366 end
375 end
367
376
368 # Overrides assign_attributes so that project and tracker get assigned first
377 # Overrides assign_attributes so that project and tracker get assigned first
369 def assign_attributes_with_project_and_tracker_first(new_attributes, *args)
378 def assign_attributes_with_project_and_tracker_first(new_attributes, *args)
370 return if new_attributes.nil?
379 return if new_attributes.nil?
371 attrs = new_attributes.dup
380 attrs = new_attributes.dup
372 attrs.stringify_keys!
381 attrs.stringify_keys!
373
382
374 %w(project project_id tracker tracker_id).each do |attr|
383 %w(project project_id tracker tracker_id).each do |attr|
375 if attrs.has_key?(attr)
384 if attrs.has_key?(attr)
376 send "#{attr}=", attrs.delete(attr)
385 send "#{attr}=", attrs.delete(attr)
377 end
386 end
378 end
387 end
379 send :assign_attributes_without_project_and_tracker_first, attrs, *args
388 send :assign_attributes_without_project_and_tracker_first, attrs, *args
380 end
389 end
381 # Do not redefine alias chain on reload (see #4838)
390 # Do not redefine alias chain on reload (see #4838)
382 alias_method_chain(:assign_attributes, :project_and_tracker_first) unless method_defined?(:assign_attributes_without_project_and_tracker_first)
391 alias_method_chain(:assign_attributes, :project_and_tracker_first) unless method_defined?(:assign_attributes_without_project_and_tracker_first)
383
392
384 def attributes=(new_attributes)
393 def attributes=(new_attributes)
385 assign_attributes new_attributes
394 assign_attributes new_attributes
386 end
395 end
387
396
388 def estimated_hours=(h)
397 def estimated_hours=(h)
389 write_attribute :estimated_hours, (h.is_a?(String) ? h.to_hours : h)
398 write_attribute :estimated_hours, (h.is_a?(String) ? h.to_hours : h)
390 end
399 end
391
400
392 safe_attributes 'project_id',
401 safe_attributes 'project_id',
393 'tracker_id',
402 'tracker_id',
394 'status_id',
403 'status_id',
395 'category_id',
404 'category_id',
396 'assigned_to_id',
405 'assigned_to_id',
397 'priority_id',
406 'priority_id',
398 'fixed_version_id',
407 'fixed_version_id',
399 'subject',
408 'subject',
400 'description',
409 'description',
401 'start_date',
410 'start_date',
402 'due_date',
411 'due_date',
403 'done_ratio',
412 'done_ratio',
404 'estimated_hours',
413 'estimated_hours',
405 'custom_field_values',
414 'custom_field_values',
406 'custom_fields',
415 'custom_fields',
407 'lock_version',
416 'lock_version',
408 'notes',
417 'notes',
409 :if => lambda {|issue, user| issue.new_record? || user.allowed_to?(:edit_issues, issue.project) }
418 :if => lambda {|issue, user| issue.new_record? || user.allowed_to?(:edit_issues, issue.project) }
410
419
411 safe_attributes 'notes',
420 safe_attributes 'notes',
412 :if => lambda {|issue, user| user.allowed_to?(:add_issue_notes, issue.project)}
421 :if => lambda {|issue, user| user.allowed_to?(:add_issue_notes, issue.project)}
413
422
414 safe_attributes 'private_notes',
423 safe_attributes 'private_notes',
415 :if => lambda {|issue, user| !issue.new_record? && user.allowed_to?(:set_notes_private, issue.project)}
424 :if => lambda {|issue, user| !issue.new_record? && user.allowed_to?(:set_notes_private, issue.project)}
416
425
417 safe_attributes 'watcher_user_ids',
426 safe_attributes 'watcher_user_ids',
418 :if => lambda {|issue, user| issue.new_record? && user.allowed_to?(:add_issue_watchers, issue.project)}
427 :if => lambda {|issue, user| issue.new_record? && user.allowed_to?(:add_issue_watchers, issue.project)}
419
428
420 safe_attributes 'is_private',
429 safe_attributes 'is_private',
421 :if => lambda {|issue, user|
430 :if => lambda {|issue, user|
422 user.allowed_to?(:set_issues_private, issue.project) ||
431 user.allowed_to?(:set_issues_private, issue.project) ||
423 (issue.author_id == user.id && user.allowed_to?(:set_own_issues_private, issue.project))
432 (issue.author_id == user.id && user.allowed_to?(:set_own_issues_private, issue.project))
424 }
433 }
425
434
426 safe_attributes 'parent_issue_id',
435 safe_attributes 'parent_issue_id',
427 :if => lambda {|issue, user| (issue.new_record? || user.allowed_to?(:edit_issues, issue.project)) &&
436 :if => lambda {|issue, user| (issue.new_record? || user.allowed_to?(:edit_issues, issue.project)) &&
428 user.allowed_to?(:manage_subtasks, issue.project)}
437 user.allowed_to?(:manage_subtasks, issue.project)}
429
438
430 def safe_attribute_names(user=nil)
439 def safe_attribute_names(user=nil)
431 names = super
440 names = super
432 names -= disabled_core_fields
441 names -= disabled_core_fields
433 names -= read_only_attribute_names(user)
442 names -= read_only_attribute_names(user)
434 if new_record?
443 if new_record?
435 # Make sure that project_id can always be set for new issues
444 # Make sure that project_id can always be set for new issues
436 names |= %w(project_id)
445 names |= %w(project_id)
437 end
446 end
438 if dates_derived?
447 if dates_derived?
439 names -= %w(start_date due_date)
448 names -= %w(start_date due_date)
440 end
449 end
441 if priority_derived?
450 if priority_derived?
442 names -= %w(priority_id)
451 names -= %w(priority_id)
443 end
452 end
444 if done_ratio_derived?
453 if done_ratio_derived?
445 names -= %w(done_ratio)
454 names -= %w(done_ratio)
446 end
455 end
447 names
456 names
448 end
457 end
449
458
450 # Safely sets attributes
459 # Safely sets attributes
451 # Should be called from controllers instead of #attributes=
460 # Should be called from controllers instead of #attributes=
452 # attr_accessible is too rough because we still want things like
461 # attr_accessible is too rough because we still want things like
453 # Issue.new(:project => foo) to work
462 # Issue.new(:project => foo) to work
454 def safe_attributes=(attrs, user=User.current)
463 def safe_attributes=(attrs, user=User.current)
455 return unless attrs.is_a?(Hash)
464 return unless attrs.is_a?(Hash)
456
465
457 attrs = attrs.deep_dup
466 attrs = attrs.deep_dup
458
467
459 # Project and Tracker must be set before since new_statuses_allowed_to depends on it.
468 # Project and Tracker must be set before since new_statuses_allowed_to depends on it.
460 if (p = attrs.delete('project_id')) && safe_attribute?('project_id')
469 if (p = attrs.delete('project_id')) && safe_attribute?('project_id')
461 if allowed_target_projects(user).where(:id => p.to_i).exists?
470 if allowed_target_projects(user).where(:id => p.to_i).exists?
462 self.project_id = p
471 self.project_id = p
463 end
472 end
464
473
465 if project_id_changed? && attrs['category_id'].to_s == category_id_was.to_s
474 if project_id_changed? && attrs['category_id'].to_s == category_id_was.to_s
466 # Discard submitted category on previous project
475 # Discard submitted category on previous project
467 attrs.delete('category_id')
476 attrs.delete('category_id')
468 end
477 end
469 end
478 end
470
479
471 if (t = attrs.delete('tracker_id')) && safe_attribute?('tracker_id')
480 if (t = attrs.delete('tracker_id')) && safe_attribute?('tracker_id')
472 self.tracker_id = t
481 self.tracker_id = t
473 end
482 end
474 if project
483 if project
475 # Set the default tracker to accept custom field values
484 # Set the default tracker to accept custom field values
476 # even if tracker is not specified
485 # even if tracker is not specified
477 self.tracker ||= project.trackers.first
486 self.tracker ||= project.trackers.first
478 end
487 end
479
488
480 statuses_allowed = new_statuses_allowed_to(user)
489 statuses_allowed = new_statuses_allowed_to(user)
481 if (s = attrs.delete('status_id')) && safe_attribute?('status_id')
490 if (s = attrs.delete('status_id')) && safe_attribute?('status_id')
482 if statuses_allowed.collect(&:id).include?(s.to_i)
491 if statuses_allowed.collect(&:id).include?(s.to_i)
483 self.status_id = s
492 self.status_id = s
484 end
493 end
485 end
494 end
486 if new_record? && !statuses_allowed.include?(status)
495 if new_record? && !statuses_allowed.include?(status)
487 self.status = statuses_allowed.first || default_status
496 self.status = statuses_allowed.first || default_status
488 end
497 end
489
498
490 attrs = delete_unsafe_attributes(attrs, user)
499 attrs = delete_unsafe_attributes(attrs, user)
491 return if attrs.empty?
500 return if attrs.empty?
492
501
493 if attrs['parent_issue_id'].present?
502 if attrs['parent_issue_id'].present?
494 s = attrs['parent_issue_id'].to_s
503 s = attrs['parent_issue_id'].to_s
495 unless (m = s.match(%r{\A#?(\d+)\z})) && (m[1] == parent_id.to_s || Issue.visible(user).exists?(m[1]))
504 unless (m = s.match(%r{\A#?(\d+)\z})) && (m[1] == parent_id.to_s || Issue.visible(user).exists?(m[1]))
496 @invalid_parent_issue_id = attrs.delete('parent_issue_id')
505 @invalid_parent_issue_id = attrs.delete('parent_issue_id')
497 end
506 end
498 end
507 end
499
508
500 if attrs['custom_field_values'].present?
509 if attrs['custom_field_values'].present?
501 editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}
510 editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}
502 attrs['custom_field_values'].select! {|k, v| editable_custom_field_ids.include?(k.to_s)}
511 attrs['custom_field_values'].select! {|k, v| editable_custom_field_ids.include?(k.to_s)}
503 end
512 end
504
513
505 if attrs['custom_fields'].present?
514 if attrs['custom_fields'].present?
506 editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}
515 editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}
507 attrs['custom_fields'].select! {|c| editable_custom_field_ids.include?(c['id'].to_s)}
516 attrs['custom_fields'].select! {|c| editable_custom_field_ids.include?(c['id'].to_s)}
508 end
517 end
509
518
510 # mass-assignment security bypass
519 # mass-assignment security bypass
511 assign_attributes attrs, :without_protection => true
520 assign_attributes attrs, :without_protection => true
512 end
521 end
513
522
514 def disabled_core_fields
523 def disabled_core_fields
515 tracker ? tracker.disabled_core_fields : []
524 tracker ? tracker.disabled_core_fields : []
516 end
525 end
517
526
518 # Returns the custom_field_values that can be edited by the given user
527 # Returns the custom_field_values that can be edited by the given user
519 def editable_custom_field_values(user=nil)
528 def editable_custom_field_values(user=nil)
520 visible_custom_field_values(user).reject do |value|
529 visible_custom_field_values(user).reject do |value|
521 read_only_attribute_names(user).include?(value.custom_field_id.to_s)
530 read_only_attribute_names(user).include?(value.custom_field_id.to_s)
522 end
531 end
523 end
532 end
524
533
525 # Returns the custom fields that can be edited by the given user
534 # Returns the custom fields that can be edited by the given user
526 def editable_custom_fields(user=nil)
535 def editable_custom_fields(user=nil)
527 editable_custom_field_values(user).map(&:custom_field).uniq
536 editable_custom_field_values(user).map(&:custom_field).uniq
528 end
537 end
529
538
530 # Returns the names of attributes that are read-only for user or the current user
539 # Returns the names of attributes that are read-only for user or the current user
531 # For users with multiple roles, the read-only fields are the intersection of
540 # For users with multiple roles, the read-only fields are the intersection of
532 # read-only fields of each role
541 # read-only fields of each role
533 # The result is an array of strings where sustom fields are represented with their ids
542 # The result is an array of strings where sustom fields are represented with their ids
534 #
543 #
535 # Examples:
544 # Examples:
536 # issue.read_only_attribute_names # => ['due_date', '2']
545 # issue.read_only_attribute_names # => ['due_date', '2']
537 # issue.read_only_attribute_names(user) # => []
546 # issue.read_only_attribute_names(user) # => []
538 def read_only_attribute_names(user=nil)
547 def read_only_attribute_names(user=nil)
539 workflow_rule_by_attribute(user).reject {|attr, rule| rule != 'readonly'}.keys
548 workflow_rule_by_attribute(user).reject {|attr, rule| rule != 'readonly'}.keys
540 end
549 end
541
550
542 # Returns the names of required attributes for user or the current user
551 # Returns the names of required attributes for user or the current user
543 # For users with multiple roles, the required fields are the intersection of
552 # For users with multiple roles, the required fields are the intersection of
544 # required fields of each role
553 # required fields of each role
545 # The result is an array of strings where sustom fields are represented with their ids
554 # The result is an array of strings where sustom fields are represented with their ids
546 #
555 #
547 # Examples:
556 # Examples:
548 # issue.required_attribute_names # => ['due_date', '2']
557 # issue.required_attribute_names # => ['due_date', '2']
549 # issue.required_attribute_names(user) # => []
558 # issue.required_attribute_names(user) # => []
550 def required_attribute_names(user=nil)
559 def required_attribute_names(user=nil)
551 workflow_rule_by_attribute(user).reject {|attr, rule| rule != 'required'}.keys
560 workflow_rule_by_attribute(user).reject {|attr, rule| rule != 'required'}.keys
552 end
561 end
553
562
554 # Returns true if the attribute is required for user
563 # Returns true if the attribute is required for user
555 def required_attribute?(name, user=nil)
564 def required_attribute?(name, user=nil)
556 required_attribute_names(user).include?(name.to_s)
565 required_attribute_names(user).include?(name.to_s)
557 end
566 end
558
567
559 # Returns a hash of the workflow rule by attribute for the given user
568 # Returns a hash of the workflow rule by attribute for the given user
560 #
569 #
561 # Examples:
570 # Examples:
562 # issue.workflow_rule_by_attribute # => {'due_date' => 'required', 'start_date' => 'readonly'}
571 # issue.workflow_rule_by_attribute # => {'due_date' => 'required', 'start_date' => 'readonly'}
563 def workflow_rule_by_attribute(user=nil)
572 def workflow_rule_by_attribute(user=nil)
564 return @workflow_rule_by_attribute if @workflow_rule_by_attribute && user.nil?
573 return @workflow_rule_by_attribute if @workflow_rule_by_attribute && user.nil?
565
574
566 user_real = user || User.current
575 user_real = user || User.current
567 roles = user_real.admin ? Role.all.to_a : user_real.roles_for_project(project)
576 roles = user_real.admin ? Role.all.to_a : user_real.roles_for_project(project)
568 roles = roles.select(&:consider_workflow?)
577 roles = roles.select(&:consider_workflow?)
569 return {} if roles.empty?
578 return {} if roles.empty?
570
579
571 result = {}
580 result = {}
572 workflow_permissions = WorkflowPermission.where(:tracker_id => tracker_id, :old_status_id => status_id, :role_id => roles.map(&:id)).to_a
581 workflow_permissions = WorkflowPermission.where(:tracker_id => tracker_id, :old_status_id => status_id, :role_id => roles.map(&:id)).to_a
573 if workflow_permissions.any?
582 if workflow_permissions.any?
574 workflow_rules = workflow_permissions.inject({}) do |h, wp|
583 workflow_rules = workflow_permissions.inject({}) do |h, wp|
575 h[wp.field_name] ||= {}
584 h[wp.field_name] ||= {}
576 h[wp.field_name][wp.role_id] = wp.rule
585 h[wp.field_name][wp.role_id] = wp.rule
577 h
586 h
578 end
587 end
579 fields_with_roles = {}
588 fields_with_roles = {}
580 IssueCustomField.where(:visible => false).joins(:roles).pluck(:id, "role_id").each do |field_id, role_id|
589 IssueCustomField.where(:visible => false).joins(:roles).pluck(:id, "role_id").each do |field_id, role_id|
581 fields_with_roles[field_id] ||= []
590 fields_with_roles[field_id] ||= []
582 fields_with_roles[field_id] << role_id
591 fields_with_roles[field_id] << role_id
583 end
592 end
584 roles.each do |role|
593 roles.each do |role|
585 fields_with_roles.each do |field_id, role_ids|
594 fields_with_roles.each do |field_id, role_ids|
586 unless role_ids.include?(role.id)
595 unless role_ids.include?(role.id)
587 field_name = field_id.to_s
596 field_name = field_id.to_s
588 workflow_rules[field_name] ||= {}
597 workflow_rules[field_name] ||= {}
589 workflow_rules[field_name][role.id] = 'readonly'
598 workflow_rules[field_name][role.id] = 'readonly'
590 end
599 end
591 end
600 end
592 end
601 end
593 workflow_rules.each do |attr, rules|
602 workflow_rules.each do |attr, rules|
594 next if rules.size < roles.size
603 next if rules.size < roles.size
595 uniq_rules = rules.values.uniq
604 uniq_rules = rules.values.uniq
596 if uniq_rules.size == 1
605 if uniq_rules.size == 1
597 result[attr] = uniq_rules.first
606 result[attr] = uniq_rules.first
598 else
607 else
599 result[attr] = 'required'
608 result[attr] = 'required'
600 end
609 end
601 end
610 end
602 end
611 end
603 @workflow_rule_by_attribute = result if user.nil?
612 @workflow_rule_by_attribute = result if user.nil?
604 result
613 result
605 end
614 end
606 private :workflow_rule_by_attribute
615 private :workflow_rule_by_attribute
607
616
608 def done_ratio
617 def done_ratio
609 if Issue.use_status_for_done_ratio? && status && status.default_done_ratio
618 if Issue.use_status_for_done_ratio? && status && status.default_done_ratio
610 status.default_done_ratio
619 status.default_done_ratio
611 else
620 else
612 read_attribute(:done_ratio)
621 read_attribute(:done_ratio)
613 end
622 end
614 end
623 end
615
624
616 def self.use_status_for_done_ratio?
625 def self.use_status_for_done_ratio?
617 Setting.issue_done_ratio == 'issue_status'
626 Setting.issue_done_ratio == 'issue_status'
618 end
627 end
619
628
620 def self.use_field_for_done_ratio?
629 def self.use_field_for_done_ratio?
621 Setting.issue_done_ratio == 'issue_field'
630 Setting.issue_done_ratio == 'issue_field'
622 end
631 end
623
632
624 def validate_issue
633 def validate_issue
625 if due_date && start_date && (start_date_changed? || due_date_changed?) && due_date < start_date
634 if due_date && start_date && (start_date_changed? || due_date_changed?) && due_date < start_date
626 errors.add :due_date, :greater_than_start_date
635 errors.add :due_date, :greater_than_start_date
627 end
636 end
628
637
629 if start_date && start_date_changed? && soonest_start && start_date < soonest_start
638 if start_date && start_date_changed? && soonest_start && start_date < soonest_start
630 errors.add :start_date, :earlier_than_minimum_start_date, :date => format_date(soonest_start)
639 errors.add :start_date, :earlier_than_minimum_start_date, :date => format_date(soonest_start)
631 end
640 end
632
641
633 if fixed_version
642 if fixed_version
634 if !assignable_versions.include?(fixed_version)
643 if !assignable_versions.include?(fixed_version)
635 errors.add :fixed_version_id, :inclusion
644 errors.add :fixed_version_id, :inclusion
636 elsif reopening? && fixed_version.closed?
645 elsif reopening? && fixed_version.closed?
637 errors.add :base, I18n.t(:error_can_not_reopen_issue_on_closed_version)
646 errors.add :base, I18n.t(:error_can_not_reopen_issue_on_closed_version)
638 end
647 end
639 end
648 end
640
649
641 # Checks that the issue can not be added/moved to a disabled tracker
650 # Checks that the issue can not be added/moved to a disabled tracker
642 if project && (tracker_id_changed? || project_id_changed?)
651 if project && (tracker_id_changed? || project_id_changed?)
643 unless project.trackers.include?(tracker)
652 unless project.trackers.include?(tracker)
644 errors.add :tracker_id, :inclusion
653 errors.add :tracker_id, :inclusion
645 end
654 end
646 end
655 end
647
656
648 # Checks parent issue assignment
657 # Checks parent issue assignment
649 if @invalid_parent_issue_id.present?
658 if @invalid_parent_issue_id.present?
650 errors.add :parent_issue_id, :invalid
659 errors.add :parent_issue_id, :invalid
651 elsif @parent_issue
660 elsif @parent_issue
652 if !valid_parent_project?(@parent_issue)
661 if !valid_parent_project?(@parent_issue)
653 errors.add :parent_issue_id, :invalid
662 errors.add :parent_issue_id, :invalid
654 elsif (@parent_issue != parent) && (all_dependent_issues.include?(@parent_issue) || @parent_issue.all_dependent_issues.include?(self))
663 elsif (@parent_issue != parent) && (all_dependent_issues.include?(@parent_issue) || @parent_issue.all_dependent_issues.include?(self))
655 errors.add :parent_issue_id, :invalid
664 errors.add :parent_issue_id, :invalid
656 elsif !new_record?
665 elsif !new_record?
657 # moving an existing issue
666 # moving an existing issue
658 if move_possible?(@parent_issue)
667 if move_possible?(@parent_issue)
659 # move accepted
668 # move accepted
660 else
669 else
661 errors.add :parent_issue_id, :invalid
670 errors.add :parent_issue_id, :invalid
662 end
671 end
663 end
672 end
664 end
673 end
665 end
674 end
666
675
667 # Validates the issue against additional workflow requirements
676 # Validates the issue against additional workflow requirements
668 def validate_required_fields
677 def validate_required_fields
669 user = new_record? ? author : current_journal.try(:user)
678 user = new_record? ? author : current_journal.try(:user)
670
679
671 required_attribute_names(user).each do |attribute|
680 required_attribute_names(user).each do |attribute|
672 if attribute =~ /^\d+$/
681 if attribute =~ /^\d+$/
673 attribute = attribute.to_i
682 attribute = attribute.to_i
674 v = custom_field_values.detect {|v| v.custom_field_id == attribute }
683 v = custom_field_values.detect {|v| v.custom_field_id == attribute }
675 if v && Array(v.value).detect(&:present?).nil?
684 if v && Array(v.value).detect(&:present?).nil?
676 errors.add :base, v.custom_field.name + ' ' + l('activerecord.errors.messages.blank')
685 errors.add :base, v.custom_field.name + ' ' + l('activerecord.errors.messages.blank')
677 end
686 end
678 else
687 else
679 if respond_to?(attribute) && send(attribute).blank? && !disabled_core_fields.include?(attribute)
688 if respond_to?(attribute) && send(attribute).blank? && !disabled_core_fields.include?(attribute)
680 next if attribute == 'category_id' && project.try(:issue_categories).blank?
689 next if attribute == 'category_id' && project.try(:issue_categories).blank?
681 next if attribute == 'fixed_version_id' && assignable_versions.blank?
690 next if attribute == 'fixed_version_id' && assignable_versions.blank?
682 errors.add attribute, :blank
691 errors.add attribute, :blank
683 end
692 end
684 end
693 end
685 end
694 end
686 end
695 end
687
696
688 # Overrides Redmine::Acts::Customizable::InstanceMethods#validate_custom_field_values
697 # Overrides Redmine::Acts::Customizable::InstanceMethods#validate_custom_field_values
689 # so that custom values that are not editable are not validated (eg. a custom field that
698 # so that custom values that are not editable are not validated (eg. a custom field that
690 # is marked as required should not trigger a validation error if the user is not allowed
699 # is marked as required should not trigger a validation error if the user is not allowed
691 # to edit this field).
700 # to edit this field).
692 def validate_custom_field_values
701 def validate_custom_field_values
693 user = new_record? ? author : current_journal.try(:user)
702 user = new_record? ? author : current_journal.try(:user)
694 if new_record? || custom_field_values_changed?
703 if new_record? || custom_field_values_changed?
695 editable_custom_field_values(user).each(&:validate_value)
704 editable_custom_field_values(user).each(&:validate_value)
696 end
705 end
697 end
706 end
698
707
699 # Set the done_ratio using the status if that setting is set. This will keep the done_ratios
708 # Set the done_ratio using the status if that setting is set. This will keep the done_ratios
700 # even if the user turns off the setting later
709 # even if the user turns off the setting later
701 def update_done_ratio_from_issue_status
710 def update_done_ratio_from_issue_status
702 if Issue.use_status_for_done_ratio? && status && status.default_done_ratio
711 if Issue.use_status_for_done_ratio? && status && status.default_done_ratio
703 self.done_ratio = status.default_done_ratio
712 self.done_ratio = status.default_done_ratio
704 end
713 end
705 end
714 end
706
715
707 def init_journal(user, notes = "")
716 def init_journal(user, notes = "")
708 @current_journal ||= Journal.new(:journalized => self, :user => user, :notes => notes)
717 @current_journal ||= Journal.new(:journalized => self, :user => user, :notes => notes)
709 end
718 end
710
719
711 # Returns the current journal or nil if it's not initialized
720 # Returns the current journal or nil if it's not initialized
712 def current_journal
721 def current_journal
713 @current_journal
722 @current_journal
714 end
723 end
715
724
716 # Returns the names of attributes that are journalized when updating the issue
725 # Returns the names of attributes that are journalized when updating the issue
717 def journalized_attribute_names
726 def journalized_attribute_names
718 names = Issue.column_names - %w(id root_id lft rgt lock_version created_on updated_on closed_on)
727 names = Issue.column_names - %w(id root_id lft rgt lock_version created_on updated_on closed_on)
719 if tracker
728 if tracker
720 names -= tracker.disabled_core_fields
729 names -= tracker.disabled_core_fields
721 end
730 end
722 names
731 names
723 end
732 end
724
733
725 # Returns the id of the last journal or nil
734 # Returns the id of the last journal or nil
726 def last_journal_id
735 def last_journal_id
727 if new_record?
736 if new_record?
728 nil
737 nil
729 else
738 else
730 journals.maximum(:id)
739 journals.maximum(:id)
731 end
740 end
732 end
741 end
733
742
734 # Returns a scope for journals that have an id greater than journal_id
743 # Returns a scope for journals that have an id greater than journal_id
735 def journals_after(journal_id)
744 def journals_after(journal_id)
736 scope = journals.reorder("#{Journal.table_name}.id ASC")
745 scope = journals.reorder("#{Journal.table_name}.id ASC")
737 if journal_id.present?
746 if journal_id.present?
738 scope = scope.where("#{Journal.table_name}.id > ?", journal_id.to_i)
747 scope = scope.where("#{Journal.table_name}.id > ?", journal_id.to_i)
739 end
748 end
740 scope
749 scope
741 end
750 end
742
751
743 # Returns the initial status of the issue
752 # Returns the initial status of the issue
744 # Returns nil for a new issue
753 # Returns nil for a new issue
745 def status_was
754 def status_was
746 if status_id_changed?
755 if status_id_changed?
747 if status_id_was.to_i > 0
756 if status_id_was.to_i > 0
748 @status_was ||= IssueStatus.find_by_id(status_id_was)
757 @status_was ||= IssueStatus.find_by_id(status_id_was)
749 end
758 end
750 else
759 else
751 @status_was ||= status
760 @status_was ||= status
752 end
761 end
753 end
762 end
754
763
755 # Return true if the issue is closed, otherwise false
764 # Return true if the issue is closed, otherwise false
756 def closed?
765 def closed?
757 status.present? && status.is_closed?
766 status.present? && status.is_closed?
758 end
767 end
759
768
760 # Returns true if the issue was closed when loaded
769 # Returns true if the issue was closed when loaded
761 def was_closed?
770 def was_closed?
762 status_was.present? && status_was.is_closed?
771 status_was.present? && status_was.is_closed?
763 end
772 end
764
773
765 # Return true if the issue is being reopened
774 # Return true if the issue is being reopened
766 def reopening?
775 def reopening?
767 if new_record?
776 if new_record?
768 false
777 false
769 else
778 else
770 status_id_changed? && !closed? && was_closed?
779 status_id_changed? && !closed? && was_closed?
771 end
780 end
772 end
781 end
773 alias :reopened? :reopening?
782 alias :reopened? :reopening?
774
783
775 # Return true if the issue is being closed
784 # Return true if the issue is being closed
776 def closing?
785 def closing?
777 if new_record?
786 if new_record?
778 closed?
787 closed?
779 else
788 else
780 status_id_changed? && closed? && !was_closed?
789 status_id_changed? && closed? && !was_closed?
781 end
790 end
782 end
791 end
783
792
784 # Returns true if the issue is overdue
793 # Returns true if the issue is overdue
785 def overdue?
794 def overdue?
786 due_date.present? && (due_date < Date.today) && !closed?
795 due_date.present? && (due_date < Date.today) && !closed?
787 end
796 end
788
797
789 # Is the amount of work done less than it should for the due date
798 # Is the amount of work done less than it should for the due date
790 def behind_schedule?
799 def behind_schedule?
791 return false if start_date.nil? || due_date.nil?
800 return false if start_date.nil? || due_date.nil?
792 done_date = start_date + ((due_date - start_date + 1) * done_ratio / 100).floor
801 done_date = start_date + ((due_date - start_date + 1) * done_ratio / 100).floor
793 return done_date <= Date.today
802 return done_date <= Date.today
794 end
803 end
795
804
796 # Does this issue have children?
805 # Does this issue have children?
797 def children?
806 def children?
798 !leaf?
807 !leaf?
799 end
808 end
800
809
801 # Users the issue can be assigned to
810 # Users the issue can be assigned to
802 def assignable_users
811 def assignable_users
803 users = project.assignable_users.to_a
812 users = project.assignable_users.to_a
804 users << author if author
813 users << author if author
805 users << assigned_to if assigned_to
814 users << assigned_to if assigned_to
806 users.uniq.sort
815 users.uniq.sort
807 end
816 end
808
817
809 # Versions that the issue can be assigned to
818 # Versions that the issue can be assigned to
810 def assignable_versions
819 def assignable_versions
811 return @assignable_versions if @assignable_versions
820 return @assignable_versions if @assignable_versions
812
821
813 versions = project.shared_versions.open.to_a
822 versions = project.shared_versions.open.to_a
814 if fixed_version
823 if fixed_version
815 if fixed_version_id_changed?
824 if fixed_version_id_changed?
816 # nothing to do
825 # nothing to do
817 elsif project_id_changed?
826 elsif project_id_changed?
818 if project.shared_versions.include?(fixed_version)
827 if project.shared_versions.include?(fixed_version)
819 versions << fixed_version
828 versions << fixed_version
820 end
829 end
821 else
830 else
822 versions << fixed_version
831 versions << fixed_version
823 end
832 end
824 end
833 end
825 @assignable_versions = versions.uniq.sort
834 @assignable_versions = versions.uniq.sort
826 end
835 end
827
836
828 # Returns true if this issue is blocked by another issue that is still open
837 # Returns true if this issue is blocked by another issue that is still open
829 def blocked?
838 def blocked?
830 !relations_to.detect {|ir| ir.relation_type == 'blocks' && !ir.issue_from.closed?}.nil?
839 !relations_to.detect {|ir| ir.relation_type == 'blocks' && !ir.issue_from.closed?}.nil?
831 end
840 end
832
841
833 # Returns the default status of the issue based on its tracker
842 # Returns the default status of the issue based on its tracker
834 # Returns nil if tracker is nil
843 # Returns nil if tracker is nil
835 def default_status
844 def default_status
836 tracker.try(:default_status)
845 tracker.try(:default_status)
837 end
846 end
838
847
839 # Returns an array of statuses that user is able to apply
848 # Returns an array of statuses that user is able to apply
840 def new_statuses_allowed_to(user=User.current, include_default=false)
849 def new_statuses_allowed_to(user=User.current, include_default=false)
841 if new_record? && @copied_from
850 if new_record? && @copied_from
842 [default_status, @copied_from.status].compact.uniq.sort
851 [default_status, @copied_from.status].compact.uniq.sort
843 else
852 else
844 initial_status = nil
853 initial_status = nil
845 if new_record?
854 if new_record?
846 # nop
855 # nop
847 elsif tracker_id_changed?
856 elsif tracker_id_changed?
848 if Tracker.where(:id => tracker_id_was, :default_status_id => status_id_was).any?
857 if Tracker.where(:id => tracker_id_was, :default_status_id => status_id_was).any?
849 initial_status = default_status
858 initial_status = default_status
850 elsif tracker.issue_status_ids.include?(status_id_was)
859 elsif tracker.issue_status_ids.include?(status_id_was)
851 initial_status = IssueStatus.find_by_id(status_id_was)
860 initial_status = IssueStatus.find_by_id(status_id_was)
852 else
861 else
853 initial_status = default_status
862 initial_status = default_status
854 end
863 end
855 else
864 else
856 initial_status = status_was
865 initial_status = status_was
857 end
866 end
858
867
859 initial_assigned_to_id = assigned_to_id_changed? ? assigned_to_id_was : assigned_to_id
868 initial_assigned_to_id = assigned_to_id_changed? ? assigned_to_id_was : assigned_to_id
860 assignee_transitions_allowed = initial_assigned_to_id.present? &&
869 assignee_transitions_allowed = initial_assigned_to_id.present? &&
861 (user.id == initial_assigned_to_id || user.group_ids.include?(initial_assigned_to_id))
870 (user.id == initial_assigned_to_id || user.group_ids.include?(initial_assigned_to_id))
862
871
863 statuses = []
872 statuses = []
864 statuses += IssueStatus.new_statuses_allowed(
873 statuses += IssueStatus.new_statuses_allowed(
865 initial_status,
874 initial_status,
866 user.admin ? Role.all.to_a : user.roles_for_project(project),
875 user.admin ? Role.all.to_a : user.roles_for_project(project),
867 tracker,
876 tracker,
868 author == user,
877 author == user,
869 assignee_transitions_allowed
878 assignee_transitions_allowed
870 )
879 )
871 statuses << initial_status unless statuses.empty?
880 statuses << initial_status unless statuses.empty?
872 statuses << default_status if include_default || (new_record? && statuses.empty?)
881 statuses << default_status if include_default || (new_record? && statuses.empty?)
873 statuses = statuses.compact.uniq.sort
882 statuses = statuses.compact.uniq.sort
874 if blocked?
883 if blocked?
875 statuses.reject!(&:is_closed?)
884 statuses.reject!(&:is_closed?)
876 end
885 end
877 statuses
886 statuses
878 end
887 end
879 end
888 end
880
889
881 # Returns the previous assignee (user or group) if changed
890 # Returns the previous assignee (user or group) if changed
882 def assigned_to_was
891 def assigned_to_was
883 # assigned_to_id_was is reset before after_save callbacks
892 # assigned_to_id_was is reset before after_save callbacks
884 user_id = @previous_assigned_to_id || assigned_to_id_was
893 user_id = @previous_assigned_to_id || assigned_to_id_was
885 if user_id && user_id != assigned_to_id
894 if user_id && user_id != assigned_to_id
886 @assigned_to_was ||= Principal.find_by_id(user_id)
895 @assigned_to_was ||= Principal.find_by_id(user_id)
887 end
896 end
888 end
897 end
889
898
890 # Returns the original tracker
899 # Returns the original tracker
891 def tracker_was
900 def tracker_was
892 Tracker.find_by_id(tracker_id_was)
901 Tracker.find_by_id(tracker_id_was)
893 end
902 end
894
903
895 # Returns the users that should be notified
904 # Returns the users that should be notified
896 def notified_users
905 def notified_users
897 notified = []
906 notified = []
898 # Author and assignee are always notified unless they have been
907 # Author and assignee are always notified unless they have been
899 # locked or don't want to be notified
908 # locked or don't want to be notified
900 notified << author if author
909 notified << author if author
901 if assigned_to
910 if assigned_to
902 notified += (assigned_to.is_a?(Group) ? assigned_to.users : [assigned_to])
911 notified += (assigned_to.is_a?(Group) ? assigned_to.users : [assigned_to])
903 end
912 end
904 if assigned_to_was
913 if assigned_to_was
905 notified += (assigned_to_was.is_a?(Group) ? assigned_to_was.users : [assigned_to_was])
914 notified += (assigned_to_was.is_a?(Group) ? assigned_to_was.users : [assigned_to_was])
906 end
915 end
907 notified = notified.select {|u| u.active? && u.notify_about?(self)}
916 notified = notified.select {|u| u.active? && u.notify_about?(self)}
908
917
909 notified += project.notified_users
918 notified += project.notified_users
910 notified.uniq!
919 notified.uniq!
911 # Remove users that can not view the issue
920 # Remove users that can not view the issue
912 notified.reject! {|user| !visible?(user)}
921 notified.reject! {|user| !visible?(user)}
913 notified
922 notified
914 end
923 end
915
924
916 # Returns the email addresses that should be notified
925 # Returns the email addresses that should be notified
917 def recipients
926 def recipients
918 notified_users.collect(&:mail)
927 notified_users.collect(&:mail)
919 end
928 end
920
929
921 def each_notification(users, &block)
930 def each_notification(users, &block)
922 if users.any?
931 if users.any?
923 if custom_field_values.detect {|value| !value.custom_field.visible?}
932 if custom_field_values.detect {|value| !value.custom_field.visible?}
924 users_by_custom_field_visibility = users.group_by do |user|
933 users_by_custom_field_visibility = users.group_by do |user|
925 visible_custom_field_values(user).map(&:custom_field_id).sort
934 visible_custom_field_values(user).map(&:custom_field_id).sort
926 end
935 end
927 users_by_custom_field_visibility.values.each do |users|
936 users_by_custom_field_visibility.values.each do |users|
928 yield(users)
937 yield(users)
929 end
938 end
930 else
939 else
931 yield(users)
940 yield(users)
932 end
941 end
933 end
942 end
934 end
943 end
935
944
936 def notify?
945 def notify?
937 @notify != false
946 @notify != false
938 end
947 end
939
948
940 def notify=(arg)
949 def notify=(arg)
941 @notify = arg
950 @notify = arg
942 end
951 end
943
952
944 # Returns the number of hours spent on this issue
953 # Returns the number of hours spent on this issue
945 def spent_hours
954 def spent_hours
946 @spent_hours ||= time_entries.sum(:hours) || 0
955 @spent_hours ||= time_entries.sum(:hours) || 0
947 end
956 end
948
957
949 # Returns the total number of hours spent on this issue and its descendants
958 # Returns the total number of hours spent on this issue and its descendants
950 def total_spent_hours
959 def total_spent_hours
951 @total_spent_hours ||= if leaf?
960 @total_spent_hours ||= if leaf?
952 spent_hours
961 spent_hours
953 else
962 else
954 self_and_descendants.joins(:time_entries).sum("#{TimeEntry.table_name}.hours").to_f || 0.0
963 self_and_descendants.joins(:time_entries).sum("#{TimeEntry.table_name}.hours").to_f || 0.0
955 end
964 end
956 end
965 end
957
966
958 def total_estimated_hours
967 def total_estimated_hours
959 if leaf?
968 if leaf?
960 estimated_hours
969 estimated_hours
961 else
970 else
962 @total_estimated_hours ||= self_and_descendants.sum(:estimated_hours)
971 @total_estimated_hours ||= self_and_descendants.sum(:estimated_hours)
963 end
972 end
964 end
973 end
965
974
966 def relations
975 def relations
967 @relations ||= IssueRelation::Relations.new(self, (relations_from + relations_to).sort)
976 @relations ||= IssueRelation::Relations.new(self, (relations_from + relations_to).sort)
968 end
977 end
969
978
970 # Preloads relations for a collection of issues
979 # Preloads relations for a collection of issues
971 def self.load_relations(issues)
980 def self.load_relations(issues)
972 if issues.any?
981 if issues.any?
973 relations = IssueRelation.where("issue_from_id IN (:ids) OR issue_to_id IN (:ids)", :ids => issues.map(&:id)).all
982 relations = IssueRelation.where("issue_from_id IN (:ids) OR issue_to_id IN (:ids)", :ids => issues.map(&:id)).all
974 issues.each do |issue|
983 issues.each do |issue|
975 issue.instance_variable_set "@relations", relations.select {|r| r.issue_from_id == issue.id || r.issue_to_id == issue.id}
984 issue.instance_variable_set "@relations", relations.select {|r| r.issue_from_id == issue.id || r.issue_to_id == issue.id}
976 end
985 end
977 end
986 end
978 end
987 end
979
988
980 # Preloads visible spent time for a collection of issues
989 # Preloads visible spent time for a collection of issues
981 def self.load_visible_spent_hours(issues, user=User.current)
990 def self.load_visible_spent_hours(issues, user=User.current)
982 if issues.any?
991 if issues.any?
983 hours_by_issue_id = TimeEntry.visible(user).where(:issue_id => issues.map(&:id)).group(:issue_id).sum(:hours)
992 hours_by_issue_id = TimeEntry.visible(user).where(:issue_id => issues.map(&:id)).group(:issue_id).sum(:hours)
984 issues.each do |issue|
993 issues.each do |issue|
985 issue.instance_variable_set "@spent_hours", (hours_by_issue_id[issue.id] || 0)
994 issue.instance_variable_set "@spent_hours", (hours_by_issue_id[issue.id] || 0)
986 end
995 end
987 end
996 end
988 end
997 end
989
998
990 # Preloads visible total spent time for a collection of issues
999 # Preloads visible total spent time for a collection of issues
991 def self.load_visible_total_spent_hours(issues, user=User.current)
1000 def self.load_visible_total_spent_hours(issues, user=User.current)
992 if issues.any?
1001 if issues.any?
993 hours_by_issue_id = TimeEntry.visible(user).joins(:issue).
1002 hours_by_issue_id = TimeEntry.visible(user).joins(:issue).
994 joins("JOIN #{Issue.table_name} parent ON parent.root_id = #{Issue.table_name}.root_id" +
1003 joins("JOIN #{Issue.table_name} parent ON parent.root_id = #{Issue.table_name}.root_id" +
995 " AND parent.lft <= #{Issue.table_name}.lft AND parent.rgt >= #{Issue.table_name}.rgt").
1004 " AND parent.lft <= #{Issue.table_name}.lft AND parent.rgt >= #{Issue.table_name}.rgt").
996 where("parent.id IN (?)", issues.map(&:id)).group("parent.id").sum(:hours)
1005 where("parent.id IN (?)", issues.map(&:id)).group("parent.id").sum(:hours)
997 issues.each do |issue|
1006 issues.each do |issue|
998 issue.instance_variable_set "@total_spent_hours", (hours_by_issue_id[issue.id] || 0)
1007 issue.instance_variable_set "@total_spent_hours", (hours_by_issue_id[issue.id] || 0)
999 end
1008 end
1000 end
1009 end
1001 end
1010 end
1002
1011
1003 # Preloads visible relations for a collection of issues
1012 # Preloads visible relations for a collection of issues
1004 def self.load_visible_relations(issues, user=User.current)
1013 def self.load_visible_relations(issues, user=User.current)
1005 if issues.any?
1014 if issues.any?
1006 issue_ids = issues.map(&:id)
1015 issue_ids = issues.map(&:id)
1007 # Relations with issue_from in given issues and visible issue_to
1016 # Relations with issue_from in given issues and visible issue_to
1008 relations_from = IssueRelation.joins(:issue_to => :project).
1017 relations_from = IssueRelation.joins(:issue_to => :project).
1009 where(visible_condition(user)).where(:issue_from_id => issue_ids).to_a
1018 where(visible_condition(user)).where(:issue_from_id => issue_ids).to_a
1010 # Relations with issue_to in given issues and visible issue_from
1019 # Relations with issue_to in given issues and visible issue_from
1011 relations_to = IssueRelation.joins(:issue_from => :project).
1020 relations_to = IssueRelation.joins(:issue_from => :project).
1012 where(visible_condition(user)).
1021 where(visible_condition(user)).
1013 where(:issue_to_id => issue_ids).to_a
1022 where(:issue_to_id => issue_ids).to_a
1014 issues.each do |issue|
1023 issues.each do |issue|
1015 relations =
1024 relations =
1016 relations_from.select {|relation| relation.issue_from_id == issue.id} +
1025 relations_from.select {|relation| relation.issue_from_id == issue.id} +
1017 relations_to.select {|relation| relation.issue_to_id == issue.id}
1026 relations_to.select {|relation| relation.issue_to_id == issue.id}
1018
1027
1019 issue.instance_variable_set "@relations", IssueRelation::Relations.new(issue, relations.sort)
1028 issue.instance_variable_set "@relations", IssueRelation::Relations.new(issue, relations.sort)
1020 end
1029 end
1021 end
1030 end
1022 end
1031 end
1023
1032
1024 # Finds an issue relation given its id.
1033 # Finds an issue relation given its id.
1025 def find_relation(relation_id)
1034 def find_relation(relation_id)
1026 IssueRelation.where("issue_to_id = ? OR issue_from_id = ?", id, id).find(relation_id)
1035 IssueRelation.where("issue_to_id = ? OR issue_from_id = ?", id, id).find(relation_id)
1027 end
1036 end
1028
1037
1029 # Returns all the other issues that depend on the issue
1038 # Returns all the other issues that depend on the issue
1030 # The algorithm is a modified breadth first search (bfs)
1039 # The algorithm is a modified breadth first search (bfs)
1031 def all_dependent_issues(except=[])
1040 def all_dependent_issues(except=[])
1032 # The found dependencies
1041 # The found dependencies
1033 dependencies = []
1042 dependencies = []
1034
1043
1035 # The visited flag for every node (issue) used by the breadth first search
1044 # The visited flag for every node (issue) used by the breadth first search
1036 eNOT_DISCOVERED = 0 # The issue is "new" to the algorithm, it has not seen it before.
1045 eNOT_DISCOVERED = 0 # The issue is "new" to the algorithm, it has not seen it before.
1037
1046
1038 ePROCESS_ALL = 1 # The issue is added to the queue. Process both children and relations of
1047 ePROCESS_ALL = 1 # The issue is added to the queue. Process both children and relations of
1039 # the issue when it is processed.
1048 # the issue when it is processed.
1040
1049
1041 ePROCESS_RELATIONS_ONLY = 2 # The issue was added to the queue and will be output as dependent issue,
1050 ePROCESS_RELATIONS_ONLY = 2 # The issue was added to the queue and will be output as dependent issue,
1042 # but its children will not be added to the queue when it is processed.
1051 # but its children will not be added to the queue when it is processed.
1043
1052
1044 eRELATIONS_PROCESSED = 3 # The related issues, the parent issue and the issue itself have been added to
1053 eRELATIONS_PROCESSED = 3 # The related issues, the parent issue and the issue itself have been added to
1045 # the queue, but its children have not been added.
1054 # the queue, but its children have not been added.
1046
1055
1047 ePROCESS_CHILDREN_ONLY = 4 # The relations and the parent of the issue have been added to the queue, but
1056 ePROCESS_CHILDREN_ONLY = 4 # The relations and the parent of the issue have been added to the queue, but
1048 # the children still need to be processed.
1057 # the children still need to be processed.
1049
1058
1050 eALL_PROCESSED = 5 # The issue and all its children, its parent and its related issues have been
1059 eALL_PROCESSED = 5 # The issue and all its children, its parent and its related issues have been
1051 # added as dependent issues. It needs no further processing.
1060 # added as dependent issues. It needs no further processing.
1052
1061
1053 issue_status = Hash.new(eNOT_DISCOVERED)
1062 issue_status = Hash.new(eNOT_DISCOVERED)
1054
1063
1055 # The queue
1064 # The queue
1056 queue = []
1065 queue = []
1057
1066
1058 # Initialize the bfs, add start node (self) to the queue
1067 # Initialize the bfs, add start node (self) to the queue
1059 queue << self
1068 queue << self
1060 issue_status[self] = ePROCESS_ALL
1069 issue_status[self] = ePROCESS_ALL
1061
1070
1062 while (!queue.empty?) do
1071 while (!queue.empty?) do
1063 current_issue = queue.shift
1072 current_issue = queue.shift
1064 current_issue_status = issue_status[current_issue]
1073 current_issue_status = issue_status[current_issue]
1065 dependencies << current_issue
1074 dependencies << current_issue
1066
1075
1067 # Add parent to queue, if not already in it.
1076 # Add parent to queue, if not already in it.
1068 parent = current_issue.parent
1077 parent = current_issue.parent
1069 parent_status = issue_status[parent]
1078 parent_status = issue_status[parent]
1070
1079
1071 if parent && (parent_status == eNOT_DISCOVERED) && !except.include?(parent)
1080 if parent && (parent_status == eNOT_DISCOVERED) && !except.include?(parent)
1072 queue << parent
1081 queue << parent
1073 issue_status[parent] = ePROCESS_RELATIONS_ONLY
1082 issue_status[parent] = ePROCESS_RELATIONS_ONLY
1074 end
1083 end
1075
1084
1076 # Add children to queue, but only if they are not already in it and
1085 # Add children to queue, but only if they are not already in it and
1077 # the children of the current node need to be processed.
1086 # the children of the current node need to be processed.
1078 if (current_issue_status == ePROCESS_CHILDREN_ONLY || current_issue_status == ePROCESS_ALL)
1087 if (current_issue_status == ePROCESS_CHILDREN_ONLY || current_issue_status == ePROCESS_ALL)
1079 current_issue.children.each do |child|
1088 current_issue.children.each do |child|
1080 next if except.include?(child)
1089 next if except.include?(child)
1081
1090
1082 if (issue_status[child] == eNOT_DISCOVERED)
1091 if (issue_status[child] == eNOT_DISCOVERED)
1083 queue << child
1092 queue << child
1084 issue_status[child] = ePROCESS_ALL
1093 issue_status[child] = ePROCESS_ALL
1085 elsif (issue_status[child] == eRELATIONS_PROCESSED)
1094 elsif (issue_status[child] == eRELATIONS_PROCESSED)
1086 queue << child
1095 queue << child
1087 issue_status[child] = ePROCESS_CHILDREN_ONLY
1096 issue_status[child] = ePROCESS_CHILDREN_ONLY
1088 elsif (issue_status[child] == ePROCESS_RELATIONS_ONLY)
1097 elsif (issue_status[child] == ePROCESS_RELATIONS_ONLY)
1089 queue << child
1098 queue << child
1090 issue_status[child] = ePROCESS_ALL
1099 issue_status[child] = ePROCESS_ALL
1091 end
1100 end
1092 end
1101 end
1093 end
1102 end
1094
1103
1095 # Add related issues to the queue, if they are not already in it.
1104 # Add related issues to the queue, if they are not already in it.
1096 current_issue.relations_from.map(&:issue_to).each do |related_issue|
1105 current_issue.relations_from.map(&:issue_to).each do |related_issue|
1097 next if except.include?(related_issue)
1106 next if except.include?(related_issue)
1098
1107
1099 if (issue_status[related_issue] == eNOT_DISCOVERED)
1108 if (issue_status[related_issue] == eNOT_DISCOVERED)
1100 queue << related_issue
1109 queue << related_issue
1101 issue_status[related_issue] = ePROCESS_ALL
1110 issue_status[related_issue] = ePROCESS_ALL
1102 elsif (issue_status[related_issue] == eRELATIONS_PROCESSED)
1111 elsif (issue_status[related_issue] == eRELATIONS_PROCESSED)
1103 queue << related_issue
1112 queue << related_issue
1104 issue_status[related_issue] = ePROCESS_CHILDREN_ONLY
1113 issue_status[related_issue] = ePROCESS_CHILDREN_ONLY
1105 elsif (issue_status[related_issue] == ePROCESS_RELATIONS_ONLY)
1114 elsif (issue_status[related_issue] == ePROCESS_RELATIONS_ONLY)
1106 queue << related_issue
1115 queue << related_issue
1107 issue_status[related_issue] = ePROCESS_ALL
1116 issue_status[related_issue] = ePROCESS_ALL
1108 end
1117 end
1109 end
1118 end
1110
1119
1111 # Set new status for current issue
1120 # Set new status for current issue
1112 if (current_issue_status == ePROCESS_ALL) || (current_issue_status == ePROCESS_CHILDREN_ONLY)
1121 if (current_issue_status == ePROCESS_ALL) || (current_issue_status == ePROCESS_CHILDREN_ONLY)
1113 issue_status[current_issue] = eALL_PROCESSED
1122 issue_status[current_issue] = eALL_PROCESSED
1114 elsif (current_issue_status == ePROCESS_RELATIONS_ONLY)
1123 elsif (current_issue_status == ePROCESS_RELATIONS_ONLY)
1115 issue_status[current_issue] = eRELATIONS_PROCESSED
1124 issue_status[current_issue] = eRELATIONS_PROCESSED
1116 end
1125 end
1117 end # while
1126 end # while
1118
1127
1119 # Remove the issues from the "except" parameter from the result array
1128 # Remove the issues from the "except" parameter from the result array
1120 dependencies -= except
1129 dependencies -= except
1121 dependencies.delete(self)
1130 dependencies.delete(self)
1122
1131
1123 dependencies
1132 dependencies
1124 end
1133 end
1125
1134
1126 # Returns an array of issues that duplicate this one
1135 # Returns an array of issues that duplicate this one
1127 def duplicates
1136 def duplicates
1128 relations_to.select {|r| r.relation_type == IssueRelation::TYPE_DUPLICATES}.collect {|r| r.issue_from}
1137 relations_to.select {|r| r.relation_type == IssueRelation::TYPE_DUPLICATES}.collect {|r| r.issue_from}
1129 end
1138 end
1130
1139
1131 # Returns the due date or the target due date if any
1140 # Returns the due date or the target due date if any
1132 # Used on gantt chart
1141 # Used on gantt chart
1133 def due_before
1142 def due_before
1134 due_date || (fixed_version ? fixed_version.effective_date : nil)
1143 due_date || (fixed_version ? fixed_version.effective_date : nil)
1135 end
1144 end
1136
1145
1137 # Returns the time scheduled for this issue.
1146 # Returns the time scheduled for this issue.
1138 #
1147 #
1139 # Example:
1148 # Example:
1140 # Start Date: 2/26/09, End Date: 3/04/09
1149 # Start Date: 2/26/09, End Date: 3/04/09
1141 # duration => 6
1150 # duration => 6
1142 def duration
1151 def duration
1143 (start_date && due_date) ? due_date - start_date : 0
1152 (start_date && due_date) ? due_date - start_date : 0
1144 end
1153 end
1145
1154
1146 # Returns the duration in working days
1155 # Returns the duration in working days
1147 def working_duration
1156 def working_duration
1148 (start_date && due_date) ? working_days(start_date, due_date) : 0
1157 (start_date && due_date) ? working_days(start_date, due_date) : 0
1149 end
1158 end
1150
1159
1151 def soonest_start(reload=false)
1160 def soonest_start(reload=false)
1152 if @soonest_start.nil? || reload
1161 if @soonest_start.nil? || reload
1153 dates = relations_to(reload).collect{|relation| relation.successor_soonest_start}
1162 dates = relations_to(reload).collect{|relation| relation.successor_soonest_start}
1154 p = @parent_issue || parent
1163 p = @parent_issue || parent
1155 if p && Setting.parent_issue_dates == 'derived'
1164 if p && Setting.parent_issue_dates == 'derived'
1156 dates << p.soonest_start
1165 dates << p.soonest_start
1157 end
1166 end
1158 @soonest_start = dates.compact.max
1167 @soonest_start = dates.compact.max
1159 end
1168 end
1160 @soonest_start
1169 @soonest_start
1161 end
1170 end
1162
1171
1163 # Sets start_date on the given date or the next working day
1172 # Sets start_date on the given date or the next working day
1164 # and changes due_date to keep the same working duration.
1173 # and changes due_date to keep the same working duration.
1165 def reschedule_on(date)
1174 def reschedule_on(date)
1166 wd = working_duration
1175 wd = working_duration
1167 date = next_working_date(date)
1176 date = next_working_date(date)
1168 self.start_date = date
1177 self.start_date = date
1169 self.due_date = add_working_days(date, wd)
1178 self.due_date = add_working_days(date, wd)
1170 end
1179 end
1171
1180
1172 # Reschedules the issue on the given date or the next working day and saves the record.
1181 # Reschedules the issue on the given date or the next working day and saves the record.
1173 # If the issue is a parent task, this is done by rescheduling its subtasks.
1182 # If the issue is a parent task, this is done by rescheduling its subtasks.
1174 def reschedule_on!(date)
1183 def reschedule_on!(date)
1175 return if date.nil?
1184 return if date.nil?
1176 if leaf? || !dates_derived?
1185 if leaf? || !dates_derived?
1177 if start_date.nil? || start_date != date
1186 if start_date.nil? || start_date != date
1178 if start_date && start_date > date
1187 if start_date && start_date > date
1179 # Issue can not be moved earlier than its soonest start date
1188 # Issue can not be moved earlier than its soonest start date
1180 date = [soonest_start(true), date].compact.max
1189 date = [soonest_start(true), date].compact.max
1181 end
1190 end
1182 reschedule_on(date)
1191 reschedule_on(date)
1183 begin
1192 begin
1184 save
1193 save
1185 rescue ActiveRecord::StaleObjectError
1194 rescue ActiveRecord::StaleObjectError
1186 reload
1195 reload
1187 reschedule_on(date)
1196 reschedule_on(date)
1188 save
1197 save
1189 end
1198 end
1190 end
1199 end
1191 else
1200 else
1192 leaves.each do |leaf|
1201 leaves.each do |leaf|
1193 if leaf.start_date
1202 if leaf.start_date
1194 # Only move subtask if it starts at the same date as the parent
1203 # Only move subtask if it starts at the same date as the parent
1195 # or if it starts before the given date
1204 # or if it starts before the given date
1196 if start_date == leaf.start_date || date > leaf.start_date
1205 if start_date == leaf.start_date || date > leaf.start_date
1197 leaf.reschedule_on!(date)
1206 leaf.reschedule_on!(date)
1198 end
1207 end
1199 else
1208 else
1200 leaf.reschedule_on!(date)
1209 leaf.reschedule_on!(date)
1201 end
1210 end
1202 end
1211 end
1203 end
1212 end
1204 end
1213 end
1205
1214
1206 def dates_derived?
1215 def dates_derived?
1207 !leaf? && Setting.parent_issue_dates == 'derived'
1216 !leaf? && Setting.parent_issue_dates == 'derived'
1208 end
1217 end
1209
1218
1210 def priority_derived?
1219 def priority_derived?
1211 !leaf? && Setting.parent_issue_priority == 'derived'
1220 !leaf? && Setting.parent_issue_priority == 'derived'
1212 end
1221 end
1213
1222
1214 def done_ratio_derived?
1223 def done_ratio_derived?
1215 !leaf? && Setting.parent_issue_done_ratio == 'derived'
1224 !leaf? && Setting.parent_issue_done_ratio == 'derived'
1216 end
1225 end
1217
1226
1218 def <=>(issue)
1227 def <=>(issue)
1219 if issue.nil?
1228 if issue.nil?
1220 -1
1229 -1
1221 elsif root_id != issue.root_id
1230 elsif root_id != issue.root_id
1222 (root_id || 0) <=> (issue.root_id || 0)
1231 (root_id || 0) <=> (issue.root_id || 0)
1223 else
1232 else
1224 (lft || 0) <=> (issue.lft || 0)
1233 (lft || 0) <=> (issue.lft || 0)
1225 end
1234 end
1226 end
1235 end
1227
1236
1228 def to_s
1237 def to_s
1229 "#{tracker} ##{id}: #{subject}"
1238 "#{tracker} ##{id}: #{subject}"
1230 end
1239 end
1231
1240
1232 # Returns a string of css classes that apply to the issue
1241 # Returns a string of css classes that apply to the issue
1233 def css_classes(user=User.current)
1242 def css_classes(user=User.current)
1234 s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}"
1243 s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}"
1235 s << ' closed' if closed?
1244 s << ' closed' if closed?
1236 s << ' overdue' if overdue?
1245 s << ' overdue' if overdue?
1237 s << ' child' if child?
1246 s << ' child' if child?
1238 s << ' parent' unless leaf?
1247 s << ' parent' unless leaf?
1239 s << ' private' if is_private?
1248 s << ' private' if is_private?
1240 if user.logged?
1249 if user.logged?
1241 s << ' created-by-me' if author_id == user.id
1250 s << ' created-by-me' if author_id == user.id
1242 s << ' assigned-to-me' if assigned_to_id == user.id
1251 s << ' assigned-to-me' if assigned_to_id == user.id
1243 s << ' assigned-to-my-group' if user.groups.any? {|g| g.id == assigned_to_id}
1252 s << ' assigned-to-my-group' if user.groups.any? {|g| g.id == assigned_to_id}
1244 end
1253 end
1245 s
1254 s
1246 end
1255 end
1247
1256
1248 # Unassigns issues from +version+ if it's no longer shared with issue's project
1257 # Unassigns issues from +version+ if it's no longer shared with issue's project
1249 def self.update_versions_from_sharing_change(version)
1258 def self.update_versions_from_sharing_change(version)
1250 # Update issues assigned to the version
1259 # Update issues assigned to the version
1251 update_versions(["#{Issue.table_name}.fixed_version_id = ?", version.id])
1260 update_versions(["#{Issue.table_name}.fixed_version_id = ?", version.id])
1252 end
1261 end
1253
1262
1254 # Unassigns issues from versions that are no longer shared
1263 # Unassigns issues from versions that are no longer shared
1255 # after +project+ was moved
1264 # after +project+ was moved
1256 def self.update_versions_from_hierarchy_change(project)
1265 def self.update_versions_from_hierarchy_change(project)
1257 moved_project_ids = project.self_and_descendants.reload.collect(&:id)
1266 moved_project_ids = project.self_and_descendants.reload.collect(&:id)
1258 # Update issues of the moved projects and issues assigned to a version of a moved project
1267 # Update issues of the moved projects and issues assigned to a version of a moved project
1259 Issue.update_versions(
1268 Issue.update_versions(
1260 ["#{Version.table_name}.project_id IN (?) OR #{Issue.table_name}.project_id IN (?)",
1269 ["#{Version.table_name}.project_id IN (?) OR #{Issue.table_name}.project_id IN (?)",
1261 moved_project_ids, moved_project_ids]
1270 moved_project_ids, moved_project_ids]
1262 )
1271 )
1263 end
1272 end
1264
1273
1265 def parent_issue_id=(arg)
1274 def parent_issue_id=(arg)
1266 s = arg.to_s.strip.presence
1275 s = arg.to_s.strip.presence
1267 if s && (m = s.match(%r{\A#?(\d+)\z})) && (@parent_issue = Issue.find_by_id(m[1]))
1276 if s && (m = s.match(%r{\A#?(\d+)\z})) && (@parent_issue = Issue.find_by_id(m[1]))
1268 @invalid_parent_issue_id = nil
1277 @invalid_parent_issue_id = nil
1269 elsif s.blank?
1278 elsif s.blank?
1270 @parent_issue = nil
1279 @parent_issue = nil
1271 @invalid_parent_issue_id = nil
1280 @invalid_parent_issue_id = nil
1272 else
1281 else
1273 @parent_issue = nil
1282 @parent_issue = nil
1274 @invalid_parent_issue_id = arg
1283 @invalid_parent_issue_id = arg
1275 end
1284 end
1276 end
1285 end
1277
1286
1278 def parent_issue_id
1287 def parent_issue_id
1279 if @invalid_parent_issue_id
1288 if @invalid_parent_issue_id
1280 @invalid_parent_issue_id
1289 @invalid_parent_issue_id
1281 elsif instance_variable_defined? :@parent_issue
1290 elsif instance_variable_defined? :@parent_issue
1282 @parent_issue.nil? ? nil : @parent_issue.id
1291 @parent_issue.nil? ? nil : @parent_issue.id
1283 else
1292 else
1284 parent_id
1293 parent_id
1285 end
1294 end
1286 end
1295 end
1287
1296
1288 def set_parent_id
1297 def set_parent_id
1289 self.parent_id = parent_issue_id
1298 self.parent_id = parent_issue_id
1290 end
1299 end
1291
1300
1292 # Returns true if issue's project is a valid
1301 # Returns true if issue's project is a valid
1293 # parent issue project
1302 # parent issue project
1294 def valid_parent_project?(issue=parent)
1303 def valid_parent_project?(issue=parent)
1295 return true if issue.nil? || issue.project_id == project_id
1304 return true if issue.nil? || issue.project_id == project_id
1296
1305
1297 case Setting.cross_project_subtasks
1306 case Setting.cross_project_subtasks
1298 when 'system'
1307 when 'system'
1299 true
1308 true
1300 when 'tree'
1309 when 'tree'
1301 issue.project.root == project.root
1310 issue.project.root == project.root
1302 when 'hierarchy'
1311 when 'hierarchy'
1303 issue.project.is_or_is_ancestor_of?(project) || issue.project.is_descendant_of?(project)
1312 issue.project.is_or_is_ancestor_of?(project) || issue.project.is_descendant_of?(project)
1304 when 'descendants'
1313 when 'descendants'
1305 issue.project.is_or_is_ancestor_of?(project)
1314 issue.project.is_or_is_ancestor_of?(project)
1306 else
1315 else
1307 false
1316 false
1308 end
1317 end
1309 end
1318 end
1310
1319
1311 # Returns an issue scope based on project and scope
1320 # Returns an issue scope based on project and scope
1312 def self.cross_project_scope(project, scope=nil)
1321 def self.cross_project_scope(project, scope=nil)
1313 if project.nil?
1322 if project.nil?
1314 return Issue
1323 return Issue
1315 end
1324 end
1316 case scope
1325 case scope
1317 when 'all', 'system'
1326 when 'all', 'system'
1318 Issue
1327 Issue
1319 when 'tree'
1328 when 'tree'
1320 Issue.joins(:project).where("(#{Project.table_name}.lft >= :lft AND #{Project.table_name}.rgt <= :rgt)",
1329 Issue.joins(:project).where("(#{Project.table_name}.lft >= :lft AND #{Project.table_name}.rgt <= :rgt)",
1321 :lft => project.root.lft, :rgt => project.root.rgt)
1330 :lft => project.root.lft, :rgt => project.root.rgt)
1322 when 'hierarchy'
1331 when 'hierarchy'
1323 Issue.joins(:project).where("(#{Project.table_name}.lft >= :lft AND #{Project.table_name}.rgt <= :rgt) OR (#{Project.table_name}.lft < :lft AND #{Project.table_name}.rgt > :rgt)",
1332 Issue.joins(:project).where("(#{Project.table_name}.lft >= :lft AND #{Project.table_name}.rgt <= :rgt) OR (#{Project.table_name}.lft < :lft AND #{Project.table_name}.rgt > :rgt)",
1324 :lft => project.lft, :rgt => project.rgt)
1333 :lft => project.lft, :rgt => project.rgt)
1325 when 'descendants'
1334 when 'descendants'
1326 Issue.joins(:project).where("(#{Project.table_name}.lft >= :lft AND #{Project.table_name}.rgt <= :rgt)",
1335 Issue.joins(:project).where("(#{Project.table_name}.lft >= :lft AND #{Project.table_name}.rgt <= :rgt)",
1327 :lft => project.lft, :rgt => project.rgt)
1336 :lft => project.lft, :rgt => project.rgt)
1328 else
1337 else
1329 Issue.where(:project_id => project.id)
1338 Issue.where(:project_id => project.id)
1330 end
1339 end
1331 end
1340 end
1332
1341
1333 def self.by_tracker(project)
1342 def self.by_tracker(project)
1334 count_and_group_by(:project => project, :association => :tracker)
1343 count_and_group_by(:project => project, :association => :tracker)
1335 end
1344 end
1336
1345
1337 def self.by_version(project)
1346 def self.by_version(project)
1338 count_and_group_by(:project => project, :association => :fixed_version)
1347 count_and_group_by(:project => project, :association => :fixed_version)
1339 end
1348 end
1340
1349
1341 def self.by_priority(project)
1350 def self.by_priority(project)
1342 count_and_group_by(:project => project, :association => :priority)
1351 count_and_group_by(:project => project, :association => :priority)
1343 end
1352 end
1344
1353
1345 def self.by_category(project)
1354 def self.by_category(project)
1346 count_and_group_by(:project => project, :association => :category)
1355 count_and_group_by(:project => project, :association => :category)
1347 end
1356 end
1348
1357
1349 def self.by_assigned_to(project)
1358 def self.by_assigned_to(project)
1350 count_and_group_by(:project => project, :association => :assigned_to)
1359 count_and_group_by(:project => project, :association => :assigned_to)
1351 end
1360 end
1352
1361
1353 def self.by_author(project)
1362 def self.by_author(project)
1354 count_and_group_by(:project => project, :association => :author)
1363 count_and_group_by(:project => project, :association => :author)
1355 end
1364 end
1356
1365
1357 def self.by_subproject(project)
1366 def self.by_subproject(project)
1358 r = count_and_group_by(:project => project, :with_subprojects => true, :association => :project)
1367 r = count_and_group_by(:project => project, :with_subprojects => true, :association => :project)
1359 r.reject {|r| r["project_id"] == project.id.to_s}
1368 r.reject {|r| r["project_id"] == project.id.to_s}
1360 end
1369 end
1361
1370
1362 # Query generator for selecting groups of issue counts for a project
1371 # Query generator for selecting groups of issue counts for a project
1363 # based on specific criteria
1372 # based on specific criteria
1364 #
1373 #
1365 # Options
1374 # Options
1366 # * project - Project to search in.
1375 # * project - Project to search in.
1367 # * with_subprojects - Includes subprojects issues if set to true.
1376 # * with_subprojects - Includes subprojects issues if set to true.
1368 # * association - Symbol. Association for grouping.
1377 # * association - Symbol. Association for grouping.
1369 def self.count_and_group_by(options)
1378 def self.count_and_group_by(options)
1370 assoc = reflect_on_association(options[:association])
1379 assoc = reflect_on_association(options[:association])
1371 select_field = assoc.foreign_key
1380 select_field = assoc.foreign_key
1372
1381
1373 Issue.
1382 Issue.
1374 visible(User.current, :project => options[:project], :with_subprojects => options[:with_subprojects]).
1383 visible(User.current, :project => options[:project], :with_subprojects => options[:with_subprojects]).
1375 joins(:status, assoc.name).
1384 joins(:status, assoc.name).
1376 group(:status_id, :is_closed, select_field).
1385 group(:status_id, :is_closed, select_field).
1377 count.
1386 count.
1378 map do |columns, total|
1387 map do |columns, total|
1379 status_id, is_closed, field_value = columns
1388 status_id, is_closed, field_value = columns
1380 is_closed = ['t', 'true', '1'].include?(is_closed.to_s)
1389 is_closed = ['t', 'true', '1'].include?(is_closed.to_s)
1381 {
1390 {
1382 "status_id" => status_id.to_s,
1391 "status_id" => status_id.to_s,
1383 "closed" => is_closed,
1392 "closed" => is_closed,
1384 select_field => field_value.to_s,
1393 select_field => field_value.to_s,
1385 "total" => total.to_s
1394 "total" => total.to_s
1386 }
1395 }
1387 end
1396 end
1388 end
1397 end
1389
1398
1390 # Returns a scope of projects that user can assign the issue to
1399 # Returns a scope of projects that user can assign the issue to
1391 def allowed_target_projects(user=User.current)
1400 def allowed_target_projects(user=User.current)
1392 current_project = new_record? ? nil : project
1401 current_project = new_record? ? nil : project
1393 self.class.allowed_target_projects(user, current_project)
1402 self.class.allowed_target_projects(user, current_project)
1394 end
1403 end
1395
1404
1396 # Returns a scope of projects that user can assign issues to
1405 # Returns a scope of projects that user can assign issues to
1397 # If current_project is given, it will be included in the scope
1406 # If current_project is given, it will be included in the scope
1398 def self.allowed_target_projects(user=User.current, current_project=nil)
1407 def self.allowed_target_projects(user=User.current, current_project=nil)
1399 condition = Project.allowed_to_condition(user, :add_issues)
1408 condition = Project.allowed_to_condition(user, :add_issues)
1400 if current_project
1409 if current_project
1401 condition = ["(#{condition}) OR #{Project.table_name}.id = ?", current_project.id]
1410 condition = ["(#{condition}) OR #{Project.table_name}.id = ?", current_project.id]
1402 end
1411 end
1403 Project.where(condition).having_trackers
1412 Project.where(condition).having_trackers
1404 end
1413 end
1405
1414
1406 private
1415 private
1407
1416
1408 def after_project_change
1417 def after_project_change
1409 # Update project_id on related time entries
1418 # Update project_id on related time entries
1410 TimeEntry.where({:issue_id => id}).update_all(["project_id = ?", project_id])
1419 TimeEntry.where({:issue_id => id}).update_all(["project_id = ?", project_id])
1411
1420
1412 # Delete issue relations
1421 # Delete issue relations
1413 unless Setting.cross_project_issue_relations?
1422 unless Setting.cross_project_issue_relations?
1414 relations_from.clear
1423 relations_from.clear
1415 relations_to.clear
1424 relations_to.clear
1416 end
1425 end
1417
1426
1418 # Move subtasks that were in the same project
1427 # Move subtasks that were in the same project
1419 children.each do |child|
1428 children.each do |child|
1420 next unless child.project_id == project_id_was
1429 next unless child.project_id == project_id_was
1421 # Change project and keep project
1430 # Change project and keep project
1422 child.send :project=, project, true
1431 child.send :project=, project, true
1423 unless child.save
1432 unless child.save
1424 raise ActiveRecord::Rollback
1433 raise ActiveRecord::Rollback
1425 end
1434 end
1426 end
1435 end
1427 end
1436 end
1428
1437
1429 # Callback for after the creation of an issue by copy
1438 # Callback for after the creation of an issue by copy
1430 # * adds a "copied to" relation with the copied issue
1439 # * adds a "copied to" relation with the copied issue
1431 # * copies subtasks from the copied issue
1440 # * copies subtasks from the copied issue
1432 def after_create_from_copy
1441 def after_create_from_copy
1433 return unless copy? && !@after_create_from_copy_handled
1442 return unless copy? && !@after_create_from_copy_handled
1434
1443
1435 if (@copied_from.project_id == project_id || Setting.cross_project_issue_relations?) && @copy_options[:link] != false
1444 if (@copied_from.project_id == project_id || Setting.cross_project_issue_relations?) && @copy_options[:link] != false
1436 if @current_journal
1445 if @current_journal
1437 @copied_from.init_journal(@current_journal.user)
1446 @copied_from.init_journal(@current_journal.user)
1438 end
1447 end
1439 relation = IssueRelation.new(:issue_from => @copied_from, :issue_to => self, :relation_type => IssueRelation::TYPE_COPIED_TO)
1448 relation = IssueRelation.new(:issue_from => @copied_from, :issue_to => self, :relation_type => IssueRelation::TYPE_COPIED_TO)
1440 unless relation.save
1449 unless relation.save
1441 logger.error "Could not create relation while copying ##{@copied_from.id} to ##{id} due to validation errors: #{relation.errors.full_messages.join(', ')}" if logger
1450 logger.error "Could not create relation while copying ##{@copied_from.id} to ##{id} due to validation errors: #{relation.errors.full_messages.join(', ')}" if logger
1442 end
1451 end
1443 end
1452 end
1444
1453
1445 unless @copied_from.leaf? || @copy_options[:subtasks] == false
1454 unless @copied_from.leaf? || @copy_options[:subtasks] == false
1446 copy_options = (@copy_options || {}).merge(:subtasks => false)
1455 copy_options = (@copy_options || {}).merge(:subtasks => false)
1447 copied_issue_ids = {@copied_from.id => self.id}
1456 copied_issue_ids = {@copied_from.id => self.id}
1448 @copied_from.reload.descendants.reorder("#{Issue.table_name}.lft").each do |child|
1457 @copied_from.reload.descendants.reorder("#{Issue.table_name}.lft").each do |child|
1449 # Do not copy self when copying an issue as a descendant of the copied issue
1458 # Do not copy self when copying an issue as a descendant of the copied issue
1450 next if child == self
1459 next if child == self
1451 # Do not copy subtasks of issues that were not copied
1460 # Do not copy subtasks of issues that were not copied
1452 next unless copied_issue_ids[child.parent_id]
1461 next unless copied_issue_ids[child.parent_id]
1453 # Do not copy subtasks that are not visible to avoid potential disclosure of private data
1462 # Do not copy subtasks that are not visible to avoid potential disclosure of private data
1454 unless child.visible?
1463 unless child.visible?
1455 logger.error "Subtask ##{child.id} was not copied during ##{@copied_from.id} copy because it is not visible to the current user" if logger
1464 logger.error "Subtask ##{child.id} was not copied during ##{@copied_from.id} copy because it is not visible to the current user" if logger
1456 next
1465 next
1457 end
1466 end
1458 copy = Issue.new.copy_from(child, copy_options)
1467 copy = Issue.new.copy_from(child, copy_options)
1459 if @current_journal
1468 if @current_journal
1460 copy.init_journal(@current_journal.user)
1469 copy.init_journal(@current_journal.user)
1461 end
1470 end
1462 copy.author = author
1471 copy.author = author
1463 copy.project = project
1472 copy.project = project
1464 copy.parent_issue_id = copied_issue_ids[child.parent_id]
1473 copy.parent_issue_id = copied_issue_ids[child.parent_id]
1465 unless copy.save
1474 unless copy.save
1466 logger.error "Could not copy subtask ##{child.id} while copying ##{@copied_from.id} to ##{id} due to validation errors: #{copy.errors.full_messages.join(', ')}" if logger
1475 logger.error "Could not copy subtask ##{child.id} while copying ##{@copied_from.id} to ##{id} due to validation errors: #{copy.errors.full_messages.join(', ')}" if logger
1467 next
1476 next
1468 end
1477 end
1469 copied_issue_ids[child.id] = copy.id
1478 copied_issue_ids[child.id] = copy.id
1470 end
1479 end
1471 end
1480 end
1472 @after_create_from_copy_handled = true
1481 @after_create_from_copy_handled = true
1473 end
1482 end
1474
1483
1475 def update_nested_set_attributes
1484 def update_nested_set_attributes
1476 if parent_id_changed?
1485 if parent_id_changed?
1477 update_nested_set_attributes_on_parent_change
1486 update_nested_set_attributes_on_parent_change
1478 end
1487 end
1479 remove_instance_variable(:@parent_issue) if instance_variable_defined?(:@parent_issue)
1488 remove_instance_variable(:@parent_issue) if instance_variable_defined?(:@parent_issue)
1480 end
1489 end
1481
1490
1482 # Updates the nested set for when an existing issue is moved
1491 # Updates the nested set for when an existing issue is moved
1483 def update_nested_set_attributes_on_parent_change
1492 def update_nested_set_attributes_on_parent_change
1484 former_parent_id = parent_id_was
1493 former_parent_id = parent_id_was
1485 # delete invalid relations of all descendants
1494 # delete invalid relations of all descendants
1486 self_and_descendants.each do |issue|
1495 self_and_descendants.each do |issue|
1487 issue.relations.each do |relation|
1496 issue.relations.each do |relation|
1488 relation.destroy unless relation.valid?
1497 relation.destroy unless relation.valid?
1489 end
1498 end
1490 end
1499 end
1491 # update former parent
1500 # update former parent
1492 recalculate_attributes_for(former_parent_id) if former_parent_id
1501 recalculate_attributes_for(former_parent_id) if former_parent_id
1493 end
1502 end
1494
1503
1495 def update_parent_attributes
1504 def update_parent_attributes
1496 if parent_id
1505 if parent_id
1497 recalculate_attributes_for(parent_id)
1506 recalculate_attributes_for(parent_id)
1498 association(:parent).reset
1507 association(:parent).reset
1499 end
1508 end
1500 end
1509 end
1501
1510
1502 def recalculate_attributes_for(issue_id)
1511 def recalculate_attributes_for(issue_id)
1503 if issue_id && p = Issue.find_by_id(issue_id)
1512 if issue_id && p = Issue.find_by_id(issue_id)
1504 if p.priority_derived?
1513 if p.priority_derived?
1505 # priority = highest priority of children
1514 # priority = highest priority of children
1506 if priority_position = p.children.joins(:priority).maximum("#{IssuePriority.table_name}.position")
1515 if priority_position = p.children.joins(:priority).maximum("#{IssuePriority.table_name}.position")
1507 p.priority = IssuePriority.find_by_position(priority_position)
1516 p.priority = IssuePriority.find_by_position(priority_position)
1508 end
1517 end
1509 end
1518 end
1510
1519
1511 if p.dates_derived?
1520 if p.dates_derived?
1512 # start/due dates = lowest/highest dates of children
1521 # start/due dates = lowest/highest dates of children
1513 p.start_date = p.children.minimum(:start_date)
1522 p.start_date = p.children.minimum(:start_date)
1514 p.due_date = p.children.maximum(:due_date)
1523 p.due_date = p.children.maximum(:due_date)
1515 if p.start_date && p.due_date && p.due_date < p.start_date
1524 if p.start_date && p.due_date && p.due_date < p.start_date
1516 p.start_date, p.due_date = p.due_date, p.start_date
1525 p.start_date, p.due_date = p.due_date, p.start_date
1517 end
1526 end
1518 end
1527 end
1519
1528
1520 if p.done_ratio_derived?
1529 if p.done_ratio_derived?
1521 # done ratio = weighted average ratio of leaves
1530 # done ratio = weighted average ratio of leaves
1522 unless Issue.use_status_for_done_ratio? && p.status && p.status.default_done_ratio
1531 unless Issue.use_status_for_done_ratio? && p.status && p.status.default_done_ratio
1523 leaves_count = p.leaves.count
1532 leaves_count = p.leaves.count
1524 if leaves_count > 0
1533 if leaves_count > 0
1525 average = p.leaves.where("estimated_hours > 0").average(:estimated_hours).to_f
1534 average = p.leaves.where("estimated_hours > 0").average(:estimated_hours).to_f
1526 if average == 0
1535 if average == 0
1527 average = 1
1536 average = 1
1528 end
1537 end
1529 done = p.leaves.joins(:status).
1538 done = p.leaves.joins(:status).
1530 sum("COALESCE(CASE WHEN estimated_hours > 0 THEN estimated_hours ELSE NULL END, #{average}) " +
1539 sum("COALESCE(CASE WHEN estimated_hours > 0 THEN estimated_hours ELSE NULL END, #{average}) " +
1531 "* (CASE WHEN is_closed = #{self.class.connection.quoted_true} THEN 100 ELSE COALESCE(done_ratio, 0) END)").to_f
1540 "* (CASE WHEN is_closed = #{self.class.connection.quoted_true} THEN 100 ELSE COALESCE(done_ratio, 0) END)").to_f
1532 progress = done / (average * leaves_count)
1541 progress = done / (average * leaves_count)
1533 p.done_ratio = progress.round
1542 p.done_ratio = progress.round
1534 end
1543 end
1535 end
1544 end
1536 end
1545 end
1537
1546
1538 # ancestors will be recursively updated
1547 # ancestors will be recursively updated
1539 p.save(:validate => false)
1548 p.save(:validate => false)
1540 end
1549 end
1541 end
1550 end
1542
1551
1543 # Update issues so their versions are not pointing to a
1552 # Update issues so their versions are not pointing to a
1544 # fixed_version that is not shared with the issue's project
1553 # fixed_version that is not shared with the issue's project
1545 def self.update_versions(conditions=nil)
1554 def self.update_versions(conditions=nil)
1546 # Only need to update issues with a fixed_version from
1555 # Only need to update issues with a fixed_version from
1547 # a different project and that is not systemwide shared
1556 # a different project and that is not systemwide shared
1548 Issue.joins(:project, :fixed_version).
1557 Issue.joins(:project, :fixed_version).
1549 where("#{Issue.table_name}.fixed_version_id IS NOT NULL" +
1558 where("#{Issue.table_name}.fixed_version_id IS NOT NULL" +
1550 " AND #{Issue.table_name}.project_id <> #{Version.table_name}.project_id" +
1559 " AND #{Issue.table_name}.project_id <> #{Version.table_name}.project_id" +
1551 " AND #{Version.table_name}.sharing <> 'system'").
1560 " AND #{Version.table_name}.sharing <> 'system'").
1552 where(conditions).each do |issue|
1561 where(conditions).each do |issue|
1553 next if issue.project.nil? || issue.fixed_version.nil?
1562 next if issue.project.nil? || issue.fixed_version.nil?
1554 unless issue.project.shared_versions.include?(issue.fixed_version)
1563 unless issue.project.shared_versions.include?(issue.fixed_version)
1555 issue.init_journal(User.current)
1564 issue.init_journal(User.current)
1556 issue.fixed_version = nil
1565 issue.fixed_version = nil
1557 issue.save
1566 issue.save
1558 end
1567 end
1559 end
1568 end
1560 end
1569 end
1561
1570
1562 # Callback on file attachment
1571 # Callback on file attachment
1563 def attachment_added(attachment)
1572 def attachment_added(attachment)
1564 if current_journal && !attachment.new_record?
1573 if current_journal && !attachment.new_record?
1565 current_journal.journalize_attachment(attachment, :added)
1574 current_journal.journalize_attachment(attachment, :added)
1566 end
1575 end
1567 end
1576 end
1568
1577
1569 # Callback on attachment deletion
1578 # Callback on attachment deletion
1570 def attachment_removed(attachment)
1579 def attachment_removed(attachment)
1571 if current_journal && !attachment.new_record?
1580 if current_journal && !attachment.new_record?
1572 current_journal.journalize_attachment(attachment, :removed)
1581 current_journal.journalize_attachment(attachment, :removed)
1573 current_journal.save
1582 current_journal.save
1574 end
1583 end
1575 end
1584 end
1576
1585
1577 # Called after a relation is added
1586 # Called after a relation is added
1578 def relation_added(relation)
1587 def relation_added(relation)
1579 if current_journal
1588 if current_journal
1580 current_journal.journalize_relation(relation, :added)
1589 current_journal.journalize_relation(relation, :added)
1581 current_journal.save
1590 current_journal.save
1582 end
1591 end
1583 end
1592 end
1584
1593
1585 # Called after a relation is removed
1594 # Called after a relation is removed
1586 def relation_removed(relation)
1595 def relation_removed(relation)
1587 if current_journal
1596 if current_journal
1588 current_journal.journalize_relation(relation, :removed)
1597 current_journal.journalize_relation(relation, :removed)
1589 current_journal.save
1598 current_journal.save
1590 end
1599 end
1591 end
1600 end
1592
1601
1593 # Default assignment based on category
1602 # Default assignment based on category
1594 def default_assign
1603 def default_assign
1595 if assigned_to.nil? && category && category.assigned_to
1604 if assigned_to.nil? && category && category.assigned_to
1596 self.assigned_to = category.assigned_to
1605 self.assigned_to = category.assigned_to
1597 end
1606 end
1598 end
1607 end
1599
1608
1600 # Updates start/due dates of following issues
1609 # Updates start/due dates of following issues
1601 def reschedule_following_issues
1610 def reschedule_following_issues
1602 if start_date_changed? || due_date_changed?
1611 if start_date_changed? || due_date_changed?
1603 relations_from.each do |relation|
1612 relations_from.each do |relation|
1604 relation.set_issue_to_dates
1613 relation.set_issue_to_dates
1605 end
1614 end
1606 end
1615 end
1607 end
1616 end
1608
1617
1609 # Closes duplicates if the issue is being closed
1618 # Closes duplicates if the issue is being closed
1610 def close_duplicates
1619 def close_duplicates
1611 if closing?
1620 if closing?
1612 duplicates.each do |duplicate|
1621 duplicates.each do |duplicate|
1613 # Reload is needed in case the duplicate was updated by a previous duplicate
1622 # Reload is needed in case the duplicate was updated by a previous duplicate
1614 duplicate.reload
1623 duplicate.reload
1615 # Don't re-close it if it's already closed
1624 # Don't re-close it if it's already closed
1616 next if duplicate.closed?
1625 next if duplicate.closed?
1617 # Same user and notes
1626 # Same user and notes
1618 if @current_journal
1627 if @current_journal
1619 duplicate.init_journal(@current_journal.user, @current_journal.notes)
1628 duplicate.init_journal(@current_journal.user, @current_journal.notes)
1620 end
1629 end
1621 duplicate.update_attribute :status, self.status
1630 duplicate.update_attribute :status, self.status
1622 end
1631 end
1623 end
1632 end
1624 end
1633 end
1625
1634
1626 # Make sure updated_on is updated when adding a note and set updated_on now
1635 # Make sure updated_on is updated when adding a note and set updated_on now
1627 # so we can set closed_on with the same value on closing
1636 # so we can set closed_on with the same value on closing
1628 def force_updated_on_change
1637 def force_updated_on_change
1629 if @current_journal || changed?
1638 if @current_journal || changed?
1630 self.updated_on = current_time_from_proper_timezone
1639 self.updated_on = current_time_from_proper_timezone
1631 if new_record?
1640 if new_record?
1632 self.created_on = updated_on
1641 self.created_on = updated_on
1633 end
1642 end
1634 end
1643 end
1635 end
1644 end
1636
1645
1637 # Callback for setting closed_on when the issue is closed.
1646 # Callback for setting closed_on when the issue is closed.
1638 # The closed_on attribute stores the time of the last closing
1647 # The closed_on attribute stores the time of the last closing
1639 # and is preserved when the issue is reopened.
1648 # and is preserved when the issue is reopened.
1640 def update_closed_on
1649 def update_closed_on
1641 if closing?
1650 if closing?
1642 self.closed_on = updated_on
1651 self.closed_on = updated_on
1643 end
1652 end
1644 end
1653 end
1645
1654
1646 # Saves the changes in a Journal
1655 # Saves the changes in a Journal
1647 # Called after_save
1656 # Called after_save
1648 def create_journal
1657 def create_journal
1649 if current_journal
1658 if current_journal
1650 current_journal.save
1659 current_journal.save
1651 end
1660 end
1652 end
1661 end
1653
1662
1654 def send_notification
1663 def send_notification
1655 if notify? && Setting.notified_events.include?('issue_added')
1664 if notify? && Setting.notified_events.include?('issue_added')
1656 Mailer.deliver_issue_add(self)
1665 Mailer.deliver_issue_add(self)
1657 end
1666 end
1658 end
1667 end
1659
1668
1660 # Stores the previous assignee so we can still have access
1669 # Stores the previous assignee so we can still have access
1661 # to it during after_save callbacks (assigned_to_id_was is reset)
1670 # to it during after_save callbacks (assigned_to_id_was is reset)
1662 def set_assigned_to_was
1671 def set_assigned_to_was
1663 @previous_assigned_to_id = assigned_to_id_was
1672 @previous_assigned_to_id = assigned_to_id_was
1664 end
1673 end
1665
1674
1666 # Clears the previous assignee at the end of after_save callbacks
1675 # Clears the previous assignee at the end of after_save callbacks
1667 def clear_assigned_to_was
1676 def clear_assigned_to_was
1668 @assigned_to_was = nil
1677 @assigned_to_was = nil
1669 @previous_assigned_to_id = nil
1678 @previous_assigned_to_id = nil
1670 end
1679 end
1671
1680
1672 def clear_disabled_fields
1681 def clear_disabled_fields
1673 if tracker
1682 if tracker
1674 tracker.disabled_core_fields.each do |attribute|
1683 tracker.disabled_core_fields.each do |attribute|
1675 send "#{attribute}=", nil
1684 send "#{attribute}=", nil
1676 end
1685 end
1677 self.done_ratio ||= 0
1686 self.done_ratio ||= 0
1678 end
1687 end
1679 end
1688 end
1680 end
1689 end
@@ -1,1042 +1,1044
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2015 Jean-Philippe Lang
2 # Copyright (C) 2006-2015 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 class Project < ActiveRecord::Base
18 class Project < ActiveRecord::Base
19 include Redmine::SafeAttributes
19 include Redmine::SafeAttributes
20 include Redmine::NestedSet::ProjectNestedSet
20 include Redmine::NestedSet::ProjectNestedSet
21
21
22 # Project statuses
22 # Project statuses
23 STATUS_ACTIVE = 1
23 STATUS_ACTIVE = 1
24 STATUS_CLOSED = 5
24 STATUS_CLOSED = 5
25 STATUS_ARCHIVED = 9
25 STATUS_ARCHIVED = 9
26
26
27 # Maximum length for project identifiers
27 # Maximum length for project identifiers
28 IDENTIFIER_MAX_LENGTH = 100
28 IDENTIFIER_MAX_LENGTH = 100
29
29
30 # Specific overridden Activities
30 # Specific overridden Activities
31 has_many :time_entry_activities
31 has_many :time_entry_activities
32 has_many :memberships, :class_name => 'Member', :inverse_of => :project
32 has_many :memberships, :class_name => 'Member', :inverse_of => :project
33 # Memberships of active users only
33 # Memberships of active users only
34 has_many :members,
34 has_many :members,
35 lambda { joins(:principal).where(:users => {:type => 'User', :status => Principal::STATUS_ACTIVE}) }
35 lambda { joins(:principal).where(:users => {:type => 'User', :status => Principal::STATUS_ACTIVE}) }
36 has_many :enabled_modules, :dependent => :delete_all
36 has_many :enabled_modules, :dependent => :delete_all
37 has_and_belongs_to_many :trackers, lambda {order(:position)}
37 has_and_belongs_to_many :trackers, lambda {order(:position)}
38 has_many :issues, :dependent => :destroy
38 has_many :issues, :dependent => :destroy
39 has_many :issue_changes, :through => :issues, :source => :journals
39 has_many :issue_changes, :through => :issues, :source => :journals
40 has_many :versions, lambda {order("#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC")}, :dependent => :destroy
40 has_many :versions, lambda {order("#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC")}, :dependent => :destroy
41 belongs_to :default_version, :class_name => 'Version'
41 has_many :time_entries, :dependent => :destroy
42 has_many :time_entries, :dependent => :destroy
42 has_many :queries, :class_name => 'IssueQuery', :dependent => :delete_all
43 has_many :queries, :class_name => 'IssueQuery', :dependent => :delete_all
43 has_many :documents, :dependent => :destroy
44 has_many :documents, :dependent => :destroy
44 has_many :news, lambda {includes(:author)}, :dependent => :destroy
45 has_many :news, lambda {includes(:author)}, :dependent => :destroy
45 has_many :issue_categories, lambda {order("#{IssueCategory.table_name}.name")}, :dependent => :delete_all
46 has_many :issue_categories, lambda {order("#{IssueCategory.table_name}.name")}, :dependent => :delete_all
46 has_many :boards, lambda {order("position ASC")}, :dependent => :destroy
47 has_many :boards, lambda {order("position ASC")}, :dependent => :destroy
47 has_one :repository, lambda {where(["is_default = ?", true])}
48 has_one :repository, lambda {where(["is_default = ?", true])}
48 has_many :repositories, :dependent => :destroy
49 has_many :repositories, :dependent => :destroy
49 has_many :changesets, :through => :repository
50 has_many :changesets, :through => :repository
50 has_one :wiki, :dependent => :destroy
51 has_one :wiki, :dependent => :destroy
51 # Custom field for the project issues
52 # Custom field for the project issues
52 has_and_belongs_to_many :issue_custom_fields,
53 has_and_belongs_to_many :issue_custom_fields,
53 lambda {order("#{CustomField.table_name}.position")},
54 lambda {order("#{CustomField.table_name}.position")},
54 :class_name => 'IssueCustomField',
55 :class_name => 'IssueCustomField',
55 :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
56 :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
56 :association_foreign_key => 'custom_field_id'
57 :association_foreign_key => 'custom_field_id'
57
58
58 acts_as_attachable :view_permission => :view_files,
59 acts_as_attachable :view_permission => :view_files,
59 :edit_permission => :manage_files,
60 :edit_permission => :manage_files,
60 :delete_permission => :manage_files
61 :delete_permission => :manage_files
61
62
62 acts_as_customizable
63 acts_as_customizable
63 acts_as_searchable :columns => ['name', 'identifier', 'description'], :project_key => "#{Project.table_name}.id", :permission => nil
64 acts_as_searchable :columns => ['name', 'identifier', 'description'], :project_key => "#{Project.table_name}.id", :permission => nil
64 acts_as_event :title => Proc.new {|o| "#{l(:label_project)}: #{o.name}"},
65 acts_as_event :title => Proc.new {|o| "#{l(:label_project)}: #{o.name}"},
65 :url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o}},
66 :url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o}},
66 :author => nil
67 :author => nil
67
68
68 attr_protected :status
69 attr_protected :status
69
70
70 validates_presence_of :name, :identifier
71 validates_presence_of :name, :identifier
71 validates_uniqueness_of :identifier, :if => Proc.new {|p| p.identifier_changed?}
72 validates_uniqueness_of :identifier, :if => Proc.new {|p| p.identifier_changed?}
72 validates_length_of :name, :maximum => 255
73 validates_length_of :name, :maximum => 255
73 validates_length_of :homepage, :maximum => 255
74 validates_length_of :homepage, :maximum => 255
74 validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH
75 validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH
75 # downcase letters, digits, dashes but not digits only
76 # downcase letters, digits, dashes but not digits only
76 validates_format_of :identifier, :with => /\A(?!\d+$)[a-z0-9\-_]*\z/, :if => Proc.new { |p| p.identifier_changed? }
77 validates_format_of :identifier, :with => /\A(?!\d+$)[a-z0-9\-_]*\z/, :if => Proc.new { |p| p.identifier_changed? }
77 # reserved words
78 # reserved words
78 validates_exclusion_of :identifier, :in => %w( new )
79 validates_exclusion_of :identifier, :in => %w( new )
79 validate :validate_parent
80 validate :validate_parent
80
81
81 after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
82 after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
82 after_save :remove_inherited_member_roles, :add_inherited_member_roles, :if => Proc.new {|project| project.parent_id_changed?}
83 after_save :remove_inherited_member_roles, :add_inherited_member_roles, :if => Proc.new {|project| project.parent_id_changed?}
83 after_update :update_versions_from_hierarchy_change, :if => Proc.new {|project| project.parent_id_changed?}
84 after_update :update_versions_from_hierarchy_change, :if => Proc.new {|project| project.parent_id_changed?}
84 before_destroy :delete_all_members
85 before_destroy :delete_all_members
85
86
86 scope :has_module, lambda {|mod|
87 scope :has_module, lambda {|mod|
87 where("#{Project.table_name}.id IN (SELECT em.project_id FROM #{EnabledModule.table_name} em WHERE em.name=?)", mod.to_s)
88 where("#{Project.table_name}.id IN (SELECT em.project_id FROM #{EnabledModule.table_name} em WHERE em.name=?)", mod.to_s)
88 }
89 }
89 scope :active, lambda { where(:status => STATUS_ACTIVE) }
90 scope :active, lambda { where(:status => STATUS_ACTIVE) }
90 scope :status, lambda {|arg| where(arg.blank? ? nil : {:status => arg.to_i}) }
91 scope :status, lambda {|arg| where(arg.blank? ? nil : {:status => arg.to_i}) }
91 scope :all_public, lambda { where(:is_public => true) }
92 scope :all_public, lambda { where(:is_public => true) }
92 scope :visible, lambda {|*args| where(Project.visible_condition(args.shift || User.current, *args)) }
93 scope :visible, lambda {|*args| where(Project.visible_condition(args.shift || User.current, *args)) }
93 scope :allowed_to, lambda {|*args|
94 scope :allowed_to, lambda {|*args|
94 user = User.current
95 user = User.current
95 permission = nil
96 permission = nil
96 if args.first.is_a?(Symbol)
97 if args.first.is_a?(Symbol)
97 permission = args.shift
98 permission = args.shift
98 else
99 else
99 user = args.shift
100 user = args.shift
100 permission = args.shift
101 permission = args.shift
101 end
102 end
102 where(Project.allowed_to_condition(user, permission, *args))
103 where(Project.allowed_to_condition(user, permission, *args))
103 }
104 }
104 scope :like, lambda {|arg|
105 scope :like, lambda {|arg|
105 if arg.blank?
106 if arg.blank?
106 where(nil)
107 where(nil)
107 else
108 else
108 pattern = "%#{arg.to_s.strip.downcase}%"
109 pattern = "%#{arg.to_s.strip.downcase}%"
109 where("LOWER(identifier) LIKE :p OR LOWER(name) LIKE :p", :p => pattern)
110 where("LOWER(identifier) LIKE :p OR LOWER(name) LIKE :p", :p => pattern)
110 end
111 end
111 }
112 }
112 scope :sorted, lambda {order(:lft)}
113 scope :sorted, lambda {order(:lft)}
113 scope :having_trackers, lambda {
114 scope :having_trackers, lambda {
114 where("#{Project.table_name}.id IN (SELECT DISTINCT project_id FROM #{table_name_prefix}projects_trackers#{table_name_suffix})")
115 where("#{Project.table_name}.id IN (SELECT DISTINCT project_id FROM #{table_name_prefix}projects_trackers#{table_name_suffix})")
115 }
116 }
116
117
117 def initialize(attributes=nil, *args)
118 def initialize(attributes=nil, *args)
118 super
119 super
119
120
120 initialized = (attributes || {}).stringify_keys
121 initialized = (attributes || {}).stringify_keys
121 if !initialized.key?('identifier') && Setting.sequential_project_identifiers?
122 if !initialized.key?('identifier') && Setting.sequential_project_identifiers?
122 self.identifier = Project.next_identifier
123 self.identifier = Project.next_identifier
123 end
124 end
124 if !initialized.key?('is_public')
125 if !initialized.key?('is_public')
125 self.is_public = Setting.default_projects_public?
126 self.is_public = Setting.default_projects_public?
126 end
127 end
127 if !initialized.key?('enabled_module_names')
128 if !initialized.key?('enabled_module_names')
128 self.enabled_module_names = Setting.default_projects_modules
129 self.enabled_module_names = Setting.default_projects_modules
129 end
130 end
130 if !initialized.key?('trackers') && !initialized.key?('tracker_ids')
131 if !initialized.key?('trackers') && !initialized.key?('tracker_ids')
131 default = Setting.default_projects_tracker_ids
132 default = Setting.default_projects_tracker_ids
132 if default.is_a?(Array)
133 if default.is_a?(Array)
133 self.trackers = Tracker.where(:id => default.map(&:to_i)).sorted.to_a
134 self.trackers = Tracker.where(:id => default.map(&:to_i)).sorted.to_a
134 else
135 else
135 self.trackers = Tracker.sorted.to_a
136 self.trackers = Tracker.sorted.to_a
136 end
137 end
137 end
138 end
138 end
139 end
139
140
140 def identifier=(identifier)
141 def identifier=(identifier)
141 super unless identifier_frozen?
142 super unless identifier_frozen?
142 end
143 end
143
144
144 def identifier_frozen?
145 def identifier_frozen?
145 errors[:identifier].blank? && !(new_record? || identifier.blank?)
146 errors[:identifier].blank? && !(new_record? || identifier.blank?)
146 end
147 end
147
148
148 # returns latest created projects
149 # returns latest created projects
149 # non public projects will be returned only if user is a member of those
150 # non public projects will be returned only if user is a member of those
150 def self.latest(user=nil, count=5)
151 def self.latest(user=nil, count=5)
151 visible(user).limit(count).order("created_on DESC").to_a
152 visible(user).limit(count).order("created_on DESC").to_a
152 end
153 end
153
154
154 # Returns true if the project is visible to +user+ or to the current user.
155 # Returns true if the project is visible to +user+ or to the current user.
155 def visible?(user=User.current)
156 def visible?(user=User.current)
156 user.allowed_to?(:view_project, self)
157 user.allowed_to?(:view_project, self)
157 end
158 end
158
159
159 # Returns a SQL conditions string used to find all projects visible by the specified user.
160 # Returns a SQL conditions string used to find all projects visible by the specified user.
160 #
161 #
161 # Examples:
162 # Examples:
162 # Project.visible_condition(admin) => "projects.status = 1"
163 # Project.visible_condition(admin) => "projects.status = 1"
163 # Project.visible_condition(normal_user) => "((projects.status = 1) AND (projects.is_public = 1 OR projects.id IN (1,3,4)))"
164 # Project.visible_condition(normal_user) => "((projects.status = 1) AND (projects.is_public = 1 OR projects.id IN (1,3,4)))"
164 # Project.visible_condition(anonymous) => "((projects.status = 1) AND (projects.is_public = 1))"
165 # Project.visible_condition(anonymous) => "((projects.status = 1) AND (projects.is_public = 1))"
165 def self.visible_condition(user, options={})
166 def self.visible_condition(user, options={})
166 allowed_to_condition(user, :view_project, options)
167 allowed_to_condition(user, :view_project, options)
167 end
168 end
168
169
169 # Returns a SQL conditions string used to find all projects for which +user+ has the given +permission+
170 # Returns a SQL conditions string used to find all projects for which +user+ has the given +permission+
170 #
171 #
171 # Valid options:
172 # Valid options:
172 # * :project => limit the condition to project
173 # * :project => limit the condition to project
173 # * :with_subprojects => limit the condition to project and its subprojects
174 # * :with_subprojects => limit the condition to project and its subprojects
174 # * :member => limit the condition to the user projects
175 # * :member => limit the condition to the user projects
175 def self.allowed_to_condition(user, permission, options={})
176 def self.allowed_to_condition(user, permission, options={})
176 perm = Redmine::AccessControl.permission(permission)
177 perm = Redmine::AccessControl.permission(permission)
177 base_statement = (perm && perm.read? ? "#{Project.table_name}.status <> #{Project::STATUS_ARCHIVED}" : "#{Project.table_name}.status = #{Project::STATUS_ACTIVE}")
178 base_statement = (perm && perm.read? ? "#{Project.table_name}.status <> #{Project::STATUS_ARCHIVED}" : "#{Project.table_name}.status = #{Project::STATUS_ACTIVE}")
178 if perm && perm.project_module
179 if perm && perm.project_module
179 # If the permission belongs to a project module, make sure the module is enabled
180 # If the permission belongs to a project module, make sure the module is enabled
180 base_statement << " AND #{Project.table_name}.id IN (SELECT em.project_id FROM #{EnabledModule.table_name} em WHERE em.name='#{perm.project_module}')"
181 base_statement << " AND #{Project.table_name}.id IN (SELECT em.project_id FROM #{EnabledModule.table_name} em WHERE em.name='#{perm.project_module}')"
181 end
182 end
182 if project = options[:project]
183 if project = options[:project]
183 project_statement = project.project_condition(options[:with_subprojects])
184 project_statement = project.project_condition(options[:with_subprojects])
184 base_statement = "(#{project_statement}) AND (#{base_statement})"
185 base_statement = "(#{project_statement}) AND (#{base_statement})"
185 end
186 end
186
187
187 if user.admin?
188 if user.admin?
188 base_statement
189 base_statement
189 else
190 else
190 statement_by_role = {}
191 statement_by_role = {}
191 unless options[:member]
192 unless options[:member]
192 role = user.builtin_role
193 role = user.builtin_role
193 if role.allowed_to?(permission)
194 if role.allowed_to?(permission)
194 s = "#{Project.table_name}.is_public = #{connection.quoted_true}"
195 s = "#{Project.table_name}.is_public = #{connection.quoted_true}"
195 if user.id
196 if user.id
196 s = "(#{s} AND #{Project.table_name}.id NOT IN (SELECT project_id FROM #{Member.table_name} WHERE user_id = #{user.id}))"
197 s = "(#{s} AND #{Project.table_name}.id NOT IN (SELECT project_id FROM #{Member.table_name} WHERE user_id = #{user.id}))"
197 end
198 end
198 statement_by_role[role] = s
199 statement_by_role[role] = s
199 end
200 end
200 end
201 end
201 user.projects_by_role.each do |role, projects|
202 user.projects_by_role.each do |role, projects|
202 if role.allowed_to?(permission) && projects.any?
203 if role.allowed_to?(permission) && projects.any?
203 statement_by_role[role] = "#{Project.table_name}.id IN (#{projects.collect(&:id).join(',')})"
204 statement_by_role[role] = "#{Project.table_name}.id IN (#{projects.collect(&:id).join(',')})"
204 end
205 end
205 end
206 end
206 if statement_by_role.empty?
207 if statement_by_role.empty?
207 "1=0"
208 "1=0"
208 else
209 else
209 if block_given?
210 if block_given?
210 statement_by_role.each do |role, statement|
211 statement_by_role.each do |role, statement|
211 if s = yield(role, user)
212 if s = yield(role, user)
212 statement_by_role[role] = "(#{statement} AND (#{s}))"
213 statement_by_role[role] = "(#{statement} AND (#{s}))"
213 end
214 end
214 end
215 end
215 end
216 end
216 "((#{base_statement}) AND (#{statement_by_role.values.join(' OR ')}))"
217 "((#{base_statement}) AND (#{statement_by_role.values.join(' OR ')}))"
217 end
218 end
218 end
219 end
219 end
220 end
220
221
221 def override_roles(role)
222 def override_roles(role)
222 @override_members ||= memberships.
223 @override_members ||= memberships.
223 joins(:principal).
224 joins(:principal).
224 where(:users => {:type => ['GroupAnonymous', 'GroupNonMember']}).to_a
225 where(:users => {:type => ['GroupAnonymous', 'GroupNonMember']}).to_a
225
226
226 group_class = role.anonymous? ? GroupAnonymous : GroupNonMember
227 group_class = role.anonymous? ? GroupAnonymous : GroupNonMember
227 member = @override_members.detect {|m| m.principal.is_a? group_class}
228 member = @override_members.detect {|m| m.principal.is_a? group_class}
228 member ? member.roles.to_a : [role]
229 member ? member.roles.to_a : [role]
229 end
230 end
230
231
231 def principals
232 def principals
232 @principals ||= Principal.active.joins(:members).where("#{Member.table_name}.project_id = ?", id).uniq
233 @principals ||= Principal.active.joins(:members).where("#{Member.table_name}.project_id = ?", id).uniq
233 end
234 end
234
235
235 def users
236 def users
236 @users ||= User.active.joins(:members).where("#{Member.table_name}.project_id = ?", id).uniq
237 @users ||= User.active.joins(:members).where("#{Member.table_name}.project_id = ?", id).uniq
237 end
238 end
238
239
239 # Returns the Systemwide and project specific activities
240 # Returns the Systemwide and project specific activities
240 def activities(include_inactive=false)
241 def activities(include_inactive=false)
241 t = TimeEntryActivity.table_name
242 t = TimeEntryActivity.table_name
242 scope = TimeEntryActivity.where("#{t}.project_id IS NULL OR #{t}.project_id = ?", id)
243 scope = TimeEntryActivity.where("#{t}.project_id IS NULL OR #{t}.project_id = ?", id)
243
244
244 overridden_activity_ids = self.time_entry_activities.pluck(:parent_id).compact
245 overridden_activity_ids = self.time_entry_activities.pluck(:parent_id).compact
245 if overridden_activity_ids.any?
246 if overridden_activity_ids.any?
246 scope = scope.where("#{t}.id NOT IN (?)", overridden_activity_ids)
247 scope = scope.where("#{t}.id NOT IN (?)", overridden_activity_ids)
247 end
248 end
248 unless include_inactive
249 unless include_inactive
249 scope = scope.active
250 scope = scope.active
250 end
251 end
251 scope
252 scope
252 end
253 end
253
254
254 # Will create a new Project specific Activity or update an existing one
255 # Will create a new Project specific Activity or update an existing one
255 #
256 #
256 # This will raise a ActiveRecord::Rollback if the TimeEntryActivity
257 # This will raise a ActiveRecord::Rollback if the TimeEntryActivity
257 # does not successfully save.
258 # does not successfully save.
258 def update_or_create_time_entry_activity(id, activity_hash)
259 def update_or_create_time_entry_activity(id, activity_hash)
259 if activity_hash.respond_to?(:has_key?) && activity_hash.has_key?('parent_id')
260 if activity_hash.respond_to?(:has_key?) && activity_hash.has_key?('parent_id')
260 self.create_time_entry_activity_if_needed(activity_hash)
261 self.create_time_entry_activity_if_needed(activity_hash)
261 else
262 else
262 activity = project.time_entry_activities.find_by_id(id.to_i)
263 activity = project.time_entry_activities.find_by_id(id.to_i)
263 activity.update_attributes(activity_hash) if activity
264 activity.update_attributes(activity_hash) if activity
264 end
265 end
265 end
266 end
266
267
267 # Create a new TimeEntryActivity if it overrides a system TimeEntryActivity
268 # Create a new TimeEntryActivity if it overrides a system TimeEntryActivity
268 #
269 #
269 # This will raise a ActiveRecord::Rollback if the TimeEntryActivity
270 # This will raise a ActiveRecord::Rollback if the TimeEntryActivity
270 # does not successfully save.
271 # does not successfully save.
271 def create_time_entry_activity_if_needed(activity)
272 def create_time_entry_activity_if_needed(activity)
272 if activity['parent_id']
273 if activity['parent_id']
273 parent_activity = TimeEntryActivity.find(activity['parent_id'])
274 parent_activity = TimeEntryActivity.find(activity['parent_id'])
274 activity['name'] = parent_activity.name
275 activity['name'] = parent_activity.name
275 activity['position'] = parent_activity.position
276 activity['position'] = parent_activity.position
276 if Enumeration.overriding_change?(activity, parent_activity)
277 if Enumeration.overriding_change?(activity, parent_activity)
277 project_activity = self.time_entry_activities.create(activity)
278 project_activity = self.time_entry_activities.create(activity)
278 if project_activity.new_record?
279 if project_activity.new_record?
279 raise ActiveRecord::Rollback, "Overriding TimeEntryActivity was not successfully saved"
280 raise ActiveRecord::Rollback, "Overriding TimeEntryActivity was not successfully saved"
280 else
281 else
281 self.time_entries.
282 self.time_entries.
282 where(:activity_id => parent_activity.id).
283 where(:activity_id => parent_activity.id).
283 update_all(:activity_id => project_activity.id)
284 update_all(:activity_id => project_activity.id)
284 end
285 end
285 end
286 end
286 end
287 end
287 end
288 end
288
289
289 # Returns a :conditions SQL string that can be used to find the issues associated with this project.
290 # Returns a :conditions SQL string that can be used to find the issues associated with this project.
290 #
291 #
291 # Examples:
292 # Examples:
292 # project.project_condition(true) => "(projects.id = 1 OR (projects.lft > 1 AND projects.rgt < 10))"
293 # project.project_condition(true) => "(projects.id = 1 OR (projects.lft > 1 AND projects.rgt < 10))"
293 # project.project_condition(false) => "projects.id = 1"
294 # project.project_condition(false) => "projects.id = 1"
294 def project_condition(with_subprojects)
295 def project_condition(with_subprojects)
295 cond = "#{Project.table_name}.id = #{id}"
296 cond = "#{Project.table_name}.id = #{id}"
296 cond = "(#{cond} OR (#{Project.table_name}.lft > #{lft} AND #{Project.table_name}.rgt < #{rgt}))" if with_subprojects
297 cond = "(#{cond} OR (#{Project.table_name}.lft > #{lft} AND #{Project.table_name}.rgt < #{rgt}))" if with_subprojects
297 cond
298 cond
298 end
299 end
299
300
300 def self.find(*args)
301 def self.find(*args)
301 if args.first && args.first.is_a?(String) && !args.first.match(/^\d*$/)
302 if args.first && args.first.is_a?(String) && !args.first.match(/^\d*$/)
302 project = find_by_identifier(*args)
303 project = find_by_identifier(*args)
303 raise ActiveRecord::RecordNotFound, "Couldn't find Project with identifier=#{args.first}" if project.nil?
304 raise ActiveRecord::RecordNotFound, "Couldn't find Project with identifier=#{args.first}" if project.nil?
304 project
305 project
305 else
306 else
306 super
307 super
307 end
308 end
308 end
309 end
309
310
310 def self.find_by_param(*args)
311 def self.find_by_param(*args)
311 self.find(*args)
312 self.find(*args)
312 end
313 end
313
314
314 alias :base_reload :reload
315 alias :base_reload :reload
315 def reload(*args)
316 def reload(*args)
316 @principals = nil
317 @principals = nil
317 @users = nil
318 @users = nil
318 @shared_versions = nil
319 @shared_versions = nil
319 @rolled_up_versions = nil
320 @rolled_up_versions = nil
320 @rolled_up_trackers = nil
321 @rolled_up_trackers = nil
321 @all_issue_custom_fields = nil
322 @all_issue_custom_fields = nil
322 @all_time_entry_custom_fields = nil
323 @all_time_entry_custom_fields = nil
323 @to_param = nil
324 @to_param = nil
324 @allowed_parents = nil
325 @allowed_parents = nil
325 @allowed_permissions = nil
326 @allowed_permissions = nil
326 @actions_allowed = nil
327 @actions_allowed = nil
327 @start_date = nil
328 @start_date = nil
328 @due_date = nil
329 @due_date = nil
329 @override_members = nil
330 @override_members = nil
330 @assignable_users = nil
331 @assignable_users = nil
331 base_reload(*args)
332 base_reload(*args)
332 end
333 end
333
334
334 def to_param
335 def to_param
335 if new_record?
336 if new_record?
336 nil
337 nil
337 else
338 else
338 # id is used for projects with a numeric identifier (compatibility)
339 # id is used for projects with a numeric identifier (compatibility)
339 @to_param ||= (identifier.to_s =~ %r{^\d*$} ? id.to_s : identifier)
340 @to_param ||= (identifier.to_s =~ %r{^\d*$} ? id.to_s : identifier)
340 end
341 end
341 end
342 end
342
343
343 def active?
344 def active?
344 self.status == STATUS_ACTIVE
345 self.status == STATUS_ACTIVE
345 end
346 end
346
347
347 def archived?
348 def archived?
348 self.status == STATUS_ARCHIVED
349 self.status == STATUS_ARCHIVED
349 end
350 end
350
351
351 # Archives the project and its descendants
352 # Archives the project and its descendants
352 def archive
353 def archive
353 # Check that there is no issue of a non descendant project that is assigned
354 # Check that there is no issue of a non descendant project that is assigned
354 # to one of the project or descendant versions
355 # to one of the project or descendant versions
355 version_ids = self_and_descendants.joins(:versions).pluck("#{Version.table_name}.id")
356 version_ids = self_and_descendants.joins(:versions).pluck("#{Version.table_name}.id")
356
357
357 if version_ids.any? &&
358 if version_ids.any? &&
358 Issue.
359 Issue.
359 includes(:project).
360 includes(:project).
360 where("#{Project.table_name}.lft < ? OR #{Project.table_name}.rgt > ?", lft, rgt).
361 where("#{Project.table_name}.lft < ? OR #{Project.table_name}.rgt > ?", lft, rgt).
361 where(:fixed_version_id => version_ids).
362 where(:fixed_version_id => version_ids).
362 exists?
363 exists?
363 return false
364 return false
364 end
365 end
365 Project.transaction do
366 Project.transaction do
366 archive!
367 archive!
367 end
368 end
368 true
369 true
369 end
370 end
370
371
371 # Unarchives the project
372 # Unarchives the project
372 # All its ancestors must be active
373 # All its ancestors must be active
373 def unarchive
374 def unarchive
374 return false if ancestors.detect {|a| !a.active?}
375 return false if ancestors.detect {|a| !a.active?}
375 update_attribute :status, STATUS_ACTIVE
376 update_attribute :status, STATUS_ACTIVE
376 end
377 end
377
378
378 def close
379 def close
379 self_and_descendants.status(STATUS_ACTIVE).update_all :status => STATUS_CLOSED
380 self_and_descendants.status(STATUS_ACTIVE).update_all :status => STATUS_CLOSED
380 end
381 end
381
382
382 def reopen
383 def reopen
383 self_and_descendants.status(STATUS_CLOSED).update_all :status => STATUS_ACTIVE
384 self_and_descendants.status(STATUS_CLOSED).update_all :status => STATUS_ACTIVE
384 end
385 end
385
386
386 # Returns an array of projects the project can be moved to
387 # Returns an array of projects the project can be moved to
387 # by the current user
388 # by the current user
388 def allowed_parents(user=User.current)
389 def allowed_parents(user=User.current)
389 return @allowed_parents if @allowed_parents
390 return @allowed_parents if @allowed_parents
390 @allowed_parents = Project.allowed_to(user, :add_subprojects).to_a
391 @allowed_parents = Project.allowed_to(user, :add_subprojects).to_a
391 @allowed_parents = @allowed_parents - self_and_descendants
392 @allowed_parents = @allowed_parents - self_and_descendants
392 if user.allowed_to?(:add_project, nil, :global => true) || (!new_record? && parent.nil?)
393 if user.allowed_to?(:add_project, nil, :global => true) || (!new_record? && parent.nil?)
393 @allowed_parents << nil
394 @allowed_parents << nil
394 end
395 end
395 unless parent.nil? || @allowed_parents.empty? || @allowed_parents.include?(parent)
396 unless parent.nil? || @allowed_parents.empty? || @allowed_parents.include?(parent)
396 @allowed_parents << parent
397 @allowed_parents << parent
397 end
398 end
398 @allowed_parents
399 @allowed_parents
399 end
400 end
400
401
401 # Sets the parent of the project with authorization check
402 # Sets the parent of the project with authorization check
402 def set_allowed_parent!(p)
403 def set_allowed_parent!(p)
403 ActiveSupport::Deprecation.warn "Project#set_allowed_parent! is deprecated and will be removed in Redmine 4, use #safe_attributes= instead."
404 ActiveSupport::Deprecation.warn "Project#set_allowed_parent! is deprecated and will be removed in Redmine 4, use #safe_attributes= instead."
404 p = p.id if p.is_a?(Project)
405 p = p.id if p.is_a?(Project)
405 send :safe_attributes, {:project_id => p}
406 send :safe_attributes, {:project_id => p}
406 save
407 save
407 end
408 end
408
409
409 # Sets the parent of the project and saves the project
410 # Sets the parent of the project and saves the project
410 # Argument can be either a Project, a String, a Fixnum or nil
411 # Argument can be either a Project, a String, a Fixnum or nil
411 def set_parent!(p)
412 def set_parent!(p)
412 if p.is_a?(Project)
413 if p.is_a?(Project)
413 self.parent = p
414 self.parent = p
414 else
415 else
415 self.parent_id = p
416 self.parent_id = p
416 end
417 end
417 save
418 save
418 end
419 end
419
420
420 # Returns an array of the trackers used by the project and its active sub projects
421 # Returns an array of the trackers used by the project and its active sub projects
421 def rolled_up_trackers
422 def rolled_up_trackers
422 @rolled_up_trackers ||=
423 @rolled_up_trackers ||=
423 Tracker.
424 Tracker.
424 joins(:projects).
425 joins(:projects).
425 joins("JOIN #{EnabledModule.table_name} ON #{EnabledModule.table_name}.project_id = #{Project.table_name}.id AND #{EnabledModule.table_name}.name = 'issue_tracking'").
426 joins("JOIN #{EnabledModule.table_name} ON #{EnabledModule.table_name}.project_id = #{Project.table_name}.id AND #{EnabledModule.table_name}.name = 'issue_tracking'").
426 where("#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status <> ?", lft, rgt, STATUS_ARCHIVED).
427 where("#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status <> ?", lft, rgt, STATUS_ARCHIVED).
427 uniq.
428 uniq.
428 sorted.
429 sorted.
429 to_a
430 to_a
430 end
431 end
431
432
432 # Closes open and locked project versions that are completed
433 # Closes open and locked project versions that are completed
433 def close_completed_versions
434 def close_completed_versions
434 Version.transaction do
435 Version.transaction do
435 versions.where(:status => %w(open locked)).each do |version|
436 versions.where(:status => %w(open locked)).each do |version|
436 if version.completed?
437 if version.completed?
437 version.update_attribute(:status, 'closed')
438 version.update_attribute(:status, 'closed')
438 end
439 end
439 end
440 end
440 end
441 end
441 end
442 end
442
443
443 # Returns a scope of the Versions on subprojects
444 # Returns a scope of the Versions on subprojects
444 def rolled_up_versions
445 def rolled_up_versions
445 @rolled_up_versions ||=
446 @rolled_up_versions ||=
446 Version.
447 Version.
447 joins(:project).
448 joins(:project).
448 where("#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status <> ?", lft, rgt, STATUS_ARCHIVED)
449 where("#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status <> ?", lft, rgt, STATUS_ARCHIVED)
449 end
450 end
450
451
451 # Returns a scope of the Versions used by the project
452 # Returns a scope of the Versions used by the project
452 def shared_versions
453 def shared_versions
453 if new_record?
454 if new_record?
454 Version.
455 Version.
455 joins(:project).
456 joins(:project).
456 preload(:project).
457 preload(:project).
457 where("#{Project.table_name}.status <> ? AND #{Version.table_name}.sharing = 'system'", STATUS_ARCHIVED)
458 where("#{Project.table_name}.status <> ? AND #{Version.table_name}.sharing = 'system'", STATUS_ARCHIVED)
458 else
459 else
459 @shared_versions ||= begin
460 @shared_versions ||= begin
460 r = root? ? self : root
461 r = root? ? self : root
461 Version.
462 Version.
462 joins(:project).
463 joins(:project).
463 preload(:project).
464 preload(:project).
464 where("#{Project.table_name}.id = #{id}" +
465 where("#{Project.table_name}.id = #{id}" +
465 " OR (#{Project.table_name}.status <> #{Project::STATUS_ARCHIVED} AND (" +
466 " OR (#{Project.table_name}.status <> #{Project::STATUS_ARCHIVED} AND (" +
466 " #{Version.table_name}.sharing = 'system'" +
467 " #{Version.table_name}.sharing = 'system'" +
467 " OR (#{Project.table_name}.lft >= #{r.lft} AND #{Project.table_name}.rgt <= #{r.rgt} AND #{Version.table_name}.sharing = 'tree')" +
468 " OR (#{Project.table_name}.lft >= #{r.lft} AND #{Project.table_name}.rgt <= #{r.rgt} AND #{Version.table_name}.sharing = 'tree')" +
468 " OR (#{Project.table_name}.lft < #{lft} AND #{Project.table_name}.rgt > #{rgt} AND #{Version.table_name}.sharing IN ('hierarchy', 'descendants'))" +
469 " OR (#{Project.table_name}.lft < #{lft} AND #{Project.table_name}.rgt > #{rgt} AND #{Version.table_name}.sharing IN ('hierarchy', 'descendants'))" +
469 " OR (#{Project.table_name}.lft > #{lft} AND #{Project.table_name}.rgt < #{rgt} AND #{Version.table_name}.sharing = 'hierarchy')" +
470 " OR (#{Project.table_name}.lft > #{lft} AND #{Project.table_name}.rgt < #{rgt} AND #{Version.table_name}.sharing = 'hierarchy')" +
470 "))")
471 "))")
471 end
472 end
472 end
473 end
473 end
474 end
474
475
475 # Returns a hash of project users grouped by role
476 # Returns a hash of project users grouped by role
476 def users_by_role
477 def users_by_role
477 members.includes(:user, :roles).inject({}) do |h, m|
478 members.includes(:user, :roles).inject({}) do |h, m|
478 m.roles.each do |r|
479 m.roles.each do |r|
479 h[r] ||= []
480 h[r] ||= []
480 h[r] << m.user
481 h[r] << m.user
481 end
482 end
482 h
483 h
483 end
484 end
484 end
485 end
485
486
486 # Adds user as a project member with the default role
487 # Adds user as a project member with the default role
487 # Used for when a non-admin user creates a project
488 # Used for when a non-admin user creates a project
488 def add_default_member(user)
489 def add_default_member(user)
489 role = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
490 role = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
490 member = Member.new(:project => self, :principal => user, :roles => [role])
491 member = Member.new(:project => self, :principal => user, :roles => [role])
491 self.members << member
492 self.members << member
492 member
493 member
493 end
494 end
494
495
495 # Deletes all project's members
496 # Deletes all project's members
496 def delete_all_members
497 def delete_all_members
497 me, mr = Member.table_name, MemberRole.table_name
498 me, mr = Member.table_name, MemberRole.table_name
498 self.class.connection.delete("DELETE FROM #{mr} WHERE #{mr}.member_id IN (SELECT #{me}.id FROM #{me} WHERE #{me}.project_id = #{id})")
499 self.class.connection.delete("DELETE FROM #{mr} WHERE #{mr}.member_id IN (SELECT #{me}.id FROM #{me} WHERE #{me}.project_id = #{id})")
499 Member.delete_all(['project_id = ?', id])
500 Member.delete_all(['project_id = ?', id])
500 end
501 end
501
502
502 # Return a Principal scope of users/groups issues can be assigned to
503 # Return a Principal scope of users/groups issues can be assigned to
503 def assignable_users
504 def assignable_users
504 types = ['User']
505 types = ['User']
505 types << 'Group' if Setting.issue_group_assignment?
506 types << 'Group' if Setting.issue_group_assignment?
506
507
507 @assignable_users ||= Principal.
508 @assignable_users ||= Principal.
508 active.
509 active.
509 joins(:members => :roles).
510 joins(:members => :roles).
510 where(:type => types, :members => {:project_id => id}, :roles => {:assignable => true}).
511 where(:type => types, :members => {:project_id => id}, :roles => {:assignable => true}).
511 uniq.
512 uniq.
512 sorted
513 sorted
513 end
514 end
514
515
515 # Returns the mail addresses of users that should be always notified on project events
516 # Returns the mail addresses of users that should be always notified on project events
516 def recipients
517 def recipients
517 notified_users.collect {|user| user.mail}
518 notified_users.collect {|user| user.mail}
518 end
519 end
519
520
520 # Returns the users that should be notified on project events
521 # Returns the users that should be notified on project events
521 def notified_users
522 def notified_users
522 # TODO: User part should be extracted to User#notify_about?
523 # TODO: User part should be extracted to User#notify_about?
523 members.select {|m| m.principal.present? && (m.mail_notification? || m.principal.mail_notification == 'all')}.collect {|m| m.principal}
524 members.select {|m| m.principal.present? && (m.mail_notification? || m.principal.mail_notification == 'all')}.collect {|m| m.principal}
524 end
525 end
525
526
526 # Returns a scope of all custom fields enabled for project issues
527 # Returns a scope of all custom fields enabled for project issues
527 # (explicitly associated custom fields and custom fields enabled for all projects)
528 # (explicitly associated custom fields and custom fields enabled for all projects)
528 def all_issue_custom_fields
529 def all_issue_custom_fields
529 if new_record?
530 if new_record?
530 @all_issue_custom_fields ||= IssueCustomField.
531 @all_issue_custom_fields ||= IssueCustomField.
531 sorted.
532 sorted.
532 where("is_for_all = ? OR id IN (?)", true, issue_custom_field_ids)
533 where("is_for_all = ? OR id IN (?)", true, issue_custom_field_ids)
533 else
534 else
534 @all_issue_custom_fields ||= IssueCustomField.
535 @all_issue_custom_fields ||= IssueCustomField.
535 sorted.
536 sorted.
536 where("is_for_all = ? OR id IN (SELECT DISTINCT cfp.custom_field_id" +
537 where("is_for_all = ? OR id IN (SELECT DISTINCT cfp.custom_field_id" +
537 " FROM #{table_name_prefix}custom_fields_projects#{table_name_suffix} cfp" +
538 " FROM #{table_name_prefix}custom_fields_projects#{table_name_suffix} cfp" +
538 " WHERE cfp.project_id = ?)", true, id)
539 " WHERE cfp.project_id = ?)", true, id)
539 end
540 end
540 end
541 end
541
542
542 def project
543 def project
543 self
544 self
544 end
545 end
545
546
546 def <=>(project)
547 def <=>(project)
547 name.casecmp(project.name)
548 name.casecmp(project.name)
548 end
549 end
549
550
550 def to_s
551 def to_s
551 name
552 name
552 end
553 end
553
554
554 # Returns a short description of the projects (first lines)
555 # Returns a short description of the projects (first lines)
555 def short_description(length = 255)
556 def short_description(length = 255)
556 description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
557 description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
557 end
558 end
558
559
559 def css_classes
560 def css_classes
560 s = 'project'
561 s = 'project'
561 s << ' root' if root?
562 s << ' root' if root?
562 s << ' child' if child?
563 s << ' child' if child?
563 s << (leaf? ? ' leaf' : ' parent')
564 s << (leaf? ? ' leaf' : ' parent')
564 unless active?
565 unless active?
565 if archived?
566 if archived?
566 s << ' archived'
567 s << ' archived'
567 else
568 else
568 s << ' closed'
569 s << ' closed'
569 end
570 end
570 end
571 end
571 s
572 s
572 end
573 end
573
574
574 # The earliest start date of a project, based on it's issues and versions
575 # The earliest start date of a project, based on it's issues and versions
575 def start_date
576 def start_date
576 @start_date ||= [
577 @start_date ||= [
577 issues.minimum('start_date'),
578 issues.minimum('start_date'),
578 shared_versions.minimum('effective_date'),
579 shared_versions.minimum('effective_date'),
579 Issue.fixed_version(shared_versions).minimum('start_date')
580 Issue.fixed_version(shared_versions).minimum('start_date')
580 ].compact.min
581 ].compact.min
581 end
582 end
582
583
583 # The latest due date of an issue or version
584 # The latest due date of an issue or version
584 def due_date
585 def due_date
585 @due_date ||= [
586 @due_date ||= [
586 issues.maximum('due_date'),
587 issues.maximum('due_date'),
587 shared_versions.maximum('effective_date'),
588 shared_versions.maximum('effective_date'),
588 Issue.fixed_version(shared_versions).maximum('due_date')
589 Issue.fixed_version(shared_versions).maximum('due_date')
589 ].compact.max
590 ].compact.max
590 end
591 end
591
592
592 def overdue?
593 def overdue?
593 active? && !due_date.nil? && (due_date < Date.today)
594 active? && !due_date.nil? && (due_date < Date.today)
594 end
595 end
595
596
596 # Returns the percent completed for this project, based on the
597 # Returns the percent completed for this project, based on the
597 # progress on it's versions.
598 # progress on it's versions.
598 def completed_percent(options={:include_subprojects => false})
599 def completed_percent(options={:include_subprojects => false})
599 if options.delete(:include_subprojects)
600 if options.delete(:include_subprojects)
600 total = self_and_descendants.collect(&:completed_percent).sum
601 total = self_and_descendants.collect(&:completed_percent).sum
601
602
602 total / self_and_descendants.count
603 total / self_and_descendants.count
603 else
604 else
604 if versions.count > 0
605 if versions.count > 0
605 total = versions.collect(&:completed_percent).sum
606 total = versions.collect(&:completed_percent).sum
606
607
607 total / versions.count
608 total / versions.count
608 else
609 else
609 100
610 100
610 end
611 end
611 end
612 end
612 end
613 end
613
614
614 # Return true if this project allows to do the specified action.
615 # Return true if this project allows to do the specified action.
615 # action can be:
616 # action can be:
616 # * a parameter-like Hash (eg. :controller => 'projects', :action => 'edit')
617 # * a parameter-like Hash (eg. :controller => 'projects', :action => 'edit')
617 # * a permission Symbol (eg. :edit_project)
618 # * a permission Symbol (eg. :edit_project)
618 def allows_to?(action)
619 def allows_to?(action)
619 if archived?
620 if archived?
620 # No action allowed on archived projects
621 # No action allowed on archived projects
621 return false
622 return false
622 end
623 end
623 unless active? || Redmine::AccessControl.read_action?(action)
624 unless active? || Redmine::AccessControl.read_action?(action)
624 # No write action allowed on closed projects
625 # No write action allowed on closed projects
625 return false
626 return false
626 end
627 end
627 # No action allowed on disabled modules
628 # No action allowed on disabled modules
628 if action.is_a? Hash
629 if action.is_a? Hash
629 allowed_actions.include? "#{action[:controller]}/#{action[:action]}"
630 allowed_actions.include? "#{action[:controller]}/#{action[:action]}"
630 else
631 else
631 allowed_permissions.include? action
632 allowed_permissions.include? action
632 end
633 end
633 end
634 end
634
635
635 # Return the enabled module with the given name
636 # Return the enabled module with the given name
636 # or nil if the module is not enabled for the project
637 # or nil if the module is not enabled for the project
637 def enabled_module(name)
638 def enabled_module(name)
638 name = name.to_s
639 name = name.to_s
639 enabled_modules.detect {|m| m.name == name}
640 enabled_modules.detect {|m| m.name == name}
640 end
641 end
641
642
642 # Return true if the module with the given name is enabled
643 # Return true if the module with the given name is enabled
643 def module_enabled?(name)
644 def module_enabled?(name)
644 enabled_module(name).present?
645 enabled_module(name).present?
645 end
646 end
646
647
647 def enabled_module_names=(module_names)
648 def enabled_module_names=(module_names)
648 if module_names && module_names.is_a?(Array)
649 if module_names && module_names.is_a?(Array)
649 module_names = module_names.collect(&:to_s).reject(&:blank?)
650 module_names = module_names.collect(&:to_s).reject(&:blank?)
650 self.enabled_modules = module_names.collect {|name| enabled_modules.detect {|mod| mod.name == name} || EnabledModule.new(:name => name)}
651 self.enabled_modules = module_names.collect {|name| enabled_modules.detect {|mod| mod.name == name} || EnabledModule.new(:name => name)}
651 else
652 else
652 enabled_modules.clear
653 enabled_modules.clear
653 end
654 end
654 end
655 end
655
656
656 # Returns an array of the enabled modules names
657 # Returns an array of the enabled modules names
657 def enabled_module_names
658 def enabled_module_names
658 enabled_modules.collect(&:name)
659 enabled_modules.collect(&:name)
659 end
660 end
660
661
661 # Enable a specific module
662 # Enable a specific module
662 #
663 #
663 # Examples:
664 # Examples:
664 # project.enable_module!(:issue_tracking)
665 # project.enable_module!(:issue_tracking)
665 # project.enable_module!("issue_tracking")
666 # project.enable_module!("issue_tracking")
666 def enable_module!(name)
667 def enable_module!(name)
667 enabled_modules << EnabledModule.new(:name => name.to_s) unless module_enabled?(name)
668 enabled_modules << EnabledModule.new(:name => name.to_s) unless module_enabled?(name)
668 end
669 end
669
670
670 # Disable a module if it exists
671 # Disable a module if it exists
671 #
672 #
672 # Examples:
673 # Examples:
673 # project.disable_module!(:issue_tracking)
674 # project.disable_module!(:issue_tracking)
674 # project.disable_module!("issue_tracking")
675 # project.disable_module!("issue_tracking")
675 # project.disable_module!(project.enabled_modules.first)
676 # project.disable_module!(project.enabled_modules.first)
676 def disable_module!(target)
677 def disable_module!(target)
677 target = enabled_modules.detect{|mod| target.to_s == mod.name} unless enabled_modules.include?(target)
678 target = enabled_modules.detect{|mod| target.to_s == mod.name} unless enabled_modules.include?(target)
678 target.destroy unless target.blank?
679 target.destroy unless target.blank?
679 end
680 end
680
681
681 safe_attributes 'name',
682 safe_attributes 'name',
682 'description',
683 'description',
683 'homepage',
684 'homepage',
684 'is_public',
685 'is_public',
685 'identifier',
686 'identifier',
686 'custom_field_values',
687 'custom_field_values',
687 'custom_fields',
688 'custom_fields',
688 'tracker_ids',
689 'tracker_ids',
689 'issue_custom_field_ids',
690 'issue_custom_field_ids',
690 'parent_id'
691 'parent_id',
692 'default_version_id'
691
693
692 safe_attributes 'enabled_module_names',
694 safe_attributes 'enabled_module_names',
693 :if => lambda {|project, user| project.new_record? || user.allowed_to?(:select_project_modules, project) }
695 :if => lambda {|project, user| project.new_record? || user.allowed_to?(:select_project_modules, project) }
694
696
695 safe_attributes 'inherit_members',
697 safe_attributes 'inherit_members',
696 :if => lambda {|project, user| project.parent.nil? || project.parent.visible?(user)}
698 :if => lambda {|project, user| project.parent.nil? || project.parent.visible?(user)}
697
699
698 def safe_attributes=(attrs, user=User.current)
700 def safe_attributes=(attrs, user=User.current)
699 return unless attrs.is_a?(Hash)
701 return unless attrs.is_a?(Hash)
700 attrs = attrs.deep_dup
702 attrs = attrs.deep_dup
701
703
702 @unallowed_parent_id = nil
704 @unallowed_parent_id = nil
703 if new_record? || attrs.key?('parent_id')
705 if new_record? || attrs.key?('parent_id')
704 parent_id_param = attrs['parent_id'].to_s
706 parent_id_param = attrs['parent_id'].to_s
705 if new_record? || parent_id_param != parent_id.to_s
707 if new_record? || parent_id_param != parent_id.to_s
706 p = parent_id_param.present? ? Project.find_by_id(parent_id_param) : nil
708 p = parent_id_param.present? ? Project.find_by_id(parent_id_param) : nil
707 unless allowed_parents(user).include?(p)
709 unless allowed_parents(user).include?(p)
708 attrs.delete('parent_id')
710 attrs.delete('parent_id')
709 @unallowed_parent_id = true
711 @unallowed_parent_id = true
710 end
712 end
711 end
713 end
712 end
714 end
713
715
714 super(attrs, user)
716 super(attrs, user)
715 end
717 end
716
718
717 # Returns an auto-generated project identifier based on the last identifier used
719 # Returns an auto-generated project identifier based on the last identifier used
718 def self.next_identifier
720 def self.next_identifier
719 p = Project.order('id DESC').first
721 p = Project.order('id DESC').first
720 p.nil? ? nil : p.identifier.to_s.succ
722 p.nil? ? nil : p.identifier.to_s.succ
721 end
723 end
722
724
723 # Copies and saves the Project instance based on the +project+.
725 # Copies and saves the Project instance based on the +project+.
724 # Duplicates the source project's:
726 # Duplicates the source project's:
725 # * Wiki
727 # * Wiki
726 # * Versions
728 # * Versions
727 # * Categories
729 # * Categories
728 # * Issues
730 # * Issues
729 # * Members
731 # * Members
730 # * Queries
732 # * Queries
731 #
733 #
732 # Accepts an +options+ argument to specify what to copy
734 # Accepts an +options+ argument to specify what to copy
733 #
735 #
734 # Examples:
736 # Examples:
735 # project.copy(1) # => copies everything
737 # project.copy(1) # => copies everything
736 # project.copy(1, :only => 'members') # => copies members only
738 # project.copy(1, :only => 'members') # => copies members only
737 # project.copy(1, :only => ['members', 'versions']) # => copies members and versions
739 # project.copy(1, :only => ['members', 'versions']) # => copies members and versions
738 def copy(project, options={})
740 def copy(project, options={})
739 project = project.is_a?(Project) ? project : Project.find(project)
741 project = project.is_a?(Project) ? project : Project.find(project)
740
742
741 to_be_copied = %w(wiki versions issue_categories issues members queries boards)
743 to_be_copied = %w(wiki versions issue_categories issues members queries boards)
742 to_be_copied = to_be_copied & Array.wrap(options[:only]) unless options[:only].nil?
744 to_be_copied = to_be_copied & Array.wrap(options[:only]) unless options[:only].nil?
743
745
744 Project.transaction do
746 Project.transaction do
745 if save
747 if save
746 reload
748 reload
747 to_be_copied.each do |name|
749 to_be_copied.each do |name|
748 send "copy_#{name}", project
750 send "copy_#{name}", project
749 end
751 end
750 Redmine::Hook.call_hook(:model_project_copy_before_save, :source_project => project, :destination_project => self)
752 Redmine::Hook.call_hook(:model_project_copy_before_save, :source_project => project, :destination_project => self)
751 save
753 save
752 else
754 else
753 false
755 false
754 end
756 end
755 end
757 end
756 end
758 end
757
759
758 def member_principals
760 def member_principals
759 ActiveSupport::Deprecation.warn "Project#member_principals is deprecated and will be removed in Redmine 4.0. Use #memberships.active instead."
761 ActiveSupport::Deprecation.warn "Project#member_principals is deprecated and will be removed in Redmine 4.0. Use #memberships.active instead."
760 memberships.active
762 memberships.active
761 end
763 end
762
764
763 # Returns a new unsaved Project instance with attributes copied from +project+
765 # Returns a new unsaved Project instance with attributes copied from +project+
764 def self.copy_from(project)
766 def self.copy_from(project)
765 project = project.is_a?(Project) ? project : Project.find(project)
767 project = project.is_a?(Project) ? project : Project.find(project)
766 # clear unique attributes
768 # clear unique attributes
767 attributes = project.attributes.dup.except('id', 'name', 'identifier', 'status', 'parent_id', 'lft', 'rgt')
769 attributes = project.attributes.dup.except('id', 'name', 'identifier', 'status', 'parent_id', 'lft', 'rgt')
768 copy = Project.new(attributes)
770 copy = Project.new(attributes)
769 copy.enabled_module_names = project.enabled_module_names
771 copy.enabled_module_names = project.enabled_module_names
770 copy.trackers = project.trackers
772 copy.trackers = project.trackers
771 copy.custom_values = project.custom_values.collect {|v| v.clone}
773 copy.custom_values = project.custom_values.collect {|v| v.clone}
772 copy.issue_custom_fields = project.issue_custom_fields
774 copy.issue_custom_fields = project.issue_custom_fields
773 copy
775 copy
774 end
776 end
775
777
776 # Yields the given block for each project with its level in the tree
778 # Yields the given block for each project with its level in the tree
777 def self.project_tree(projects, &block)
779 def self.project_tree(projects, &block)
778 ancestors = []
780 ancestors = []
779 projects.sort_by(&:lft).each do |project|
781 projects.sort_by(&:lft).each do |project|
780 while (ancestors.any? && !project.is_descendant_of?(ancestors.last))
782 while (ancestors.any? && !project.is_descendant_of?(ancestors.last))
781 ancestors.pop
783 ancestors.pop
782 end
784 end
783 yield project, ancestors.size
785 yield project, ancestors.size
784 ancestors << project
786 ancestors << project
785 end
787 end
786 end
788 end
787
789
788 private
790 private
789
791
790 def update_inherited_members
792 def update_inherited_members
791 if parent
793 if parent
792 if inherit_members? && !inherit_members_was
794 if inherit_members? && !inherit_members_was
793 remove_inherited_member_roles
795 remove_inherited_member_roles
794 add_inherited_member_roles
796 add_inherited_member_roles
795 elsif !inherit_members? && inherit_members_was
797 elsif !inherit_members? && inherit_members_was
796 remove_inherited_member_roles
798 remove_inherited_member_roles
797 end
799 end
798 end
800 end
799 end
801 end
800
802
801 def remove_inherited_member_roles
803 def remove_inherited_member_roles
802 member_roles = memberships.map(&:member_roles).flatten
804 member_roles = memberships.map(&:member_roles).flatten
803 member_role_ids = member_roles.map(&:id)
805 member_role_ids = member_roles.map(&:id)
804 member_roles.each do |member_role|
806 member_roles.each do |member_role|
805 if member_role.inherited_from && !member_role_ids.include?(member_role.inherited_from)
807 if member_role.inherited_from && !member_role_ids.include?(member_role.inherited_from)
806 member_role.destroy
808 member_role.destroy
807 end
809 end
808 end
810 end
809 end
811 end
810
812
811 def add_inherited_member_roles
813 def add_inherited_member_roles
812 if inherit_members? && parent
814 if inherit_members? && parent
813 parent.memberships.each do |parent_member|
815 parent.memberships.each do |parent_member|
814 member = Member.find_or_new(self.id, parent_member.user_id)
816 member = Member.find_or_new(self.id, parent_member.user_id)
815 parent_member.member_roles.each do |parent_member_role|
817 parent_member.member_roles.each do |parent_member_role|
816 member.member_roles << MemberRole.new(:role => parent_member_role.role, :inherited_from => parent_member_role.id)
818 member.member_roles << MemberRole.new(:role => parent_member_role.role, :inherited_from => parent_member_role.id)
817 end
819 end
818 member.save!
820 member.save!
819 end
821 end
820 memberships.reset
822 memberships.reset
821 end
823 end
822 end
824 end
823
825
824 def update_versions_from_hierarchy_change
826 def update_versions_from_hierarchy_change
825 Issue.update_versions_from_hierarchy_change(self)
827 Issue.update_versions_from_hierarchy_change(self)
826 end
828 end
827
829
828 def validate_parent
830 def validate_parent
829 if @unallowed_parent_id
831 if @unallowed_parent_id
830 errors.add(:parent_id, :invalid)
832 errors.add(:parent_id, :invalid)
831 elsif parent_id_changed?
833 elsif parent_id_changed?
832 unless parent.nil? || (parent.active? && move_possible?(parent))
834 unless parent.nil? || (parent.active? && move_possible?(parent))
833 errors.add(:parent_id, :invalid)
835 errors.add(:parent_id, :invalid)
834 end
836 end
835 end
837 end
836 end
838 end
837
839
838 # Copies wiki from +project+
840 # Copies wiki from +project+
839 def copy_wiki(project)
841 def copy_wiki(project)
840 # Check that the source project has a wiki first
842 # Check that the source project has a wiki first
841 unless project.wiki.nil?
843 unless project.wiki.nil?
842 wiki = self.wiki || Wiki.new
844 wiki = self.wiki || Wiki.new
843 wiki.attributes = project.wiki.attributes.dup.except("id", "project_id")
845 wiki.attributes = project.wiki.attributes.dup.except("id", "project_id")
844 wiki_pages_map = {}
846 wiki_pages_map = {}
845 project.wiki.pages.each do |page|
847 project.wiki.pages.each do |page|
846 # Skip pages without content
848 # Skip pages without content
847 next if page.content.nil?
849 next if page.content.nil?
848 new_wiki_content = WikiContent.new(page.content.attributes.dup.except("id", "page_id", "updated_on"))
850 new_wiki_content = WikiContent.new(page.content.attributes.dup.except("id", "page_id", "updated_on"))
849 new_wiki_page = WikiPage.new(page.attributes.dup.except("id", "wiki_id", "created_on", "parent_id"))
851 new_wiki_page = WikiPage.new(page.attributes.dup.except("id", "wiki_id", "created_on", "parent_id"))
850 new_wiki_page.content = new_wiki_content
852 new_wiki_page.content = new_wiki_content
851 wiki.pages << new_wiki_page
853 wiki.pages << new_wiki_page
852 wiki_pages_map[page.id] = new_wiki_page
854 wiki_pages_map[page.id] = new_wiki_page
853 end
855 end
854
856
855 self.wiki = wiki
857 self.wiki = wiki
856 wiki.save
858 wiki.save
857 # Reproduce page hierarchy
859 # Reproduce page hierarchy
858 project.wiki.pages.each do |page|
860 project.wiki.pages.each do |page|
859 if page.parent_id && wiki_pages_map[page.id]
861 if page.parent_id && wiki_pages_map[page.id]
860 wiki_pages_map[page.id].parent = wiki_pages_map[page.parent_id]
862 wiki_pages_map[page.id].parent = wiki_pages_map[page.parent_id]
861 wiki_pages_map[page.id].save
863 wiki_pages_map[page.id].save
862 end
864 end
863 end
865 end
864 end
866 end
865 end
867 end
866
868
867 # Copies versions from +project+
869 # Copies versions from +project+
868 def copy_versions(project)
870 def copy_versions(project)
869 project.versions.each do |version|
871 project.versions.each do |version|
870 new_version = Version.new
872 new_version = Version.new
871 new_version.attributes = version.attributes.dup.except("id", "project_id", "created_on", "updated_on")
873 new_version.attributes = version.attributes.dup.except("id", "project_id", "created_on", "updated_on")
872 self.versions << new_version
874 self.versions << new_version
873 end
875 end
874 end
876 end
875
877
876 # Copies issue categories from +project+
878 # Copies issue categories from +project+
877 def copy_issue_categories(project)
879 def copy_issue_categories(project)
878 project.issue_categories.each do |issue_category|
880 project.issue_categories.each do |issue_category|
879 new_issue_category = IssueCategory.new
881 new_issue_category = IssueCategory.new
880 new_issue_category.attributes = issue_category.attributes.dup.except("id", "project_id")
882 new_issue_category.attributes = issue_category.attributes.dup.except("id", "project_id")
881 self.issue_categories << new_issue_category
883 self.issue_categories << new_issue_category
882 end
884 end
883 end
885 end
884
886
885 # Copies issues from +project+
887 # Copies issues from +project+
886 def copy_issues(project)
888 def copy_issues(project)
887 # Stores the source issue id as a key and the copied issues as the
889 # Stores the source issue id as a key and the copied issues as the
888 # value. Used to map the two together for issue relations.
890 # value. Used to map the two together for issue relations.
889 issues_map = {}
891 issues_map = {}
890
892
891 # Store status and reopen locked/closed versions
893 # Store status and reopen locked/closed versions
892 version_statuses = versions.reject(&:open?).map {|version| [version, version.status]}
894 version_statuses = versions.reject(&:open?).map {|version| [version, version.status]}
893 version_statuses.each do |version, status|
895 version_statuses.each do |version, status|
894 version.update_attribute :status, 'open'
896 version.update_attribute :status, 'open'
895 end
897 end
896
898
897 # Get issues sorted by root_id, lft so that parent issues
899 # Get issues sorted by root_id, lft so that parent issues
898 # get copied before their children
900 # get copied before their children
899 project.issues.reorder('root_id, lft').each do |issue|
901 project.issues.reorder('root_id, lft').each do |issue|
900 new_issue = Issue.new
902 new_issue = Issue.new
901 new_issue.copy_from(issue, :subtasks => false, :link => false)
903 new_issue.copy_from(issue, :subtasks => false, :link => false)
902 new_issue.project = self
904 new_issue.project = self
903 # Changing project resets the custom field values
905 # Changing project resets the custom field values
904 # TODO: handle this in Issue#project=
906 # TODO: handle this in Issue#project=
905 new_issue.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
907 new_issue.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
906 # Reassign fixed_versions by name, since names are unique per project
908 # Reassign fixed_versions by name, since names are unique per project
907 if issue.fixed_version && issue.fixed_version.project == project
909 if issue.fixed_version && issue.fixed_version.project == project
908 new_issue.fixed_version = self.versions.detect {|v| v.name == issue.fixed_version.name}
910 new_issue.fixed_version = self.versions.detect {|v| v.name == issue.fixed_version.name}
909 end
911 end
910 # Reassign version custom field values
912 # Reassign version custom field values
911 new_issue.custom_field_values.each do |custom_value|
913 new_issue.custom_field_values.each do |custom_value|
912 if custom_value.custom_field.field_format == 'version' && custom_value.value.present?
914 if custom_value.custom_field.field_format == 'version' && custom_value.value.present?
913 versions = Version.where(:id => custom_value.value).to_a
915 versions = Version.where(:id => custom_value.value).to_a
914 new_value = versions.map do |version|
916 new_value = versions.map do |version|
915 if version.project == project
917 if version.project == project
916 self.versions.detect {|v| v.name == version.name}.try(:id)
918 self.versions.detect {|v| v.name == version.name}.try(:id)
917 else
919 else
918 version.id
920 version.id
919 end
921 end
920 end
922 end
921 new_value.compact!
923 new_value.compact!
922 new_value = new_value.first unless custom_value.custom_field.multiple?
924 new_value = new_value.first unless custom_value.custom_field.multiple?
923 custom_value.value = new_value
925 custom_value.value = new_value
924 end
926 end
925 end
927 end
926 # Reassign the category by name, since names are unique per project
928 # Reassign the category by name, since names are unique per project
927 if issue.category
929 if issue.category
928 new_issue.category = self.issue_categories.detect {|c| c.name == issue.category.name}
930 new_issue.category = self.issue_categories.detect {|c| c.name == issue.category.name}
929 end
931 end
930 # Parent issue
932 # Parent issue
931 if issue.parent_id
933 if issue.parent_id
932 if copied_parent = issues_map[issue.parent_id]
934 if copied_parent = issues_map[issue.parent_id]
933 new_issue.parent_issue_id = copied_parent.id
935 new_issue.parent_issue_id = copied_parent.id
934 end
936 end
935 end
937 end
936
938
937 self.issues << new_issue
939 self.issues << new_issue
938 if new_issue.new_record?
940 if new_issue.new_record?
939 logger.info "Project#copy_issues: issue ##{issue.id} could not be copied: #{new_issue.errors.full_messages}" if logger && logger.info?
941 logger.info "Project#copy_issues: issue ##{issue.id} could not be copied: #{new_issue.errors.full_messages}" if logger && logger.info?
940 else
942 else
941 issues_map[issue.id] = new_issue unless new_issue.new_record?
943 issues_map[issue.id] = new_issue unless new_issue.new_record?
942 end
944 end
943 end
945 end
944
946
945 # Restore locked/closed version statuses
947 # Restore locked/closed version statuses
946 version_statuses.each do |version, status|
948 version_statuses.each do |version, status|
947 version.update_attribute :status, status
949 version.update_attribute :status, status
948 end
950 end
949
951
950 # Relations after in case issues related each other
952 # Relations after in case issues related each other
951 project.issues.each do |issue|
953 project.issues.each do |issue|
952 new_issue = issues_map[issue.id]
954 new_issue = issues_map[issue.id]
953 unless new_issue
955 unless new_issue
954 # Issue was not copied
956 # Issue was not copied
955 next
957 next
956 end
958 end
957
959
958 # Relations
960 # Relations
959 issue.relations_from.each do |source_relation|
961 issue.relations_from.each do |source_relation|
960 new_issue_relation = IssueRelation.new
962 new_issue_relation = IssueRelation.new
961 new_issue_relation.attributes = source_relation.attributes.dup.except("id", "issue_from_id", "issue_to_id")
963 new_issue_relation.attributes = source_relation.attributes.dup.except("id", "issue_from_id", "issue_to_id")
962 new_issue_relation.issue_to = issues_map[source_relation.issue_to_id]
964 new_issue_relation.issue_to = issues_map[source_relation.issue_to_id]
963 if new_issue_relation.issue_to.nil? && Setting.cross_project_issue_relations?
965 if new_issue_relation.issue_to.nil? && Setting.cross_project_issue_relations?
964 new_issue_relation.issue_to = source_relation.issue_to
966 new_issue_relation.issue_to = source_relation.issue_to
965 end
967 end
966 new_issue.relations_from << new_issue_relation
968 new_issue.relations_from << new_issue_relation
967 end
969 end
968
970
969 issue.relations_to.each do |source_relation|
971 issue.relations_to.each do |source_relation|
970 new_issue_relation = IssueRelation.new
972 new_issue_relation = IssueRelation.new
971 new_issue_relation.attributes = source_relation.attributes.dup.except("id", "issue_from_id", "issue_to_id")
973 new_issue_relation.attributes = source_relation.attributes.dup.except("id", "issue_from_id", "issue_to_id")
972 new_issue_relation.issue_from = issues_map[source_relation.issue_from_id]
974 new_issue_relation.issue_from = issues_map[source_relation.issue_from_id]
973 if new_issue_relation.issue_from.nil? && Setting.cross_project_issue_relations?
975 if new_issue_relation.issue_from.nil? && Setting.cross_project_issue_relations?
974 new_issue_relation.issue_from = source_relation.issue_from
976 new_issue_relation.issue_from = source_relation.issue_from
975 end
977 end
976 new_issue.relations_to << new_issue_relation
978 new_issue.relations_to << new_issue_relation
977 end
979 end
978 end
980 end
979 end
981 end
980
982
981 # Copies members from +project+
983 # Copies members from +project+
982 def copy_members(project)
984 def copy_members(project)
983 # Copy users first, then groups to handle members with inherited and given roles
985 # Copy users first, then groups to handle members with inherited and given roles
984 members_to_copy = []
986 members_to_copy = []
985 members_to_copy += project.memberships.select {|m| m.principal.is_a?(User)}
987 members_to_copy += project.memberships.select {|m| m.principal.is_a?(User)}
986 members_to_copy += project.memberships.select {|m| !m.principal.is_a?(User)}
988 members_to_copy += project.memberships.select {|m| !m.principal.is_a?(User)}
987
989
988 members_to_copy.each do |member|
990 members_to_copy.each do |member|
989 new_member = Member.new
991 new_member = Member.new
990 new_member.attributes = member.attributes.dup.except("id", "project_id", "created_on")
992 new_member.attributes = member.attributes.dup.except("id", "project_id", "created_on")
991 # only copy non inherited roles
993 # only copy non inherited roles
992 # inherited roles will be added when copying the group membership
994 # inherited roles will be added when copying the group membership
993 role_ids = member.member_roles.reject(&:inherited?).collect(&:role_id)
995 role_ids = member.member_roles.reject(&:inherited?).collect(&:role_id)
994 next if role_ids.empty?
996 next if role_ids.empty?
995 new_member.role_ids = role_ids
997 new_member.role_ids = role_ids
996 new_member.project = self
998 new_member.project = self
997 self.members << new_member
999 self.members << new_member
998 end
1000 end
999 end
1001 end
1000
1002
1001 # Copies queries from +project+
1003 # Copies queries from +project+
1002 def copy_queries(project)
1004 def copy_queries(project)
1003 project.queries.each do |query|
1005 project.queries.each do |query|
1004 new_query = IssueQuery.new
1006 new_query = IssueQuery.new
1005 new_query.attributes = query.attributes.dup.except("id", "project_id", "sort_criteria", "user_id", "type")
1007 new_query.attributes = query.attributes.dup.except("id", "project_id", "sort_criteria", "user_id", "type")
1006 new_query.sort_criteria = query.sort_criteria if query.sort_criteria
1008 new_query.sort_criteria = query.sort_criteria if query.sort_criteria
1007 new_query.project = self
1009 new_query.project = self
1008 new_query.user_id = query.user_id
1010 new_query.user_id = query.user_id
1009 new_query.role_ids = query.role_ids if query.visibility == IssueQuery::VISIBILITY_ROLES
1011 new_query.role_ids = query.role_ids if query.visibility == IssueQuery::VISIBILITY_ROLES
1010 self.queries << new_query
1012 self.queries << new_query
1011 end
1013 end
1012 end
1014 end
1013
1015
1014 # Copies boards from +project+
1016 # Copies boards from +project+
1015 def copy_boards(project)
1017 def copy_boards(project)
1016 project.boards.each do |board|
1018 project.boards.each do |board|
1017 new_board = Board.new
1019 new_board = Board.new
1018 new_board.attributes = board.attributes.dup.except("id", "project_id", "topics_count", "messages_count", "last_message_id")
1020 new_board.attributes = board.attributes.dup.except("id", "project_id", "topics_count", "messages_count", "last_message_id")
1019 new_board.project = self
1021 new_board.project = self
1020 self.boards << new_board
1022 self.boards << new_board
1021 end
1023 end
1022 end
1024 end
1023
1025
1024 def allowed_permissions
1026 def allowed_permissions
1025 @allowed_permissions ||= begin
1027 @allowed_permissions ||= begin
1026 module_names = enabled_modules.loaded? ? enabled_modules.map(&:name) : enabled_modules.pluck(:name)
1028 module_names = enabled_modules.loaded? ? enabled_modules.map(&:name) : enabled_modules.pluck(:name)
1027 Redmine::AccessControl.modules_permissions(module_names).collect {|p| p.name}
1029 Redmine::AccessControl.modules_permissions(module_names).collect {|p| p.name}
1028 end
1030 end
1029 end
1031 end
1030
1032
1031 def allowed_actions
1033 def allowed_actions
1032 @actions_allowed ||= allowed_permissions.inject([]) { |actions, permission| actions += Redmine::AccessControl.allowed_actions(permission) }.flatten
1034 @actions_allowed ||= allowed_permissions.inject([]) { |actions, permission| actions += Redmine::AccessControl.allowed_actions(permission) }.flatten
1033 end
1035 end
1034
1036
1035 # Archives subprojects recursively
1037 # Archives subprojects recursively
1036 def archive!
1038 def archive!
1037 children.each do |subproject|
1039 children.each do |subproject|
1038 subproject.send :archive!
1040 subproject.send :archive!
1039 end
1041 end
1040 update_attribute :status, STATUS_ARCHIVED
1042 update_attribute :status, STATUS_ARCHIVED
1041 end
1043 end
1042 end
1044 end
@@ -1,300 +1,307
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2015 Jean-Philippe Lang
2 # Copyright (C) 2006-2015 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 class Version < ActiveRecord::Base
18 class Version < ActiveRecord::Base
19 include Redmine::SafeAttributes
19 include Redmine::SafeAttributes
20
20 after_update :update_issues_from_sharing_change
21 after_update :update_issues_from_sharing_change
22 before_destroy :nullify_projects_default_version
23
21 belongs_to :project
24 belongs_to :project
22 has_many :fixed_issues, :class_name => 'Issue', :foreign_key => 'fixed_version_id', :dependent => :nullify
25 has_many :fixed_issues, :class_name => 'Issue', :foreign_key => 'fixed_version_id', :dependent => :nullify
23 acts_as_customizable
26 acts_as_customizable
24 acts_as_attachable :view_permission => :view_files,
27 acts_as_attachable :view_permission => :view_files,
25 :edit_permission => :manage_files,
28 :edit_permission => :manage_files,
26 :delete_permission => :manage_files
29 :delete_permission => :manage_files
27
30
28 VERSION_STATUSES = %w(open locked closed)
31 VERSION_STATUSES = %w(open locked closed)
29 VERSION_SHARINGS = %w(none descendants hierarchy tree system)
32 VERSION_SHARINGS = %w(none descendants hierarchy tree system)
30
33
31 validates_presence_of :name
34 validates_presence_of :name
32 validates_uniqueness_of :name, :scope => [:project_id]
35 validates_uniqueness_of :name, :scope => [:project_id]
33 validates_length_of :name, :maximum => 60
36 validates_length_of :name, :maximum => 60
34 validates_length_of :description, :maximum => 255
37 validates_length_of :description, :maximum => 255
35 validates :effective_date, :date => true
38 validates :effective_date, :date => true
36 validates_inclusion_of :status, :in => VERSION_STATUSES
39 validates_inclusion_of :status, :in => VERSION_STATUSES
37 validates_inclusion_of :sharing, :in => VERSION_SHARINGS
40 validates_inclusion_of :sharing, :in => VERSION_SHARINGS
38 attr_protected :id
41 attr_protected :id
39
42
40 scope :named, lambda {|arg| where("LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip)}
43 scope :named, lambda {|arg| where("LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip)}
41 scope :open, lambda { where(:status => 'open') }
44 scope :open, lambda { where(:status => 'open') }
42 scope :visible, lambda {|*args|
45 scope :visible, lambda {|*args|
43 joins(:project).
46 joins(:project).
44 where(Project.allowed_to_condition(args.first || User.current, :view_issues))
47 where(Project.allowed_to_condition(args.first || User.current, :view_issues))
45 }
48 }
46
49
47 safe_attributes 'name',
50 safe_attributes 'name',
48 'description',
51 'description',
49 'effective_date',
52 'effective_date',
50 'due_date',
53 'due_date',
51 'wiki_page_title',
54 'wiki_page_title',
52 'status',
55 'status',
53 'sharing',
56 'sharing',
54 'custom_field_values',
57 'custom_field_values',
55 'custom_fields'
58 'custom_fields'
56
59
57 # Returns true if +user+ or current user is allowed to view the version
60 # Returns true if +user+ or current user is allowed to view the version
58 def visible?(user=User.current)
61 def visible?(user=User.current)
59 user.allowed_to?(:view_issues, self.project)
62 user.allowed_to?(:view_issues, self.project)
60 end
63 end
61
64
62 # Version files have same visibility as project files
65 # Version files have same visibility as project files
63 def attachments_visible?(*args)
66 def attachments_visible?(*args)
64 project.present? && project.attachments_visible?(*args)
67 project.present? && project.attachments_visible?(*args)
65 end
68 end
66
69
67 def attachments_deletable?(usr=User.current)
70 def attachments_deletable?(usr=User.current)
68 project.present? && project.attachments_deletable?(usr)
71 project.present? && project.attachments_deletable?(usr)
69 end
72 end
70
73
71 def start_date
74 def start_date
72 @start_date ||= fixed_issues.minimum('start_date')
75 @start_date ||= fixed_issues.minimum('start_date')
73 end
76 end
74
77
75 def due_date
78 def due_date
76 effective_date
79 effective_date
77 end
80 end
78
81
79 def due_date=(arg)
82 def due_date=(arg)
80 self.effective_date=(arg)
83 self.effective_date=(arg)
81 end
84 end
82
85
83 # Returns the total estimated time for this version
86 # Returns the total estimated time for this version
84 # (sum of leaves estimated_hours)
87 # (sum of leaves estimated_hours)
85 def estimated_hours
88 def estimated_hours
86 @estimated_hours ||= fixed_issues.sum(:estimated_hours).to_f
89 @estimated_hours ||= fixed_issues.sum(:estimated_hours).to_f
87 end
90 end
88
91
89 # Returns the total reported time for this version
92 # Returns the total reported time for this version
90 def spent_hours
93 def spent_hours
91 @spent_hours ||= TimeEntry.joins(:issue).where("#{Issue.table_name}.fixed_version_id = ?", id).sum(:hours).to_f
94 @spent_hours ||= TimeEntry.joins(:issue).where("#{Issue.table_name}.fixed_version_id = ?", id).sum(:hours).to_f
92 end
95 end
93
96
94 def closed?
97 def closed?
95 status == 'closed'
98 status == 'closed'
96 end
99 end
97
100
98 def open?
101 def open?
99 status == 'open'
102 status == 'open'
100 end
103 end
101
104
102 # Returns true if the version is completed: due date reached and no open issues
105 # Returns true if the version is completed: due date reached and no open issues
103 def completed?
106 def completed?
104 effective_date && (effective_date < Date.today) && (open_issues_count == 0)
107 effective_date && (effective_date < Date.today) && (open_issues_count == 0)
105 end
108 end
106
109
107 def behind_schedule?
110 def behind_schedule?
108 if completed_percent == 100
111 if completed_percent == 100
109 return false
112 return false
110 elsif due_date && start_date
113 elsif due_date && start_date
111 done_date = start_date + ((due_date - start_date+1)* completed_percent/100).floor
114 done_date = start_date + ((due_date - start_date+1)* completed_percent/100).floor
112 return done_date <= Date.today
115 return done_date <= Date.today
113 else
116 else
114 false # No issues so it's not late
117 false # No issues so it's not late
115 end
118 end
116 end
119 end
117
120
118 # Returns the completion percentage of this version based on the amount of open/closed issues
121 # Returns the completion percentage of this version based on the amount of open/closed issues
119 # and the time spent on the open issues.
122 # and the time spent on the open issues.
120 def completed_percent
123 def completed_percent
121 if issues_count == 0
124 if issues_count == 0
122 0
125 0
123 elsif open_issues_count == 0
126 elsif open_issues_count == 0
124 100
127 100
125 else
128 else
126 issues_progress(false) + issues_progress(true)
129 issues_progress(false) + issues_progress(true)
127 end
130 end
128 end
131 end
129
132
130 # Returns the percentage of issues that have been marked as 'closed'.
133 # Returns the percentage of issues that have been marked as 'closed'.
131 def closed_percent
134 def closed_percent
132 if issues_count == 0
135 if issues_count == 0
133 0
136 0
134 else
137 else
135 issues_progress(false)
138 issues_progress(false)
136 end
139 end
137 end
140 end
138
141
139 # Returns true if the version is overdue: due date reached and some open issues
142 # Returns true if the version is overdue: due date reached and some open issues
140 def overdue?
143 def overdue?
141 effective_date && (effective_date < Date.today) && (open_issues_count > 0)
144 effective_date && (effective_date < Date.today) && (open_issues_count > 0)
142 end
145 end
143
146
144 # Returns assigned issues count
147 # Returns assigned issues count
145 def issues_count
148 def issues_count
146 load_issue_counts
149 load_issue_counts
147 @issue_count
150 @issue_count
148 end
151 end
149
152
150 # Returns the total amount of open issues for this version.
153 # Returns the total amount of open issues for this version.
151 def open_issues_count
154 def open_issues_count
152 load_issue_counts
155 load_issue_counts
153 @open_issues_count
156 @open_issues_count
154 end
157 end
155
158
156 # Returns the total amount of closed issues for this version.
159 # Returns the total amount of closed issues for this version.
157 def closed_issues_count
160 def closed_issues_count
158 load_issue_counts
161 load_issue_counts
159 @closed_issues_count
162 @closed_issues_count
160 end
163 end
161
164
162 def wiki_page
165 def wiki_page
163 if project.wiki && !wiki_page_title.blank?
166 if project.wiki && !wiki_page_title.blank?
164 @wiki_page ||= project.wiki.find_page(wiki_page_title)
167 @wiki_page ||= project.wiki.find_page(wiki_page_title)
165 end
168 end
166 @wiki_page
169 @wiki_page
167 end
170 end
168
171
169 def to_s; name end
172 def to_s; name end
170
173
171 def to_s_with_project
174 def to_s_with_project
172 "#{project} - #{name}"
175 "#{project} - #{name}"
173 end
176 end
174
177
175 # Versions are sorted by effective_date and name
178 # Versions are sorted by effective_date and name
176 # Those with no effective_date are at the end, sorted by name
179 # Those with no effective_date are at the end, sorted by name
177 def <=>(version)
180 def <=>(version)
178 if self.effective_date
181 if self.effective_date
179 if version.effective_date
182 if version.effective_date
180 if self.effective_date == version.effective_date
183 if self.effective_date == version.effective_date
181 name == version.name ? id <=> version.id : name <=> version.name
184 name == version.name ? id <=> version.id : name <=> version.name
182 else
185 else
183 self.effective_date <=> version.effective_date
186 self.effective_date <=> version.effective_date
184 end
187 end
185 else
188 else
186 -1
189 -1
187 end
190 end
188 else
191 else
189 if version.effective_date
192 if version.effective_date
190 1
193 1
191 else
194 else
192 name == version.name ? id <=> version.id : name <=> version.name
195 name == version.name ? id <=> version.id : name <=> version.name
193 end
196 end
194 end
197 end
195 end
198 end
196
199
197 def self.fields_for_order_statement(table=nil)
200 def self.fields_for_order_statement(table=nil)
198 table ||= table_name
201 table ||= table_name
199 ["(CASE WHEN #{table}.effective_date IS NULL THEN 1 ELSE 0 END)", "#{table}.effective_date", "#{table}.name", "#{table}.id"]
202 ["(CASE WHEN #{table}.effective_date IS NULL THEN 1 ELSE 0 END)", "#{table}.effective_date", "#{table}.name", "#{table}.id"]
200 end
203 end
201
204
202 scope :sorted, lambda { order(fields_for_order_statement) }
205 scope :sorted, lambda { order(fields_for_order_statement) }
203
206
204 # Returns the sharings that +user+ can set the version to
207 # Returns the sharings that +user+ can set the version to
205 def allowed_sharings(user = User.current)
208 def allowed_sharings(user = User.current)
206 VERSION_SHARINGS.select do |s|
209 VERSION_SHARINGS.select do |s|
207 if sharing == s
210 if sharing == s
208 true
211 true
209 else
212 else
210 case s
213 case s
211 when 'system'
214 when 'system'
212 # Only admin users can set a systemwide sharing
215 # Only admin users can set a systemwide sharing
213 user.admin?
216 user.admin?
214 when 'hierarchy', 'tree'
217 when 'hierarchy', 'tree'
215 # Only users allowed to manage versions of the root project can
218 # Only users allowed to manage versions of the root project can
216 # set sharing to hierarchy or tree
219 # set sharing to hierarchy or tree
217 project.nil? || user.allowed_to?(:manage_versions, project.root)
220 project.nil? || user.allowed_to?(:manage_versions, project.root)
218 else
221 else
219 true
222 true
220 end
223 end
221 end
224 end
222 end
225 end
223 end
226 end
224
227
225 # Returns true if the version is shared, otherwise false
228 # Returns true if the version is shared, otherwise false
226 def shared?
229 def shared?
227 sharing != 'none'
230 sharing != 'none'
228 end
231 end
229
232
230 def deletable?
233 def deletable?
231 fixed_issues.empty? && !referenced_by_a_custom_field?
234 fixed_issues.empty? && !referenced_by_a_custom_field?
232 end
235 end
233
236
234 private
237 private
235
238
236 def load_issue_counts
239 def load_issue_counts
237 unless @issue_count
240 unless @issue_count
238 @open_issues_count = 0
241 @open_issues_count = 0
239 @closed_issues_count = 0
242 @closed_issues_count = 0
240 fixed_issues.group(:status).count.each do |status, count|
243 fixed_issues.group(:status).count.each do |status, count|
241 if status.is_closed?
244 if status.is_closed?
242 @closed_issues_count += count
245 @closed_issues_count += count
243 else
246 else
244 @open_issues_count += count
247 @open_issues_count += count
245 end
248 end
246 end
249 end
247 @issue_count = @open_issues_count + @closed_issues_count
250 @issue_count = @open_issues_count + @closed_issues_count
248 end
251 end
249 end
252 end
250
253
251 # Update the issue's fixed versions. Used if a version's sharing changes.
254 # Update the issue's fixed versions. Used if a version's sharing changes.
252 def update_issues_from_sharing_change
255 def update_issues_from_sharing_change
253 if sharing_changed?
256 if sharing_changed?
254 if VERSION_SHARINGS.index(sharing_was).nil? ||
257 if VERSION_SHARINGS.index(sharing_was).nil? ||
255 VERSION_SHARINGS.index(sharing).nil? ||
258 VERSION_SHARINGS.index(sharing).nil? ||
256 VERSION_SHARINGS.index(sharing_was) > VERSION_SHARINGS.index(sharing)
259 VERSION_SHARINGS.index(sharing_was) > VERSION_SHARINGS.index(sharing)
257 Issue.update_versions_from_sharing_change self
260 Issue.update_versions_from_sharing_change self
258 end
261 end
259 end
262 end
260 end
263 end
261
264
262 # Returns the average estimated time of assigned issues
265 # Returns the average estimated time of assigned issues
263 # or 1 if no issue has an estimated time
266 # or 1 if no issue has an estimated time
264 # Used to weight unestimated issues in progress calculation
267 # Used to weight unestimated issues in progress calculation
265 def estimated_average
268 def estimated_average
266 if @estimated_average.nil?
269 if @estimated_average.nil?
267 average = fixed_issues.average(:estimated_hours).to_f
270 average = fixed_issues.average(:estimated_hours).to_f
268 if average == 0
271 if average == 0
269 average = 1
272 average = 1
270 end
273 end
271 @estimated_average = average
274 @estimated_average = average
272 end
275 end
273 @estimated_average
276 @estimated_average
274 end
277 end
275
278
276 # Returns the total progress of open or closed issues. The returned percentage takes into account
279 # Returns the total progress of open or closed issues. The returned percentage takes into account
277 # the amount of estimated time set for this version.
280 # the amount of estimated time set for this version.
278 #
281 #
279 # Examples:
282 # Examples:
280 # issues_progress(true) => returns the progress percentage for open issues.
283 # issues_progress(true) => returns the progress percentage for open issues.
281 # issues_progress(false) => returns the progress percentage for closed issues.
284 # issues_progress(false) => returns the progress percentage for closed issues.
282 def issues_progress(open)
285 def issues_progress(open)
283 @issues_progress ||= {}
286 @issues_progress ||= {}
284 @issues_progress[open] ||= begin
287 @issues_progress[open] ||= begin
285 progress = 0
288 progress = 0
286 if issues_count > 0
289 if issues_count > 0
287 ratio = open ? 'done_ratio' : 100
290 ratio = open ? 'done_ratio' : 100
288
291
289 done = fixed_issues.open(open).sum("COALESCE(estimated_hours, #{estimated_average}) * #{ratio}").to_f
292 done = fixed_issues.open(open).sum("COALESCE(estimated_hours, #{estimated_average}) * #{ratio}").to_f
290 progress = done / (estimated_average * issues_count)
293 progress = done / (estimated_average * issues_count)
291 end
294 end
292 progress
295 progress
293 end
296 end
294 end
297 end
295
298
296 def referenced_by_a_custom_field?
299 def referenced_by_a_custom_field?
297 CustomValue.joins(:custom_field).
300 CustomValue.joins(:custom_field).
298 where(:value => id.to_s, :custom_fields => {:field_format => 'version'}).any?
301 where(:value => id.to_s, :custom_fields => {:field_format => 'version'}).any?
299 end
302 end
303
304 def nullify_projects_default_version
305 Project.where(:default_version_id => id).update_all(:default_version_id => nil)
306 end
300 end
307 end
@@ -1,102 +1,106
1 <%= error_messages_for 'project' %>
1 <%= error_messages_for 'project' %>
2
2
3 <div class="box tabular">
3 <div class="box tabular">
4 <!--[form:project]-->
4 <!--[form:project]-->
5 <p><%= f.text_field :name, :required => true, :size => 60 %></p>
5 <p><%= f.text_field :name, :required => true, :size => 60 %></p>
6
6
7 <p><%= f.text_area :description, :rows => 8, :class => 'wiki-edit' %></p>
7 <p><%= f.text_area :description, :rows => 8, :class => 'wiki-edit' %></p>
8 <p><%= f.text_field :identifier, :required => true, :size => 60, :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH %>
8 <p><%= f.text_field :identifier, :required => true, :size => 60, :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH %>
9 <% unless @project.identifier_frozen? %>
9 <% unless @project.identifier_frozen? %>
10 <em class="info"><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %></em>
10 <em class="info"><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %></em>
11 <% end %></p>
11 <% end %></p>
12 <p><%= f.text_field :homepage, :size => 60 %></p>
12 <p><%= f.text_field :homepage, :size => 60 %></p>
13 <p><%= f.check_box :is_public %></p>
13 <p><%= f.check_box :is_public %></p>
14
14
15 <% unless @project.allowed_parents.compact.empty? %>
15 <% unless @project.allowed_parents.compact.empty? %>
16 <p><%= label(:project, :parent_id, l(:field_parent)) %><%= parent_project_select_tag(@project) %></p>
16 <p><%= label(:project, :parent_id, l(:field_parent)) %><%= parent_project_select_tag(@project) %></p>
17 <% end %>
17 <% end %>
18
18
19 <% if @project.safe_attribute? 'inherit_members' %>
19 <% if @project.safe_attribute? 'inherit_members' %>
20 <p><%= f.check_box :inherit_members %></p>
20 <p><%= f.check_box :inherit_members %></p>
21 <% end %>
21 <% end %>
22
22
23 <% if @project.safe_attribute?('default_version_id') && (default_version_options = project_default_version_options(@project)).present? %>
24 <p><%= f.select :default_version_id, project_default_version_options(@project), :include_blank => true %></p>
25 <% end %>
26
23 <%= wikitoolbar_for 'project_description' %>
27 <%= wikitoolbar_for 'project_description' %>
24
28
25 <% @project.custom_field_values.each do |value| %>
29 <% @project.custom_field_values.each do |value| %>
26 <p><%= custom_field_tag_with_label :project, value %></p>
30 <p><%= custom_field_tag_with_label :project, value %></p>
27 <% end %>
31 <% end %>
28 <%= call_hook(:view_projects_form, :project => @project, :form => f) %>
32 <%= call_hook(:view_projects_form, :project => @project, :form => f) %>
29 </div>
33 </div>
30
34
31 <% if @project.new_record? %>
35 <% if @project.new_record? %>
32 <fieldset class="box tabular"><legend><%= l(:label_module_plural) %></legend>
36 <fieldset class="box tabular"><legend><%= l(:label_module_plural) %></legend>
33 <% Redmine::AccessControl.available_project_modules.each do |m| %>
37 <% Redmine::AccessControl.available_project_modules.each do |m| %>
34 <label class="floating">
38 <label class="floating">
35 <%= check_box_tag 'project[enabled_module_names][]', m, @project.module_enabled?(m), :id => "project_enabled_module_names_#{m}" %>
39 <%= check_box_tag 'project[enabled_module_names][]', m, @project.module_enabled?(m), :id => "project_enabled_module_names_#{m}" %>
36 <%= l_or_humanize(m, :prefix => "project_module_") %>
40 <%= l_or_humanize(m, :prefix => "project_module_") %>
37 </label>
41 </label>
38 <% end %>
42 <% end %>
39 <%= hidden_field_tag 'project[enabled_module_names][]', '' %>
43 <%= hidden_field_tag 'project[enabled_module_names][]', '' %>
40 </fieldset>
44 </fieldset>
41 <% end %>
45 <% end %>
42
46
43 <% if @project.new_record? || @project.module_enabled?('issue_tracking') %>
47 <% if @project.new_record? || @project.module_enabled?('issue_tracking') %>
44 <% unless @trackers.empty? %>
48 <% unless @trackers.empty? %>
45 <fieldset class="box tabular" id="project_trackers"><legend><%=l(:label_tracker_plural)%></legend>
49 <fieldset class="box tabular" id="project_trackers"><legend><%=l(:label_tracker_plural)%></legend>
46 <% @trackers.each do |tracker| %>
50 <% @trackers.each do |tracker| %>
47 <label class="floating">
51 <label class="floating">
48 <%= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.to_a.include?(tracker), :id => nil %>
52 <%= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.to_a.include?(tracker), :id => nil %>
49 <%= tracker %>
53 <%= tracker %>
50 </label>
54 </label>
51 <% end %>
55 <% end %>
52 <%= hidden_field_tag 'project[tracker_ids][]', '' %>
56 <%= hidden_field_tag 'project[tracker_ids][]', '' %>
53 </fieldset>
57 </fieldset>
54 <% end %>
58 <% end %>
55
59
56 <% unless @issue_custom_fields.empty? %>
60 <% unless @issue_custom_fields.empty? %>
57 <fieldset class="box tabular" id="project_issue_custom_fields"><legend><%=l(:label_custom_field_plural)%></legend>
61 <fieldset class="box tabular" id="project_issue_custom_fields"><legend><%=l(:label_custom_field_plural)%></legend>
58 <% @issue_custom_fields.each do |custom_field| %>
62 <% @issue_custom_fields.each do |custom_field| %>
59 <label class="floating">
63 <label class="floating">
60 <%= check_box_tag 'project[issue_custom_field_ids][]', custom_field.id, (@project.all_issue_custom_fields.include? custom_field),
64 <%= check_box_tag 'project[issue_custom_field_ids][]', custom_field.id, (@project.all_issue_custom_fields.include? custom_field),
61 :disabled => (custom_field.is_for_all? ? "disabled" : nil),
65 :disabled => (custom_field.is_for_all? ? "disabled" : nil),
62 :id => nil %>
66 :id => nil %>
63 <%= custom_field_name_tag(custom_field) %>
67 <%= custom_field_name_tag(custom_field) %>
64 </label>
68 </label>
65 <% end %>
69 <% end %>
66 <%= hidden_field_tag 'project[issue_custom_field_ids][]', '' %>
70 <%= hidden_field_tag 'project[issue_custom_field_ids][]', '' %>
67 </fieldset>
71 </fieldset>
68 <% end %>
72 <% end %>
69 <% end %>
73 <% end %>
70 <!--[eoform:project]-->
74 <!--[eoform:project]-->
71
75
72 <% unless @project.identifier_frozen? %>
76 <% unless @project.identifier_frozen? %>
73 <% content_for :header_tags do %>
77 <% content_for :header_tags do %>
74 <%= javascript_include_tag 'project_identifier' %>
78 <%= javascript_include_tag 'project_identifier' %>
75 <% end %>
79 <% end %>
76 <% end %>
80 <% end %>
77
81
78 <% if !User.current.admin? && @project.inherit_members? && @project.parent && User.current.member_of?(@project.parent) %>
82 <% if !User.current.admin? && @project.inherit_members? && @project.parent && User.current.member_of?(@project.parent) %>
79 <%= javascript_tag do %>
83 <%= javascript_tag do %>
80 $(document).ready(function() {
84 $(document).ready(function() {
81 $("#project_inherit_members").change(function(){
85 $("#project_inherit_members").change(function(){
82 if (!$(this).is(':checked')) {
86 if (!$(this).is(':checked')) {
83 if (!confirm("<%= escape_javascript(l(:text_own_membership_delete_confirmation)) %>")) {
87 if (!confirm("<%= escape_javascript(l(:text_own_membership_delete_confirmation)) %>")) {
84 $("#project_inherit_members").attr("checked", true);
88 $("#project_inherit_members").attr("checked", true);
85 }
89 }
86 }
90 }
87 });
91 });
88 });
92 });
89 <% end %>
93 <% end %>
90 <% end %>
94 <% end %>
91
95
92 <%= javascript_tag do %>
96 <%= javascript_tag do %>
93 $(document).ready(function() {
97 $(document).ready(function() {
94 $('#project_enabled_module_names_issue_tracking').on('change', function(){
98 $('#project_enabled_module_names_issue_tracking').on('change', function(){
95 if ($(this).prop('checked')){
99 if ($(this).prop('checked')){
96 $('#project_trackers, #project_issue_custom_fields').show();
100 $('#project_trackers, #project_issue_custom_fields').show();
97 } else {
101 } else {
98 $('#project_trackers, #project_issue_custom_fields').hide();
102 $('#project_trackers, #project_issue_custom_fields').hide();
99 }
103 }
100 }).trigger('change');
104 }).trigger('change');
101 });
105 });
102 <% end %>
106 <% end %>
@@ -1,1167 +1,1168
1 en:
1 en:
2 # Text direction: Left-to-Right (ltr) or Right-to-Left (rtl)
2 # Text direction: Left-to-Right (ltr) or Right-to-Left (rtl)
3 direction: ltr
3 direction: ltr
4 date:
4 date:
5 formats:
5 formats:
6 # Use the strftime parameters for formats.
6 # Use the strftime parameters for formats.
7 # When no format has been given, it uses default.
7 # When no format has been given, it uses default.
8 # You can provide other formats here if you like!
8 # You can provide other formats here if you like!
9 default: "%m/%d/%Y"
9 default: "%m/%d/%Y"
10 short: "%b %d"
10 short: "%b %d"
11 long: "%B %d, %Y"
11 long: "%B %d, %Y"
12
12
13 day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
13 day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
14 abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat]
14 abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat]
15
15
16 # Don't forget the nil at the beginning; there's no such thing as a 0th month
16 # Don't forget the nil at the beginning; there's no such thing as a 0th month
17 month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December]
17 month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December]
18 abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
18 abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
19 # Used in date_select and datime_select.
19 # Used in date_select and datime_select.
20 order:
20 order:
21 - :year
21 - :year
22 - :month
22 - :month
23 - :day
23 - :day
24
24
25 time:
25 time:
26 formats:
26 formats:
27 default: "%m/%d/%Y %I:%M %p"
27 default: "%m/%d/%Y %I:%M %p"
28 time: "%I:%M %p"
28 time: "%I:%M %p"
29 short: "%d %b %H:%M"
29 short: "%d %b %H:%M"
30 long: "%B %d, %Y %H:%M"
30 long: "%B %d, %Y %H:%M"
31 am: "am"
31 am: "am"
32 pm: "pm"
32 pm: "pm"
33
33
34 datetime:
34 datetime:
35 distance_in_words:
35 distance_in_words:
36 half_a_minute: "half a minute"
36 half_a_minute: "half a minute"
37 less_than_x_seconds:
37 less_than_x_seconds:
38 one: "less than 1 second"
38 one: "less than 1 second"
39 other: "less than %{count} seconds"
39 other: "less than %{count} seconds"
40 x_seconds:
40 x_seconds:
41 one: "1 second"
41 one: "1 second"
42 other: "%{count} seconds"
42 other: "%{count} seconds"
43 less_than_x_minutes:
43 less_than_x_minutes:
44 one: "less than a minute"
44 one: "less than a minute"
45 other: "less than %{count} minutes"
45 other: "less than %{count} minutes"
46 x_minutes:
46 x_minutes:
47 one: "1 minute"
47 one: "1 minute"
48 other: "%{count} minutes"
48 other: "%{count} minutes"
49 about_x_hours:
49 about_x_hours:
50 one: "about 1 hour"
50 one: "about 1 hour"
51 other: "about %{count} hours"
51 other: "about %{count} hours"
52 x_hours:
52 x_hours:
53 one: "1 hour"
53 one: "1 hour"
54 other: "%{count} hours"
54 other: "%{count} hours"
55 x_days:
55 x_days:
56 one: "1 day"
56 one: "1 day"
57 other: "%{count} days"
57 other: "%{count} days"
58 about_x_months:
58 about_x_months:
59 one: "about 1 month"
59 one: "about 1 month"
60 other: "about %{count} months"
60 other: "about %{count} months"
61 x_months:
61 x_months:
62 one: "1 month"
62 one: "1 month"
63 other: "%{count} months"
63 other: "%{count} months"
64 about_x_years:
64 about_x_years:
65 one: "about 1 year"
65 one: "about 1 year"
66 other: "about %{count} years"
66 other: "about %{count} years"
67 over_x_years:
67 over_x_years:
68 one: "over 1 year"
68 one: "over 1 year"
69 other: "over %{count} years"
69 other: "over %{count} years"
70 almost_x_years:
70 almost_x_years:
71 one: "almost 1 year"
71 one: "almost 1 year"
72 other: "almost %{count} years"
72 other: "almost %{count} years"
73
73
74 number:
74 number:
75 format:
75 format:
76 separator: "."
76 separator: "."
77 delimiter: ""
77 delimiter: ""
78 precision: 3
78 precision: 3
79
79
80 human:
80 human:
81 format:
81 format:
82 delimiter: ""
82 delimiter: ""
83 precision: 3
83 precision: 3
84 storage_units:
84 storage_units:
85 format: "%n %u"
85 format: "%n %u"
86 units:
86 units:
87 byte:
87 byte:
88 one: "Byte"
88 one: "Byte"
89 other: "Bytes"
89 other: "Bytes"
90 kb: "KB"
90 kb: "KB"
91 mb: "MB"
91 mb: "MB"
92 gb: "GB"
92 gb: "GB"
93 tb: "TB"
93 tb: "TB"
94
94
95 # Used in array.to_sentence.
95 # Used in array.to_sentence.
96 support:
96 support:
97 array:
97 array:
98 sentence_connector: "and"
98 sentence_connector: "and"
99 skip_last_comma: false
99 skip_last_comma: false
100
100
101 activerecord:
101 activerecord:
102 errors:
102 errors:
103 template:
103 template:
104 header:
104 header:
105 one: "1 error prohibited this %{model} from being saved"
105 one: "1 error prohibited this %{model} from being saved"
106 other: "%{count} errors prohibited this %{model} from being saved"
106 other: "%{count} errors prohibited this %{model} from being saved"
107 messages:
107 messages:
108 inclusion: "is not included in the list"
108 inclusion: "is not included in the list"
109 exclusion: "is reserved"
109 exclusion: "is reserved"
110 invalid: "is invalid"
110 invalid: "is invalid"
111 confirmation: "doesn't match confirmation"
111 confirmation: "doesn't match confirmation"
112 accepted: "must be accepted"
112 accepted: "must be accepted"
113 empty: "cannot be empty"
113 empty: "cannot be empty"
114 blank: "cannot be blank"
114 blank: "cannot be blank"
115 too_long: "is too long (maximum is %{count} characters)"
115 too_long: "is too long (maximum is %{count} characters)"
116 too_short: "is too short (minimum is %{count} characters)"
116 too_short: "is too short (minimum is %{count} characters)"
117 wrong_length: "is the wrong length (should be %{count} characters)"
117 wrong_length: "is the wrong length (should be %{count} characters)"
118 taken: "has already been taken"
118 taken: "has already been taken"
119 not_a_number: "is not a number"
119 not_a_number: "is not a number"
120 not_a_date: "is not a valid date"
120 not_a_date: "is not a valid date"
121 greater_than: "must be greater than %{count}"
121 greater_than: "must be greater than %{count}"
122 greater_than_or_equal_to: "must be greater than or equal to %{count}"
122 greater_than_or_equal_to: "must be greater than or equal to %{count}"
123 equal_to: "must be equal to %{count}"
123 equal_to: "must be equal to %{count}"
124 less_than: "must be less than %{count}"
124 less_than: "must be less than %{count}"
125 less_than_or_equal_to: "must be less than or equal to %{count}"
125 less_than_or_equal_to: "must be less than or equal to %{count}"
126 odd: "must be odd"
126 odd: "must be odd"
127 even: "must be even"
127 even: "must be even"
128 greater_than_start_date: "must be greater than start date"
128 greater_than_start_date: "must be greater than start date"
129 not_same_project: "doesn't belong to the same project"
129 not_same_project: "doesn't belong to the same project"
130 circular_dependency: "This relation would create a circular dependency"
130 circular_dependency: "This relation would create a circular dependency"
131 cant_link_an_issue_with_a_descendant: "An issue cannot be linked to one of its subtasks"
131 cant_link_an_issue_with_a_descendant: "An issue cannot be linked to one of its subtasks"
132 earlier_than_minimum_start_date: "cannot be earlier than %{date} because of preceding issues"
132 earlier_than_minimum_start_date: "cannot be earlier than %{date} because of preceding issues"
133
133
134 actionview_instancetag_blank_option: Please select
134 actionview_instancetag_blank_option: Please select
135
135
136 general_text_No: 'No'
136 general_text_No: 'No'
137 general_text_Yes: 'Yes'
137 general_text_Yes: 'Yes'
138 general_text_no: 'no'
138 general_text_no: 'no'
139 general_text_yes: 'yes'
139 general_text_yes: 'yes'
140 general_lang_name: 'English'
140 general_lang_name: 'English'
141 general_csv_separator: ','
141 general_csv_separator: ','
142 general_csv_decimal_separator: '.'
142 general_csv_decimal_separator: '.'
143 general_csv_encoding: ISO-8859-1
143 general_csv_encoding: ISO-8859-1
144 general_pdf_fontname: freesans
144 general_pdf_fontname: freesans
145 general_first_day_of_week: '7'
145 general_first_day_of_week: '7'
146
146
147 notice_account_updated: Account was successfully updated.
147 notice_account_updated: Account was successfully updated.
148 notice_account_invalid_creditentials: Invalid user or password
148 notice_account_invalid_creditentials: Invalid user or password
149 notice_account_password_updated: Password was successfully updated.
149 notice_account_password_updated: Password was successfully updated.
150 notice_account_wrong_password: Wrong password
150 notice_account_wrong_password: Wrong password
151 notice_account_register_done: Account was successfully created. An email containing the instructions to activate your account was sent to %{email}.
151 notice_account_register_done: Account was successfully created. An email containing the instructions to activate your account was sent to %{email}.
152 notice_account_unknown_email: Unknown user.
152 notice_account_unknown_email: Unknown user.
153 notice_account_not_activated_yet: You haven't activated your account yet. If you want to receive a new activation email, please <a href="%{url}">click this link</a>.
153 notice_account_not_activated_yet: You haven't activated your account yet. If you want to receive a new activation email, please <a href="%{url}">click this link</a>.
154 notice_account_locked: Your account is locked.
154 notice_account_locked: Your account is locked.
155 notice_can_t_change_password: This account uses an external authentication source. Impossible to change the password.
155 notice_can_t_change_password: This account uses an external authentication source. Impossible to change the password.
156 notice_account_lost_email_sent: An email with instructions to choose a new password has been sent to you.
156 notice_account_lost_email_sent: An email with instructions to choose a new password has been sent to you.
157 notice_account_activated: Your account has been activated. You can now log in.
157 notice_account_activated: Your account has been activated. You can now log in.
158 notice_successful_create: Successful creation.
158 notice_successful_create: Successful creation.
159 notice_successful_update: Successful update.
159 notice_successful_update: Successful update.
160 notice_successful_delete: Successful deletion.
160 notice_successful_delete: Successful deletion.
161 notice_successful_connection: Successful connection.
161 notice_successful_connection: Successful connection.
162 notice_file_not_found: The page you were trying to access doesn't exist or has been removed.
162 notice_file_not_found: The page you were trying to access doesn't exist or has been removed.
163 notice_locking_conflict: Data has been updated by another user.
163 notice_locking_conflict: Data has been updated by another user.
164 notice_not_authorized: You are not authorized to access this page.
164 notice_not_authorized: You are not authorized to access this page.
165 notice_not_authorized_archived_project: The project you're trying to access has been archived.
165 notice_not_authorized_archived_project: The project you're trying to access has been archived.
166 notice_email_sent: "An email was sent to %{value}"
166 notice_email_sent: "An email was sent to %{value}"
167 notice_email_error: "An error occurred while sending mail (%{value})"
167 notice_email_error: "An error occurred while sending mail (%{value})"
168 notice_feeds_access_key_reseted: Your Atom access key was reset.
168 notice_feeds_access_key_reseted: Your Atom access key was reset.
169 notice_api_access_key_reseted: Your API access key was reset.
169 notice_api_access_key_reseted: Your API access key was reset.
170 notice_failed_to_save_issues: "Failed to save %{count} issue(s) on %{total} selected: %{ids}."
170 notice_failed_to_save_issues: "Failed to save %{count} issue(s) on %{total} selected: %{ids}."
171 notice_failed_to_save_time_entries: "Failed to save %{count} time entrie(s) on %{total} selected: %{ids}."
171 notice_failed_to_save_time_entries: "Failed to save %{count} time entrie(s) on %{total} selected: %{ids}."
172 notice_failed_to_save_members: "Failed to save member(s): %{errors}."
172 notice_failed_to_save_members: "Failed to save member(s): %{errors}."
173 notice_no_issue_selected: "No issue is selected! Please, check the issues you want to edit."
173 notice_no_issue_selected: "No issue is selected! Please, check the issues you want to edit."
174 notice_account_pending: "Your account was created and is now pending administrator approval."
174 notice_account_pending: "Your account was created and is now pending administrator approval."
175 notice_default_data_loaded: Default configuration successfully loaded.
175 notice_default_data_loaded: Default configuration successfully loaded.
176 notice_unable_delete_version: Unable to delete version.
176 notice_unable_delete_version: Unable to delete version.
177 notice_unable_delete_time_entry: Unable to delete time log entry.
177 notice_unable_delete_time_entry: Unable to delete time log entry.
178 notice_issue_done_ratios_updated: Issue done ratios updated.
178 notice_issue_done_ratios_updated: Issue done ratios updated.
179 notice_gantt_chart_truncated: "The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})"
179 notice_gantt_chart_truncated: "The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})"
180 notice_issue_successful_create: "Issue %{id} created."
180 notice_issue_successful_create: "Issue %{id} created."
181 notice_issue_update_conflict: "The issue has been updated by an other user while you were editing it."
181 notice_issue_update_conflict: "The issue has been updated by an other user while you were editing it."
182 notice_account_deleted: "Your account has been permanently deleted."
182 notice_account_deleted: "Your account has been permanently deleted."
183 notice_user_successful_create: "User %{id} created."
183 notice_user_successful_create: "User %{id} created."
184 notice_new_password_must_be_different: The new password must be different from the current password
184 notice_new_password_must_be_different: The new password must be different from the current password
185 notice_import_finished: "All %{count} items have been imported."
185 notice_import_finished: "All %{count} items have been imported."
186 notice_import_finished_with_errors: "%{count} out of %{total} items could not be imported."
186 notice_import_finished_with_errors: "%{count} out of %{total} items could not be imported."
187
187
188 error_can_t_load_default_data: "Default configuration could not be loaded: %{value}"
188 error_can_t_load_default_data: "Default configuration could not be loaded: %{value}"
189 error_scm_not_found: "The entry or revision was not found in the repository."
189 error_scm_not_found: "The entry or revision was not found in the repository."
190 error_scm_command_failed: "An error occurred when trying to access the repository: %{value}"
190 error_scm_command_failed: "An error occurred when trying to access the repository: %{value}"
191 error_scm_annotate: "The entry does not exist or cannot be annotated."
191 error_scm_annotate: "The entry does not exist or cannot be annotated."
192 error_scm_annotate_big_text_file: "The entry cannot be annotated, as it exceeds the maximum text file size."
192 error_scm_annotate_big_text_file: "The entry cannot be annotated, as it exceeds the maximum text file size."
193 error_issue_not_found_in_project: 'The issue was not found or does not belong to this project'
193 error_issue_not_found_in_project: 'The issue was not found or does not belong to this project'
194 error_no_tracker_in_project: 'No tracker is associated to this project. Please check the Project settings.'
194 error_no_tracker_in_project: 'No tracker is associated to this project. Please check the Project settings.'
195 error_no_default_issue_status: 'No default issue status is defined. Please check your configuration (Go to "Administration -> Issue statuses").'
195 error_no_default_issue_status: 'No default issue status is defined. Please check your configuration (Go to "Administration -> Issue statuses").'
196 error_can_not_delete_custom_field: Unable to delete custom field
196 error_can_not_delete_custom_field: Unable to delete custom field
197 error_can_not_delete_tracker: "This tracker contains issues and cannot be deleted."
197 error_can_not_delete_tracker: "This tracker contains issues and cannot be deleted."
198 error_can_not_remove_role: "This role is in use and cannot be deleted."
198 error_can_not_remove_role: "This role is in use and cannot be deleted."
199 error_can_not_reopen_issue_on_closed_version: 'An issue assigned to a closed version cannot be reopened'
199 error_can_not_reopen_issue_on_closed_version: 'An issue assigned to a closed version cannot be reopened'
200 error_can_not_archive_project: This project cannot be archived
200 error_can_not_archive_project: This project cannot be archived
201 error_issue_done_ratios_not_updated: "Issue done ratios not updated."
201 error_issue_done_ratios_not_updated: "Issue done ratios not updated."
202 error_workflow_copy_source: 'Please select a source tracker or role'
202 error_workflow_copy_source: 'Please select a source tracker or role'
203 error_workflow_copy_target: 'Please select target tracker(s) and role(s)'
203 error_workflow_copy_target: 'Please select target tracker(s) and role(s)'
204 error_unable_delete_issue_status: 'Unable to delete issue status'
204 error_unable_delete_issue_status: 'Unable to delete issue status'
205 error_unable_to_connect: "Unable to connect (%{value})"
205 error_unable_to_connect: "Unable to connect (%{value})"
206 error_attachment_too_big: "This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})"
206 error_attachment_too_big: "This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})"
207 error_session_expired: "Your session has expired. Please login again."
207 error_session_expired: "Your session has expired. Please login again."
208 warning_attachments_not_saved: "%{count} file(s) could not be saved."
208 warning_attachments_not_saved: "%{count} file(s) could not be saved."
209 error_password_expired: "Your password has expired or the administrator requires you to change it."
209 error_password_expired: "Your password has expired or the administrator requires you to change it."
210 error_invalid_file_encoding: "The file is not a valid %{encoding} encoded file"
210 error_invalid_file_encoding: "The file is not a valid %{encoding} encoded file"
211 error_invalid_csv_file_or_settings: "The file is not a CSV file or does not match the settings below"
211 error_invalid_csv_file_or_settings: "The file is not a CSV file or does not match the settings below"
212 error_can_not_read_import_file: "An error occurred while reading the file to import"
212 error_can_not_read_import_file: "An error occurred while reading the file to import"
213
213
214 mail_subject_lost_password: "Your %{value} password"
214 mail_subject_lost_password: "Your %{value} password"
215 mail_body_lost_password: 'To change your password, click on the following link:'
215 mail_body_lost_password: 'To change your password, click on the following link:'
216 mail_subject_register: "Your %{value} account activation"
216 mail_subject_register: "Your %{value} account activation"
217 mail_body_register: 'To activate your account, click on the following link:'
217 mail_body_register: 'To activate your account, click on the following link:'
218 mail_body_account_information_external: "You can use your %{value} account to log in."
218 mail_body_account_information_external: "You can use your %{value} account to log in."
219 mail_body_account_information: Your account information
219 mail_body_account_information: Your account information
220 mail_subject_account_activation_request: "%{value} account activation request"
220 mail_subject_account_activation_request: "%{value} account activation request"
221 mail_body_account_activation_request: "A new user (%{value}) has registered. The account is pending your approval:"
221 mail_body_account_activation_request: "A new user (%{value}) has registered. The account is pending your approval:"
222 mail_subject_reminder: "%{count} issue(s) due in the next %{days} days"
222 mail_subject_reminder: "%{count} issue(s) due in the next %{days} days"
223 mail_body_reminder: "%{count} issue(s) that are assigned to you are due in the next %{days} days:"
223 mail_body_reminder: "%{count} issue(s) that are assigned to you are due in the next %{days} days:"
224 mail_subject_wiki_content_added: "'%{id}' wiki page has been added"
224 mail_subject_wiki_content_added: "'%{id}' wiki page has been added"
225 mail_body_wiki_content_added: "The '%{id}' wiki page has been added by %{author}."
225 mail_body_wiki_content_added: "The '%{id}' wiki page has been added by %{author}."
226 mail_subject_wiki_content_updated: "'%{id}' wiki page has been updated"
226 mail_subject_wiki_content_updated: "'%{id}' wiki page has been updated"
227 mail_body_wiki_content_updated: "The '%{id}' wiki page has been updated by %{author}."
227 mail_body_wiki_content_updated: "The '%{id}' wiki page has been updated by %{author}."
228
228
229 field_name: Name
229 field_name: Name
230 field_description: Description
230 field_description: Description
231 field_summary: Summary
231 field_summary: Summary
232 field_is_required: Required
232 field_is_required: Required
233 field_firstname: First name
233 field_firstname: First name
234 field_lastname: Last name
234 field_lastname: Last name
235 field_mail: Email
235 field_mail: Email
236 field_address: Email
236 field_address: Email
237 field_filename: File
237 field_filename: File
238 field_filesize: Size
238 field_filesize: Size
239 field_downloads: Downloads
239 field_downloads: Downloads
240 field_author: Author
240 field_author: Author
241 field_created_on: Created
241 field_created_on: Created
242 field_updated_on: Updated
242 field_updated_on: Updated
243 field_closed_on: Closed
243 field_closed_on: Closed
244 field_field_format: Format
244 field_field_format: Format
245 field_is_for_all: For all projects
245 field_is_for_all: For all projects
246 field_possible_values: Possible values
246 field_possible_values: Possible values
247 field_regexp: Regular expression
247 field_regexp: Regular expression
248 field_min_length: Minimum length
248 field_min_length: Minimum length
249 field_max_length: Maximum length
249 field_max_length: Maximum length
250 field_value: Value
250 field_value: Value
251 field_category: Category
251 field_category: Category
252 field_title: Title
252 field_title: Title
253 field_project: Project
253 field_project: Project
254 field_issue: Issue
254 field_issue: Issue
255 field_status: Status
255 field_status: Status
256 field_notes: Notes
256 field_notes: Notes
257 field_is_closed: Issue closed
257 field_is_closed: Issue closed
258 field_is_default: Default value
258 field_is_default: Default value
259 field_tracker: Tracker
259 field_tracker: Tracker
260 field_subject: Subject
260 field_subject: Subject
261 field_due_date: Due date
261 field_due_date: Due date
262 field_assigned_to: Assignee
262 field_assigned_to: Assignee
263 field_priority: Priority
263 field_priority: Priority
264 field_fixed_version: Target version
264 field_fixed_version: Target version
265 field_user: User
265 field_user: User
266 field_principal: Principal
266 field_principal: Principal
267 field_role: Role
267 field_role: Role
268 field_homepage: Homepage
268 field_homepage: Homepage
269 field_is_public: Public
269 field_is_public: Public
270 field_parent: Subproject of
270 field_parent: Subproject of
271 field_is_in_roadmap: Issues displayed in roadmap
271 field_is_in_roadmap: Issues displayed in roadmap
272 field_login: Login
272 field_login: Login
273 field_mail_notification: Email notifications
273 field_mail_notification: Email notifications
274 field_admin: Administrator
274 field_admin: Administrator
275 field_last_login_on: Last connection
275 field_last_login_on: Last connection
276 field_language: Language
276 field_language: Language
277 field_effective_date: Date
277 field_effective_date: Date
278 field_password: Password
278 field_password: Password
279 field_new_password: New password
279 field_new_password: New password
280 field_password_confirmation: Confirmation
280 field_password_confirmation: Confirmation
281 field_version: Version
281 field_version: Version
282 field_type: Type
282 field_type: Type
283 field_host: Host
283 field_host: Host
284 field_port: Port
284 field_port: Port
285 field_account: Account
285 field_account: Account
286 field_base_dn: Base DN
286 field_base_dn: Base DN
287 field_attr_login: Login attribute
287 field_attr_login: Login attribute
288 field_attr_firstname: Firstname attribute
288 field_attr_firstname: Firstname attribute
289 field_attr_lastname: Lastname attribute
289 field_attr_lastname: Lastname attribute
290 field_attr_mail: Email attribute
290 field_attr_mail: Email attribute
291 field_onthefly: On-the-fly user creation
291 field_onthefly: On-the-fly user creation
292 field_start_date: Start date
292 field_start_date: Start date
293 field_done_ratio: "% Done"
293 field_done_ratio: "% Done"
294 field_auth_source: Authentication mode
294 field_auth_source: Authentication mode
295 field_hide_mail: Hide my email address
295 field_hide_mail: Hide my email address
296 field_comments: Comment
296 field_comments: Comment
297 field_url: URL
297 field_url: URL
298 field_start_page: Start page
298 field_start_page: Start page
299 field_subproject: Subproject
299 field_subproject: Subproject
300 field_hours: Hours
300 field_hours: Hours
301 field_activity: Activity
301 field_activity: Activity
302 field_spent_on: Date
302 field_spent_on: Date
303 field_identifier: Identifier
303 field_identifier: Identifier
304 field_is_filter: Used as a filter
304 field_is_filter: Used as a filter
305 field_issue_to: Related issue
305 field_issue_to: Related issue
306 field_delay: Delay
306 field_delay: Delay
307 field_assignable: Issues can be assigned to this role
307 field_assignable: Issues can be assigned to this role
308 field_redirect_existing_links: Redirect existing links
308 field_redirect_existing_links: Redirect existing links
309 field_estimated_hours: Estimated time
309 field_estimated_hours: Estimated time
310 field_column_names: Columns
310 field_column_names: Columns
311 field_time_entries: Log time
311 field_time_entries: Log time
312 field_time_zone: Time zone
312 field_time_zone: Time zone
313 field_searchable: Searchable
313 field_searchable: Searchable
314 field_default_value: Default value
314 field_default_value: Default value
315 field_comments_sorting: Display comments
315 field_comments_sorting: Display comments
316 field_parent_title: Parent page
316 field_parent_title: Parent page
317 field_editable: Editable
317 field_editable: Editable
318 field_watcher: Watcher
318 field_watcher: Watcher
319 field_identity_url: OpenID URL
319 field_identity_url: OpenID URL
320 field_content: Content
320 field_content: Content
321 field_group_by: Group results by
321 field_group_by: Group results by
322 field_sharing: Sharing
322 field_sharing: Sharing
323 field_parent_issue: Parent task
323 field_parent_issue: Parent task
324 field_member_of_group: "Assignee's group"
324 field_member_of_group: "Assignee's group"
325 field_assigned_to_role: "Assignee's role"
325 field_assigned_to_role: "Assignee's role"
326 field_text: Text field
326 field_text: Text field
327 field_visible: Visible
327 field_visible: Visible
328 field_warn_on_leaving_unsaved: "Warn me when leaving a page with unsaved text"
328 field_warn_on_leaving_unsaved: "Warn me when leaving a page with unsaved text"
329 field_issues_visibility: Issues visibility
329 field_issues_visibility: Issues visibility
330 field_is_private: Private
330 field_is_private: Private
331 field_commit_logs_encoding: Commit messages encoding
331 field_commit_logs_encoding: Commit messages encoding
332 field_scm_path_encoding: Path encoding
332 field_scm_path_encoding: Path encoding
333 field_path_to_repository: Path to repository
333 field_path_to_repository: Path to repository
334 field_root_directory: Root directory
334 field_root_directory: Root directory
335 field_cvsroot: CVSROOT
335 field_cvsroot: CVSROOT
336 field_cvs_module: Module
336 field_cvs_module: Module
337 field_repository_is_default: Main repository
337 field_repository_is_default: Main repository
338 field_multiple: Multiple values
338 field_multiple: Multiple values
339 field_auth_source_ldap_filter: LDAP filter
339 field_auth_source_ldap_filter: LDAP filter
340 field_core_fields: Standard fields
340 field_core_fields: Standard fields
341 field_timeout: "Timeout (in seconds)"
341 field_timeout: "Timeout (in seconds)"
342 field_board_parent: Parent forum
342 field_board_parent: Parent forum
343 field_private_notes: Private notes
343 field_private_notes: Private notes
344 field_inherit_members: Inherit members
344 field_inherit_members: Inherit members
345 field_generate_password: Generate password
345 field_generate_password: Generate password
346 field_must_change_passwd: Must change password at next logon
346 field_must_change_passwd: Must change password at next logon
347 field_default_status: Default status
347 field_default_status: Default status
348 field_users_visibility: Users visibility
348 field_users_visibility: Users visibility
349 field_time_entries_visibility: Time logs visibility
349 field_time_entries_visibility: Time logs visibility
350 field_total_estimated_hours: Total estimated time
350 field_total_estimated_hours: Total estimated time
351 field_default_version: Default version
351
352
352 setting_app_title: Application title
353 setting_app_title: Application title
353 setting_app_subtitle: Application subtitle
354 setting_app_subtitle: Application subtitle
354 setting_welcome_text: Welcome text
355 setting_welcome_text: Welcome text
355 setting_default_language: Default language
356 setting_default_language: Default language
356 setting_login_required: Authentication required
357 setting_login_required: Authentication required
357 setting_self_registration: Self-registration
358 setting_self_registration: Self-registration
358 setting_attachment_max_size: Maximum attachment size
359 setting_attachment_max_size: Maximum attachment size
359 setting_issues_export_limit: Issues export limit
360 setting_issues_export_limit: Issues export limit
360 setting_mail_from: Emission email address
361 setting_mail_from: Emission email address
361 setting_bcc_recipients: Blind carbon copy recipients (bcc)
362 setting_bcc_recipients: Blind carbon copy recipients (bcc)
362 setting_plain_text_mail: Plain text mail (no HTML)
363 setting_plain_text_mail: Plain text mail (no HTML)
363 setting_host_name: Host name and path
364 setting_host_name: Host name and path
364 setting_text_formatting: Text formatting
365 setting_text_formatting: Text formatting
365 setting_wiki_compression: Wiki history compression
366 setting_wiki_compression: Wiki history compression
366 setting_feeds_limit: Maximum number of items in Atom feeds
367 setting_feeds_limit: Maximum number of items in Atom feeds
367 setting_default_projects_public: New projects are public by default
368 setting_default_projects_public: New projects are public by default
368 setting_autofetch_changesets: Fetch commits automatically
369 setting_autofetch_changesets: Fetch commits automatically
369 setting_sys_api_enabled: Enable WS for repository management
370 setting_sys_api_enabled: Enable WS for repository management
370 setting_commit_ref_keywords: Referencing keywords
371 setting_commit_ref_keywords: Referencing keywords
371 setting_commit_fix_keywords: Fixing keywords
372 setting_commit_fix_keywords: Fixing keywords
372 setting_autologin: Autologin
373 setting_autologin: Autologin
373 setting_date_format: Date format
374 setting_date_format: Date format
374 setting_time_format: Time format
375 setting_time_format: Time format
375 setting_cross_project_issue_relations: Allow cross-project issue relations
376 setting_cross_project_issue_relations: Allow cross-project issue relations
376 setting_cross_project_subtasks: Allow cross-project subtasks
377 setting_cross_project_subtasks: Allow cross-project subtasks
377 setting_issue_list_default_columns: Default columns displayed on the issue list
378 setting_issue_list_default_columns: Default columns displayed on the issue list
378 setting_repositories_encodings: Attachments and repositories encodings
379 setting_repositories_encodings: Attachments and repositories encodings
379 setting_emails_header: Email header
380 setting_emails_header: Email header
380 setting_emails_footer: Email footer
381 setting_emails_footer: Email footer
381 setting_protocol: Protocol
382 setting_protocol: Protocol
382 setting_per_page_options: Objects per page options
383 setting_per_page_options: Objects per page options
383 setting_user_format: Users display format
384 setting_user_format: Users display format
384 setting_activity_days_default: Days displayed on project activity
385 setting_activity_days_default: Days displayed on project activity
385 setting_display_subprojects_issues: Display subprojects issues on main projects by default
386 setting_display_subprojects_issues: Display subprojects issues on main projects by default
386 setting_enabled_scm: Enabled SCM
387 setting_enabled_scm: Enabled SCM
387 setting_mail_handler_body_delimiters: "Truncate emails after one of these lines"
388 setting_mail_handler_body_delimiters: "Truncate emails after one of these lines"
388 setting_mail_handler_api_enabled: Enable WS for incoming emails
389 setting_mail_handler_api_enabled: Enable WS for incoming emails
389 setting_mail_handler_api_key: API key
390 setting_mail_handler_api_key: API key
390 setting_sequential_project_identifiers: Generate sequential project identifiers
391 setting_sequential_project_identifiers: Generate sequential project identifiers
391 setting_gravatar_enabled: Use Gravatar user icons
392 setting_gravatar_enabled: Use Gravatar user icons
392 setting_gravatar_default: Default Gravatar image
393 setting_gravatar_default: Default Gravatar image
393 setting_diff_max_lines_displayed: Maximum number of diff lines displayed
394 setting_diff_max_lines_displayed: Maximum number of diff lines displayed
394 setting_file_max_size_displayed: Maximum size of text files displayed inline
395 setting_file_max_size_displayed: Maximum size of text files displayed inline
395 setting_repository_log_display_limit: Maximum number of revisions displayed on file log
396 setting_repository_log_display_limit: Maximum number of revisions displayed on file log
396 setting_openid: Allow OpenID login and registration
397 setting_openid: Allow OpenID login and registration
397 setting_password_max_age: Require password change after
398 setting_password_max_age: Require password change after
398 setting_password_min_length: Minimum password length
399 setting_password_min_length: Minimum password length
399 setting_new_project_user_role_id: Role given to a non-admin user who creates a project
400 setting_new_project_user_role_id: Role given to a non-admin user who creates a project
400 setting_default_projects_modules: Default enabled modules for new projects
401 setting_default_projects_modules: Default enabled modules for new projects
401 setting_issue_done_ratio: Calculate the issue done ratio with
402 setting_issue_done_ratio: Calculate the issue done ratio with
402 setting_issue_done_ratio_issue_field: Use the issue field
403 setting_issue_done_ratio_issue_field: Use the issue field
403 setting_issue_done_ratio_issue_status: Use the issue status
404 setting_issue_done_ratio_issue_status: Use the issue status
404 setting_start_of_week: Start calendars on
405 setting_start_of_week: Start calendars on
405 setting_rest_api_enabled: Enable REST web service
406 setting_rest_api_enabled: Enable REST web service
406 setting_cache_formatted_text: Cache formatted text
407 setting_cache_formatted_text: Cache formatted text
407 setting_default_notification_option: Default notification option
408 setting_default_notification_option: Default notification option
408 setting_commit_logtime_enabled: Enable time logging
409 setting_commit_logtime_enabled: Enable time logging
409 setting_commit_logtime_activity_id: Activity for logged time
410 setting_commit_logtime_activity_id: Activity for logged time
410 setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
411 setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
411 setting_issue_group_assignment: Allow issue assignment to groups
412 setting_issue_group_assignment: Allow issue assignment to groups
412 setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
413 setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
413 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
414 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
414 setting_unsubscribe: Allow users to delete their own account
415 setting_unsubscribe: Allow users to delete their own account
415 setting_session_lifetime: Session maximum lifetime
416 setting_session_lifetime: Session maximum lifetime
416 setting_session_timeout: Session inactivity timeout
417 setting_session_timeout: Session inactivity timeout
417 setting_thumbnails_enabled: Display attachment thumbnails
418 setting_thumbnails_enabled: Display attachment thumbnails
418 setting_thumbnails_size: Thumbnails size (in pixels)
419 setting_thumbnails_size: Thumbnails size (in pixels)
419 setting_non_working_week_days: Non-working days
420 setting_non_working_week_days: Non-working days
420 setting_jsonp_enabled: Enable JSONP support
421 setting_jsonp_enabled: Enable JSONP support
421 setting_default_projects_tracker_ids: Default trackers for new projects
422 setting_default_projects_tracker_ids: Default trackers for new projects
422 setting_mail_handler_excluded_filenames: Exclude attachments by name
423 setting_mail_handler_excluded_filenames: Exclude attachments by name
423 setting_force_default_language_for_anonymous: Force default language for anonymous users
424 setting_force_default_language_for_anonymous: Force default language for anonymous users
424 setting_force_default_language_for_loggedin: Force default language for logged-in users
425 setting_force_default_language_for_loggedin: Force default language for logged-in users
425 setting_link_copied_issue: Link issues on copy
426 setting_link_copied_issue: Link issues on copy
426 setting_max_additional_emails: Maximum number of additional email addresses
427 setting_max_additional_emails: Maximum number of additional email addresses
427 setting_search_results_per_page: Search results per page
428 setting_search_results_per_page: Search results per page
428
429
429 permission_add_project: Create project
430 permission_add_project: Create project
430 permission_add_subprojects: Create subprojects
431 permission_add_subprojects: Create subprojects
431 permission_edit_project: Edit project
432 permission_edit_project: Edit project
432 permission_close_project: Close / reopen the project
433 permission_close_project: Close / reopen the project
433 permission_select_project_modules: Select project modules
434 permission_select_project_modules: Select project modules
434 permission_manage_members: Manage members
435 permission_manage_members: Manage members
435 permission_manage_project_activities: Manage project activities
436 permission_manage_project_activities: Manage project activities
436 permission_manage_versions: Manage versions
437 permission_manage_versions: Manage versions
437 permission_manage_categories: Manage issue categories
438 permission_manage_categories: Manage issue categories
438 permission_view_issues: View Issues
439 permission_view_issues: View Issues
439 permission_add_issues: Add issues
440 permission_add_issues: Add issues
440 permission_edit_issues: Edit issues
441 permission_edit_issues: Edit issues
441 permission_copy_issues: Copy issues
442 permission_copy_issues: Copy issues
442 permission_manage_issue_relations: Manage issue relations
443 permission_manage_issue_relations: Manage issue relations
443 permission_set_issues_private: Set issues public or private
444 permission_set_issues_private: Set issues public or private
444 permission_set_own_issues_private: Set own issues public or private
445 permission_set_own_issues_private: Set own issues public or private
445 permission_add_issue_notes: Add notes
446 permission_add_issue_notes: Add notes
446 permission_edit_issue_notes: Edit notes
447 permission_edit_issue_notes: Edit notes
447 permission_edit_own_issue_notes: Edit own notes
448 permission_edit_own_issue_notes: Edit own notes
448 permission_view_private_notes: View private notes
449 permission_view_private_notes: View private notes
449 permission_set_notes_private: Set notes as private
450 permission_set_notes_private: Set notes as private
450 permission_move_issues: Move issues
451 permission_move_issues: Move issues
451 permission_delete_issues: Delete issues
452 permission_delete_issues: Delete issues
452 permission_manage_public_queries: Manage public queries
453 permission_manage_public_queries: Manage public queries
453 permission_save_queries: Save queries
454 permission_save_queries: Save queries
454 permission_view_gantt: View gantt chart
455 permission_view_gantt: View gantt chart
455 permission_view_calendar: View calendar
456 permission_view_calendar: View calendar
456 permission_view_issue_watchers: View watchers list
457 permission_view_issue_watchers: View watchers list
457 permission_add_issue_watchers: Add watchers
458 permission_add_issue_watchers: Add watchers
458 permission_delete_issue_watchers: Delete watchers
459 permission_delete_issue_watchers: Delete watchers
459 permission_log_time: Log spent time
460 permission_log_time: Log spent time
460 permission_view_time_entries: View spent time
461 permission_view_time_entries: View spent time
461 permission_edit_time_entries: Edit time logs
462 permission_edit_time_entries: Edit time logs
462 permission_edit_own_time_entries: Edit own time logs
463 permission_edit_own_time_entries: Edit own time logs
463 permission_manage_news: Manage news
464 permission_manage_news: Manage news
464 permission_comment_news: Comment news
465 permission_comment_news: Comment news
465 permission_view_documents: View documents
466 permission_view_documents: View documents
466 permission_add_documents: Add documents
467 permission_add_documents: Add documents
467 permission_edit_documents: Edit documents
468 permission_edit_documents: Edit documents
468 permission_delete_documents: Delete documents
469 permission_delete_documents: Delete documents
469 permission_manage_files: Manage files
470 permission_manage_files: Manage files
470 permission_view_files: View files
471 permission_view_files: View files
471 permission_manage_wiki: Manage wiki
472 permission_manage_wiki: Manage wiki
472 permission_rename_wiki_pages: Rename wiki pages
473 permission_rename_wiki_pages: Rename wiki pages
473 permission_delete_wiki_pages: Delete wiki pages
474 permission_delete_wiki_pages: Delete wiki pages
474 permission_view_wiki_pages: View wiki
475 permission_view_wiki_pages: View wiki
475 permission_view_wiki_edits: View wiki history
476 permission_view_wiki_edits: View wiki history
476 permission_edit_wiki_pages: Edit wiki pages
477 permission_edit_wiki_pages: Edit wiki pages
477 permission_delete_wiki_pages_attachments: Delete attachments
478 permission_delete_wiki_pages_attachments: Delete attachments
478 permission_protect_wiki_pages: Protect wiki pages
479 permission_protect_wiki_pages: Protect wiki pages
479 permission_manage_repository: Manage repository
480 permission_manage_repository: Manage repository
480 permission_browse_repository: Browse repository
481 permission_browse_repository: Browse repository
481 permission_view_changesets: View changesets
482 permission_view_changesets: View changesets
482 permission_commit_access: Commit access
483 permission_commit_access: Commit access
483 permission_manage_boards: Manage forums
484 permission_manage_boards: Manage forums
484 permission_view_messages: View messages
485 permission_view_messages: View messages
485 permission_add_messages: Post messages
486 permission_add_messages: Post messages
486 permission_edit_messages: Edit messages
487 permission_edit_messages: Edit messages
487 permission_edit_own_messages: Edit own messages
488 permission_edit_own_messages: Edit own messages
488 permission_delete_messages: Delete messages
489 permission_delete_messages: Delete messages
489 permission_delete_own_messages: Delete own messages
490 permission_delete_own_messages: Delete own messages
490 permission_export_wiki_pages: Export wiki pages
491 permission_export_wiki_pages: Export wiki pages
491 permission_manage_subtasks: Manage subtasks
492 permission_manage_subtasks: Manage subtasks
492 permission_manage_related_issues: Manage related issues
493 permission_manage_related_issues: Manage related issues
493 permission_import_issues: Import issues
494 permission_import_issues: Import issues
494
495
495 project_module_issue_tracking: Issue tracking
496 project_module_issue_tracking: Issue tracking
496 project_module_time_tracking: Time tracking
497 project_module_time_tracking: Time tracking
497 project_module_news: News
498 project_module_news: News
498 project_module_documents: Documents
499 project_module_documents: Documents
499 project_module_files: Files
500 project_module_files: Files
500 project_module_wiki: Wiki
501 project_module_wiki: Wiki
501 project_module_repository: Repository
502 project_module_repository: Repository
502 project_module_boards: Forums
503 project_module_boards: Forums
503 project_module_calendar: Calendar
504 project_module_calendar: Calendar
504 project_module_gantt: Gantt
505 project_module_gantt: Gantt
505
506
506 label_user: User
507 label_user: User
507 label_user_plural: Users
508 label_user_plural: Users
508 label_user_new: New user
509 label_user_new: New user
509 label_user_anonymous: Anonymous
510 label_user_anonymous: Anonymous
510 label_project: Project
511 label_project: Project
511 label_project_new: New project
512 label_project_new: New project
512 label_project_plural: Projects
513 label_project_plural: Projects
513 label_x_projects:
514 label_x_projects:
514 zero: no projects
515 zero: no projects
515 one: 1 project
516 one: 1 project
516 other: "%{count} projects"
517 other: "%{count} projects"
517 label_project_all: All Projects
518 label_project_all: All Projects
518 label_project_latest: Latest projects
519 label_project_latest: Latest projects
519 label_issue: Issue
520 label_issue: Issue
520 label_issue_new: New issue
521 label_issue_new: New issue
521 label_issue_plural: Issues
522 label_issue_plural: Issues
522 label_issue_view_all: View all issues
523 label_issue_view_all: View all issues
523 label_issues_by: "Issues by %{value}"
524 label_issues_by: "Issues by %{value}"
524 label_issue_added: Issue added
525 label_issue_added: Issue added
525 label_issue_updated: Issue updated
526 label_issue_updated: Issue updated
526 label_issue_note_added: Note added
527 label_issue_note_added: Note added
527 label_issue_status_updated: Status updated
528 label_issue_status_updated: Status updated
528 label_issue_assigned_to_updated: Assignee updated
529 label_issue_assigned_to_updated: Assignee updated
529 label_issue_priority_updated: Priority updated
530 label_issue_priority_updated: Priority updated
530 label_document: Document
531 label_document: Document
531 label_document_new: New document
532 label_document_new: New document
532 label_document_plural: Documents
533 label_document_plural: Documents
533 label_document_added: Document added
534 label_document_added: Document added
534 label_role: Role
535 label_role: Role
535 label_role_plural: Roles
536 label_role_plural: Roles
536 label_role_new: New role
537 label_role_new: New role
537 label_role_and_permissions: Roles and permissions
538 label_role_and_permissions: Roles and permissions
538 label_role_anonymous: Anonymous
539 label_role_anonymous: Anonymous
539 label_role_non_member: Non member
540 label_role_non_member: Non member
540 label_member: Member
541 label_member: Member
541 label_member_new: New member
542 label_member_new: New member
542 label_member_plural: Members
543 label_member_plural: Members
543 label_tracker: Tracker
544 label_tracker: Tracker
544 label_tracker_plural: Trackers
545 label_tracker_plural: Trackers
545 label_tracker_new: New tracker
546 label_tracker_new: New tracker
546 label_workflow: Workflow
547 label_workflow: Workflow
547 label_issue_status: Issue status
548 label_issue_status: Issue status
548 label_issue_status_plural: Issue statuses
549 label_issue_status_plural: Issue statuses
549 label_issue_status_new: New status
550 label_issue_status_new: New status
550 label_issue_category: Issue category
551 label_issue_category: Issue category
551 label_issue_category_plural: Issue categories
552 label_issue_category_plural: Issue categories
552 label_issue_category_new: New category
553 label_issue_category_new: New category
553 label_custom_field: Custom field
554 label_custom_field: Custom field
554 label_custom_field_plural: Custom fields
555 label_custom_field_plural: Custom fields
555 label_custom_field_new: New custom field
556 label_custom_field_new: New custom field
556 label_enumerations: Enumerations
557 label_enumerations: Enumerations
557 label_enumeration_new: New value
558 label_enumeration_new: New value
558 label_information: Information
559 label_information: Information
559 label_information_plural: Information
560 label_information_plural: Information
560 label_please_login: Please log in
561 label_please_login: Please log in
561 label_register: Register
562 label_register: Register
562 label_login_with_open_id_option: or login with OpenID
563 label_login_with_open_id_option: or login with OpenID
563 label_password_lost: Lost password
564 label_password_lost: Lost password
564 label_password_required: Confirm your password to continue
565 label_password_required: Confirm your password to continue
565 label_home: Home
566 label_home: Home
566 label_my_page: My page
567 label_my_page: My page
567 label_my_account: My account
568 label_my_account: My account
568 label_my_projects: My projects
569 label_my_projects: My projects
569 label_my_page_block: My page block
570 label_my_page_block: My page block
570 label_administration: Administration
571 label_administration: Administration
571 label_login: Sign in
572 label_login: Sign in
572 label_logout: Sign out
573 label_logout: Sign out
573 label_help: Help
574 label_help: Help
574 label_reported_issues: Reported issues
575 label_reported_issues: Reported issues
575 label_assigned_issues: Assigned issues
576 label_assigned_issues: Assigned issues
576 label_assigned_to_me_issues: Issues assigned to me
577 label_assigned_to_me_issues: Issues assigned to me
577 label_last_login: Last connection
578 label_last_login: Last connection
578 label_registered_on: Registered on
579 label_registered_on: Registered on
579 label_activity: Activity
580 label_activity: Activity
580 label_overall_activity: Overall activity
581 label_overall_activity: Overall activity
581 label_user_activity: "%{value}'s activity"
582 label_user_activity: "%{value}'s activity"
582 label_new: New
583 label_new: New
583 label_logged_as: Logged in as
584 label_logged_as: Logged in as
584 label_environment: Environment
585 label_environment: Environment
585 label_authentication: Authentication
586 label_authentication: Authentication
586 label_auth_source: Authentication mode
587 label_auth_source: Authentication mode
587 label_auth_source_new: New authentication mode
588 label_auth_source_new: New authentication mode
588 label_auth_source_plural: Authentication modes
589 label_auth_source_plural: Authentication modes
589 label_subproject_plural: Subprojects
590 label_subproject_plural: Subprojects
590 label_subproject_new: New subproject
591 label_subproject_new: New subproject
591 label_and_its_subprojects: "%{value} and its subprojects"
592 label_and_its_subprojects: "%{value} and its subprojects"
592 label_min_max_length: Min - Max length
593 label_min_max_length: Min - Max length
593 label_list: List
594 label_list: List
594 label_date: Date
595 label_date: Date
595 label_integer: Integer
596 label_integer: Integer
596 label_float: Float
597 label_float: Float
597 label_boolean: Boolean
598 label_boolean: Boolean
598 label_string: Text
599 label_string: Text
599 label_text: Long text
600 label_text: Long text
600 label_attribute: Attribute
601 label_attribute: Attribute
601 label_attribute_plural: Attributes
602 label_attribute_plural: Attributes
602 label_no_data: No data to display
603 label_no_data: No data to display
603 label_change_status: Change status
604 label_change_status: Change status
604 label_history: History
605 label_history: History
605 label_attachment: File
606 label_attachment: File
606 label_attachment_new: New file
607 label_attachment_new: New file
607 label_attachment_delete: Delete file
608 label_attachment_delete: Delete file
608 label_attachment_plural: Files
609 label_attachment_plural: Files
609 label_file_added: File added
610 label_file_added: File added
610 label_report: Report
611 label_report: Report
611 label_report_plural: Reports
612 label_report_plural: Reports
612 label_news: News
613 label_news: News
613 label_news_new: Add news
614 label_news_new: Add news
614 label_news_plural: News
615 label_news_plural: News
615 label_news_latest: Latest news
616 label_news_latest: Latest news
616 label_news_view_all: View all news
617 label_news_view_all: View all news
617 label_news_added: News added
618 label_news_added: News added
618 label_news_comment_added: Comment added to a news
619 label_news_comment_added: Comment added to a news
619 label_settings: Settings
620 label_settings: Settings
620 label_overview: Overview
621 label_overview: Overview
621 label_version: Version
622 label_version: Version
622 label_version_new: New version
623 label_version_new: New version
623 label_version_plural: Versions
624 label_version_plural: Versions
624 label_close_versions: Close completed versions
625 label_close_versions: Close completed versions
625 label_confirmation: Confirmation
626 label_confirmation: Confirmation
626 label_export_to: 'Also available in:'
627 label_export_to: 'Also available in:'
627 label_read: Read...
628 label_read: Read...
628 label_public_projects: Public projects
629 label_public_projects: Public projects
629 label_open_issues: open
630 label_open_issues: open
630 label_open_issues_plural: open
631 label_open_issues_plural: open
631 label_closed_issues: closed
632 label_closed_issues: closed
632 label_closed_issues_plural: closed
633 label_closed_issues_plural: closed
633 label_x_open_issues_abbr:
634 label_x_open_issues_abbr:
634 zero: 0 open
635 zero: 0 open
635 one: 1 open
636 one: 1 open
636 other: "%{count} open"
637 other: "%{count} open"
637 label_x_closed_issues_abbr:
638 label_x_closed_issues_abbr:
638 zero: 0 closed
639 zero: 0 closed
639 one: 1 closed
640 one: 1 closed
640 other: "%{count} closed"
641 other: "%{count} closed"
641 label_x_issues:
642 label_x_issues:
642 zero: 0 issues
643 zero: 0 issues
643 one: 1 issue
644 one: 1 issue
644 other: "%{count} issues"
645 other: "%{count} issues"
645 label_total: Total
646 label_total: Total
646 label_total_plural: Totals
647 label_total_plural: Totals
647 label_total_time: Total time
648 label_total_time: Total time
648 label_permissions: Permissions
649 label_permissions: Permissions
649 label_current_status: Current status
650 label_current_status: Current status
650 label_new_statuses_allowed: New statuses allowed
651 label_new_statuses_allowed: New statuses allowed
651 label_all: all
652 label_all: all
652 label_any: any
653 label_any: any
653 label_none: none
654 label_none: none
654 label_nobody: nobody
655 label_nobody: nobody
655 label_next: Next
656 label_next: Next
656 label_previous: Previous
657 label_previous: Previous
657 label_used_by: Used by
658 label_used_by: Used by
658 label_details: Details
659 label_details: Details
659 label_add_note: Add a note
660 label_add_note: Add a note
660 label_calendar: Calendar
661 label_calendar: Calendar
661 label_months_from: months from
662 label_months_from: months from
662 label_gantt: Gantt
663 label_gantt: Gantt
663 label_internal: Internal
664 label_internal: Internal
664 label_last_changes: "last %{count} changes"
665 label_last_changes: "last %{count} changes"
665 label_change_view_all: View all changes
666 label_change_view_all: View all changes
666 label_personalize_page: Personalize this page
667 label_personalize_page: Personalize this page
667 label_comment: Comment
668 label_comment: Comment
668 label_comment_plural: Comments
669 label_comment_plural: Comments
669 label_x_comments:
670 label_x_comments:
670 zero: no comments
671 zero: no comments
671 one: 1 comment
672 one: 1 comment
672 other: "%{count} comments"
673 other: "%{count} comments"
673 label_comment_add: Add a comment
674 label_comment_add: Add a comment
674 label_comment_added: Comment added
675 label_comment_added: Comment added
675 label_comment_delete: Delete comments
676 label_comment_delete: Delete comments
676 label_query: Custom query
677 label_query: Custom query
677 label_query_plural: Custom queries
678 label_query_plural: Custom queries
678 label_query_new: New query
679 label_query_new: New query
679 label_my_queries: My custom queries
680 label_my_queries: My custom queries
680 label_filter_add: Add filter
681 label_filter_add: Add filter
681 label_filter_plural: Filters
682 label_filter_plural: Filters
682 label_equals: is
683 label_equals: is
683 label_not_equals: is not
684 label_not_equals: is not
684 label_in_less_than: in less than
685 label_in_less_than: in less than
685 label_in_more_than: in more than
686 label_in_more_than: in more than
686 label_in_the_next_days: in the next
687 label_in_the_next_days: in the next
687 label_in_the_past_days: in the past
688 label_in_the_past_days: in the past
688 label_greater_or_equal: '>='
689 label_greater_or_equal: '>='
689 label_less_or_equal: '<='
690 label_less_or_equal: '<='
690 label_between: between
691 label_between: between
691 label_in: in
692 label_in: in
692 label_today: today
693 label_today: today
693 label_all_time: all time
694 label_all_time: all time
694 label_yesterday: yesterday
695 label_yesterday: yesterday
695 label_this_week: this week
696 label_this_week: this week
696 label_last_week: last week
697 label_last_week: last week
697 label_last_n_weeks: "last %{count} weeks"
698 label_last_n_weeks: "last %{count} weeks"
698 label_last_n_days: "last %{count} days"
699 label_last_n_days: "last %{count} days"
699 label_this_month: this month
700 label_this_month: this month
700 label_last_month: last month
701 label_last_month: last month
701 label_this_year: this year
702 label_this_year: this year
702 label_date_range: Date range
703 label_date_range: Date range
703 label_less_than_ago: less than days ago
704 label_less_than_ago: less than days ago
704 label_more_than_ago: more than days ago
705 label_more_than_ago: more than days ago
705 label_ago: days ago
706 label_ago: days ago
706 label_contains: contains
707 label_contains: contains
707 label_not_contains: doesn't contain
708 label_not_contains: doesn't contain
708 label_any_issues_in_project: any issues in project
709 label_any_issues_in_project: any issues in project
709 label_any_issues_not_in_project: any issues not in project
710 label_any_issues_not_in_project: any issues not in project
710 label_no_issues_in_project: no issues in project
711 label_no_issues_in_project: no issues in project
711 label_day_plural: days
712 label_day_plural: days
712 label_repository: Repository
713 label_repository: Repository
713 label_repository_new: New repository
714 label_repository_new: New repository
714 label_repository_plural: Repositories
715 label_repository_plural: Repositories
715 label_browse: Browse
716 label_browse: Browse
716 label_branch: Branch
717 label_branch: Branch
717 label_tag: Tag
718 label_tag: Tag
718 label_revision: Revision
719 label_revision: Revision
719 label_revision_plural: Revisions
720 label_revision_plural: Revisions
720 label_revision_id: "Revision %{value}"
721 label_revision_id: "Revision %{value}"
721 label_associated_revisions: Associated revisions
722 label_associated_revisions: Associated revisions
722 label_added: added
723 label_added: added
723 label_modified: modified
724 label_modified: modified
724 label_copied: copied
725 label_copied: copied
725 label_renamed: renamed
726 label_renamed: renamed
726 label_deleted: deleted
727 label_deleted: deleted
727 label_latest_revision: Latest revision
728 label_latest_revision: Latest revision
728 label_latest_revision_plural: Latest revisions
729 label_latest_revision_plural: Latest revisions
729 label_view_revisions: View revisions
730 label_view_revisions: View revisions
730 label_view_all_revisions: View all revisions
731 label_view_all_revisions: View all revisions
731 label_max_size: Maximum size
732 label_max_size: Maximum size
732 label_sort_highest: Move to top
733 label_sort_highest: Move to top
733 label_sort_higher: Move up
734 label_sort_higher: Move up
734 label_sort_lower: Move down
735 label_sort_lower: Move down
735 label_sort_lowest: Move to bottom
736 label_sort_lowest: Move to bottom
736 label_roadmap: Roadmap
737 label_roadmap: Roadmap
737 label_roadmap_due_in: "Due in %{value}"
738 label_roadmap_due_in: "Due in %{value}"
738 label_roadmap_overdue: "%{value} late"
739 label_roadmap_overdue: "%{value} late"
739 label_roadmap_no_issues: No issues for this version
740 label_roadmap_no_issues: No issues for this version
740 label_search: Search
741 label_search: Search
741 label_result_plural: Results
742 label_result_plural: Results
742 label_all_words: All words
743 label_all_words: All words
743 label_wiki: Wiki
744 label_wiki: Wiki
744 label_wiki_edit: Wiki edit
745 label_wiki_edit: Wiki edit
745 label_wiki_edit_plural: Wiki edits
746 label_wiki_edit_plural: Wiki edits
746 label_wiki_page: Wiki page
747 label_wiki_page: Wiki page
747 label_wiki_page_plural: Wiki pages
748 label_wiki_page_plural: Wiki pages
748 label_index_by_title: Index by title
749 label_index_by_title: Index by title
749 label_index_by_date: Index by date
750 label_index_by_date: Index by date
750 label_current_version: Current version
751 label_current_version: Current version
751 label_preview: Preview
752 label_preview: Preview
752 label_feed_plural: Feeds
753 label_feed_plural: Feeds
753 label_changes_details: Details of all changes
754 label_changes_details: Details of all changes
754 label_issue_tracking: Issue tracking
755 label_issue_tracking: Issue tracking
755 label_spent_time: Spent time
756 label_spent_time: Spent time
756 label_total_spent_time: Total spent time
757 label_total_spent_time: Total spent time
757 label_overall_spent_time: Overall spent time
758 label_overall_spent_time: Overall spent time
758 label_f_hour: "%{value} hour"
759 label_f_hour: "%{value} hour"
759 label_f_hour_plural: "%{value} hours"
760 label_f_hour_plural: "%{value} hours"
760 label_f_hour_short: "%{value} h"
761 label_f_hour_short: "%{value} h"
761 label_time_tracking: Time tracking
762 label_time_tracking: Time tracking
762 label_change_plural: Changes
763 label_change_plural: Changes
763 label_statistics: Statistics
764 label_statistics: Statistics
764 label_commits_per_month: Commits per month
765 label_commits_per_month: Commits per month
765 label_commits_per_author: Commits per author
766 label_commits_per_author: Commits per author
766 label_diff: diff
767 label_diff: diff
767 label_view_diff: View differences
768 label_view_diff: View differences
768 label_diff_inline: inline
769 label_diff_inline: inline
769 label_diff_side_by_side: side by side
770 label_diff_side_by_side: side by side
770 label_options: Options
771 label_options: Options
771 label_copy_workflow_from: Copy workflow from
772 label_copy_workflow_from: Copy workflow from
772 label_permissions_report: Permissions report
773 label_permissions_report: Permissions report
773 label_watched_issues: Watched issues
774 label_watched_issues: Watched issues
774 label_related_issues: Related issues
775 label_related_issues: Related issues
775 label_applied_status: Applied status
776 label_applied_status: Applied status
776 label_loading: Loading...
777 label_loading: Loading...
777 label_relation_new: New relation
778 label_relation_new: New relation
778 label_relation_delete: Delete relation
779 label_relation_delete: Delete relation
779 label_relates_to: Related to
780 label_relates_to: Related to
780 label_duplicates: Duplicates
781 label_duplicates: Duplicates
781 label_duplicated_by: Duplicated by
782 label_duplicated_by: Duplicated by
782 label_blocks: Blocks
783 label_blocks: Blocks
783 label_blocked_by: Blocked by
784 label_blocked_by: Blocked by
784 label_precedes: Precedes
785 label_precedes: Precedes
785 label_follows: Follows
786 label_follows: Follows
786 label_copied_to: Copied to
787 label_copied_to: Copied to
787 label_copied_from: Copied from
788 label_copied_from: Copied from
788 label_end_to_start: end to start
789 label_end_to_start: end to start
789 label_end_to_end: end to end
790 label_end_to_end: end to end
790 label_start_to_start: start to start
791 label_start_to_start: start to start
791 label_start_to_end: start to end
792 label_start_to_end: start to end
792 label_stay_logged_in: Stay logged in
793 label_stay_logged_in: Stay logged in
793 label_disabled: disabled
794 label_disabled: disabled
794 label_show_completed_versions: Show completed versions
795 label_show_completed_versions: Show completed versions
795 label_me: me
796 label_me: me
796 label_board: Forum
797 label_board: Forum
797 label_board_new: New forum
798 label_board_new: New forum
798 label_board_plural: Forums
799 label_board_plural: Forums
799 label_board_locked: Locked
800 label_board_locked: Locked
800 label_board_sticky: Sticky
801 label_board_sticky: Sticky
801 label_topic_plural: Topics
802 label_topic_plural: Topics
802 label_message_plural: Messages
803 label_message_plural: Messages
803 label_message_last: Last message
804 label_message_last: Last message
804 label_message_new: New message
805 label_message_new: New message
805 label_message_posted: Message added
806 label_message_posted: Message added
806 label_reply_plural: Replies
807 label_reply_plural: Replies
807 label_send_information: Send account information to the user
808 label_send_information: Send account information to the user
808 label_year: Year
809 label_year: Year
809 label_month: Month
810 label_month: Month
810 label_week: Week
811 label_week: Week
811 label_date_from: From
812 label_date_from: From
812 label_date_to: To
813 label_date_to: To
813 label_language_based: Based on user's language
814 label_language_based: Based on user's language
814 label_sort_by: "Sort by %{value}"
815 label_sort_by: "Sort by %{value}"
815 label_send_test_email: Send a test email
816 label_send_test_email: Send a test email
816 label_feeds_access_key: Atom access key
817 label_feeds_access_key: Atom access key
817 label_missing_feeds_access_key: Missing a Atom access key
818 label_missing_feeds_access_key: Missing a Atom access key
818 label_feeds_access_key_created_on: "Atom access key created %{value} ago"
819 label_feeds_access_key_created_on: "Atom access key created %{value} ago"
819 label_module_plural: Modules
820 label_module_plural: Modules
820 label_added_time_by: "Added by %{author} %{age} ago"
821 label_added_time_by: "Added by %{author} %{age} ago"
821 label_updated_time_by: "Updated by %{author} %{age} ago"
822 label_updated_time_by: "Updated by %{author} %{age} ago"
822 label_updated_time: "Updated %{value} ago"
823 label_updated_time: "Updated %{value} ago"
823 label_jump_to_a_project: Jump to a project...
824 label_jump_to_a_project: Jump to a project...
824 label_file_plural: Files
825 label_file_plural: Files
825 label_changeset_plural: Changesets
826 label_changeset_plural: Changesets
826 label_default_columns: Default columns
827 label_default_columns: Default columns
827 label_no_change_option: (No change)
828 label_no_change_option: (No change)
828 label_bulk_edit_selected_issues: Bulk edit selected issues
829 label_bulk_edit_selected_issues: Bulk edit selected issues
829 label_bulk_edit_selected_time_entries: Bulk edit selected time entries
830 label_bulk_edit_selected_time_entries: Bulk edit selected time entries
830 label_theme: Theme
831 label_theme: Theme
831 label_default: Default
832 label_default: Default
832 label_search_titles_only: Search titles only
833 label_search_titles_only: Search titles only
833 label_user_mail_option_all: "For any event on all my projects"
834 label_user_mail_option_all: "For any event on all my projects"
834 label_user_mail_option_selected: "For any event on the selected projects only..."
835 label_user_mail_option_selected: "For any event on the selected projects only..."
835 label_user_mail_option_none: "No events"
836 label_user_mail_option_none: "No events"
836 label_user_mail_option_only_my_events: "Only for things I watch or I'm involved in"
837 label_user_mail_option_only_my_events: "Only for things I watch or I'm involved in"
837 label_user_mail_option_only_assigned: "Only for things I am assigned to"
838 label_user_mail_option_only_assigned: "Only for things I am assigned to"
838 label_user_mail_option_only_owner: "Only for things I am the owner of"
839 label_user_mail_option_only_owner: "Only for things I am the owner of"
839 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
840 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
840 label_registration_activation_by_email: account activation by email
841 label_registration_activation_by_email: account activation by email
841 label_registration_manual_activation: manual account activation
842 label_registration_manual_activation: manual account activation
842 label_registration_automatic_activation: automatic account activation
843 label_registration_automatic_activation: automatic account activation
843 label_display_per_page: "Per page: %{value}"
844 label_display_per_page: "Per page: %{value}"
844 label_age: Age
845 label_age: Age
845 label_change_properties: Change properties
846 label_change_properties: Change properties
846 label_general: General
847 label_general: General
847 label_more: More
848 label_more: More
848 label_scm: SCM
849 label_scm: SCM
849 label_plugins: Plugins
850 label_plugins: Plugins
850 label_ldap_authentication: LDAP authentication
851 label_ldap_authentication: LDAP authentication
851 label_downloads_abbr: D/L
852 label_downloads_abbr: D/L
852 label_optional_description: Optional description
853 label_optional_description: Optional description
853 label_add_another_file: Add another file
854 label_add_another_file: Add another file
854 label_preferences: Preferences
855 label_preferences: Preferences
855 label_chronological_order: In chronological order
856 label_chronological_order: In chronological order
856 label_reverse_chronological_order: In reverse chronological order
857 label_reverse_chronological_order: In reverse chronological order
857 label_planning: Planning
858 label_planning: Planning
858 label_incoming_emails: Incoming emails
859 label_incoming_emails: Incoming emails
859 label_generate_key: Generate a key
860 label_generate_key: Generate a key
860 label_issue_watchers: Watchers
861 label_issue_watchers: Watchers
861 label_example: Example
862 label_example: Example
862 label_display: Display
863 label_display: Display
863 label_sort: Sort
864 label_sort: Sort
864 label_ascending: Ascending
865 label_ascending: Ascending
865 label_descending: Descending
866 label_descending: Descending
866 label_date_from_to: From %{start} to %{end}
867 label_date_from_to: From %{start} to %{end}
867 label_wiki_content_added: Wiki page added
868 label_wiki_content_added: Wiki page added
868 label_wiki_content_updated: Wiki page updated
869 label_wiki_content_updated: Wiki page updated
869 label_group: Group
870 label_group: Group
870 label_group_plural: Groups
871 label_group_plural: Groups
871 label_group_new: New group
872 label_group_new: New group
872 label_group_anonymous: Anonymous users
873 label_group_anonymous: Anonymous users
873 label_group_non_member: Non member users
874 label_group_non_member: Non member users
874 label_time_entry_plural: Spent time
875 label_time_entry_plural: Spent time
875 label_version_sharing_none: Not shared
876 label_version_sharing_none: Not shared
876 label_version_sharing_descendants: With subprojects
877 label_version_sharing_descendants: With subprojects
877 label_version_sharing_hierarchy: With project hierarchy
878 label_version_sharing_hierarchy: With project hierarchy
878 label_version_sharing_tree: With project tree
879 label_version_sharing_tree: With project tree
879 label_version_sharing_system: With all projects
880 label_version_sharing_system: With all projects
880 label_update_issue_done_ratios: Update issue done ratios
881 label_update_issue_done_ratios: Update issue done ratios
881 label_copy_source: Source
882 label_copy_source: Source
882 label_copy_target: Target
883 label_copy_target: Target
883 label_copy_same_as_target: Same as target
884 label_copy_same_as_target: Same as target
884 label_display_used_statuses_only: Only display statuses that are used by this tracker
885 label_display_used_statuses_only: Only display statuses that are used by this tracker
885 label_api_access_key: API access key
886 label_api_access_key: API access key
886 label_missing_api_access_key: Missing an API access key
887 label_missing_api_access_key: Missing an API access key
887 label_api_access_key_created_on: "API access key created %{value} ago"
888 label_api_access_key_created_on: "API access key created %{value} ago"
888 label_profile: Profile
889 label_profile: Profile
889 label_subtask_plural: Subtasks
890 label_subtask_plural: Subtasks
890 label_project_copy_notifications: Send email notifications during the project copy
891 label_project_copy_notifications: Send email notifications during the project copy
891 label_principal_search: "Search for user or group:"
892 label_principal_search: "Search for user or group:"
892 label_user_search: "Search for user:"
893 label_user_search: "Search for user:"
893 label_additional_workflow_transitions_for_author: Additional transitions allowed when the user is the author
894 label_additional_workflow_transitions_for_author: Additional transitions allowed when the user is the author
894 label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee
895 label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee
895 label_issues_visibility_all: All issues
896 label_issues_visibility_all: All issues
896 label_issues_visibility_public: All non private issues
897 label_issues_visibility_public: All non private issues
897 label_issues_visibility_own: Issues created by or assigned to the user
898 label_issues_visibility_own: Issues created by or assigned to the user
898 label_git_report_last_commit: Report last commit for files and directories
899 label_git_report_last_commit: Report last commit for files and directories
899 label_parent_revision: Parent
900 label_parent_revision: Parent
900 label_child_revision: Child
901 label_child_revision: Child
901 label_export_options: "%{export_format} export options"
902 label_export_options: "%{export_format} export options"
902 label_copy_attachments: Copy attachments
903 label_copy_attachments: Copy attachments
903 label_copy_subtasks: Copy subtasks
904 label_copy_subtasks: Copy subtasks
904 label_item_position: "%{position} of %{count}"
905 label_item_position: "%{position} of %{count}"
905 label_completed_versions: Completed versions
906 label_completed_versions: Completed versions
906 label_search_for_watchers: Search for watchers to add
907 label_search_for_watchers: Search for watchers to add
907 label_session_expiration: Session expiration
908 label_session_expiration: Session expiration
908 label_show_closed_projects: View closed projects
909 label_show_closed_projects: View closed projects
909 label_status_transitions: Status transitions
910 label_status_transitions: Status transitions
910 label_fields_permissions: Fields permissions
911 label_fields_permissions: Fields permissions
911 label_readonly: Read-only
912 label_readonly: Read-only
912 label_required: Required
913 label_required: Required
913 label_hidden: Hidden
914 label_hidden: Hidden
914 label_attribute_of_project: "Project's %{name}"
915 label_attribute_of_project: "Project's %{name}"
915 label_attribute_of_issue: "Issue's %{name}"
916 label_attribute_of_issue: "Issue's %{name}"
916 label_attribute_of_author: "Author's %{name}"
917 label_attribute_of_author: "Author's %{name}"
917 label_attribute_of_assigned_to: "Assignee's %{name}"
918 label_attribute_of_assigned_to: "Assignee's %{name}"
918 label_attribute_of_user: "User's %{name}"
919 label_attribute_of_user: "User's %{name}"
919 label_attribute_of_fixed_version: "Target version's %{name}"
920 label_attribute_of_fixed_version: "Target version's %{name}"
920 label_cross_project_descendants: With subprojects
921 label_cross_project_descendants: With subprojects
921 label_cross_project_tree: With project tree
922 label_cross_project_tree: With project tree
922 label_cross_project_hierarchy: With project hierarchy
923 label_cross_project_hierarchy: With project hierarchy
923 label_cross_project_system: With all projects
924 label_cross_project_system: With all projects
924 label_gantt_progress_line: Progress line
925 label_gantt_progress_line: Progress line
925 label_visibility_private: to me only
926 label_visibility_private: to me only
926 label_visibility_roles: to these roles only
927 label_visibility_roles: to these roles only
927 label_visibility_public: to any users
928 label_visibility_public: to any users
928 label_link: Link
929 label_link: Link
929 label_only: only
930 label_only: only
930 label_drop_down_list: drop-down list
931 label_drop_down_list: drop-down list
931 label_checkboxes: checkboxes
932 label_checkboxes: checkboxes
932 label_radio_buttons: radio buttons
933 label_radio_buttons: radio buttons
933 label_link_values_to: Link values to URL
934 label_link_values_to: Link values to URL
934 label_custom_field_select_type: Select the type of object to which the custom field is to be attached
935 label_custom_field_select_type: Select the type of object to which the custom field is to be attached
935 label_check_for_updates: Check for updates
936 label_check_for_updates: Check for updates
936 label_latest_compatible_version: Latest compatible version
937 label_latest_compatible_version: Latest compatible version
937 label_unknown_plugin: Unknown plugin
938 label_unknown_plugin: Unknown plugin
938 label_add_projects: Add projects
939 label_add_projects: Add projects
939 label_users_visibility_all: All active users
940 label_users_visibility_all: All active users
940 label_users_visibility_members_of_visible_projects: Members of visible projects
941 label_users_visibility_members_of_visible_projects: Members of visible projects
941 label_edit_attachments: Edit attached files
942 label_edit_attachments: Edit attached files
942 label_link_copied_issue: Link copied issue
943 label_link_copied_issue: Link copied issue
943 label_ask: Ask
944 label_ask: Ask
944 label_search_attachments_yes: Search attachment filenames and descriptions
945 label_search_attachments_yes: Search attachment filenames and descriptions
945 label_search_attachments_no: Do not search attachments
946 label_search_attachments_no: Do not search attachments
946 label_search_attachments_only: Search attachments only
947 label_search_attachments_only: Search attachments only
947 label_search_open_issues_only: Open issues only
948 label_search_open_issues_only: Open issues only
948 label_email_address_plural: Emails
949 label_email_address_plural: Emails
949 label_email_address_add: Add email address
950 label_email_address_add: Add email address
950 label_enable_notifications: Enable notifications
951 label_enable_notifications: Enable notifications
951 label_disable_notifications: Disable notifications
952 label_disable_notifications: Disable notifications
952 label_blank_value: blank
953 label_blank_value: blank
953 label_parent_task_attributes: Parent tasks attributes
954 label_parent_task_attributes: Parent tasks attributes
954 label_parent_task_attributes_derived: Calculated from subtasks
955 label_parent_task_attributes_derived: Calculated from subtasks
955 label_parent_task_attributes_independent: Independent of subtasks
956 label_parent_task_attributes_independent: Independent of subtasks
956 label_time_entries_visibility_all: All time entries
957 label_time_entries_visibility_all: All time entries
957 label_time_entries_visibility_own: Time entries created by the user
958 label_time_entries_visibility_own: Time entries created by the user
958 label_member_management: Member management
959 label_member_management: Member management
959 label_member_management_all_roles: All roles
960 label_member_management_all_roles: All roles
960 label_member_management_selected_roles_only: Only these roles
961 label_member_management_selected_roles_only: Only these roles
961 label_import_issues: Import issues
962 label_import_issues: Import issues
962 label_select_file_to_import: Select the file to import
963 label_select_file_to_import: Select the file to import
963 label_fields_separator: Field separator
964 label_fields_separator: Field separator
964 label_fields_wrapper: Field wrapper
965 label_fields_wrapper: Field wrapper
965 label_encoding: Encoding
966 label_encoding: Encoding
966 label_comma_char: Comma
967 label_comma_char: Comma
967 label_semi_colon_char: Semi colon
968 label_semi_colon_char: Semi colon
968 label_quote_char: Quote
969 label_quote_char: Quote
969 label_double_quote_char: Double quote
970 label_double_quote_char: Double quote
970 label_fields_mapping: Fields mapping
971 label_fields_mapping: Fields mapping
971 label_file_content_preview: File content preview
972 label_file_content_preview: File content preview
972 label_create_missing_values: Create missing values
973 label_create_missing_values: Create missing values
973 label_api: API
974 label_api: API
974 label_field_format_enumeration: Key/value list
975 label_field_format_enumeration: Key/value list
975
976
976 button_login: Login
977 button_login: Login
977 button_submit: Submit
978 button_submit: Submit
978 button_save: Save
979 button_save: Save
979 button_check_all: Check all
980 button_check_all: Check all
980 button_uncheck_all: Uncheck all
981 button_uncheck_all: Uncheck all
981 button_collapse_all: Collapse all
982 button_collapse_all: Collapse all
982 button_expand_all: Expand all
983 button_expand_all: Expand all
983 button_delete: Delete
984 button_delete: Delete
984 button_create: Create
985 button_create: Create
985 button_create_and_continue: Create and continue
986 button_create_and_continue: Create and continue
986 button_test: Test
987 button_test: Test
987 button_edit: Edit
988 button_edit: Edit
988 button_edit_associated_wikipage: "Edit associated Wiki page: %{page_title}"
989 button_edit_associated_wikipage: "Edit associated Wiki page: %{page_title}"
989 button_add: Add
990 button_add: Add
990 button_change: Change
991 button_change: Change
991 button_apply: Apply
992 button_apply: Apply
992 button_clear: Clear
993 button_clear: Clear
993 button_lock: Lock
994 button_lock: Lock
994 button_unlock: Unlock
995 button_unlock: Unlock
995 button_download: Download
996 button_download: Download
996 button_list: List
997 button_list: List
997 button_view: View
998 button_view: View
998 button_move: Move
999 button_move: Move
999 button_move_and_follow: Move and follow
1000 button_move_and_follow: Move and follow
1000 button_back: Back
1001 button_back: Back
1001 button_cancel: Cancel
1002 button_cancel: Cancel
1002 button_activate: Activate
1003 button_activate: Activate
1003 button_sort: Sort
1004 button_sort: Sort
1004 button_log_time: Log time
1005 button_log_time: Log time
1005 button_rollback: Rollback to this version
1006 button_rollback: Rollback to this version
1006 button_watch: Watch
1007 button_watch: Watch
1007 button_unwatch: Unwatch
1008 button_unwatch: Unwatch
1008 button_reply: Reply
1009 button_reply: Reply
1009 button_archive: Archive
1010 button_archive: Archive
1010 button_unarchive: Unarchive
1011 button_unarchive: Unarchive
1011 button_reset: Reset
1012 button_reset: Reset
1012 button_rename: Rename
1013 button_rename: Rename
1013 button_change_password: Change password
1014 button_change_password: Change password
1014 button_copy: Copy
1015 button_copy: Copy
1015 button_copy_and_follow: Copy and follow
1016 button_copy_and_follow: Copy and follow
1016 button_annotate: Annotate
1017 button_annotate: Annotate
1017 button_update: Update
1018 button_update: Update
1018 button_configure: Configure
1019 button_configure: Configure
1019 button_quote: Quote
1020 button_quote: Quote
1020 button_duplicate: Duplicate
1021 button_duplicate: Duplicate
1021 button_show: Show
1022 button_show: Show
1022 button_hide: Hide
1023 button_hide: Hide
1023 button_edit_section: Edit this section
1024 button_edit_section: Edit this section
1024 button_export: Export
1025 button_export: Export
1025 button_delete_my_account: Delete my account
1026 button_delete_my_account: Delete my account
1026 button_close: Close
1027 button_close: Close
1027 button_reopen: Reopen
1028 button_reopen: Reopen
1028 button_import: Import
1029 button_import: Import
1029
1030
1030 status_active: active
1031 status_active: active
1031 status_registered: registered
1032 status_registered: registered
1032 status_locked: locked
1033 status_locked: locked
1033
1034
1034 project_status_active: active
1035 project_status_active: active
1035 project_status_closed: closed
1036 project_status_closed: closed
1036 project_status_archived: archived
1037 project_status_archived: archived
1037
1038
1038 version_status_open: open
1039 version_status_open: open
1039 version_status_locked: locked
1040 version_status_locked: locked
1040 version_status_closed: closed
1041 version_status_closed: closed
1041
1042
1042 field_active: Active
1043 field_active: Active
1043
1044
1044 text_select_mail_notifications: Select actions for which email notifications should be sent.
1045 text_select_mail_notifications: Select actions for which email notifications should be sent.
1045 text_regexp_info: eg. ^[A-Z0-9]+$
1046 text_regexp_info: eg. ^[A-Z0-9]+$
1046 text_min_max_length_info: 0 means no restriction
1047 text_min_max_length_info: 0 means no restriction
1047 text_project_destroy_confirmation: Are you sure you want to delete this project and related data?
1048 text_project_destroy_confirmation: Are you sure you want to delete this project and related data?
1048 text_subprojects_destroy_warning: "Its subproject(s): %{value} will be also deleted."
1049 text_subprojects_destroy_warning: "Its subproject(s): %{value} will be also deleted."
1049 text_workflow_edit: Select a role and a tracker to edit the workflow
1050 text_workflow_edit: Select a role and a tracker to edit the workflow
1050 text_are_you_sure: Are you sure?
1051 text_are_you_sure: Are you sure?
1051 text_journal_changed: "%{label} changed from %{old} to %{new}"
1052 text_journal_changed: "%{label} changed from %{old} to %{new}"
1052 text_journal_changed_no_detail: "%{label} updated"
1053 text_journal_changed_no_detail: "%{label} updated"
1053 text_journal_set_to: "%{label} set to %{value}"
1054 text_journal_set_to: "%{label} set to %{value}"
1054 text_journal_deleted: "%{label} deleted (%{old})"
1055 text_journal_deleted: "%{label} deleted (%{old})"
1055 text_journal_added: "%{label} %{value} added"
1056 text_journal_added: "%{label} %{value} added"
1056 text_tip_issue_begin_day: issue beginning this day
1057 text_tip_issue_begin_day: issue beginning this day
1057 text_tip_issue_end_day: issue ending this day
1058 text_tip_issue_end_day: issue ending this day
1058 text_tip_issue_begin_end_day: issue beginning and ending this day
1059 text_tip_issue_begin_end_day: issue beginning and ending this day
1059 text_project_identifier_info: 'Only lower case letters (a-z), numbers, dashes and underscores are allowed, must start with a lower case letter.<br />Once saved, the identifier cannot be changed.'
1060 text_project_identifier_info: 'Only lower case letters (a-z), numbers, dashes and underscores are allowed, must start with a lower case letter.<br />Once saved, the identifier cannot be changed.'
1060 text_caracters_maximum: "%{count} characters maximum."
1061 text_caracters_maximum: "%{count} characters maximum."
1061 text_caracters_minimum: "Must be at least %{count} characters long."
1062 text_caracters_minimum: "Must be at least %{count} characters long."
1062 text_length_between: "Length between %{min} and %{max} characters."
1063 text_length_between: "Length between %{min} and %{max} characters."
1063 text_tracker_no_workflow: No workflow defined for this tracker
1064 text_tracker_no_workflow: No workflow defined for this tracker
1064 text_unallowed_characters: Unallowed characters
1065 text_unallowed_characters: Unallowed characters
1065 text_comma_separated: Multiple values allowed (comma separated).
1066 text_comma_separated: Multiple values allowed (comma separated).
1066 text_line_separated: Multiple values allowed (one line for each value).
1067 text_line_separated: Multiple values allowed (one line for each value).
1067 text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages
1068 text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages
1068 text_issue_added: "Issue %{id} has been reported by %{author}."
1069 text_issue_added: "Issue %{id} has been reported by %{author}."
1069 text_issue_updated: "Issue %{id} has been updated by %{author}."
1070 text_issue_updated: "Issue %{id} has been updated by %{author}."
1070 text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content?
1071 text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content?
1071 text_issue_category_destroy_question: "Some issues (%{count}) are assigned to this category. What do you want to do?"
1072 text_issue_category_destroy_question: "Some issues (%{count}) are assigned to this category. What do you want to do?"
1072 text_issue_category_destroy_assignments: Remove category assignments
1073 text_issue_category_destroy_assignments: Remove category assignments
1073 text_issue_category_reassign_to: Reassign issues to this category
1074 text_issue_category_reassign_to: Reassign issues to this category
1074 text_user_mail_option: "For unselected projects, you will only receive notifications about things you watch or you're involved in (eg. issues you're the author or assignee)."
1075 text_user_mail_option: "For unselected projects, you will only receive notifications about things you watch or you're involved in (eg. issues you're the author or assignee)."
1075 text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
1076 text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
1076 text_load_default_configuration: Load the default configuration
1077 text_load_default_configuration: Load the default configuration
1077 text_status_changed_by_changeset: "Applied in changeset %{value}."
1078 text_status_changed_by_changeset: "Applied in changeset %{value}."
1078 text_time_logged_by_changeset: "Applied in changeset %{value}."
1079 text_time_logged_by_changeset: "Applied in changeset %{value}."
1079 text_issues_destroy_confirmation: 'Are you sure you want to delete the selected issue(s)?'
1080 text_issues_destroy_confirmation: 'Are you sure you want to delete the selected issue(s)?'
1080 text_issues_destroy_descendants_confirmation: "This will also delete %{count} subtask(s)."
1081 text_issues_destroy_descendants_confirmation: "This will also delete %{count} subtask(s)."
1081 text_time_entries_destroy_confirmation: 'Are you sure you want to delete the selected time entr(y/ies)?'
1082 text_time_entries_destroy_confirmation: 'Are you sure you want to delete the selected time entr(y/ies)?'
1082 text_select_project_modules: 'Select modules to enable for this project:'
1083 text_select_project_modules: 'Select modules to enable for this project:'
1083 text_default_administrator_account_changed: Default administrator account changed
1084 text_default_administrator_account_changed: Default administrator account changed
1084 text_file_repository_writable: Attachments directory writable
1085 text_file_repository_writable: Attachments directory writable
1085 text_plugin_assets_writable: Plugin assets directory writable
1086 text_plugin_assets_writable: Plugin assets directory writable
1086 text_rmagick_available: RMagick available (optional)
1087 text_rmagick_available: RMagick available (optional)
1087 text_convert_available: ImageMagick convert available (optional)
1088 text_convert_available: ImageMagick convert available (optional)
1088 text_destroy_time_entries_question: "%{hours} hours were reported on the issues you are about to delete. What do you want to do?"
1089 text_destroy_time_entries_question: "%{hours} hours were reported on the issues you are about to delete. What do you want to do?"
1089 text_destroy_time_entries: Delete reported hours
1090 text_destroy_time_entries: Delete reported hours
1090 text_assign_time_entries_to_project: Assign reported hours to the project
1091 text_assign_time_entries_to_project: Assign reported hours to the project
1091 text_reassign_time_entries: 'Reassign reported hours to this issue:'
1092 text_reassign_time_entries: 'Reassign reported hours to this issue:'
1092 text_user_wrote: "%{value} wrote:"
1093 text_user_wrote: "%{value} wrote:"
1093 text_enumeration_destroy_question: "%{count} objects are assigned to the value β€œ%{name}”."
1094 text_enumeration_destroy_question: "%{count} objects are assigned to the value β€œ%{name}”."
1094 text_enumeration_category_reassign_to: 'Reassign them to this value:'
1095 text_enumeration_category_reassign_to: 'Reassign them to this value:'
1095 text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/configuration.yml and restart the application to enable them."
1096 text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/configuration.yml and restart the application to enable them."
1096 text_repository_usernames_mapping: "Select or update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
1097 text_repository_usernames_mapping: "Select or update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped."
1097 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
1098 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
1098 text_custom_field_possible_values_info: 'One line for each value'
1099 text_custom_field_possible_values_info: 'One line for each value'
1099 text_wiki_page_destroy_question: "This page has %{descendants} child page(s) and descendant(s). What do you want to do?"
1100 text_wiki_page_destroy_question: "This page has %{descendants} child page(s) and descendant(s). What do you want to do?"
1100 text_wiki_page_nullify_children: "Keep child pages as root pages"
1101 text_wiki_page_nullify_children: "Keep child pages as root pages"
1101 text_wiki_page_destroy_children: "Delete child pages and all their descendants"
1102 text_wiki_page_destroy_children: "Delete child pages and all their descendants"
1102 text_wiki_page_reassign_children: "Reassign child pages to this parent page"
1103 text_wiki_page_reassign_children: "Reassign child pages to this parent page"
1103 text_own_membership_delete_confirmation: "You are about to remove some or all of your permissions and may no longer be able to edit this project after that.\nAre you sure you want to continue?"
1104 text_own_membership_delete_confirmation: "You are about to remove some or all of your permissions and may no longer be able to edit this project after that.\nAre you sure you want to continue?"
1104 text_zoom_in: Zoom in
1105 text_zoom_in: Zoom in
1105 text_zoom_out: Zoom out
1106 text_zoom_out: Zoom out
1106 text_warn_on_leaving_unsaved: "The current page contains unsaved text that will be lost if you leave this page."
1107 text_warn_on_leaving_unsaved: "The current page contains unsaved text that will be lost if you leave this page."
1107 text_scm_path_encoding_note: "Default: UTF-8"
1108 text_scm_path_encoding_note: "Default: UTF-8"
1108 text_subversion_repository_note: "Examples: file:///, http://, https://, svn://, svn+[tunnelscheme]://"
1109 text_subversion_repository_note: "Examples: file:///, http://, https://, svn://, svn+[tunnelscheme]://"
1109 text_git_repository_note: Repository is bare and local (e.g. /gitrepo, c:\gitrepo)
1110 text_git_repository_note: Repository is bare and local (e.g. /gitrepo, c:\gitrepo)
1110 text_mercurial_repository_note: Local repository (e.g. /hgrepo, c:\hgrepo)
1111 text_mercurial_repository_note: Local repository (e.g. /hgrepo, c:\hgrepo)
1111 text_scm_command: Command
1112 text_scm_command: Command
1112 text_scm_command_version: Version
1113 text_scm_command_version: Version
1113 text_scm_config: You can configure your SCM commands in config/configuration.yml. Please restart the application after editing it.
1114 text_scm_config: You can configure your SCM commands in config/configuration.yml. Please restart the application after editing it.
1114 text_scm_command_not_available: SCM command is not available. Please check settings on the administration panel.
1115 text_scm_command_not_available: SCM command is not available. Please check settings on the administration panel.
1115 text_issue_conflict_resolution_overwrite: "Apply my changes anyway (previous notes will be kept but some changes may be overwritten)"
1116 text_issue_conflict_resolution_overwrite: "Apply my changes anyway (previous notes will be kept but some changes may be overwritten)"
1116 text_issue_conflict_resolution_add_notes: "Add my notes and discard my other changes"
1117 text_issue_conflict_resolution_add_notes: "Add my notes and discard my other changes"
1117 text_issue_conflict_resolution_cancel: "Discard all my changes and redisplay %{link}"
1118 text_issue_conflict_resolution_cancel: "Discard all my changes and redisplay %{link}"
1118 text_account_destroy_confirmation: "Are you sure you want to proceed?\nYour account will be permanently deleted, with no way to reactivate it."
1119 text_account_destroy_confirmation: "Are you sure you want to proceed?\nYour account will be permanently deleted, with no way to reactivate it."
1119 text_session_expiration_settings: "Warning: changing these settings may expire the current sessions including yours."
1120 text_session_expiration_settings: "Warning: changing these settings may expire the current sessions including yours."
1120 text_project_closed: This project is closed and read-only.
1121 text_project_closed: This project is closed and read-only.
1121 text_turning_multiple_off: "If you disable multiple values, multiple values will be removed in order to preserve only one value per item."
1122 text_turning_multiple_off: "If you disable multiple values, multiple values will be removed in order to preserve only one value per item."
1122
1123
1123 default_role_manager: Manager
1124 default_role_manager: Manager
1124 default_role_developer: Developer
1125 default_role_developer: Developer
1125 default_role_reporter: Reporter
1126 default_role_reporter: Reporter
1126 default_tracker_bug: Bug
1127 default_tracker_bug: Bug
1127 default_tracker_feature: Feature
1128 default_tracker_feature: Feature
1128 default_tracker_support: Support
1129 default_tracker_support: Support
1129 default_issue_status_new: New
1130 default_issue_status_new: New
1130 default_issue_status_in_progress: In Progress
1131 default_issue_status_in_progress: In Progress
1131 default_issue_status_resolved: Resolved
1132 default_issue_status_resolved: Resolved
1132 default_issue_status_feedback: Feedback
1133 default_issue_status_feedback: Feedback
1133 default_issue_status_closed: Closed
1134 default_issue_status_closed: Closed
1134 default_issue_status_rejected: Rejected
1135 default_issue_status_rejected: Rejected
1135 default_doc_category_user: User documentation
1136 default_doc_category_user: User documentation
1136 default_doc_category_tech: Technical documentation
1137 default_doc_category_tech: Technical documentation
1137 default_priority_low: Low
1138 default_priority_low: Low
1138 default_priority_normal: Normal
1139 default_priority_normal: Normal
1139 default_priority_high: High
1140 default_priority_high: High
1140 default_priority_urgent: Urgent
1141 default_priority_urgent: Urgent
1141 default_priority_immediate: Immediate
1142 default_priority_immediate: Immediate
1142 default_activity_design: Design
1143 default_activity_design: Design
1143 default_activity_development: Development
1144 default_activity_development: Development
1144
1145
1145 enumeration_issue_priorities: Issue priorities
1146 enumeration_issue_priorities: Issue priorities
1146 enumeration_doc_categories: Document categories
1147 enumeration_doc_categories: Document categories
1147 enumeration_activities: Activities (time tracking)
1148 enumeration_activities: Activities (time tracking)
1148 enumeration_system_activity: System Activity
1149 enumeration_system_activity: System Activity
1149 description_filter: Filter
1150 description_filter: Filter
1150 description_search: Searchfield
1151 description_search: Searchfield
1151 description_choose_project: Projects
1152 description_choose_project: Projects
1152 description_project_scope: Search scope
1153 description_project_scope: Search scope
1153 description_notes: Notes
1154 description_notes: Notes
1154 description_message_content: Message content
1155 description_message_content: Message content
1155 description_query_sort_criteria_attribute: Sort attribute
1156 description_query_sort_criteria_attribute: Sort attribute
1156 description_query_sort_criteria_direction: Sort direction
1157 description_query_sort_criteria_direction: Sort direction
1157 description_user_mail_notification: Mail notification settings
1158 description_user_mail_notification: Mail notification settings
1158 description_available_columns: Available Columns
1159 description_available_columns: Available Columns
1159 description_selected_columns: Selected Columns
1160 description_selected_columns: Selected Columns
1160 description_all_columns: All Columns
1161 description_all_columns: All Columns
1161 description_issue_category_reassign: Choose issue category
1162 description_issue_category_reassign: Choose issue category
1162 description_wiki_subpages_reassign: Choose new parent page
1163 description_wiki_subpages_reassign: Choose new parent page
1163 description_date_range_list: Choose range from list
1164 description_date_range_list: Choose range from list
1164 description_date_range_interval: Choose range by selecting start and end date
1165 description_date_range_interval: Choose range by selecting start and end date
1165 description_date_from: Enter start date
1166 description_date_from: Enter start date
1166 description_date_to: Enter end date
1167 description_date_to: Enter end date
1167 text_repository_identifier_info: 'Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.'
1168 text_repository_identifier_info: 'Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.'
@@ -1,1187 +1,1188
1 # French translations for Ruby on Rails
1 # French translations for Ruby on Rails
2 # by Christian Lescuyer (christian@flyingcoders.com)
2 # by Christian Lescuyer (christian@flyingcoders.com)
3 # contributor: Sebastien Grosjean - ZenCocoon.com
3 # contributor: Sebastien Grosjean - ZenCocoon.com
4 # contributor: Thibaut Cuvelier - Developpez.com
4 # contributor: Thibaut Cuvelier - Developpez.com
5
5
6 fr:
6 fr:
7 direction: ltr
7 direction: ltr
8 date:
8 date:
9 formats:
9 formats:
10 default: "%d/%m/%Y"
10 default: "%d/%m/%Y"
11 short: "%e %b"
11 short: "%e %b"
12 long: "%e %B %Y"
12 long: "%e %B %Y"
13 long_ordinal: "%e %B %Y"
13 long_ordinal: "%e %B %Y"
14 only_day: "%e"
14 only_day: "%e"
15
15
16 day_names: [dimanche, lundi, mardi, mercredi, jeudi, vendredi, samedi]
16 day_names: [dimanche, lundi, mardi, mercredi, jeudi, vendredi, samedi]
17 abbr_day_names: [dim, lun, mar, mer, jeu, ven, sam]
17 abbr_day_names: [dim, lun, mar, mer, jeu, ven, sam]
18
18
19 # Don't forget the nil at the beginning; there's no such thing as a 0th month
19 # Don't forget the nil at the beginning; there's no such thing as a 0th month
20 month_names: [~, janvier, fΓ©vrier, mars, avril, mai, juin, juillet, aoΓ»t, septembre, octobre, novembre, dΓ©cembre]
20 month_names: [~, janvier, fΓ©vrier, mars, avril, mai, juin, juillet, aoΓ»t, septembre, octobre, novembre, dΓ©cembre]
21 abbr_month_names: [~, jan., fΓ©v., mar., avr., mai, juin, juil., aoΓ»t, sept., oct., nov., dΓ©c.]
21 abbr_month_names: [~, jan., fΓ©v., mar., avr., mai, juin, juil., aoΓ»t, sept., oct., nov., dΓ©c.]
22 # Used in date_select and datime_select.
22 # Used in date_select and datime_select.
23 order:
23 order:
24 - :day
24 - :day
25 - :month
25 - :month
26 - :year
26 - :year
27
27
28 time:
28 time:
29 formats:
29 formats:
30 default: "%d/%m/%Y %H:%M"
30 default: "%d/%m/%Y %H:%M"
31 time: "%H:%M"
31 time: "%H:%M"
32 short: "%d %b %H:%M"
32 short: "%d %b %H:%M"
33 long: "%A %d %B %Y %H:%M:%S %Z"
33 long: "%A %d %B %Y %H:%M:%S %Z"
34 long_ordinal: "%A %d %B %Y %H:%M:%S %Z"
34 long_ordinal: "%A %d %B %Y %H:%M:%S %Z"
35 only_second: "%S"
35 only_second: "%S"
36 am: 'am'
36 am: 'am'
37 pm: 'pm'
37 pm: 'pm'
38
38
39 datetime:
39 datetime:
40 distance_in_words:
40 distance_in_words:
41 half_a_minute: "30 secondes"
41 half_a_minute: "30 secondes"
42 less_than_x_seconds:
42 less_than_x_seconds:
43 zero: "moins d'une seconde"
43 zero: "moins d'une seconde"
44 one: "moins d'uneΒ seconde"
44 one: "moins d'uneΒ seconde"
45 other: "moins de %{count}Β secondes"
45 other: "moins de %{count}Β secondes"
46 x_seconds:
46 x_seconds:
47 one: "1Β seconde"
47 one: "1Β seconde"
48 other: "%{count}Β secondes"
48 other: "%{count}Β secondes"
49 less_than_x_minutes:
49 less_than_x_minutes:
50 zero: "moins d'une minute"
50 zero: "moins d'une minute"
51 one: "moins d'uneΒ minute"
51 one: "moins d'uneΒ minute"
52 other: "moins de %{count}Β minutes"
52 other: "moins de %{count}Β minutes"
53 x_minutes:
53 x_minutes:
54 one: "1Β minute"
54 one: "1Β minute"
55 other: "%{count}Β minutes"
55 other: "%{count}Β minutes"
56 about_x_hours:
56 about_x_hours:
57 one: "environ une heure"
57 one: "environ une heure"
58 other: "environ %{count}Β heures"
58 other: "environ %{count}Β heures"
59 x_hours:
59 x_hours:
60 one: "une heure"
60 one: "une heure"
61 other: "%{count}Β heures"
61 other: "%{count}Β heures"
62 x_days:
62 x_days:
63 one: "unΒ jour"
63 one: "unΒ jour"
64 other: "%{count}Β jours"
64 other: "%{count}Β jours"
65 about_x_months:
65 about_x_months:
66 one: "environ un mois"
66 one: "environ un mois"
67 other: "environ %{count}Β mois"
67 other: "environ %{count}Β mois"
68 x_months:
68 x_months:
69 one: "unΒ mois"
69 one: "unΒ mois"
70 other: "%{count}Β mois"
70 other: "%{count}Β mois"
71 about_x_years:
71 about_x_years:
72 one: "environ un an"
72 one: "environ un an"
73 other: "environ %{count}Β ans"
73 other: "environ %{count}Β ans"
74 over_x_years:
74 over_x_years:
75 one: "plus d'un an"
75 one: "plus d'un an"
76 other: "plus de %{count}Β ans"
76 other: "plus de %{count}Β ans"
77 almost_x_years:
77 almost_x_years:
78 one: "presqu'un an"
78 one: "presqu'un an"
79 other: "presque %{count} ans"
79 other: "presque %{count} ans"
80 prompts:
80 prompts:
81 year: "AnnΓ©e"
81 year: "AnnΓ©e"
82 month: "Mois"
82 month: "Mois"
83 day: "Jour"
83 day: "Jour"
84 hour: "Heure"
84 hour: "Heure"
85 minute: "Minute"
85 minute: "Minute"
86 second: "Seconde"
86 second: "Seconde"
87
87
88 number:
88 number:
89 format:
89 format:
90 precision: 3
90 precision: 3
91 separator: ','
91 separator: ','
92 delimiter: 'Β '
92 delimiter: 'Β '
93 currency:
93 currency:
94 format:
94 format:
95 unit: '€'
95 unit: '€'
96 precision: 2
96 precision: 2
97 format: '%nΒ %u'
97 format: '%nΒ %u'
98 human:
98 human:
99 format:
99 format:
100 precision: 3
100 precision: 3
101 storage_units:
101 storage_units:
102 format: "%n %u"
102 format: "%n %u"
103 units:
103 units:
104 byte:
104 byte:
105 one: "octet"
105 one: "octet"
106 other: "octets"
106 other: "octets"
107 kb: "ko"
107 kb: "ko"
108 mb: "Mo"
108 mb: "Mo"
109 gb: "Go"
109 gb: "Go"
110 tb: "To"
110 tb: "To"
111
111
112 support:
112 support:
113 array:
113 array:
114 sentence_connector: 'et'
114 sentence_connector: 'et'
115 skip_last_comma: true
115 skip_last_comma: true
116 word_connector: ", "
116 word_connector: ", "
117 two_words_connector: " et "
117 two_words_connector: " et "
118 last_word_connector: " et "
118 last_word_connector: " et "
119
119
120 activerecord:
120 activerecord:
121 errors:
121 errors:
122 template:
122 template:
123 header:
123 header:
124 one: "Impossible d'enregistrer %{model} : une erreur"
124 one: "Impossible d'enregistrer %{model} : une erreur"
125 other: "Impossible d'enregistrer %{model} : %{count} erreurs."
125 other: "Impossible d'enregistrer %{model} : %{count} erreurs."
126 body: "Veuillez vΓ©rifier les champs suivantsΒ :"
126 body: "Veuillez vΓ©rifier les champs suivantsΒ :"
127 messages:
127 messages:
128 inclusion: "n'est pas inclus(e) dans la liste"
128 inclusion: "n'est pas inclus(e) dans la liste"
129 exclusion: "n'est pas disponible"
129 exclusion: "n'est pas disponible"
130 invalid: "n'est pas valide"
130 invalid: "n'est pas valide"
131 confirmation: "ne concorde pas avec la confirmation"
131 confirmation: "ne concorde pas avec la confirmation"
132 accepted: "doit Γͺtre acceptΓ©(e)"
132 accepted: "doit Γͺtre acceptΓ©(e)"
133 empty: "doit Γͺtre renseignΓ©(e)"
133 empty: "doit Γͺtre renseignΓ©(e)"
134 blank: "doit Γͺtre renseignΓ©(e)"
134 blank: "doit Γͺtre renseignΓ©(e)"
135 too_long: "est trop long (pas plus de %{count} caractères)"
135 too_long: "est trop long (pas plus de %{count} caractères)"
136 too_short: "est trop court (au moins %{count} caractères)"
136 too_short: "est trop court (au moins %{count} caractères)"
137 wrong_length: "ne fait pas la bonne longueur (doit comporter %{count} caractères)"
137 wrong_length: "ne fait pas la bonne longueur (doit comporter %{count} caractères)"
138 taken: "est dΓ©jΓ  utilisΓ©"
138 taken: "est dΓ©jΓ  utilisΓ©"
139 not_a_number: "n'est pas un nombre"
139 not_a_number: "n'est pas un nombre"
140 not_a_date: "n'est pas une date valide"
140 not_a_date: "n'est pas une date valide"
141 greater_than: "doit Γͺtre supΓ©rieur Γ  %{count}"
141 greater_than: "doit Γͺtre supΓ©rieur Γ  %{count}"
142 greater_than_or_equal_to: "doit Γͺtre supΓ©rieur ou Γ©gal Γ  %{count}"
142 greater_than_or_equal_to: "doit Γͺtre supΓ©rieur ou Γ©gal Γ  %{count}"
143 equal_to: "doit Γͺtre Γ©gal Γ  %{count}"
143 equal_to: "doit Γͺtre Γ©gal Γ  %{count}"
144 less_than: "doit Γͺtre infΓ©rieur Γ  %{count}"
144 less_than: "doit Γͺtre infΓ©rieur Γ  %{count}"
145 less_than_or_equal_to: "doit Γͺtre infΓ©rieur ou Γ©gal Γ  %{count}"
145 less_than_or_equal_to: "doit Γͺtre infΓ©rieur ou Γ©gal Γ  %{count}"
146 odd: "doit Γͺtre impair"
146 odd: "doit Γͺtre impair"
147 even: "doit Γͺtre pair"
147 even: "doit Γͺtre pair"
148 greater_than_start_date: "doit Γͺtre postΓ©rieure Γ  la date de dΓ©but"
148 greater_than_start_date: "doit Γͺtre postΓ©rieure Γ  la date de dΓ©but"
149 not_same_project: "n'appartient pas au mΓͺme projet"
149 not_same_project: "n'appartient pas au mΓͺme projet"
150 circular_dependency: "Cette relation crΓ©erait une dΓ©pendance circulaire"
150 circular_dependency: "Cette relation crΓ©erait une dΓ©pendance circulaire"
151 cant_link_an_issue_with_a_descendant: "Une demande ne peut pas Γͺtre liΓ©e Γ  l'une de ses sous-tΓ’ches"
151 cant_link_an_issue_with_a_descendant: "Une demande ne peut pas Γͺtre liΓ©e Γ  l'une de ses sous-tΓ’ches"
152 earlier_than_minimum_start_date: "ne peut pas Γͺtre antΓ©rieure au %{date} Γ  cause des demandes qui prΓ©cΓ¨dent"
152 earlier_than_minimum_start_date: "ne peut pas Γͺtre antΓ©rieure au %{date} Γ  cause des demandes qui prΓ©cΓ¨dent"
153
153
154 actionview_instancetag_blank_option: Choisir
154 actionview_instancetag_blank_option: Choisir
155
155
156 general_text_No: 'Non'
156 general_text_No: 'Non'
157 general_text_Yes: 'Oui'
157 general_text_Yes: 'Oui'
158 general_text_no: 'non'
158 general_text_no: 'non'
159 general_text_yes: 'oui'
159 general_text_yes: 'oui'
160 general_lang_name: 'French (FranΓ§ais)'
160 general_lang_name: 'French (FranΓ§ais)'
161 general_csv_separator: ';'
161 general_csv_separator: ';'
162 general_csv_decimal_separator: ','
162 general_csv_decimal_separator: ','
163 general_csv_encoding: ISO-8859-1
163 general_csv_encoding: ISO-8859-1
164 general_pdf_fontname: freesans
164 general_pdf_fontname: freesans
165 general_first_day_of_week: '1'
165 general_first_day_of_week: '1'
166
166
167 notice_account_updated: Le compte a été mis à jour avec succès.
167 notice_account_updated: Le compte a été mis à jour avec succès.
168 notice_account_invalid_creditentials: Identifiant ou mot de passe invalide.
168 notice_account_invalid_creditentials: Identifiant ou mot de passe invalide.
169 notice_account_password_updated: Mot de passe mis à jour avec succès.
169 notice_account_password_updated: Mot de passe mis à jour avec succès.
170 notice_account_wrong_password: Mot de passe incorrect
170 notice_account_wrong_password: Mot de passe incorrect
171 notice_account_register_done: Un message contenant les instructions pour activer votre compte vous a Γ©tΓ© envoyΓ© Γ  l'adresse %{email}.
171 notice_account_register_done: Un message contenant les instructions pour activer votre compte vous a Γ©tΓ© envoyΓ© Γ  l'adresse %{email}.
172 notice_account_unknown_email: Aucun compte ne correspond Γ  cette adresse.
172 notice_account_unknown_email: Aucun compte ne correspond Γ  cette adresse.
173 notice_account_not_activated_yet: Vous n'avez pas encore activΓ© votre compte. Si vous voulez recevoir un nouveau message d'activation, veuillez <a href="%{url}">cliquer sur ce lien</a>.
173 notice_account_not_activated_yet: Vous n'avez pas encore activΓ© votre compte. Si vous voulez recevoir un nouveau message d'activation, veuillez <a href="%{url}">cliquer sur ce lien</a>.
174 notice_account_locked: Votre compte est verrouillΓ©.
174 notice_account_locked: Votre compte est verrouillΓ©.
175 notice_can_t_change_password: Ce compte utilise une authentification externe. Impossible de changer le mot de passe.
175 notice_can_t_change_password: Ce compte utilise une authentification externe. Impossible de changer le mot de passe.
176 notice_account_lost_email_sent: Un message contenant les instructions pour choisir un nouveau mot de passe vous a Γ©tΓ© envoyΓ©.
176 notice_account_lost_email_sent: Un message contenant les instructions pour choisir un nouveau mot de passe vous a Γ©tΓ© envoyΓ©.
177 notice_account_activated: Votre compte a Γ©tΓ© activΓ©. Vous pouvez Γ  prΓ©sent vous connecter.
177 notice_account_activated: Votre compte a Γ©tΓ© activΓ©. Vous pouvez Γ  prΓ©sent vous connecter.
178 notice_successful_create: Création effectuée avec succès.
178 notice_successful_create: Création effectuée avec succès.
179 notice_successful_update: Mise à jour effectuée avec succès.
179 notice_successful_update: Mise à jour effectuée avec succès.
180 notice_successful_delete: Suppression effectuée avec succès.
180 notice_successful_delete: Suppression effectuée avec succès.
181 notice_successful_connection: Connexion rΓ©ussie.
181 notice_successful_connection: Connexion rΓ©ussie.
182 notice_file_not_found: "La page Γ  laquelle vous souhaitez accΓ©der n'existe pas ou a Γ©tΓ© supprimΓ©e."
182 notice_file_not_found: "La page Γ  laquelle vous souhaitez accΓ©der n'existe pas ou a Γ©tΓ© supprimΓ©e."
183 notice_locking_conflict: Les donnΓ©es ont Γ©tΓ© mises Γ  jour par un autre utilisateur. Mise Γ  jour impossible.
183 notice_locking_conflict: Les donnΓ©es ont Γ©tΓ© mises Γ  jour par un autre utilisateur. Mise Γ  jour impossible.
184 notice_not_authorized: "Vous n'Γͺtes pas autorisΓ© Γ  accΓ©der Γ  cette page."
184 notice_not_authorized: "Vous n'Γͺtes pas autorisΓ© Γ  accΓ©der Γ  cette page."
185 notice_not_authorized_archived_project: Le projet auquel vous tentez d'accΓ©der a Γ©tΓ© archivΓ©.
185 notice_not_authorized_archived_project: Le projet auquel vous tentez d'accΓ©der a Γ©tΓ© archivΓ©.
186 notice_email_sent: "Un email a Γ©tΓ© envoyΓ© Γ  %{value}"
186 notice_email_sent: "Un email a Γ©tΓ© envoyΓ© Γ  %{value}"
187 notice_email_error: "Erreur lors de l'envoi de l'email (%{value})"
187 notice_email_error: "Erreur lors de l'envoi de l'email (%{value})"
188 notice_feeds_access_key_reseted: "Votre clé d'accès aux flux Atom a été réinitialisée."
188 notice_feeds_access_key_reseted: "Votre clé d'accès aux flux Atom a été réinitialisée."
189 notice_api_access_key_reseted: Votre clé d'accès API a été réinitialisée.
189 notice_api_access_key_reseted: Votre clé d'accès API a été réinitialisée.
190 notice_failed_to_save_issues: "%{count} demande(s) sur les %{total} sΓ©lectionnΓ©es n'ont pas pu Γͺtre mise(s) Γ  jour : %{ids}."
190 notice_failed_to_save_issues: "%{count} demande(s) sur les %{total} sΓ©lectionnΓ©es n'ont pas pu Γͺtre mise(s) Γ  jour : %{ids}."
191 notice_failed_to_save_time_entries: "%{count} temps passΓ©(s) sur les %{total} sΓ©lectionnΓ©s n'ont pas pu Γͺtre mis Γ  jour: %{ids}."
191 notice_failed_to_save_time_entries: "%{count} temps passΓ©(s) sur les %{total} sΓ©lectionnΓ©s n'ont pas pu Γͺtre mis Γ  jour: %{ids}."
192 notice_failed_to_save_members: "Erreur lors de la sauvegarde des membres: %{errors}."
192 notice_failed_to_save_members: "Erreur lors de la sauvegarde des membres: %{errors}."
193 notice_no_issue_selected: "Aucune demande sΓ©lectionnΓ©e ! Cochez les demandes que vous voulez mettre Γ  jour."
193 notice_no_issue_selected: "Aucune demande sΓ©lectionnΓ©e ! Cochez les demandes que vous voulez mettre Γ  jour."
194 notice_account_pending: "Votre compte a été créé et attend l'approbation de l'administrateur."
194 notice_account_pending: "Votre compte a été créé et attend l'approbation de l'administrateur."
195 notice_default_data_loaded: Paramétrage par défaut chargé avec succès.
195 notice_default_data_loaded: Paramétrage par défaut chargé avec succès.
196 notice_unable_delete_version: Impossible de supprimer cette version.
196 notice_unable_delete_version: Impossible de supprimer cette version.
197 notice_unable_delete_time_entry: Impossible de supprimer le temps passΓ©.
197 notice_unable_delete_time_entry: Impossible de supprimer le temps passΓ©.
198 notice_issue_done_ratios_updated: L'avancement des demandes a Γ©tΓ© mis Γ  jour.
198 notice_issue_done_ratios_updated: L'avancement des demandes a Γ©tΓ© mis Γ  jour.
199 notice_gantt_chart_truncated: "Le diagramme a Γ©tΓ© tronquΓ© car il excΓ¨de le nombre maximal d'Γ©lΓ©ments pouvant Γͺtre affichΓ©s (%{max})"
199 notice_gantt_chart_truncated: "Le diagramme a Γ©tΓ© tronquΓ© car il excΓ¨de le nombre maximal d'Γ©lΓ©ments pouvant Γͺtre affichΓ©s (%{max})"
200 notice_issue_successful_create: "Demande %{id} créée."
200 notice_issue_successful_create: "Demande %{id} créée."
201 notice_issue_update_conflict: "La demande a Γ©tΓ© mise Γ  jour par un autre utilisateur pendant que vous la modifiez."
201 notice_issue_update_conflict: "La demande a Γ©tΓ© mise Γ  jour par un autre utilisateur pendant que vous la modifiez."
202 notice_account_deleted: "Votre compte a Γ©tΓ© dΓ©finitivement supprimΓ©."
202 notice_account_deleted: "Votre compte a Γ©tΓ© dΓ©finitivement supprimΓ©."
203 notice_user_successful_create: "Utilisateur %{id} créé."
203 notice_user_successful_create: "Utilisateur %{id} créé."
204 notice_new_password_must_be_different: Votre nouveau mot de passe doit Γͺtre diffΓ©rent de votre mot de passe actuel
204 notice_new_password_must_be_different: Votre nouveau mot de passe doit Γͺtre diffΓ©rent de votre mot de passe actuel
205 notice_import_finished: "Les %{count} Γ©lΓ©ments ont Γ©tΓ© importΓ©(s)."
205 notice_import_finished: "Les %{count} Γ©lΓ©ments ont Γ©tΓ© importΓ©(s)."
206 notice_import_finished_with_errors: "%{count} Γ©lΓ©ment(s) sur %{total} n'ont pas pu Γͺtre importΓ©(s)."
206 notice_import_finished_with_errors: "%{count} Γ©lΓ©ment(s) sur %{total} n'ont pas pu Γͺtre importΓ©(s)."
207
207
208 error_can_t_load_default_data: "Une erreur s'est produite lors du chargement du paramΓ©trage : %{value}"
208 error_can_t_load_default_data: "Une erreur s'est produite lors du chargement du paramΓ©trage : %{value}"
209 error_scm_not_found: "L'entrΓ©e et/ou la rΓ©vision demandΓ©e n'existe pas dans le dΓ©pΓ΄t."
209 error_scm_not_found: "L'entrΓ©e et/ou la rΓ©vision demandΓ©e n'existe pas dans le dΓ©pΓ΄t."
210 error_scm_command_failed: "Une erreur s'est produite lors de l'accès au dépôt : %{value}"
210 error_scm_command_failed: "Une erreur s'est produite lors de l'accès au dépôt : %{value}"
211 error_scm_annotate: "L'entrΓ©e n'existe pas ou ne peut pas Γͺtre annotΓ©e."
211 error_scm_annotate: "L'entrΓ©e n'existe pas ou ne peut pas Γͺtre annotΓ©e."
212 error_scm_annotate_big_text_file: Cette entrΓ©e ne peut pas Γͺtre annotΓ©e car elle excΓ¨de la taille maximale.
212 error_scm_annotate_big_text_file: Cette entrΓ©e ne peut pas Γͺtre annotΓ©e car elle excΓ¨de la taille maximale.
213 error_issue_not_found_in_project: "La demande n'existe pas ou n'appartient pas Γ  ce projet"
213 error_issue_not_found_in_project: "La demande n'existe pas ou n'appartient pas Γ  ce projet"
214 error_no_tracker_in_project: "Aucun tracker n'est associΓ© Γ  ce projet. VΓ©rifier la configuration du projet."
214 error_no_tracker_in_project: "Aucun tracker n'est associΓ© Γ  ce projet. VΓ©rifier la configuration du projet."
215 error_no_default_issue_status: "Aucun statut de demande n'est dΓ©fini par dΓ©faut. VΓ©rifier votre configuration (Administration -> Statuts de demandes)."
215 error_no_default_issue_status: "Aucun statut de demande n'est dΓ©fini par dΓ©faut. VΓ©rifier votre configuration (Administration -> Statuts de demandes)."
216 error_can_not_delete_custom_field: Impossible de supprimer le champ personnalisΓ©
216 error_can_not_delete_custom_field: Impossible de supprimer le champ personnalisΓ©
217 error_can_not_delete_tracker: Ce tracker contient des demandes et ne peut pas Γͺtre supprimΓ©.
217 error_can_not_delete_tracker: Ce tracker contient des demandes et ne peut pas Γͺtre supprimΓ©.
218 error_can_not_remove_role: Ce rΓ΄le est utilisΓ© et ne peut pas Γͺtre supprimΓ©.
218 error_can_not_remove_role: Ce rΓ΄le est utilisΓ© et ne peut pas Γͺtre supprimΓ©.
219 error_can_not_reopen_issue_on_closed_version: 'Une demande assignΓ©e Γ  une version fermΓ©e ne peut pas Γͺtre rΓ©ouverte'
219 error_can_not_reopen_issue_on_closed_version: 'Une demande assignΓ©e Γ  une version fermΓ©e ne peut pas Γͺtre rΓ©ouverte'
220 error_can_not_archive_project: "Ce projet ne peut pas Γͺtre archivΓ©"
220 error_can_not_archive_project: "Ce projet ne peut pas Γͺtre archivΓ©"
221 error_issue_done_ratios_not_updated: L'avancement des demandes n'a pas pu Γͺtre mis Γ  jour.
221 error_issue_done_ratios_not_updated: L'avancement des demandes n'a pas pu Γͺtre mis Γ  jour.
222 error_workflow_copy_source: 'Veuillez sΓ©lectionner un tracker et/ou un rΓ΄le source'
222 error_workflow_copy_source: 'Veuillez sΓ©lectionner un tracker et/ou un rΓ΄le source'
223 error_workflow_copy_target: 'Veuillez sΓ©lectionner les trackers et rΓ΄les cibles'
223 error_workflow_copy_target: 'Veuillez sΓ©lectionner les trackers et rΓ΄les cibles'
224 error_unable_delete_issue_status: Impossible de supprimer le statut de demande
224 error_unable_delete_issue_status: Impossible de supprimer le statut de demande
225 error_unable_to_connect: Connexion impossible (%{value})
225 error_unable_to_connect: Connexion impossible (%{value})
226 error_attachment_too_big: Ce fichier ne peut pas Γͺtre attachΓ© car il excΓ¨de la taille maximale autorisΓ©e (%{max_size})
226 error_attachment_too_big: Ce fichier ne peut pas Γͺtre attachΓ© car il excΓ¨de la taille maximale autorisΓ©e (%{max_size})
227 error_session_expired: "Votre session a expirΓ©. Veuillez vous reconnecter."
227 error_session_expired: "Votre session a expirΓ©. Veuillez vous reconnecter."
228 warning_attachments_not_saved: "%{count} fichier(s) n'ont pas pu Γͺtre sauvegardΓ©s."
228 warning_attachments_not_saved: "%{count} fichier(s) n'ont pas pu Γͺtre sauvegardΓ©s."
229 error_password_expired: "Votre mot de passe a expirΓ© ou nΓ©cessite d'Γͺtre changΓ©."
229 error_password_expired: "Votre mot de passe a expirΓ© ou nΓ©cessite d'Γͺtre changΓ©."
230 error_invalid_file_encoding: "Le fichier n'est pas un fichier %{encoding} valide"
230 error_invalid_file_encoding: "Le fichier n'est pas un fichier %{encoding} valide"
231 error_invalid_csv_file_or_settings: "Le fichier n'est pas un fichier CSV ou n'est pas conforme aux paramètres sélectionnés"
231 error_invalid_csv_file_or_settings: "Le fichier n'est pas un fichier CSV ou n'est pas conforme aux paramètres sélectionnés"
232 error_can_not_read_import_file: "Une erreur est survenue lors de la lecture du fichier Γ  importer"
232 error_can_not_read_import_file: "Une erreur est survenue lors de la lecture du fichier Γ  importer"
233
233
234 mail_subject_lost_password: "Votre mot de passe %{value}"
234 mail_subject_lost_password: "Votre mot de passe %{value}"
235 mail_body_lost_password: 'Pour changer votre mot de passe, cliquez sur le lien suivant :'
235 mail_body_lost_password: 'Pour changer votre mot de passe, cliquez sur le lien suivant :'
236 mail_subject_register: "Activation de votre compte %{value}"
236 mail_subject_register: "Activation de votre compte %{value}"
237 mail_body_register: 'Pour activer votre compte, cliquez sur le lien suivant :'
237 mail_body_register: 'Pour activer votre compte, cliquez sur le lien suivant :'
238 mail_body_account_information_external: "Vous pouvez utiliser votre compte %{value} pour vous connecter."
238 mail_body_account_information_external: "Vous pouvez utiliser votre compte %{value} pour vous connecter."
239 mail_body_account_information: Paramètres de connexion de votre compte
239 mail_body_account_information: Paramètres de connexion de votre compte
240 mail_subject_account_activation_request: "Demande d'activation d'un compte %{value}"
240 mail_subject_account_activation_request: "Demande d'activation d'un compte %{value}"
241 mail_body_account_activation_request: "Un nouvel utilisateur (%{value}) s'est inscrit. Son compte nΓ©cessite votre approbation :"
241 mail_body_account_activation_request: "Un nouvel utilisateur (%{value}) s'est inscrit. Son compte nΓ©cessite votre approbation :"
242 mail_subject_reminder: "%{count} demande(s) arrivent Γ  Γ©chΓ©ance (%{days})"
242 mail_subject_reminder: "%{count} demande(s) arrivent Γ  Γ©chΓ©ance (%{days})"
243 mail_body_reminder: "%{count} demande(s) qui vous sont assignΓ©es arrivent Γ  Γ©chΓ©ance dans les %{days} prochains jours :"
243 mail_body_reminder: "%{count} demande(s) qui vous sont assignΓ©es arrivent Γ  Γ©chΓ©ance dans les %{days} prochains jours :"
244 mail_subject_wiki_content_added: "Page wiki '%{id}' ajoutΓ©e"
244 mail_subject_wiki_content_added: "Page wiki '%{id}' ajoutΓ©e"
245 mail_body_wiki_content_added: "La page wiki '%{id}' a Γ©tΓ© ajoutΓ©e par %{author}."
245 mail_body_wiki_content_added: "La page wiki '%{id}' a Γ©tΓ© ajoutΓ©e par %{author}."
246 mail_subject_wiki_content_updated: "Page wiki '%{id}' mise Γ  jour"
246 mail_subject_wiki_content_updated: "Page wiki '%{id}' mise Γ  jour"
247 mail_body_wiki_content_updated: "La page wiki '%{id}' a Γ©tΓ© mise Γ  jour par %{author}."
247 mail_body_wiki_content_updated: "La page wiki '%{id}' a Γ©tΓ© mise Γ  jour par %{author}."
248
248
249 field_name: Nom
249 field_name: Nom
250 field_description: Description
250 field_description: Description
251 field_summary: RΓ©sumΓ©
251 field_summary: RΓ©sumΓ©
252 field_is_required: Obligatoire
252 field_is_required: Obligatoire
253 field_firstname: PrΓ©nom
253 field_firstname: PrΓ©nom
254 field_lastname: Nom
254 field_lastname: Nom
255 field_mail: Email
255 field_mail: Email
256 field_address: Email
256 field_address: Email
257 field_filename: Fichier
257 field_filename: Fichier
258 field_filesize: Taille
258 field_filesize: Taille
259 field_downloads: TΓ©lΓ©chargements
259 field_downloads: TΓ©lΓ©chargements
260 field_author: Auteur
260 field_author: Auteur
261 field_created_on: Créé
261 field_created_on: Créé
262 field_updated_on: Mis-Γ -jour
262 field_updated_on: Mis-Γ -jour
263 field_closed_on: FermΓ©
263 field_closed_on: FermΓ©
264 field_field_format: Format
264 field_field_format: Format
265 field_is_for_all: Pour tous les projets
265 field_is_for_all: Pour tous les projets
266 field_possible_values: Valeurs possibles
266 field_possible_values: Valeurs possibles
267 field_regexp: Expression régulière
267 field_regexp: Expression régulière
268 field_min_length: Longueur minimum
268 field_min_length: Longueur minimum
269 field_max_length: Longueur maximum
269 field_max_length: Longueur maximum
270 field_value: Valeur
270 field_value: Valeur
271 field_category: CatΓ©gorie
271 field_category: CatΓ©gorie
272 field_title: Titre
272 field_title: Titre
273 field_project: Projet
273 field_project: Projet
274 field_issue: Demande
274 field_issue: Demande
275 field_status: Statut
275 field_status: Statut
276 field_notes: Notes
276 field_notes: Notes
277 field_is_closed: Demande fermΓ©e
277 field_is_closed: Demande fermΓ©e
278 field_is_default: Valeur par dΓ©faut
278 field_is_default: Valeur par dΓ©faut
279 field_tracker: Tracker
279 field_tracker: Tracker
280 field_subject: Sujet
280 field_subject: Sujet
281 field_due_date: EchΓ©ance
281 field_due_date: EchΓ©ance
282 field_assigned_to: AssignΓ© Γ 
282 field_assigned_to: AssignΓ© Γ 
283 field_priority: PrioritΓ©
283 field_priority: PrioritΓ©
284 field_fixed_version: Version cible
284 field_fixed_version: Version cible
285 field_user: Utilisateur
285 field_user: Utilisateur
286 field_principal: Principal
286 field_principal: Principal
287 field_role: RΓ΄le
287 field_role: RΓ΄le
288 field_homepage: Site web
288 field_homepage: Site web
289 field_is_public: Public
289 field_is_public: Public
290 field_parent: Sous-projet de
290 field_parent: Sous-projet de
291 field_is_in_roadmap: Demandes affichΓ©es dans la roadmap
291 field_is_in_roadmap: Demandes affichΓ©es dans la roadmap
292 field_login: Identifiant
292 field_login: Identifiant
293 field_mail_notification: Notifications par mail
293 field_mail_notification: Notifications par mail
294 field_admin: Administrateur
294 field_admin: Administrateur
295 field_last_login_on: Dernière connexion
295 field_last_login_on: Dernière connexion
296 field_language: Langue
296 field_language: Langue
297 field_effective_date: Date
297 field_effective_date: Date
298 field_password: Mot de passe
298 field_password: Mot de passe
299 field_new_password: Nouveau mot de passe
299 field_new_password: Nouveau mot de passe
300 field_password_confirmation: Confirmation
300 field_password_confirmation: Confirmation
301 field_version: Version
301 field_version: Version
302 field_type: Type
302 field_type: Type
303 field_host: HΓ΄te
303 field_host: HΓ΄te
304 field_port: Port
304 field_port: Port
305 field_account: Compte
305 field_account: Compte
306 field_base_dn: Base DN
306 field_base_dn: Base DN
307 field_attr_login: Attribut Identifiant
307 field_attr_login: Attribut Identifiant
308 field_attr_firstname: Attribut PrΓ©nom
308 field_attr_firstname: Attribut PrΓ©nom
309 field_attr_lastname: Attribut Nom
309 field_attr_lastname: Attribut Nom
310 field_attr_mail: Attribut Email
310 field_attr_mail: Attribut Email
311 field_onthefly: CrΓ©ation des utilisateurs Γ  la volΓ©e
311 field_onthefly: CrΓ©ation des utilisateurs Γ  la volΓ©e
312 field_start_date: DΓ©but
312 field_start_date: DΓ©but
313 field_done_ratio: "% rΓ©alisΓ©"
313 field_done_ratio: "% rΓ©alisΓ©"
314 field_auth_source: Mode d'authentification
314 field_auth_source: Mode d'authentification
315 field_hide_mail: Cacher mon adresse mail
315 field_hide_mail: Cacher mon adresse mail
316 field_comments: Commentaire
316 field_comments: Commentaire
317 field_url: URL
317 field_url: URL
318 field_start_page: Page de dΓ©marrage
318 field_start_page: Page de dΓ©marrage
319 field_subproject: Sous-projet
319 field_subproject: Sous-projet
320 field_hours: Heures
320 field_hours: Heures
321 field_activity: ActivitΓ©
321 field_activity: ActivitΓ©
322 field_spent_on: Date
322 field_spent_on: Date
323 field_identifier: Identifiant
323 field_identifier: Identifiant
324 field_is_filter: UtilisΓ© comme filtre
324 field_is_filter: UtilisΓ© comme filtre
325 field_issue_to: Demande liΓ©e
325 field_issue_to: Demande liΓ©e
326 field_delay: Retard
326 field_delay: Retard
327 field_assignable: Demandes assignables Γ  ce rΓ΄le
327 field_assignable: Demandes assignables Γ  ce rΓ΄le
328 field_redirect_existing_links: Rediriger les liens existants
328 field_redirect_existing_links: Rediriger les liens existants
329 field_estimated_hours: Temps estimΓ©
329 field_estimated_hours: Temps estimΓ©
330 field_column_names: Colonnes
330 field_column_names: Colonnes
331 field_time_entries: Temps passΓ©
331 field_time_entries: Temps passΓ©
332 field_time_zone: Fuseau horaire
332 field_time_zone: Fuseau horaire
333 field_searchable: UtilisΓ© pour les recherches
333 field_searchable: UtilisΓ© pour les recherches
334 field_default_value: Valeur par dΓ©faut
334 field_default_value: Valeur par dΓ©faut
335 field_comments_sorting: Afficher les commentaires
335 field_comments_sorting: Afficher les commentaires
336 field_parent_title: Page parent
336 field_parent_title: Page parent
337 field_editable: Modifiable
337 field_editable: Modifiable
338 field_watcher: Observateur
338 field_watcher: Observateur
339 field_identity_url: URL OpenID
339 field_identity_url: URL OpenID
340 field_content: Contenu
340 field_content: Contenu
341 field_group_by: Grouper par
341 field_group_by: Grouper par
342 field_sharing: Partage
342 field_sharing: Partage
343 field_parent_issue: TΓ’che parente
343 field_parent_issue: TΓ’che parente
344 field_member_of_group: Groupe de l'assignΓ©
344 field_member_of_group: Groupe de l'assignΓ©
345 field_assigned_to_role: RΓ΄le de l'assignΓ©
345 field_assigned_to_role: RΓ΄le de l'assignΓ©
346 field_text: Champ texte
346 field_text: Champ texte
347 field_visible: Visible
347 field_visible: Visible
348 field_warn_on_leaving_unsaved: "M'avertir lorsque je quitte une page contenant du texte non sauvegardΓ©"
348 field_warn_on_leaving_unsaved: "M'avertir lorsque je quitte une page contenant du texte non sauvegardΓ©"
349 field_issues_visibility: VisibilitΓ© des demandes
349 field_issues_visibility: VisibilitΓ© des demandes
350 field_is_private: PrivΓ©e
350 field_is_private: PrivΓ©e
351 field_commit_logs_encoding: Encodage des messages de commit
351 field_commit_logs_encoding: Encodage des messages de commit
352 field_scm_path_encoding: Encodage des chemins
352 field_scm_path_encoding: Encodage des chemins
353 field_path_to_repository: Chemin du dΓ©pΓ΄t
353 field_path_to_repository: Chemin du dΓ©pΓ΄t
354 field_root_directory: RΓ©pertoire racine
354 field_root_directory: RΓ©pertoire racine
355 field_cvsroot: CVSROOT
355 field_cvsroot: CVSROOT
356 field_cvs_module: Module
356 field_cvs_module: Module
357 field_repository_is_default: DΓ©pΓ΄t principal
357 field_repository_is_default: DΓ©pΓ΄t principal
358 field_multiple: Valeurs multiples
358 field_multiple: Valeurs multiples
359 field_auth_source_ldap_filter: Filtre LDAP
359 field_auth_source_ldap_filter: Filtre LDAP
360 field_core_fields: Champs standards
360 field_core_fields: Champs standards
361 field_timeout: "Timeout (en secondes)"
361 field_timeout: "Timeout (en secondes)"
362 field_board_parent: Forum parent
362 field_board_parent: Forum parent
363 field_private_notes: Notes privΓ©es
363 field_private_notes: Notes privΓ©es
364 field_inherit_members: HΓ©riter les membres
364 field_inherit_members: HΓ©riter les membres
365 field_generate_password: GΓ©nΓ©rer un mot de passe
365 field_generate_password: GΓ©nΓ©rer un mot de passe
366 field_must_change_passwd: Doit changer de mot de passe Γ  la prochaine connexion
366 field_must_change_passwd: Doit changer de mot de passe Γ  la prochaine connexion
367 field_default_status: Statut par dΓ©faut
367 field_default_status: Statut par dΓ©faut
368 field_users_visibility: VisibilitΓ© des utilisateurs
368 field_users_visibility: VisibilitΓ© des utilisateurs
369 field_time_entries_visibility: VisibilitΓ© du temps passΓ©
369 field_time_entries_visibility: VisibilitΓ© du temps passΓ©
370 field_total_estimated_hours: Temps estimΓ© total
370 field_total_estimated_hours: Temps estimΓ© total
371 field_default_version: Version par dΓ©faut
371
372
372 setting_app_title: Titre de l'application
373 setting_app_title: Titre de l'application
373 setting_app_subtitle: Sous-titre de l'application
374 setting_app_subtitle: Sous-titre de l'application
374 setting_welcome_text: Texte d'accueil
375 setting_welcome_text: Texte d'accueil
375 setting_default_language: Langue par dΓ©faut
376 setting_default_language: Langue par dΓ©faut
376 setting_login_required: Authentification obligatoire
377 setting_login_required: Authentification obligatoire
377 setting_self_registration: Inscription des nouveaux utilisateurs
378 setting_self_registration: Inscription des nouveaux utilisateurs
378 setting_attachment_max_size: Taille maximale des fichiers
379 setting_attachment_max_size: Taille maximale des fichiers
379 setting_issues_export_limit: Limite d'exportation des demandes
380 setting_issues_export_limit: Limite d'exportation des demandes
380 setting_mail_from: Adresse d'Γ©mission
381 setting_mail_from: Adresse d'Γ©mission
381 setting_bcc_recipients: Destinataires en copie cachΓ©e (cci)
382 setting_bcc_recipients: Destinataires en copie cachΓ©e (cci)
382 setting_plain_text_mail: Mail en texte brut (non HTML)
383 setting_plain_text_mail: Mail en texte brut (non HTML)
383 setting_host_name: Nom d'hΓ΄te et chemin
384 setting_host_name: Nom d'hΓ΄te et chemin
384 setting_text_formatting: Formatage du texte
385 setting_text_formatting: Formatage du texte
385 setting_wiki_compression: Compression de l'historique des pages wiki
386 setting_wiki_compression: Compression de l'historique des pages wiki
386 setting_feeds_limit: Nombre maximal d'Γ©lΓ©ments dans les flux Atom
387 setting_feeds_limit: Nombre maximal d'Γ©lΓ©ments dans les flux Atom
387 setting_default_projects_public: DΓ©finir les nouveaux projets comme publics par dΓ©faut
388 setting_default_projects_public: DΓ©finir les nouveaux projets comme publics par dΓ©faut
388 setting_autofetch_changesets: RΓ©cupΓ©ration automatique des commits
389 setting_autofetch_changesets: RΓ©cupΓ©ration automatique des commits
389 setting_sys_api_enabled: Activer les WS pour la gestion des dΓ©pΓ΄ts
390 setting_sys_api_enabled: Activer les WS pour la gestion des dΓ©pΓ΄ts
390 setting_commit_ref_keywords: Mots-clΓ©s de rΓ©fΓ©rencement
391 setting_commit_ref_keywords: Mots-clΓ©s de rΓ©fΓ©rencement
391 setting_commit_fix_keywords: Mots-clΓ©s de rΓ©solution
392 setting_commit_fix_keywords: Mots-clΓ©s de rΓ©solution
392 setting_autologin: DurΓ©e maximale de connexion automatique
393 setting_autologin: DurΓ©e maximale de connexion automatique
393 setting_date_format: Format de date
394 setting_date_format: Format de date
394 setting_time_format: Format d'heure
395 setting_time_format: Format d'heure
395 setting_cross_project_issue_relations: Autoriser les relations entre demandes de diffΓ©rents projets
396 setting_cross_project_issue_relations: Autoriser les relations entre demandes de diffΓ©rents projets
396 setting_cross_project_subtasks: Autoriser les sous-tΓ’ches dans des projets diffΓ©rents
397 setting_cross_project_subtasks: Autoriser les sous-tΓ’ches dans des projets diffΓ©rents
397 setting_issue_list_default_columns: Colonnes affichΓ©es par dΓ©faut sur la liste des demandes
398 setting_issue_list_default_columns: Colonnes affichΓ©es par dΓ©faut sur la liste des demandes
398 setting_repositories_encodings: Encodages des fichiers et des dΓ©pΓ΄ts
399 setting_repositories_encodings: Encodages des fichiers et des dΓ©pΓ΄ts
399 setting_emails_header: En-tΓͺte des emails
400 setting_emails_header: En-tΓͺte des emails
400 setting_emails_footer: Pied-de-page des emails
401 setting_emails_footer: Pied-de-page des emails
401 setting_protocol: Protocole
402 setting_protocol: Protocole
402 setting_per_page_options: Options d'objets affichΓ©s par page
403 setting_per_page_options: Options d'objets affichΓ©s par page
403 setting_user_format: Format d'affichage des utilisateurs
404 setting_user_format: Format d'affichage des utilisateurs
404 setting_activity_days_default: Nombre de jours affichΓ©s sur l'activitΓ© des projets
405 setting_activity_days_default: Nombre de jours affichΓ©s sur l'activitΓ© des projets
405 setting_display_subprojects_issues: Afficher par dΓ©faut les demandes des sous-projets sur les projets principaux
406 setting_display_subprojects_issues: Afficher par dΓ©faut les demandes des sous-projets sur les projets principaux
406 setting_enabled_scm: SCM activΓ©s
407 setting_enabled_scm: SCM activΓ©s
407 setting_mail_handler_body_delimiters: "Tronquer les emails après l'une de ces lignes"
408 setting_mail_handler_body_delimiters: "Tronquer les emails après l'une de ces lignes"
408 setting_mail_handler_api_enabled: "Activer le WS pour la rΓ©ception d'emails"
409 setting_mail_handler_api_enabled: "Activer le WS pour la rΓ©ception d'emails"
409 setting_mail_handler_api_key: ClΓ© de protection de l'API
410 setting_mail_handler_api_key: ClΓ© de protection de l'API
410 setting_sequential_project_identifiers: GΓ©nΓ©rer des identifiants de projet sΓ©quentiels
411 setting_sequential_project_identifiers: GΓ©nΓ©rer des identifiants de projet sΓ©quentiels
411 setting_gravatar_enabled: Afficher les Gravatar des utilisateurs
412 setting_gravatar_enabled: Afficher les Gravatar des utilisateurs
412 setting_gravatar_default: Image Gravatar par dΓ©faut
413 setting_gravatar_default: Image Gravatar par dΓ©faut
413 setting_diff_max_lines_displayed: Nombre maximum de lignes de diff affichΓ©es
414 setting_diff_max_lines_displayed: Nombre maximum de lignes de diff affichΓ©es
414 setting_file_max_size_displayed: Taille maximum des fichiers texte affichΓ©s en ligne
415 setting_file_max_size_displayed: Taille maximum des fichiers texte affichΓ©s en ligne
415 setting_repository_log_display_limit: "Nombre maximum de rΓ©visions affichΓ©es sur l'historique d'un fichier"
416 setting_repository_log_display_limit: "Nombre maximum de rΓ©visions affichΓ©es sur l'historique d'un fichier"
416 setting_openid: "Autoriser l'authentification et l'enregistrement OpenID"
417 setting_openid: "Autoriser l'authentification et l'enregistrement OpenID"
417 setting_password_max_age: Expiration des mots de passe après
418 setting_password_max_age: Expiration des mots de passe après
418 setting_password_min_length: Longueur minimum des mots de passe
419 setting_password_min_length: Longueur minimum des mots de passe
419 setting_new_project_user_role_id: RΓ΄le donnΓ© Γ  un utilisateur non-administrateur qui crΓ©e un projet
420 setting_new_project_user_role_id: RΓ΄le donnΓ© Γ  un utilisateur non-administrateur qui crΓ©e un projet
420 setting_default_projects_modules: Modules activΓ©s par dΓ©faut pour les nouveaux projets
421 setting_default_projects_modules: Modules activΓ©s par dΓ©faut pour les nouveaux projets
421 setting_issue_done_ratio: Calcul de l'avancement des demandes
422 setting_issue_done_ratio: Calcul de l'avancement des demandes
422 setting_issue_done_ratio_issue_field: 'Utiliser le champ % effectuΓ©'
423 setting_issue_done_ratio_issue_field: 'Utiliser le champ % effectuΓ©'
423 setting_issue_done_ratio_issue_status: Utiliser le statut
424 setting_issue_done_ratio_issue_status: Utiliser le statut
424 setting_start_of_week: Jour de dΓ©but des calendriers
425 setting_start_of_week: Jour de dΓ©but des calendriers
425 setting_rest_api_enabled: Activer l'API REST
426 setting_rest_api_enabled: Activer l'API REST
426 setting_cache_formatted_text: Mettre en cache le texte formatΓ©
427 setting_cache_formatted_text: Mettre en cache le texte formatΓ©
427 setting_default_notification_option: Option de notification par dΓ©faut
428 setting_default_notification_option: Option de notification par dΓ©faut
428 setting_commit_logtime_enabled: Permettre la saisie de temps
429 setting_commit_logtime_enabled: Permettre la saisie de temps
429 setting_commit_logtime_activity_id: ActivitΓ© pour le temps saisi
430 setting_commit_logtime_activity_id: ActivitΓ© pour le temps saisi
430 setting_gantt_items_limit: Nombre maximum d'Γ©lΓ©ments affichΓ©s sur le gantt
431 setting_gantt_items_limit: Nombre maximum d'Γ©lΓ©ments affichΓ©s sur le gantt
431 setting_issue_group_assignment: Permettre l'assignement des demandes aux groupes
432 setting_issue_group_assignment: Permettre l'assignement des demandes aux groupes
432 setting_default_issue_start_date_to_creation_date: Donner Γ  la date de dΓ©but d'une nouvelle demande la valeur de la date du jour
433 setting_default_issue_start_date_to_creation_date: Donner Γ  la date de dΓ©but d'une nouvelle demande la valeur de la date du jour
433 setting_commit_cross_project_ref: Permettre le rΓ©fΓ©rencement et la rΓ©solution des demandes de tous les autres projets
434 setting_commit_cross_project_ref: Permettre le rΓ©fΓ©rencement et la rΓ©solution des demandes de tous les autres projets
434 setting_unsubscribe: Permettre aux utilisateurs de supprimer leur propre compte
435 setting_unsubscribe: Permettre aux utilisateurs de supprimer leur propre compte
435 setting_session_lifetime: DurΓ©e de vie maximale des sessions
436 setting_session_lifetime: DurΓ©e de vie maximale des sessions
436 setting_session_timeout: DurΓ©e maximale d'inactivitΓ©
437 setting_session_timeout: DurΓ©e maximale d'inactivitΓ©
437 setting_thumbnails_enabled: Afficher les vignettes des images
438 setting_thumbnails_enabled: Afficher les vignettes des images
438 setting_thumbnails_size: Taille des vignettes (en pixels)
439 setting_thumbnails_size: Taille des vignettes (en pixels)
439 setting_non_working_week_days: Jours non travaillΓ©s
440 setting_non_working_week_days: Jours non travaillΓ©s
440 setting_jsonp_enabled: Activer le support JSONP
441 setting_jsonp_enabled: Activer le support JSONP
441 setting_default_projects_tracker_ids: Trackers par dΓ©faut pour les nouveaux projets
442 setting_default_projects_tracker_ids: Trackers par dΓ©faut pour les nouveaux projets
442 setting_mail_handler_excluded_filenames: Exclure les fichiers attachΓ©s par leur nom
443 setting_mail_handler_excluded_filenames: Exclure les fichiers attachΓ©s par leur nom
443 setting_force_default_language_for_anonymous: Forcer la langue par dΓ©fault pour les utilisateurs anonymes
444 setting_force_default_language_for_anonymous: Forcer la langue par dΓ©fault pour les utilisateurs anonymes
444 setting_force_default_language_for_loggedin: Forcer la langue par dΓ©fault pour les utilisateurs identifiΓ©s
445 setting_force_default_language_for_loggedin: Forcer la langue par dΓ©fault pour les utilisateurs identifiΓ©s
445 setting_link_copied_issue: Lier les demandes lors de la copie
446 setting_link_copied_issue: Lier les demandes lors de la copie
446 setting_max_additional_emails: Nombre maximal d'adresses email additionnelles
447 setting_max_additional_emails: Nombre maximal d'adresses email additionnelles
447 setting_search_results_per_page: RΓ©sultats de recherche affichΓ©s par page
448 setting_search_results_per_page: RΓ©sultats de recherche affichΓ©s par page
448
449
449 permission_add_project: CrΓ©er un projet
450 permission_add_project: CrΓ©er un projet
450 permission_add_subprojects: CrΓ©er des sous-projets
451 permission_add_subprojects: CrΓ©er des sous-projets
451 permission_edit_project: Modifier le projet
452 permission_edit_project: Modifier le projet
452 permission_close_project: Fermer / rΓ©ouvrir le projet
453 permission_close_project: Fermer / rΓ©ouvrir le projet
453 permission_select_project_modules: Choisir les modules
454 permission_select_project_modules: Choisir les modules
454 permission_manage_members: GΓ©rer les membres
455 permission_manage_members: GΓ©rer les membres
455 permission_manage_project_activities: GΓ©rer les activitΓ©s
456 permission_manage_project_activities: GΓ©rer les activitΓ©s
456 permission_manage_versions: GΓ©rer les versions
457 permission_manage_versions: GΓ©rer les versions
457 permission_manage_categories: GΓ©rer les catΓ©gories de demandes
458 permission_manage_categories: GΓ©rer les catΓ©gories de demandes
458 permission_view_issues: Voir les demandes
459 permission_view_issues: Voir les demandes
459 permission_add_issues: CrΓ©er des demandes
460 permission_add_issues: CrΓ©er des demandes
460 permission_edit_issues: Modifier les demandes
461 permission_edit_issues: Modifier les demandes
461 permission_copy_issues: Copier les demandes
462 permission_copy_issues: Copier les demandes
462 permission_manage_issue_relations: GΓ©rer les relations
463 permission_manage_issue_relations: GΓ©rer les relations
463 permission_set_issues_private: Rendre les demandes publiques ou privΓ©es
464 permission_set_issues_private: Rendre les demandes publiques ou privΓ©es
464 permission_set_own_issues_private: Rendre ses propres demandes publiques ou privΓ©es
465 permission_set_own_issues_private: Rendre ses propres demandes publiques ou privΓ©es
465 permission_add_issue_notes: Ajouter des notes
466 permission_add_issue_notes: Ajouter des notes
466 permission_edit_issue_notes: Modifier les notes
467 permission_edit_issue_notes: Modifier les notes
467 permission_edit_own_issue_notes: Modifier ses propres notes
468 permission_edit_own_issue_notes: Modifier ses propres notes
468 permission_view_private_notes: Voir les notes privΓ©es
469 permission_view_private_notes: Voir les notes privΓ©es
469 permission_set_notes_private: Rendre les notes privΓ©es
470 permission_set_notes_private: Rendre les notes privΓ©es
470 permission_move_issues: DΓ©placer les demandes
471 permission_move_issues: DΓ©placer les demandes
471 permission_delete_issues: Supprimer les demandes
472 permission_delete_issues: Supprimer les demandes
472 permission_manage_public_queries: GΓ©rer les requΓͺtes publiques
473 permission_manage_public_queries: GΓ©rer les requΓͺtes publiques
473 permission_save_queries: Sauvegarder les requΓͺtes
474 permission_save_queries: Sauvegarder les requΓͺtes
474 permission_view_gantt: Voir le gantt
475 permission_view_gantt: Voir le gantt
475 permission_view_calendar: Voir le calendrier
476 permission_view_calendar: Voir le calendrier
476 permission_view_issue_watchers: Voir la liste des observateurs
477 permission_view_issue_watchers: Voir la liste des observateurs
477 permission_add_issue_watchers: Ajouter des observateurs
478 permission_add_issue_watchers: Ajouter des observateurs
478 permission_delete_issue_watchers: Supprimer des observateurs
479 permission_delete_issue_watchers: Supprimer des observateurs
479 permission_log_time: Saisir le temps passΓ©
480 permission_log_time: Saisir le temps passΓ©
480 permission_view_time_entries: Voir le temps passΓ©
481 permission_view_time_entries: Voir le temps passΓ©
481 permission_edit_time_entries: Modifier les temps passΓ©s
482 permission_edit_time_entries: Modifier les temps passΓ©s
482 permission_edit_own_time_entries: Modifier son propre temps passΓ©
483 permission_edit_own_time_entries: Modifier son propre temps passΓ©
483 permission_manage_news: GΓ©rer les annonces
484 permission_manage_news: GΓ©rer les annonces
484 permission_comment_news: Commenter les annonces
485 permission_comment_news: Commenter les annonces
485 permission_view_documents: Voir les documents
486 permission_view_documents: Voir les documents
486 permission_add_documents: Ajouter des documents
487 permission_add_documents: Ajouter des documents
487 permission_edit_documents: Modifier les documents
488 permission_edit_documents: Modifier les documents
488 permission_delete_documents: Supprimer les documents
489 permission_delete_documents: Supprimer les documents
489 permission_manage_files: GΓ©rer les fichiers
490 permission_manage_files: GΓ©rer les fichiers
490 permission_view_files: Voir les fichiers
491 permission_view_files: Voir les fichiers
491 permission_manage_wiki: GΓ©rer le wiki
492 permission_manage_wiki: GΓ©rer le wiki
492 permission_rename_wiki_pages: Renommer les pages
493 permission_rename_wiki_pages: Renommer les pages
493 permission_delete_wiki_pages: Supprimer les pages
494 permission_delete_wiki_pages: Supprimer les pages
494 permission_view_wiki_pages: Voir le wiki
495 permission_view_wiki_pages: Voir le wiki
495 permission_view_wiki_edits: "Voir l'historique des modifications"
496 permission_view_wiki_edits: "Voir l'historique des modifications"
496 permission_edit_wiki_pages: Modifier les pages
497 permission_edit_wiki_pages: Modifier les pages
497 permission_delete_wiki_pages_attachments: Supprimer les fichiers joints
498 permission_delete_wiki_pages_attachments: Supprimer les fichiers joints
498 permission_protect_wiki_pages: ProtΓ©ger les pages
499 permission_protect_wiki_pages: ProtΓ©ger les pages
499 permission_manage_repository: GΓ©rer le dΓ©pΓ΄t de sources
500 permission_manage_repository: GΓ©rer le dΓ©pΓ΄t de sources
500 permission_browse_repository: Parcourir les sources
501 permission_browse_repository: Parcourir les sources
501 permission_view_changesets: Voir les rΓ©visions
502 permission_view_changesets: Voir les rΓ©visions
502 permission_commit_access: Droit de commit
503 permission_commit_access: Droit de commit
503 permission_manage_boards: GΓ©rer les forums
504 permission_manage_boards: GΓ©rer les forums
504 permission_view_messages: Voir les messages
505 permission_view_messages: Voir les messages
505 permission_add_messages: Poster un message
506 permission_add_messages: Poster un message
506 permission_edit_messages: Modifier les messages
507 permission_edit_messages: Modifier les messages
507 permission_edit_own_messages: Modifier ses propres messages
508 permission_edit_own_messages: Modifier ses propres messages
508 permission_delete_messages: Supprimer les messages
509 permission_delete_messages: Supprimer les messages
509 permission_delete_own_messages: Supprimer ses propres messages
510 permission_delete_own_messages: Supprimer ses propres messages
510 permission_export_wiki_pages: Exporter les pages
511 permission_export_wiki_pages: Exporter les pages
511 permission_manage_subtasks: GΓ©rer les sous-tΓ’ches
512 permission_manage_subtasks: GΓ©rer les sous-tΓ’ches
512 permission_manage_related_issues: GΓ©rer les demandes associΓ©es
513 permission_manage_related_issues: GΓ©rer les demandes associΓ©es
513 permission_import_issues: Importer des demandes
514 permission_import_issues: Importer des demandes
514
515
515 project_module_issue_tracking: Suivi des demandes
516 project_module_issue_tracking: Suivi des demandes
516 project_module_time_tracking: Suivi du temps passΓ©
517 project_module_time_tracking: Suivi du temps passΓ©
517 project_module_news: Publication d'annonces
518 project_module_news: Publication d'annonces
518 project_module_documents: Publication de documents
519 project_module_documents: Publication de documents
519 project_module_files: Publication de fichiers
520 project_module_files: Publication de fichiers
520 project_module_wiki: Wiki
521 project_module_wiki: Wiki
521 project_module_repository: DΓ©pΓ΄t de sources
522 project_module_repository: DΓ©pΓ΄t de sources
522 project_module_boards: Forums de discussion
523 project_module_boards: Forums de discussion
523 project_module_calendar: Calendrier
524 project_module_calendar: Calendrier
524 project_module_gantt: Gantt
525 project_module_gantt: Gantt
525
526
526 label_user: Utilisateur
527 label_user: Utilisateur
527 label_user_plural: Utilisateurs
528 label_user_plural: Utilisateurs
528 label_user_new: Nouvel utilisateur
529 label_user_new: Nouvel utilisateur
529 label_user_anonymous: Anonyme
530 label_user_anonymous: Anonyme
530 label_project: Projet
531 label_project: Projet
531 label_project_new: Nouveau projet
532 label_project_new: Nouveau projet
532 label_project_plural: Projets
533 label_project_plural: Projets
533 label_x_projects:
534 label_x_projects:
534 zero: aucun projet
535 zero: aucun projet
535 one: un projet
536 one: un projet
536 other: "%{count} projets"
537 other: "%{count} projets"
537 label_project_all: Tous les projets
538 label_project_all: Tous les projets
538 label_project_latest: Derniers projets
539 label_project_latest: Derniers projets
539 label_issue: Demande
540 label_issue: Demande
540 label_issue_new: Nouvelle demande
541 label_issue_new: Nouvelle demande
541 label_issue_plural: Demandes
542 label_issue_plural: Demandes
542 label_issue_view_all: Voir toutes les demandes
543 label_issue_view_all: Voir toutes les demandes
543 label_issues_by: "Demandes par %{value}"
544 label_issues_by: "Demandes par %{value}"
544 label_issue_added: Demande ajoutΓ©e
545 label_issue_added: Demande ajoutΓ©e
545 label_issue_updated: Demande mise Γ  jour
546 label_issue_updated: Demande mise Γ  jour
546 label_issue_note_added: Note ajoutΓ©e
547 label_issue_note_added: Note ajoutΓ©e
547 label_issue_status_updated: Statut changΓ©
548 label_issue_status_updated: Statut changΓ©
548 label_issue_assigned_to_updated: AssignΓ© changΓ©
549 label_issue_assigned_to_updated: AssignΓ© changΓ©
549 label_issue_priority_updated: PrioritΓ© changΓ©e
550 label_issue_priority_updated: PrioritΓ© changΓ©e
550 label_document: Document
551 label_document: Document
551 label_document_new: Nouveau document
552 label_document_new: Nouveau document
552 label_document_plural: Documents
553 label_document_plural: Documents
553 label_document_added: Document ajoutΓ©
554 label_document_added: Document ajoutΓ©
554 label_role: RΓ΄le
555 label_role: RΓ΄le
555 label_role_plural: RΓ΄les
556 label_role_plural: RΓ΄les
556 label_role_new: Nouveau rΓ΄le
557 label_role_new: Nouveau rΓ΄le
557 label_role_and_permissions: RΓ΄les et permissions
558 label_role_and_permissions: RΓ΄les et permissions
558 label_role_anonymous: Anonyme
559 label_role_anonymous: Anonyme
559 label_role_non_member: Non membre
560 label_role_non_member: Non membre
560 label_member: Membre
561 label_member: Membre
561 label_member_new: Nouveau membre
562 label_member_new: Nouveau membre
562 label_member_plural: Membres
563 label_member_plural: Membres
563 label_tracker: Tracker
564 label_tracker: Tracker
564 label_tracker_plural: Trackers
565 label_tracker_plural: Trackers
565 label_tracker_new: Nouveau tracker
566 label_tracker_new: Nouveau tracker
566 label_workflow: Workflow
567 label_workflow: Workflow
567 label_issue_status: Statut de demandes
568 label_issue_status: Statut de demandes
568 label_issue_status_plural: Statuts de demandes
569 label_issue_status_plural: Statuts de demandes
569 label_issue_status_new: Nouveau statut
570 label_issue_status_new: Nouveau statut
570 label_issue_category: CatΓ©gorie de demandes
571 label_issue_category: CatΓ©gorie de demandes
571 label_issue_category_plural: CatΓ©gories de demandes
572 label_issue_category_plural: CatΓ©gories de demandes
572 label_issue_category_new: Nouvelle catΓ©gorie
573 label_issue_category_new: Nouvelle catΓ©gorie
573 label_custom_field: Champ personnalisΓ©
574 label_custom_field: Champ personnalisΓ©
574 label_custom_field_plural: Champs personnalisΓ©s
575 label_custom_field_plural: Champs personnalisΓ©s
575 label_custom_field_new: Nouveau champ personnalisΓ©
576 label_custom_field_new: Nouveau champ personnalisΓ©
576 label_enumerations: Listes de valeurs
577 label_enumerations: Listes de valeurs
577 label_enumeration_new: Nouvelle valeur
578 label_enumeration_new: Nouvelle valeur
578 label_information: Information
579 label_information: Information
579 label_information_plural: Informations
580 label_information_plural: Informations
580 label_please_login: Identification
581 label_please_login: Identification
581 label_register: S'enregistrer
582 label_register: S'enregistrer
582 label_login_with_open_id_option: S'authentifier avec OpenID
583 label_login_with_open_id_option: S'authentifier avec OpenID
583 label_password_lost: Mot de passe perdu
584 label_password_lost: Mot de passe perdu
584 label_password_required: Confirmez votre mot de passe pour continuer
585 label_password_required: Confirmez votre mot de passe pour continuer
585 label_home: Accueil
586 label_home: Accueil
586 label_my_page: Ma page
587 label_my_page: Ma page
587 label_my_account: Mon compte
588 label_my_account: Mon compte
588 label_my_projects: Mes projets
589 label_my_projects: Mes projets
589 label_my_page_block: Blocs disponibles
590 label_my_page_block: Blocs disponibles
590 label_administration: Administration
591 label_administration: Administration
591 label_login: Connexion
592 label_login: Connexion
592 label_logout: DΓ©connexion
593 label_logout: DΓ©connexion
593 label_help: Aide
594 label_help: Aide
594 label_reported_issues: Demandes soumises
595 label_reported_issues: Demandes soumises
595 label_assigned_issues: Demandes assignΓ©es
596 label_assigned_issues: Demandes assignΓ©es
596 label_assigned_to_me_issues: Demandes qui me sont assignΓ©es
597 label_assigned_to_me_issues: Demandes qui me sont assignΓ©es
597 label_last_login: Dernière connexion
598 label_last_login: Dernière connexion
598 label_registered_on: Inscrit le
599 label_registered_on: Inscrit le
599 label_activity: ActivitΓ©
600 label_activity: ActivitΓ©
600 label_overall_activity: ActivitΓ© globale
601 label_overall_activity: ActivitΓ© globale
601 label_user_activity: "ActivitΓ© de %{value}"
602 label_user_activity: "ActivitΓ© de %{value}"
602 label_new: Nouveau
603 label_new: Nouveau
603 label_logged_as: ConnectΓ© en tant que
604 label_logged_as: ConnectΓ© en tant que
604 label_environment: Environnement
605 label_environment: Environnement
605 label_authentication: Authentification
606 label_authentication: Authentification
606 label_auth_source: Mode d'authentification
607 label_auth_source: Mode d'authentification
607 label_auth_source_new: Nouveau mode d'authentification
608 label_auth_source_new: Nouveau mode d'authentification
608 label_auth_source_plural: Modes d'authentification
609 label_auth_source_plural: Modes d'authentification
609 label_subproject_plural: Sous-projets
610 label_subproject_plural: Sous-projets
610 label_subproject_new: Nouveau sous-projet
611 label_subproject_new: Nouveau sous-projet
611 label_and_its_subprojects: "%{value} et ses sous-projets"
612 label_and_its_subprojects: "%{value} et ses sous-projets"
612 label_min_max_length: Longueurs mini - maxi
613 label_min_max_length: Longueurs mini - maxi
613 label_list: Liste
614 label_list: Liste
614 label_date: Date
615 label_date: Date
615 label_integer: Entier
616 label_integer: Entier
616 label_float: Nombre dΓ©cimal
617 label_float: Nombre dΓ©cimal
617 label_boolean: BoolΓ©en
618 label_boolean: BoolΓ©en
618 label_string: Texte
619 label_string: Texte
619 label_text: Texte long
620 label_text: Texte long
620 label_attribute: Attribut
621 label_attribute: Attribut
621 label_attribute_plural: Attributs
622 label_attribute_plural: Attributs
622 label_no_data: Aucune donnΓ©e Γ  afficher
623 label_no_data: Aucune donnΓ©e Γ  afficher
623 label_change_status: Changer le statut
624 label_change_status: Changer le statut
624 label_history: Historique
625 label_history: Historique
625 label_attachment: Fichier
626 label_attachment: Fichier
626 label_attachment_new: Nouveau fichier
627 label_attachment_new: Nouveau fichier
627 label_attachment_delete: Supprimer le fichier
628 label_attachment_delete: Supprimer le fichier
628 label_attachment_plural: Fichiers
629 label_attachment_plural: Fichiers
629 label_file_added: Fichier ajoutΓ©
630 label_file_added: Fichier ajoutΓ©
630 label_report: Rapport
631 label_report: Rapport
631 label_report_plural: Rapports
632 label_report_plural: Rapports
632 label_news: Annonce
633 label_news: Annonce
633 label_news_new: Nouvelle annonce
634 label_news_new: Nouvelle annonce
634 label_news_plural: Annonces
635 label_news_plural: Annonces
635 label_news_latest: Dernières annonces
636 label_news_latest: Dernières annonces
636 label_news_view_all: Voir toutes les annonces
637 label_news_view_all: Voir toutes les annonces
637 label_news_added: Annonce ajoutΓ©e
638 label_news_added: Annonce ajoutΓ©e
638 label_news_comment_added: Commentaire ajoutΓ© Γ  une annonce
639 label_news_comment_added: Commentaire ajoutΓ© Γ  une annonce
639 label_settings: Configuration
640 label_settings: Configuration
640 label_overview: AperΓ§u
641 label_overview: AperΓ§u
641 label_version: Version
642 label_version: Version
642 label_version_new: Nouvelle version
643 label_version_new: Nouvelle version
643 label_version_plural: Versions
644 label_version_plural: Versions
644 label_close_versions: Fermer les versions terminΓ©es
645 label_close_versions: Fermer les versions terminΓ©es
645 label_confirmation: Confirmation
646 label_confirmation: Confirmation
646 label_export_to: 'Formats disponibles :'
647 label_export_to: 'Formats disponibles :'
647 label_read: Lire...
648 label_read: Lire...
648 label_public_projects: Projets publics
649 label_public_projects: Projets publics
649 label_open_issues: ouvert
650 label_open_issues: ouvert
650 label_open_issues_plural: ouverts
651 label_open_issues_plural: ouverts
651 label_closed_issues: fermΓ©
652 label_closed_issues: fermΓ©
652 label_closed_issues_plural: fermΓ©s
653 label_closed_issues_plural: fermΓ©s
653 label_x_open_issues_abbr:
654 label_x_open_issues_abbr:
654 zero: 0 ouverte
655 zero: 0 ouverte
655 one: 1 ouverte
656 one: 1 ouverte
656 other: "%{count} ouvertes"
657 other: "%{count} ouvertes"
657 label_x_closed_issues_abbr:
658 label_x_closed_issues_abbr:
658 zero: 0 fermΓ©e
659 zero: 0 fermΓ©e
659 one: 1 fermΓ©e
660 one: 1 fermΓ©e
660 other: "%{count} fermΓ©es"
661 other: "%{count} fermΓ©es"
661 label_x_issues:
662 label_x_issues:
662 zero: 0 demande
663 zero: 0 demande
663 one: 1 demande
664 one: 1 demande
664 other: "%{count} demandes"
665 other: "%{count} demandes"
665 label_total: Total
666 label_total: Total
666 label_total_plural: Totaux
667 label_total_plural: Totaux
667 label_total_time: Temps total
668 label_total_time: Temps total
668 label_permissions: Permissions
669 label_permissions: Permissions
669 label_current_status: Statut actuel
670 label_current_status: Statut actuel
670 label_new_statuses_allowed: Nouveaux statuts autorisΓ©s
671 label_new_statuses_allowed: Nouveaux statuts autorisΓ©s
671 label_all: tous
672 label_all: tous
672 label_any: tous
673 label_any: tous
673 label_none: aucun
674 label_none: aucun
674 label_nobody: personne
675 label_nobody: personne
675 label_next: Suivant
676 label_next: Suivant
676 label_previous: PrΓ©cΓ©dent
677 label_previous: PrΓ©cΓ©dent
677 label_used_by: UtilisΓ© par
678 label_used_by: UtilisΓ© par
678 label_details: DΓ©tails
679 label_details: DΓ©tails
679 label_add_note: Ajouter une note
680 label_add_note: Ajouter une note
680 label_calendar: Calendrier
681 label_calendar: Calendrier
681 label_months_from: mois depuis
682 label_months_from: mois depuis
682 label_gantt: Gantt
683 label_gantt: Gantt
683 label_internal: Interne
684 label_internal: Interne
684 label_last_changes: "%{count} derniers changements"
685 label_last_changes: "%{count} derniers changements"
685 label_change_view_all: Voir tous les changements
686 label_change_view_all: Voir tous les changements
686 label_personalize_page: Personnaliser cette page
687 label_personalize_page: Personnaliser cette page
687 label_comment: Commentaire
688 label_comment: Commentaire
688 label_comment_plural: Commentaires
689 label_comment_plural: Commentaires
689 label_x_comments:
690 label_x_comments:
690 zero: aucun commentaire
691 zero: aucun commentaire
691 one: un commentaire
692 one: un commentaire
692 other: "%{count} commentaires"
693 other: "%{count} commentaires"
693 label_comment_add: Ajouter un commentaire
694 label_comment_add: Ajouter un commentaire
694 label_comment_added: Commentaire ajoutΓ©
695 label_comment_added: Commentaire ajoutΓ©
695 label_comment_delete: Supprimer les commentaires
696 label_comment_delete: Supprimer les commentaires
696 label_query: Rapport personnalisΓ©
697 label_query: Rapport personnalisΓ©
697 label_query_plural: Rapports personnalisΓ©s
698 label_query_plural: Rapports personnalisΓ©s
698 label_query_new: Nouveau rapport
699 label_query_new: Nouveau rapport
699 label_my_queries: Mes rapports personnalisΓ©s
700 label_my_queries: Mes rapports personnalisΓ©s
700 label_filter_add: Ajouter le filtre
701 label_filter_add: Ajouter le filtre
701 label_filter_plural: Filtres
702 label_filter_plural: Filtres
702 label_equals: Γ©gal
703 label_equals: Γ©gal
703 label_not_equals: diffΓ©rent
704 label_not_equals: diffΓ©rent
704 label_in_less_than: dans moins de
705 label_in_less_than: dans moins de
705 label_in_more_than: dans plus de
706 label_in_more_than: dans plus de
706 label_in_the_next_days: dans les prochains jours
707 label_in_the_next_days: dans les prochains jours
707 label_in_the_past_days: dans les derniers jours
708 label_in_the_past_days: dans les derniers jours
708 label_greater_or_equal: '>='
709 label_greater_or_equal: '>='
709 label_less_or_equal: '<='
710 label_less_or_equal: '<='
710 label_between: entre
711 label_between: entre
711 label_in: dans
712 label_in: dans
712 label_today: aujourd'hui
713 label_today: aujourd'hui
713 label_all_time: toute la pΓ©riode
714 label_all_time: toute la pΓ©riode
714 label_yesterday: hier
715 label_yesterday: hier
715 label_this_week: cette semaine
716 label_this_week: cette semaine
716 label_last_week: la semaine dernière
717 label_last_week: la semaine dernière
717 label_last_n_weeks: "les %{count} dernières semaines"
718 label_last_n_weeks: "les %{count} dernières semaines"
718 label_last_n_days: "les %{count} derniers jours"
719 label_last_n_days: "les %{count} derniers jours"
719 label_this_month: ce mois-ci
720 label_this_month: ce mois-ci
720 label_last_month: le mois dernier
721 label_last_month: le mois dernier
721 label_this_year: cette annΓ©e
722 label_this_year: cette annΓ©e
722 label_date_range: PΓ©riode
723 label_date_range: PΓ©riode
723 label_less_than_ago: il y a moins de
724 label_less_than_ago: il y a moins de
724 label_more_than_ago: il y a plus de
725 label_more_than_ago: il y a plus de
725 label_ago: il y a
726 label_ago: il y a
726 label_contains: contient
727 label_contains: contient
727 label_not_contains: ne contient pas
728 label_not_contains: ne contient pas
728 label_any_issues_in_project: une demande du projet
729 label_any_issues_in_project: une demande du projet
729 label_any_issues_not_in_project: une demande hors du projet
730 label_any_issues_not_in_project: une demande hors du projet
730 label_no_issues_in_project: aucune demande du projet
731 label_no_issues_in_project: aucune demande du projet
731 label_day_plural: jours
732 label_day_plural: jours
732 label_repository: DΓ©pΓ΄t
733 label_repository: DΓ©pΓ΄t
733 label_repository_new: Nouveau dΓ©pΓ΄t
734 label_repository_new: Nouveau dΓ©pΓ΄t
734 label_repository_plural: DΓ©pΓ΄ts
735 label_repository_plural: DΓ©pΓ΄ts
735 label_browse: Parcourir
736 label_browse: Parcourir
736 label_branch: Branche
737 label_branch: Branche
737 label_tag: Tag
738 label_tag: Tag
738 label_revision: RΓ©vision
739 label_revision: RΓ©vision
739 label_revision_plural: RΓ©visions
740 label_revision_plural: RΓ©visions
740 label_revision_id: "RΓ©vision %{value}"
741 label_revision_id: "RΓ©vision %{value}"
741 label_associated_revisions: RΓ©visions associΓ©es
742 label_associated_revisions: RΓ©visions associΓ©es
742 label_added: ajoutΓ©
743 label_added: ajoutΓ©
743 label_modified: modifiΓ©
744 label_modified: modifiΓ©
744 label_copied: copiΓ©
745 label_copied: copiΓ©
745 label_renamed: renommΓ©
746 label_renamed: renommΓ©
746 label_deleted: supprimΓ©
747 label_deleted: supprimΓ©
747 label_latest_revision: Dernière révision
748 label_latest_revision: Dernière révision
748 label_latest_revision_plural: Dernières révisions
749 label_latest_revision_plural: Dernières révisions
749 label_view_revisions: Voir les rΓ©visions
750 label_view_revisions: Voir les rΓ©visions
750 label_view_all_revisions: Voir toutes les rΓ©visions
751 label_view_all_revisions: Voir toutes les rΓ©visions
751 label_max_size: Taille maximale
752 label_max_size: Taille maximale
752 label_sort_highest: Remonter en premier
753 label_sort_highest: Remonter en premier
753 label_sort_higher: Remonter
754 label_sort_higher: Remonter
754 label_sort_lower: Descendre
755 label_sort_lower: Descendre
755 label_sort_lowest: Descendre en dernier
756 label_sort_lowest: Descendre en dernier
756 label_roadmap: Roadmap
757 label_roadmap: Roadmap
757 label_roadmap_due_in: "Γ‰chΓ©ance dans %{value}"
758 label_roadmap_due_in: "Γ‰chΓ©ance dans %{value}"
758 label_roadmap_overdue: "En retard de %{value}"
759 label_roadmap_overdue: "En retard de %{value}"
759 label_roadmap_no_issues: Aucune demande pour cette version
760 label_roadmap_no_issues: Aucune demande pour cette version
760 label_search: Recherche
761 label_search: Recherche
761 label_result_plural: RΓ©sultats
762 label_result_plural: RΓ©sultats
762 label_all_words: Tous les mots
763 label_all_words: Tous les mots
763 label_wiki: Wiki
764 label_wiki: Wiki
764 label_wiki_edit: RΓ©vision wiki
765 label_wiki_edit: RΓ©vision wiki
765 label_wiki_edit_plural: RΓ©visions wiki
766 label_wiki_edit_plural: RΓ©visions wiki
766 label_wiki_page: Page wiki
767 label_wiki_page: Page wiki
767 label_wiki_page_plural: Pages wiki
768 label_wiki_page_plural: Pages wiki
768 label_index_by_title: Index par titre
769 label_index_by_title: Index par titre
769 label_index_by_date: Index par date
770 label_index_by_date: Index par date
770 label_current_version: Version actuelle
771 label_current_version: Version actuelle
771 label_preview: PrΓ©visualisation
772 label_preview: PrΓ©visualisation
772 label_feed_plural: Flux Atom
773 label_feed_plural: Flux Atom
773 label_changes_details: DΓ©tails de tous les changements
774 label_changes_details: DΓ©tails de tous les changements
774 label_issue_tracking: Suivi des demandes
775 label_issue_tracking: Suivi des demandes
775 label_spent_time: Temps passΓ©
776 label_spent_time: Temps passΓ©
776 label_total_spent_time: Temps passΓ© total
777 label_total_spent_time: Temps passΓ© total
777 label_overall_spent_time: Temps passΓ© global
778 label_overall_spent_time: Temps passΓ© global
778 label_f_hour: "%{value} heure"
779 label_f_hour: "%{value} heure"
779 label_f_hour_plural: "%{value} heures"
780 label_f_hour_plural: "%{value} heures"
780 label_f_hour_short: "%{value} h"
781 label_f_hour_short: "%{value} h"
781 label_time_tracking: Suivi du temps
782 label_time_tracking: Suivi du temps
782 label_change_plural: Changements
783 label_change_plural: Changements
783 label_statistics: Statistiques
784 label_statistics: Statistiques
784 label_commits_per_month: Commits par mois
785 label_commits_per_month: Commits par mois
785 label_commits_per_author: Commits par auteur
786 label_commits_per_author: Commits par auteur
786 label_diff: diff
787 label_diff: diff
787 label_view_diff: Voir les diffΓ©rences
788 label_view_diff: Voir les diffΓ©rences
788 label_diff_inline: en ligne
789 label_diff_inline: en ligne
789 label_diff_side_by_side: cΓ΄te Γ  cΓ΄te
790 label_diff_side_by_side: cΓ΄te Γ  cΓ΄te
790 label_options: Options
791 label_options: Options
791 label_copy_workflow_from: Copier le workflow de
792 label_copy_workflow_from: Copier le workflow de
792 label_permissions_report: Synthèse des permissions
793 label_permissions_report: Synthèse des permissions
793 label_watched_issues: Demandes surveillΓ©es
794 label_watched_issues: Demandes surveillΓ©es
794 label_related_issues: Demandes liΓ©es
795 label_related_issues: Demandes liΓ©es
795 label_applied_status: Statut appliquΓ©
796 label_applied_status: Statut appliquΓ©
796 label_loading: Chargement...
797 label_loading: Chargement...
797 label_relation_new: Nouvelle relation
798 label_relation_new: Nouvelle relation
798 label_relation_delete: Supprimer la relation
799 label_relation_delete: Supprimer la relation
799 label_relates_to: LiΓ© Γ 
800 label_relates_to: LiΓ© Γ 
800 label_duplicates: Duplique
801 label_duplicates: Duplique
801 label_duplicated_by: DupliquΓ© par
802 label_duplicated_by: DupliquΓ© par
802 label_blocks: Bloque
803 label_blocks: Bloque
803 label_blocked_by: BloquΓ© par
804 label_blocked_by: BloquΓ© par
804 label_precedes: Précède
805 label_precedes: Précède
805 label_follows: Suit
806 label_follows: Suit
806 label_copied_to: CopiΓ© vers
807 label_copied_to: CopiΓ© vers
807 label_copied_from: CopiΓ© depuis
808 label_copied_from: CopiΓ© depuis
808 label_end_to_start: fin Γ  dΓ©but
809 label_end_to_start: fin Γ  dΓ©but
809 label_end_to_end: fin Γ  fin
810 label_end_to_end: fin Γ  fin
810 label_start_to_start: dΓ©but Γ  dΓ©but
811 label_start_to_start: dΓ©but Γ  dΓ©but
811 label_start_to_end: dΓ©but Γ  fin
812 label_start_to_end: dΓ©but Γ  fin
812 label_stay_logged_in: Rester connectΓ©
813 label_stay_logged_in: Rester connectΓ©
813 label_disabled: dΓ©sactivΓ©
814 label_disabled: dΓ©sactivΓ©
814 label_show_completed_versions: Voir les versions passΓ©es
815 label_show_completed_versions: Voir les versions passΓ©es
815 label_me: moi
816 label_me: moi
816 label_board: Forum
817 label_board: Forum
817 label_board_new: Nouveau forum
818 label_board_new: Nouveau forum
818 label_board_plural: Forums
819 label_board_plural: Forums
819 label_board_locked: VerrouillΓ©
820 label_board_locked: VerrouillΓ©
820 label_board_sticky: Sticky
821 label_board_sticky: Sticky
821 label_topic_plural: Discussions
822 label_topic_plural: Discussions
822 label_message_plural: Messages
823 label_message_plural: Messages
823 label_message_last: Dernier message
824 label_message_last: Dernier message
824 label_message_new: Nouveau message
825 label_message_new: Nouveau message
825 label_message_posted: Message ajoutΓ©
826 label_message_posted: Message ajoutΓ©
826 label_reply_plural: RΓ©ponses
827 label_reply_plural: RΓ©ponses
827 label_send_information: Envoyer les informations Γ  l'utilisateur
828 label_send_information: Envoyer les informations Γ  l'utilisateur
828 label_year: AnnΓ©e
829 label_year: AnnΓ©e
829 label_month: Mois
830 label_month: Mois
830 label_week: Semaine
831 label_week: Semaine
831 label_date_from: Du
832 label_date_from: Du
832 label_date_to: Au
833 label_date_to: Au
833 label_language_based: BasΓ© sur la langue de l'utilisateur
834 label_language_based: BasΓ© sur la langue de l'utilisateur
834 label_sort_by: "Trier par %{value}"
835 label_sort_by: "Trier par %{value}"
835 label_send_test_email: Envoyer un email de test
836 label_send_test_email: Envoyer un email de test
836 label_feeds_access_key: Clé d'accès Atom
837 label_feeds_access_key: Clé d'accès Atom
837 label_missing_feeds_access_key: Clé d'accès Atom manquante
838 label_missing_feeds_access_key: Clé d'accès Atom manquante
838 label_feeds_access_key_created_on: "Clé d'accès Atom créée il y a %{value}"
839 label_feeds_access_key_created_on: "Clé d'accès Atom créée il y a %{value}"
839 label_module_plural: Modules
840 label_module_plural: Modules
840 label_added_time_by: "AjoutΓ© par %{author} il y a %{age}"
841 label_added_time_by: "AjoutΓ© par %{author} il y a %{age}"
841 label_updated_time_by: "Mis Γ  jour par %{author} il y a %{age}"
842 label_updated_time_by: "Mis Γ  jour par %{author} il y a %{age}"
842 label_updated_time: "Mis Γ  jour il y a %{value}"
843 label_updated_time: "Mis Γ  jour il y a %{value}"
843 label_jump_to_a_project: Aller Γ  un projet...
844 label_jump_to_a_project: Aller Γ  un projet...
844 label_file_plural: Fichiers
845 label_file_plural: Fichiers
845 label_changeset_plural: RΓ©visions
846 label_changeset_plural: RΓ©visions
846 label_default_columns: Colonnes par dΓ©faut
847 label_default_columns: Colonnes par dΓ©faut
847 label_no_change_option: (Pas de changement)
848 label_no_change_option: (Pas de changement)
848 label_bulk_edit_selected_issues: Modifier les demandes sΓ©lectionnΓ©es
849 label_bulk_edit_selected_issues: Modifier les demandes sΓ©lectionnΓ©es
849 label_bulk_edit_selected_time_entries: Modifier les temps passΓ©s sΓ©lectionnΓ©s
850 label_bulk_edit_selected_time_entries: Modifier les temps passΓ©s sΓ©lectionnΓ©s
850 label_theme: Thème
851 label_theme: Thème
851 label_default: DΓ©faut
852 label_default: DΓ©faut
852 label_search_titles_only: Uniquement dans les titres
853 label_search_titles_only: Uniquement dans les titres
853 label_user_mail_option_all: "Pour tous les Γ©vΓ©nements de tous mes projets"
854 label_user_mail_option_all: "Pour tous les Γ©vΓ©nements de tous mes projets"
854 label_user_mail_option_selected: "Pour tous les Γ©vΓ©nements des projets sΓ©lectionnΓ©s..."
855 label_user_mail_option_selected: "Pour tous les Γ©vΓ©nements des projets sΓ©lectionnΓ©s..."
855 label_user_mail_option_none: Aucune notification
856 label_user_mail_option_none: Aucune notification
856 label_user_mail_option_only_my_events: Seulement pour ce que je surveille
857 label_user_mail_option_only_my_events: Seulement pour ce que je surveille
857 label_user_mail_option_only_assigned: Seulement pour ce qui m'est assignΓ©
858 label_user_mail_option_only_assigned: Seulement pour ce qui m'est assignΓ©
858 label_user_mail_option_only_owner: Seulement pour ce que j'ai créé
859 label_user_mail_option_only_owner: Seulement pour ce que j'ai créé
859 label_user_mail_no_self_notified: "Je ne veux pas Γͺtre notifiΓ© des changements que j'effectue"
860 label_user_mail_no_self_notified: "Je ne veux pas Γͺtre notifiΓ© des changements que j'effectue"
860 label_registration_activation_by_email: activation du compte par email
861 label_registration_activation_by_email: activation du compte par email
861 label_registration_manual_activation: activation manuelle du compte
862 label_registration_manual_activation: activation manuelle du compte
862 label_registration_automatic_activation: activation automatique du compte
863 label_registration_automatic_activation: activation automatique du compte
863 label_display_per_page: "Par page : %{value}"
864 label_display_per_page: "Par page : %{value}"
864 label_age: Γ‚ge
865 label_age: Γ‚ge
865 label_change_properties: Changer les propriΓ©tΓ©s
866 label_change_properties: Changer les propriΓ©tΓ©s
866 label_general: GΓ©nΓ©ral
867 label_general: GΓ©nΓ©ral
867 label_more: Plus
868 label_more: Plus
868 label_scm: SCM
869 label_scm: SCM
869 label_plugins: Plugins
870 label_plugins: Plugins
870 label_ldap_authentication: Authentification LDAP
871 label_ldap_authentication: Authentification LDAP
871 label_downloads_abbr: D/L
872 label_downloads_abbr: D/L
872 label_optional_description: Description facultative
873 label_optional_description: Description facultative
873 label_add_another_file: Ajouter un autre fichier
874 label_add_another_file: Ajouter un autre fichier
874 label_preferences: PrΓ©fΓ©rences
875 label_preferences: PrΓ©fΓ©rences
875 label_chronological_order: Dans l'ordre chronologique
876 label_chronological_order: Dans l'ordre chronologique
876 label_reverse_chronological_order: Dans l'ordre chronologique inverse
877 label_reverse_chronological_order: Dans l'ordre chronologique inverse
877 label_planning: Planning
878 label_planning: Planning
878 label_incoming_emails: Emails entrants
879 label_incoming_emails: Emails entrants
879 label_generate_key: GΓ©nΓ©rer une clΓ©
880 label_generate_key: GΓ©nΓ©rer une clΓ©
880 label_issue_watchers: Observateurs
881 label_issue_watchers: Observateurs
881 label_example: Exemple
882 label_example: Exemple
882 label_display: Affichage
883 label_display: Affichage
883 label_sort: Tri
884 label_sort: Tri
884 label_ascending: Croissant
885 label_ascending: Croissant
885 label_descending: DΓ©croissant
886 label_descending: DΓ©croissant
886 label_date_from_to: Du %{start} au %{end}
887 label_date_from_to: Du %{start} au %{end}
887 label_wiki_content_added: Page wiki ajoutΓ©e
888 label_wiki_content_added: Page wiki ajoutΓ©e
888 label_wiki_content_updated: Page wiki mise Γ  jour
889 label_wiki_content_updated: Page wiki mise Γ  jour
889 label_group: Groupe
890 label_group: Groupe
890 label_group_plural: Groupes
891 label_group_plural: Groupes
891 label_group_new: Nouveau groupe
892 label_group_new: Nouveau groupe
892 label_group_anonymous: Utilisateurs anonymes
893 label_group_anonymous: Utilisateurs anonymes
893 label_group_non_member: Utilisateurs non membres
894 label_group_non_member: Utilisateurs non membres
894 label_time_entry_plural: Temps passΓ©
895 label_time_entry_plural: Temps passΓ©
895 label_version_sharing_none: Non partagΓ©
896 label_version_sharing_none: Non partagΓ©
896 label_version_sharing_descendants: Avec les sous-projets
897 label_version_sharing_descendants: Avec les sous-projets
897 label_version_sharing_hierarchy: Avec toute la hiΓ©rarchie
898 label_version_sharing_hierarchy: Avec toute la hiΓ©rarchie
898 label_version_sharing_tree: Avec tout l'arbre
899 label_version_sharing_tree: Avec tout l'arbre
899 label_version_sharing_system: Avec tous les projets
900 label_version_sharing_system: Avec tous les projets
900 label_update_issue_done_ratios: Mettre Γ  jour l'avancement des demandes
901 label_update_issue_done_ratios: Mettre Γ  jour l'avancement des demandes
901 label_copy_source: Source
902 label_copy_source: Source
902 label_copy_target: Cible
903 label_copy_target: Cible
903 label_copy_same_as_target: Comme la cible
904 label_copy_same_as_target: Comme la cible
904 label_display_used_statuses_only: N'afficher que les statuts utilisΓ©s dans ce tracker
905 label_display_used_statuses_only: N'afficher que les statuts utilisΓ©s dans ce tracker
905 label_api_access_key: Clé d'accès API
906 label_api_access_key: Clé d'accès API
906 label_missing_api_access_key: Clé d'accès API manquante
907 label_missing_api_access_key: Clé d'accès API manquante
907 label_api_access_key_created_on: Clé d'accès API créée il y a %{value}
908 label_api_access_key_created_on: Clé d'accès API créée il y a %{value}
908 label_profile: Profil
909 label_profile: Profil
909 label_subtask_plural: Sous-tΓ’ches
910 label_subtask_plural: Sous-tΓ’ches
910 label_project_copy_notifications: Envoyer les notifications durant la copie du projet
911 label_project_copy_notifications: Envoyer les notifications durant la copie du projet
911 label_principal_search: "Rechercher un utilisateur ou un groupe :"
912 label_principal_search: "Rechercher un utilisateur ou un groupe :"
912 label_user_search: "Rechercher un utilisateur :"
913 label_user_search: "Rechercher un utilisateur :"
913 label_additional_workflow_transitions_for_author: Autorisations supplémentaires lorsque l'utilisateur a créé la demande
914 label_additional_workflow_transitions_for_author: Autorisations supplémentaires lorsque l'utilisateur a créé la demande
914 label_additional_workflow_transitions_for_assignee: Autorisations supplΓ©mentaires lorsque la demande est assignΓ©e Γ  l'utilisateur
915 label_additional_workflow_transitions_for_assignee: Autorisations supplΓ©mentaires lorsque la demande est assignΓ©e Γ  l'utilisateur
915 label_issues_visibility_all: Toutes les demandes
916 label_issues_visibility_all: Toutes les demandes
916 label_issues_visibility_public: Toutes les demandes non privΓ©es
917 label_issues_visibility_public: Toutes les demandes non privΓ©es
917 label_issues_visibility_own: Demandes créées par ou assignées à l'utilisateur
918 label_issues_visibility_own: Demandes créées par ou assignées à l'utilisateur
918 label_git_report_last_commit: Afficher le dernier commit des fichiers et rΓ©pertoires
919 label_git_report_last_commit: Afficher le dernier commit des fichiers et rΓ©pertoires
919 label_parent_revision: Parent
920 label_parent_revision: Parent
920 label_child_revision: Enfant
921 label_child_revision: Enfant
921 label_export_options: Options d'exportation %{export_format}
922 label_export_options: Options d'exportation %{export_format}
922 label_copy_attachments: Copier les fichiers
923 label_copy_attachments: Copier les fichiers
923 label_copy_subtasks: Copier les sous-tΓ’ches
924 label_copy_subtasks: Copier les sous-tΓ’ches
924 label_item_position: "%{position} sur %{count}"
925 label_item_position: "%{position} sur %{count}"
925 label_completed_versions: Versions passΓ©es
926 label_completed_versions: Versions passΓ©es
926 label_search_for_watchers: Rechercher des observateurs
927 label_search_for_watchers: Rechercher des observateurs
927 label_session_expiration: Expiration des sessions
928 label_session_expiration: Expiration des sessions
928 label_show_closed_projects: Voir les projets fermΓ©s
929 label_show_closed_projects: Voir les projets fermΓ©s
929 label_status_transitions: Changements de statut
930 label_status_transitions: Changements de statut
930 label_fields_permissions: Permissions sur les champs
931 label_fields_permissions: Permissions sur les champs
931 label_readonly: Lecture
932 label_readonly: Lecture
932 label_required: Obligatoire
933 label_required: Obligatoire
933 label_hidden: CachΓ©
934 label_hidden: CachΓ©
934 label_attribute_of_project: "%{name} du projet"
935 label_attribute_of_project: "%{name} du projet"
935 label_attribute_of_issue: "%{name} de la demande"
936 label_attribute_of_issue: "%{name} de la demande"
936 label_attribute_of_author: "%{name} de l'auteur"
937 label_attribute_of_author: "%{name} de l'auteur"
937 label_attribute_of_assigned_to: "%{name} de l'assignΓ©"
938 label_attribute_of_assigned_to: "%{name} de l'assignΓ©"
938 label_attribute_of_user: "%{name} de l'utilisateur"
939 label_attribute_of_user: "%{name} de l'utilisateur"
939 label_attribute_of_fixed_version: "%{name} de la version cible"
940 label_attribute_of_fixed_version: "%{name} de la version cible"
940 label_cross_project_descendants: Avec les sous-projets
941 label_cross_project_descendants: Avec les sous-projets
941 label_cross_project_tree: Avec tout l'arbre
942 label_cross_project_tree: Avec tout l'arbre
942 label_cross_project_hierarchy: Avec toute la hiΓ©rarchie
943 label_cross_project_hierarchy: Avec toute la hiΓ©rarchie
943 label_cross_project_system: Avec tous les projets
944 label_cross_project_system: Avec tous les projets
944 label_gantt_progress_line: Ligne de progression
945 label_gantt_progress_line: Ligne de progression
945 label_visibility_private: par moi uniquement
946 label_visibility_private: par moi uniquement
946 label_visibility_roles: par ces rΓ΄les uniquement
947 label_visibility_roles: par ces rΓ΄les uniquement
947 label_visibility_public: par tout le monde
948 label_visibility_public: par tout le monde
948 label_link: Lien
949 label_link: Lien
949 label_only: seulement
950 label_only: seulement
950 label_drop_down_list: liste dΓ©roulante
951 label_drop_down_list: liste dΓ©roulante
951 label_checkboxes: cases Γ  cocher
952 label_checkboxes: cases Γ  cocher
952 label_radio_buttons: boutons radio
953 label_radio_buttons: boutons radio
953 label_link_values_to: Lier les valeurs vers l'URL
954 label_link_values_to: Lier les valeurs vers l'URL
954 label_custom_field_select_type: Selectionner le type d'objet auquel attacher le champ personnalisΓ©
955 label_custom_field_select_type: Selectionner le type d'objet auquel attacher le champ personnalisΓ©
955 label_check_for_updates: VΓ©rifier les mises Γ  jour
956 label_check_for_updates: VΓ©rifier les mises Γ  jour
956 label_latest_compatible_version: Dernière version compatible
957 label_latest_compatible_version: Dernière version compatible
957 label_unknown_plugin: Plugin inconnu
958 label_unknown_plugin: Plugin inconnu
958 label_add_projects: Ajouter des projets
959 label_add_projects: Ajouter des projets
959 label_users_visibility_all: Tous les utilisateurs actifs
960 label_users_visibility_all: Tous les utilisateurs actifs
960 label_users_visibility_members_of_visible_projects: Membres des projets visibles
961 label_users_visibility_members_of_visible_projects: Membres des projets visibles
961 label_edit_attachments: Modifier les fichiers attachΓ©s
962 label_edit_attachments: Modifier les fichiers attachΓ©s
962 label_link_copied_issue: Lier la demande copiΓ©e
963 label_link_copied_issue: Lier la demande copiΓ©e
963 label_ask: Demander
964 label_ask: Demander
964 label_search_attachments_yes: Rechercher les noms et descriptions de fichiers
965 label_search_attachments_yes: Rechercher les noms et descriptions de fichiers
965 label_search_attachments_no: Ne pas rechercher les fichiers
966 label_search_attachments_no: Ne pas rechercher les fichiers
966 label_search_attachments_only: Rechercher les fichiers uniquement
967 label_search_attachments_only: Rechercher les fichiers uniquement
967 label_search_open_issues_only: Demandes ouvertes uniquement
968 label_search_open_issues_only: Demandes ouvertes uniquement
968 label_email_address_plural: Emails
969 label_email_address_plural: Emails
969 label_email_address_add: Ajouter une adresse email
970 label_email_address_add: Ajouter une adresse email
970 label_enable_notifications: Activer les notifications
971 label_enable_notifications: Activer les notifications
971 label_disable_notifications: DΓ©sactiver les notifications
972 label_disable_notifications: DΓ©sactiver les notifications
972 label_blank_value: non renseignΓ©
973 label_blank_value: non renseignΓ©
973 label_parent_task_attributes: Attributs des tΓ’ches parentes
974 label_parent_task_attributes: Attributs des tΓ’ches parentes
974 label_time_entries_visibility_all: Tous les temps passΓ©s
975 label_time_entries_visibility_all: Tous les temps passΓ©s
975 label_time_entries_visibility_own: Ses propres temps passΓ©s
976 label_time_entries_visibility_own: Ses propres temps passΓ©s
976 label_member_management: Gestion des membres
977 label_member_management: Gestion des membres
977 label_member_management_all_roles: Tous les rΓ΄les
978 label_member_management_all_roles: Tous les rΓ΄les
978 label_member_management_selected_roles_only: Ces rΓ΄les uniquement
979 label_member_management_selected_roles_only: Ces rΓ΄les uniquement
979 label_import_issues: Importer des demandes
980 label_import_issues: Importer des demandes
980 label_select_file_to_import: SΓ©lectionner le fichier Γ  importer
981 label_select_file_to_import: SΓ©lectionner le fichier Γ  importer
981 label_fields_separator: SΓ©parateur de champs
982 label_fields_separator: SΓ©parateur de champs
982 label_fields_wrapper: DΓ©limiteur de texte
983 label_fields_wrapper: DΓ©limiteur de texte
983 label_encoding: Encodage
984 label_encoding: Encodage
984 label_comma_char: Virgule
985 label_comma_char: Virgule
985 label_semi_colon_char: Point virgule
986 label_semi_colon_char: Point virgule
986 label_quote_char: Apostrophe
987 label_quote_char: Apostrophe
987 label_double_quote_char: Double apostrophe
988 label_double_quote_char: Double apostrophe
988 label_fields_mapping: Correspondance des champs
989 label_fields_mapping: Correspondance des champs
989 label_file_content_preview: AperΓ§u du contenu du fichier
990 label_file_content_preview: AperΓ§u du contenu du fichier
990 label_create_missing_values: CrΓ©er les valeurs manquantes
991 label_create_missing_values: CrΓ©er les valeurs manquantes
991 label_api: API
992 label_api: API
992 label_field_format_enumeration: Liste clΓ©/valeur
993 label_field_format_enumeration: Liste clΓ©/valeur
993
994
994 button_login: Connexion
995 button_login: Connexion
995 button_submit: Soumettre
996 button_submit: Soumettre
996 button_save: Sauvegarder
997 button_save: Sauvegarder
997 button_check_all: Tout cocher
998 button_check_all: Tout cocher
998 button_uncheck_all: Tout dΓ©cocher
999 button_uncheck_all: Tout dΓ©cocher
999 button_collapse_all: Plier tout
1000 button_collapse_all: Plier tout
1000 button_expand_all: DΓ©plier tout
1001 button_expand_all: DΓ©plier tout
1001 button_delete: Supprimer
1002 button_delete: Supprimer
1002 button_create: CrΓ©er
1003 button_create: CrΓ©er
1003 button_create_and_continue: CrΓ©er et continuer
1004 button_create_and_continue: CrΓ©er et continuer
1004 button_test: Tester
1005 button_test: Tester
1005 button_edit: Modifier
1006 button_edit: Modifier
1006 button_edit_associated_wikipage: "Modifier la page wiki associΓ©e: %{page_title}"
1007 button_edit_associated_wikipage: "Modifier la page wiki associΓ©e: %{page_title}"
1007 button_add: Ajouter
1008 button_add: Ajouter
1008 button_change: Changer
1009 button_change: Changer
1009 button_apply: Appliquer
1010 button_apply: Appliquer
1010 button_clear: Effacer
1011 button_clear: Effacer
1011 button_lock: Verrouiller
1012 button_lock: Verrouiller
1012 button_unlock: DΓ©verrouiller
1013 button_unlock: DΓ©verrouiller
1013 button_download: TΓ©lΓ©charger
1014 button_download: TΓ©lΓ©charger
1014 button_list: Lister
1015 button_list: Lister
1015 button_view: Voir
1016 button_view: Voir
1016 button_move: DΓ©placer
1017 button_move: DΓ©placer
1017 button_move_and_follow: DΓ©placer et suivre
1018 button_move_and_follow: DΓ©placer et suivre
1018 button_back: Retour
1019 button_back: Retour
1019 button_cancel: Annuler
1020 button_cancel: Annuler
1020 button_activate: Activer
1021 button_activate: Activer
1021 button_sort: Trier
1022 button_sort: Trier
1022 button_log_time: Saisir temps
1023 button_log_time: Saisir temps
1023 button_rollback: Revenir Γ  cette version
1024 button_rollback: Revenir Γ  cette version
1024 button_watch: Surveiller
1025 button_watch: Surveiller
1025 button_unwatch: Ne plus surveiller
1026 button_unwatch: Ne plus surveiller
1026 button_reply: RΓ©pondre
1027 button_reply: RΓ©pondre
1027 button_archive: Archiver
1028 button_archive: Archiver
1028 button_unarchive: DΓ©sarchiver
1029 button_unarchive: DΓ©sarchiver
1029 button_reset: RΓ©initialiser
1030 button_reset: RΓ©initialiser
1030 button_rename: Renommer
1031 button_rename: Renommer
1031 button_change_password: Changer de mot de passe
1032 button_change_password: Changer de mot de passe
1032 button_copy: Copier
1033 button_copy: Copier
1033 button_copy_and_follow: Copier et suivre
1034 button_copy_and_follow: Copier et suivre
1034 button_annotate: Annoter
1035 button_annotate: Annoter
1035 button_update: Mettre Γ  jour
1036 button_update: Mettre Γ  jour
1036 button_configure: Configurer
1037 button_configure: Configurer
1037 button_quote: Citer
1038 button_quote: Citer
1038 button_duplicate: Dupliquer
1039 button_duplicate: Dupliquer
1039 button_show: Afficher
1040 button_show: Afficher
1040 button_hide: Cacher
1041 button_hide: Cacher
1041 button_edit_section: Modifier cette section
1042 button_edit_section: Modifier cette section
1042 button_export: Exporter
1043 button_export: Exporter
1043 button_delete_my_account: Supprimer mon compte
1044 button_delete_my_account: Supprimer mon compte
1044 button_close: Fermer
1045 button_close: Fermer
1045 button_reopen: RΓ©ouvrir
1046 button_reopen: RΓ©ouvrir
1046 button_import: Importer
1047 button_import: Importer
1047
1048
1048 status_active: actif
1049 status_active: actif
1049 status_registered: enregistrΓ©
1050 status_registered: enregistrΓ©
1050 status_locked: verrouillΓ©
1051 status_locked: verrouillΓ©
1051
1052
1052 project_status_active: actif
1053 project_status_active: actif
1053 project_status_closed: fermΓ©
1054 project_status_closed: fermΓ©
1054 project_status_archived: archivΓ©
1055 project_status_archived: archivΓ©
1055
1056
1056 version_status_open: ouvert
1057 version_status_open: ouvert
1057 version_status_locked: verrouillΓ©
1058 version_status_locked: verrouillΓ©
1058 version_status_closed: fermΓ©
1059 version_status_closed: fermΓ©
1059
1060
1060 field_active: Actif
1061 field_active: Actif
1061
1062
1062 text_select_mail_notifications: Actions pour lesquelles une notification par e-mail est envoyΓ©e
1063 text_select_mail_notifications: Actions pour lesquelles une notification par e-mail est envoyΓ©e
1063 text_regexp_info: ex. ^[A-Z0-9]+$
1064 text_regexp_info: ex. ^[A-Z0-9]+$
1064 text_min_max_length_info: 0 pour aucune restriction
1065 text_min_max_length_info: 0 pour aucune restriction
1065 text_project_destroy_confirmation: Êtes-vous sûr de vouloir supprimer ce projet et toutes ses données ?
1066 text_project_destroy_confirmation: Êtes-vous sûr de vouloir supprimer ce projet et toutes ses données ?
1066 text_subprojects_destroy_warning: "Ses sous-projets : %{value} seront Γ©galement supprimΓ©s."
1067 text_subprojects_destroy_warning: "Ses sous-projets : %{value} seront Γ©galement supprimΓ©s."
1067 text_workflow_edit: SΓ©lectionner un tracker et un rΓ΄le pour Γ©diter le workflow
1068 text_workflow_edit: SΓ©lectionner un tracker et un rΓ΄le pour Γ©diter le workflow
1068 text_are_you_sure: Êtes-vous sûr ?
1069 text_are_you_sure: Êtes-vous sûr ?
1069 text_journal_changed: "%{label} changΓ© de %{old} Γ  %{new}"
1070 text_journal_changed: "%{label} changΓ© de %{old} Γ  %{new}"
1070 text_journal_changed_no_detail: "%{label} mis Γ  jour"
1071 text_journal_changed_no_detail: "%{label} mis Γ  jour"
1071 text_journal_set_to: "%{label} mis Γ  %{value}"
1072 text_journal_set_to: "%{label} mis Γ  %{value}"
1072 text_journal_deleted: "%{label} %{old} supprimΓ©"
1073 text_journal_deleted: "%{label} %{old} supprimΓ©"
1073 text_journal_added: "%{label} %{value} ajoutΓ©"
1074 text_journal_added: "%{label} %{value} ajoutΓ©"
1074 text_tip_issue_begin_day: tΓ’che commenΓ§ant ce jour
1075 text_tip_issue_begin_day: tΓ’che commenΓ§ant ce jour
1075 text_tip_issue_end_day: tΓ’che finissant ce jour
1076 text_tip_issue_end_day: tΓ’che finissant ce jour
1076 text_tip_issue_begin_end_day: tΓ’che commenΓ§ant et finissant ce jour
1077 text_tip_issue_begin_end_day: tΓ’che commenΓ§ant et finissant ce jour
1077 text_project_identifier_info: 'Seuls les lettres minuscules (a-z), chiffres, tirets et tirets bas sont autorisΓ©s, doit commencer par une minuscule.<br />Un fois sauvegardΓ©, l''identifiant ne pourra plus Γͺtre modifiΓ©.'
1078 text_project_identifier_info: 'Seuls les lettres minuscules (a-z), chiffres, tirets et tirets bas sont autorisΓ©s, doit commencer par une minuscule.<br />Un fois sauvegardΓ©, l''identifiant ne pourra plus Γͺtre modifiΓ©.'
1078 text_caracters_maximum: "%{count} caractères maximum."
1079 text_caracters_maximum: "%{count} caractères maximum."
1079 text_caracters_minimum: "%{count} caractères minimum."
1080 text_caracters_minimum: "%{count} caractères minimum."
1080 text_length_between: "Longueur comprise entre %{min} et %{max} caractères."
1081 text_length_between: "Longueur comprise entre %{min} et %{max} caractères."
1081 text_tracker_no_workflow: Aucun worflow n'est dΓ©fini pour ce tracker
1082 text_tracker_no_workflow: Aucun worflow n'est dΓ©fini pour ce tracker
1082 text_unallowed_characters: Caractères non autorisés
1083 text_unallowed_characters: Caractères non autorisés
1083 text_comma_separated: Plusieurs valeurs possibles (sΓ©parΓ©es par des virgules).
1084 text_comma_separated: Plusieurs valeurs possibles (sΓ©parΓ©es par des virgules).
1084 text_line_separated: Plusieurs valeurs possibles (une valeur par ligne).
1085 text_line_separated: Plusieurs valeurs possibles (une valeur par ligne).
1085 text_issues_ref_in_commit_messages: RΓ©fΓ©rencement et rΓ©solution des demandes dans les commentaires de commits
1086 text_issues_ref_in_commit_messages: RΓ©fΓ©rencement et rΓ©solution des demandes dans les commentaires de commits
1086 text_issue_added: "La demande %{id} a Γ©tΓ© soumise par %{author}."
1087 text_issue_added: "La demande %{id} a Γ©tΓ© soumise par %{author}."
1087 text_issue_updated: "La demande %{id} a Γ©tΓ© mise Γ  jour par %{author}."
1088 text_issue_updated: "La demande %{id} a Γ©tΓ© mise Γ  jour par %{author}."
1088 text_wiki_destroy_confirmation: Etes-vous sΓ»r de vouloir supprimer ce wiki et tout son contenu ?
1089 text_wiki_destroy_confirmation: Etes-vous sΓ»r de vouloir supprimer ce wiki et tout son contenu ?
1089 text_issue_category_destroy_question: "%{count} demandes sont affectΓ©es Γ  cette catΓ©gorie. Que voulez-vous faire ?"
1090 text_issue_category_destroy_question: "%{count} demandes sont affectΓ©es Γ  cette catΓ©gorie. Que voulez-vous faire ?"
1090 text_issue_category_destroy_assignments: N'affecter les demandes Γ  aucune autre catΓ©gorie
1091 text_issue_category_destroy_assignments: N'affecter les demandes Γ  aucune autre catΓ©gorie
1091 text_issue_category_reassign_to: RΓ©affecter les demandes Γ  cette catΓ©gorie
1092 text_issue_category_reassign_to: RΓ©affecter les demandes Γ  cette catΓ©gorie
1092 text_user_mail_option: "Pour les projets non sΓ©lectionnΓ©s, vous recevrez seulement des notifications pour ce que vous surveillez ou Γ  quoi vous participez (exemple: demandes dont vous Γͺtes l'auteur ou la personne assignΓ©e)."
1093 text_user_mail_option: "Pour les projets non sΓ©lectionnΓ©s, vous recevrez seulement des notifications pour ce que vous surveillez ou Γ  quoi vous participez (exemple: demandes dont vous Γͺtes l'auteur ou la personne assignΓ©e)."
1093 text_no_configuration_data: "Les rΓ΄les, trackers, statuts et le workflow ne sont pas encore paramΓ©trΓ©s.\nIl est vivement recommandΓ© de charger le paramΓ©trage par defaut. Vous pourrez le modifier une fois chargΓ©."
1094 text_no_configuration_data: "Les rΓ΄les, trackers, statuts et le workflow ne sont pas encore paramΓ©trΓ©s.\nIl est vivement recommandΓ© de charger le paramΓ©trage par defaut. Vous pourrez le modifier une fois chargΓ©."
1094 text_load_default_configuration: Charger le paramΓ©trage par dΓ©faut
1095 text_load_default_configuration: Charger le paramΓ©trage par dΓ©faut
1095 text_status_changed_by_changeset: "AppliquΓ© par commit %{value}."
1096 text_status_changed_by_changeset: "AppliquΓ© par commit %{value}."
1096 text_time_logged_by_changeset: "AppliquΓ© par commit %{value}"
1097 text_time_logged_by_changeset: "AppliquΓ© par commit %{value}"
1097 text_issues_destroy_confirmation: 'Êtes-vous sûr de vouloir supprimer la ou les demandes(s) selectionnée(s) ?'
1098 text_issues_destroy_confirmation: 'Êtes-vous sûr de vouloir supprimer la ou les demandes(s) selectionnée(s) ?'
1098 text_issues_destroy_descendants_confirmation: "Cela entrainera Γ©galement la suppression de %{count} sous-tΓ’che(s)."
1099 text_issues_destroy_descendants_confirmation: "Cela entrainera Γ©galement la suppression de %{count} sous-tΓ’che(s)."
1099 text_time_entries_destroy_confirmation: "Etes-vous sΓ»r de vouloir supprimer les temps passΓ©s sΓ©lectionnΓ©s ?"
1100 text_time_entries_destroy_confirmation: "Etes-vous sΓ»r de vouloir supprimer les temps passΓ©s sΓ©lectionnΓ©s ?"
1100 text_select_project_modules: 'SΓ©lectionner les modules Γ  activer pour ce projet :'
1101 text_select_project_modules: 'SΓ©lectionner les modules Γ  activer pour ce projet :'
1101 text_default_administrator_account_changed: Compte administrateur par dΓ©faut changΓ©
1102 text_default_administrator_account_changed: Compte administrateur par dΓ©faut changΓ©
1102 text_file_repository_writable: RΓ©pertoire de stockage des fichiers accessible en Γ©criture
1103 text_file_repository_writable: RΓ©pertoire de stockage des fichiers accessible en Γ©criture
1103 text_plugin_assets_writable: RΓ©pertoire public des plugins accessible en Γ©criture
1104 text_plugin_assets_writable: RΓ©pertoire public des plugins accessible en Γ©criture
1104 text_rmagick_available: Bibliothèque RMagick présente (optionnelle)
1105 text_rmagick_available: Bibliothèque RMagick présente (optionnelle)
1105 text_convert_available: Binaire convert de ImageMagick prΓ©sent (optionel)
1106 text_convert_available: Binaire convert de ImageMagick prΓ©sent (optionel)
1106 text_destroy_time_entries_question: "%{hours} heures ont Γ©tΓ© enregistrΓ©es sur les demandes Γ  supprimer. Que voulez-vous faire ?"
1107 text_destroy_time_entries_question: "%{hours} heures ont Γ©tΓ© enregistrΓ©es sur les demandes Γ  supprimer. Que voulez-vous faire ?"
1107 text_destroy_time_entries: Supprimer les heures
1108 text_destroy_time_entries: Supprimer les heures
1108 text_assign_time_entries_to_project: Reporter les heures sur le projet
1109 text_assign_time_entries_to_project: Reporter les heures sur le projet
1109 text_reassign_time_entries: 'Reporter les heures sur cette demande:'
1110 text_reassign_time_entries: 'Reporter les heures sur cette demande:'
1110 text_user_wrote: "%{value} a Γ©crit :"
1111 text_user_wrote: "%{value} a Γ©crit :"
1111 text_enumeration_destroy_question: "La valeur Β« %{name} Β» est affectΓ©e Γ  %{count} objet(s)."
1112 text_enumeration_destroy_question: "La valeur Β« %{name} Β» est affectΓ©e Γ  %{count} objet(s)."
1112 text_enumeration_category_reassign_to: 'RΓ©affecter les objets Γ  cette valeur:'
1113 text_enumeration_category_reassign_to: 'RΓ©affecter les objets Γ  cette valeur:'
1113 text_email_delivery_not_configured: "L'envoi de mail n'est pas configurΓ©, les notifications sont dΓ©sactivΓ©es.\nConfigurez votre serveur SMTP dans config/configuration.yml et redΓ©marrez l'application pour les activer."
1114 text_email_delivery_not_configured: "L'envoi de mail n'est pas configurΓ©, les notifications sont dΓ©sactivΓ©es.\nConfigurez votre serveur SMTP dans config/configuration.yml et redΓ©marrez l'application pour les activer."
1114 text_repository_usernames_mapping: "Vous pouvez sΓ©lectionner ou modifier l'utilisateur Redmine associΓ© Γ  chaque nom d'utilisateur figurant dans l'historique du dΓ©pΓ΄t.\nLes utilisateurs avec le mΓͺme identifiant ou la mΓͺme adresse mail seront automatiquement associΓ©s."
1115 text_repository_usernames_mapping: "Vous pouvez sΓ©lectionner ou modifier l'utilisateur Redmine associΓ© Γ  chaque nom d'utilisateur figurant dans l'historique du dΓ©pΓ΄t.\nLes utilisateurs avec le mΓͺme identifiant ou la mΓͺme adresse mail seront automatiquement associΓ©s."
1115 text_diff_truncated: '... Ce diffΓ©rentiel a Γ©tΓ© tronquΓ© car il excΓ¨de la taille maximale pouvant Γͺtre affichΓ©e.'
1116 text_diff_truncated: '... Ce diffΓ©rentiel a Γ©tΓ© tronquΓ© car il excΓ¨de la taille maximale pouvant Γͺtre affichΓ©e.'
1116 text_custom_field_possible_values_info: 'Une ligne par valeur'
1117 text_custom_field_possible_values_info: 'Une ligne par valeur'
1117 text_wiki_page_destroy_question: "Cette page possède %{descendants} sous-page(s) et descendante(s). Que voulez-vous faire ?"
1118 text_wiki_page_destroy_question: "Cette page possède %{descendants} sous-page(s) et descendante(s). Que voulez-vous faire ?"
1118 text_wiki_page_nullify_children: "Conserver les sous-pages en tant que pages racines"
1119 text_wiki_page_nullify_children: "Conserver les sous-pages en tant que pages racines"
1119 text_wiki_page_destroy_children: "Supprimer les sous-pages et toutes leurs descedantes"
1120 text_wiki_page_destroy_children: "Supprimer les sous-pages et toutes leurs descedantes"
1120 text_wiki_page_reassign_children: "RΓ©affecter les sous-pages Γ  cette page"
1121 text_wiki_page_reassign_children: "RΓ©affecter les sous-pages Γ  cette page"
1121 text_own_membership_delete_confirmation: "Vous allez supprimer tout ou partie de vos permissions sur ce projet et ne serez peut-Γͺtre plus autorisΓ© Γ  modifier ce projet.\nEtes-vous sΓ»r de vouloir continuer ?"
1122 text_own_membership_delete_confirmation: "Vous allez supprimer tout ou partie de vos permissions sur ce projet et ne serez peut-Γͺtre plus autorisΓ© Γ  modifier ce projet.\nEtes-vous sΓ»r de vouloir continuer ?"
1122 text_zoom_in: Zoom avant
1123 text_zoom_in: Zoom avant
1123 text_zoom_out: Zoom arrière
1124 text_zoom_out: Zoom arrière
1124 text_warn_on_leaving_unsaved: "Cette page contient du texte non sauvegardΓ© qui sera perdu si vous quittez la page."
1125 text_warn_on_leaving_unsaved: "Cette page contient du texte non sauvegardΓ© qui sera perdu si vous quittez la page."
1125 text_scm_path_encoding_note: "DΓ©faut : UTF-8"
1126 text_scm_path_encoding_note: "DΓ©faut : UTF-8"
1126 text_subversion_repository_note: "Exemples (en fonction des protocoles supportΓ©s) : file:///, http://, https://, svn://, svn+[tunnelscheme]://"
1127 text_subversion_repository_note: "Exemples (en fonction des protocoles supportΓ©s) : file:///, http://, https://, svn://, svn+[tunnelscheme]://"
1127 text_git_repository_note: "Chemin vers un dΓ©pΓ΄t vide et local (exemples : /gitrepo, c:\\gitrepo)"
1128 text_git_repository_note: "Chemin vers un dΓ©pΓ΄t vide et local (exemples : /gitrepo, c:\\gitrepo)"
1128 text_mercurial_repository_note: "Chemin vers un dΓ©pΓ΄t local (exemples : /hgrepo, c:\\hgrepo)"
1129 text_mercurial_repository_note: "Chemin vers un dΓ©pΓ΄t local (exemples : /hgrepo, c:\\hgrepo)"
1129 text_scm_command: Commande
1130 text_scm_command: Commande
1130 text_scm_command_version: Version
1131 text_scm_command_version: Version
1131 text_scm_config: Vous pouvez configurer les commandes des SCM dans config/configuration.yml. Redémarrer l'application après modification.
1132 text_scm_config: Vous pouvez configurer les commandes des SCM dans config/configuration.yml. Redémarrer l'application après modification.
1132 text_scm_command_not_available: Ce SCM n'est pas disponible. Vérifier les paramètres dans la section administration.
1133 text_scm_command_not_available: Ce SCM n'est pas disponible. Vérifier les paramètres dans la section administration.
1133 text_issue_conflict_resolution_overwrite: "Appliquer quand mΓͺme ma mise Γ  jour (les notes prΓ©cΓ©dentes seront conservΓ©es mais des changements pourront Γͺtre Γ©crasΓ©s)"
1134 text_issue_conflict_resolution_overwrite: "Appliquer quand mΓͺme ma mise Γ  jour (les notes prΓ©cΓ©dentes seront conservΓ©es mais des changements pourront Γͺtre Γ©crasΓ©s)"
1134 text_issue_conflict_resolution_add_notes: "Ajouter mes notes et ignorer mes autres changements"
1135 text_issue_conflict_resolution_add_notes: "Ajouter mes notes et ignorer mes autres changements"
1135 text_issue_conflict_resolution_cancel: "Annuler ma mise Γ  jour et rΓ©afficher %{link}"
1136 text_issue_conflict_resolution_cancel: "Annuler ma mise Γ  jour et rΓ©afficher %{link}"
1136 text_account_destroy_confirmation: "Êtes-vous sûr de vouloir continuer ?\nVotre compte sera définitivement supprimé, sans aucune possibilité de le réactiver."
1137 text_account_destroy_confirmation: "Êtes-vous sûr de vouloir continuer ?\nVotre compte sera définitivement supprimé, sans aucune possibilité de le réactiver."
1137 text_session_expiration_settings: "Attention : le changement de ces paramètres peut entrainer l'expiration des sessions utilisateurs en cours, y compris la vôtre."
1138 text_session_expiration_settings: "Attention : le changement de ces paramètres peut entrainer l'expiration des sessions utilisateurs en cours, y compris la vôtre."
1138 text_project_closed: Ce projet est fermΓ© et accessible en lecture seule.
1139 text_project_closed: Ce projet est fermΓ© et accessible en lecture seule.
1139 text_turning_multiple_off: "Si vous dΓ©sactivez les valeurs multiples, les valeurs multiples seront supprimΓ©es pour n'en conserver qu'une par objet."
1140 text_turning_multiple_off: "Si vous dΓ©sactivez les valeurs multiples, les valeurs multiples seront supprimΓ©es pour n'en conserver qu'une par objet."
1140
1141
1141 default_role_manager: Manager
1142 default_role_manager: Manager
1142 default_role_developer: DΓ©veloppeur
1143 default_role_developer: DΓ©veloppeur
1143 default_role_reporter: Rapporteur
1144 default_role_reporter: Rapporteur
1144 default_tracker_bug: Anomalie
1145 default_tracker_bug: Anomalie
1145 default_tracker_feature: Evolution
1146 default_tracker_feature: Evolution
1146 default_tracker_support: Assistance
1147 default_tracker_support: Assistance
1147 default_issue_status_new: Nouveau
1148 default_issue_status_new: Nouveau
1148 default_issue_status_in_progress: En cours
1149 default_issue_status_in_progress: En cours
1149 default_issue_status_resolved: RΓ©solu
1150 default_issue_status_resolved: RΓ©solu
1150 default_issue_status_feedback: Commentaire
1151 default_issue_status_feedback: Commentaire
1151 default_issue_status_closed: FermΓ©
1152 default_issue_status_closed: FermΓ©
1152 default_issue_status_rejected: RejetΓ©
1153 default_issue_status_rejected: RejetΓ©
1153 default_doc_category_user: Documentation utilisateur
1154 default_doc_category_user: Documentation utilisateur
1154 default_doc_category_tech: Documentation technique
1155 default_doc_category_tech: Documentation technique
1155 default_priority_low: Bas
1156 default_priority_low: Bas
1156 default_priority_normal: Normal
1157 default_priority_normal: Normal
1157 default_priority_high: Haut
1158 default_priority_high: Haut
1158 default_priority_urgent: Urgent
1159 default_priority_urgent: Urgent
1159 default_priority_immediate: ImmΓ©diat
1160 default_priority_immediate: ImmΓ©diat
1160 default_activity_design: Conception
1161 default_activity_design: Conception
1161 default_activity_development: DΓ©veloppement
1162 default_activity_development: DΓ©veloppement
1162
1163
1163 enumeration_issue_priorities: PrioritΓ©s des demandes
1164 enumeration_issue_priorities: PrioritΓ©s des demandes
1164 enumeration_doc_categories: CatΓ©gories des documents
1165 enumeration_doc_categories: CatΓ©gories des documents
1165 enumeration_activities: ActivitΓ©s (suivi du temps)
1166 enumeration_activities: ActivitΓ©s (suivi du temps)
1166 enumeration_system_activity: Activité système
1167 enumeration_system_activity: Activité système
1167 description_filter: Filtre
1168 description_filter: Filtre
1168 description_search: Champ de recherche
1169 description_search: Champ de recherche
1169 description_choose_project: Projets
1170 description_choose_project: Projets
1170 description_project_scope: Périmètre de recherche
1171 description_project_scope: Périmètre de recherche
1171 description_notes: Notes
1172 description_notes: Notes
1172 description_message_content: Contenu du message
1173 description_message_content: Contenu du message
1173 description_query_sort_criteria_attribute: Critère de tri
1174 description_query_sort_criteria_attribute: Critère de tri
1174 description_query_sort_criteria_direction: Ordre de tri
1175 description_query_sort_criteria_direction: Ordre de tri
1175 description_user_mail_notification: Option de notification
1176 description_user_mail_notification: Option de notification
1176 description_available_columns: Colonnes disponibles
1177 description_available_columns: Colonnes disponibles
1177 description_selected_columns: Colonnes sΓ©lectionnΓ©es
1178 description_selected_columns: Colonnes sΓ©lectionnΓ©es
1178 description_all_columns: Toutes les colonnes
1179 description_all_columns: Toutes les colonnes
1179 description_issue_category_reassign: Choisir une catΓ©gorie
1180 description_issue_category_reassign: Choisir une catΓ©gorie
1180 description_wiki_subpages_reassign: Choisir une nouvelle page parent
1181 description_wiki_subpages_reassign: Choisir une nouvelle page parent
1181 description_date_range_list: Choisir une pΓ©riode prΓ©dΓ©finie
1182 description_date_range_list: Choisir une pΓ©riode prΓ©dΓ©finie
1182 description_date_range_interval: Choisir une pΓ©riode
1183 description_date_range_interval: Choisir une pΓ©riode
1183 description_date_from: Date de dΓ©but
1184 description_date_from: Date de dΓ©but
1184 description_date_to: Date de fin
1185 description_date_to: Date de fin
1185 text_repository_identifier_info: 'Seuls les lettres minuscules (a-z), chiffres, tirets et tirets bas sont autorisΓ©s.<br />Un fois sauvegardΓ©, l''identifiant ne pourra plus Γͺtre modifiΓ©.'
1186 text_repository_identifier_info: 'Seuls les lettres minuscules (a-z), chiffres, tirets et tirets bas sont autorisΓ©s.<br />Un fois sauvegardΓ©, l''identifiant ne pourra plus Γͺtre modifiΓ©.'
1186 label_parent_task_attributes_derived: Calculated from subtasks
1187 label_parent_task_attributes_derived: Calculated from subtasks
1187 label_parent_task_attributes_independent: Independent of subtasks
1188 label_parent_task_attributes_independent: Independent of subtasks
1 NO CONTENT: modified file
NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -1,2759 +1,2767
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2015 Jean-Philippe Lang
2 # Copyright (C) 2006-2015 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.expand_path('../../test_helper', __FILE__)
18 require File.expand_path('../../test_helper', __FILE__)
19
19
20 class IssueTest < ActiveSupport::TestCase
20 class IssueTest < ActiveSupport::TestCase
21 fixtures :projects, :users, :email_addresses, :members, :member_roles, :roles,
21 fixtures :projects, :users, :email_addresses, :members, :member_roles, :roles,
22 :groups_users,
22 :groups_users,
23 :trackers, :projects_trackers,
23 :trackers, :projects_trackers,
24 :enabled_modules,
24 :enabled_modules,
25 :versions,
25 :versions,
26 :issue_statuses, :issue_categories, :issue_relations, :workflows,
26 :issue_statuses, :issue_categories, :issue_relations, :workflows,
27 :enumerations,
27 :enumerations,
28 :issues, :journals, :journal_details,
28 :issues, :journals, :journal_details,
29 :custom_fields, :custom_fields_projects, :custom_fields_trackers, :custom_values,
29 :custom_fields, :custom_fields_projects, :custom_fields_trackers, :custom_values,
30 :time_entries
30 :time_entries
31
31
32 include Redmine::I18n
32 include Redmine::I18n
33
33
34 def setup
34 def setup
35 set_language_if_valid 'en'
35 set_language_if_valid 'en'
36 end
36 end
37
37
38 def teardown
38 def teardown
39 User.current = nil
39 User.current = nil
40 end
40 end
41
41
42 def test_initialize
42 def test_initialize
43 issue = Issue.new
43 issue = Issue.new
44
44
45 assert_nil issue.project_id
45 assert_nil issue.project_id
46 assert_nil issue.tracker_id
46 assert_nil issue.tracker_id
47 assert_nil issue.status_id
47 assert_nil issue.status_id
48 assert_nil issue.author_id
48 assert_nil issue.author_id
49 assert_nil issue.assigned_to_id
49 assert_nil issue.assigned_to_id
50 assert_nil issue.category_id
50 assert_nil issue.category_id
51
51
52 assert_equal IssuePriority.default, issue.priority
52 assert_equal IssuePriority.default, issue.priority
53 end
53 end
54
54
55 def test_create
55 def test_create
56 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3,
56 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3,
57 :status_id => 1, :priority => IssuePriority.all.first,
57 :status_id => 1, :priority => IssuePriority.all.first,
58 :subject => 'test_create',
58 :subject => 'test_create',
59 :description => 'IssueTest#test_create', :estimated_hours => '1:30')
59 :description => 'IssueTest#test_create', :estimated_hours => '1:30')
60 assert issue.save
60 assert issue.save
61 issue.reload
61 issue.reload
62 assert_equal 1.5, issue.estimated_hours
62 assert_equal 1.5, issue.estimated_hours
63 end
63 end
64
64
65 def test_create_minimal
65 def test_create_minimal
66 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, :subject => 'test_create')
66 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, :subject => 'test_create')
67 assert issue.save
67 assert issue.save
68 assert_equal issue.tracker.default_status, issue.status
68 assert_equal issue.tracker.default_status, issue.status
69 assert issue.description.nil?
69 assert issue.description.nil?
70 assert_nil issue.estimated_hours
70 assert_nil issue.estimated_hours
71 end
71 end
72
72
73 def test_create_with_all_fields_disabled
73 def test_create_with_all_fields_disabled
74 tracker = Tracker.find(1)
74 tracker = Tracker.find(1)
75 tracker.core_fields = []
75 tracker.core_fields = []
76 tracker.save!
76 tracker.save!
77
77
78 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, :subject => 'test_create_with_all_fields_disabled')
78 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, :subject => 'test_create_with_all_fields_disabled')
79 assert_save issue
79 assert_save issue
80 end
80 end
81
81
82 def test_start_date_format_should_be_validated
82 def test_start_date_format_should_be_validated
83 set_language_if_valid 'en'
83 set_language_if_valid 'en'
84 ['2012', 'ABC', '2012-15-20'].each do |invalid_date|
84 ['2012', 'ABC', '2012-15-20'].each do |invalid_date|
85 issue = Issue.new(:start_date => invalid_date)
85 issue = Issue.new(:start_date => invalid_date)
86 assert !issue.valid?
86 assert !issue.valid?
87 assert_include 'Start date is not a valid date', issue.errors.full_messages, "No error found for invalid date #{invalid_date}"
87 assert_include 'Start date is not a valid date', issue.errors.full_messages, "No error found for invalid date #{invalid_date}"
88 end
88 end
89 end
89 end
90
90
91 def test_due_date_format_should_be_validated
91 def test_due_date_format_should_be_validated
92 set_language_if_valid 'en'
92 set_language_if_valid 'en'
93 ['2012', 'ABC', '2012-15-20'].each do |invalid_date|
93 ['2012', 'ABC', '2012-15-20'].each do |invalid_date|
94 issue = Issue.new(:due_date => invalid_date)
94 issue = Issue.new(:due_date => invalid_date)
95 assert !issue.valid?
95 assert !issue.valid?
96 assert_include 'Due date is not a valid date', issue.errors.full_messages, "No error found for invalid date #{invalid_date}"
96 assert_include 'Due date is not a valid date', issue.errors.full_messages, "No error found for invalid date #{invalid_date}"
97 end
97 end
98 end
98 end
99
99
100 def test_due_date_lesser_than_start_date_should_not_validate
100 def test_due_date_lesser_than_start_date_should_not_validate
101 set_language_if_valid 'en'
101 set_language_if_valid 'en'
102 issue = Issue.new(:start_date => '2012-10-06', :due_date => '2012-10-02')
102 issue = Issue.new(:start_date => '2012-10-06', :due_date => '2012-10-02')
103 assert !issue.valid?
103 assert !issue.valid?
104 assert_include 'Due date must be greater than start date', issue.errors.full_messages
104 assert_include 'Due date must be greater than start date', issue.errors.full_messages
105 end
105 end
106
106
107 def test_start_date_lesser_than_soonest_start_should_not_validate_on_create
107 def test_start_date_lesser_than_soonest_start_should_not_validate_on_create
108 issue = Issue.generate(:start_date => '2013-06-04')
108 issue = Issue.generate(:start_date => '2013-06-04')
109 issue.stubs(:soonest_start).returns(Date.parse('2013-06-10'))
109 issue.stubs(:soonest_start).returns(Date.parse('2013-06-10'))
110 assert !issue.valid?
110 assert !issue.valid?
111 assert_include "Start date cannot be earlier than 06/10/2013 because of preceding issues", issue.errors.full_messages
111 assert_include "Start date cannot be earlier than 06/10/2013 because of preceding issues", issue.errors.full_messages
112 end
112 end
113
113
114 def test_start_date_lesser_than_soonest_start_should_not_validate_on_update_if_changed
114 def test_start_date_lesser_than_soonest_start_should_not_validate_on_update_if_changed
115 issue = Issue.generate!(:start_date => '2013-06-04')
115 issue = Issue.generate!(:start_date => '2013-06-04')
116 issue.stubs(:soonest_start).returns(Date.parse('2013-06-10'))
116 issue.stubs(:soonest_start).returns(Date.parse('2013-06-10'))
117 issue.start_date = '2013-06-07'
117 issue.start_date = '2013-06-07'
118 assert !issue.valid?
118 assert !issue.valid?
119 assert_include "Start date cannot be earlier than 06/10/2013 because of preceding issues", issue.errors.full_messages
119 assert_include "Start date cannot be earlier than 06/10/2013 because of preceding issues", issue.errors.full_messages
120 end
120 end
121
121
122 def test_start_date_lesser_than_soonest_start_should_validate_on_update_if_unchanged
122 def test_start_date_lesser_than_soonest_start_should_validate_on_update_if_unchanged
123 issue = Issue.generate!(:start_date => '2013-06-04')
123 issue = Issue.generate!(:start_date => '2013-06-04')
124 issue.stubs(:soonest_start).returns(Date.parse('2013-06-10'))
124 issue.stubs(:soonest_start).returns(Date.parse('2013-06-10'))
125 assert issue.valid?
125 assert issue.valid?
126 end
126 end
127
127
128 def test_estimated_hours_should_be_validated
128 def test_estimated_hours_should_be_validated
129 set_language_if_valid 'en'
129 set_language_if_valid 'en'
130 ['-2'].each do |invalid|
130 ['-2'].each do |invalid|
131 issue = Issue.new(:estimated_hours => invalid)
131 issue = Issue.new(:estimated_hours => invalid)
132 assert !issue.valid?
132 assert !issue.valid?
133 assert_include 'Estimated time is invalid', issue.errors.full_messages
133 assert_include 'Estimated time is invalid', issue.errors.full_messages
134 end
134 end
135 end
135 end
136
136
137 def test_create_with_required_custom_field
137 def test_create_with_required_custom_field
138 set_language_if_valid 'en'
138 set_language_if_valid 'en'
139 field = IssueCustomField.find_by_name('Database')
139 field = IssueCustomField.find_by_name('Database')
140 field.update_attribute(:is_required, true)
140 field.update_attribute(:is_required, true)
141
141
142 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1,
142 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1,
143 :status_id => 1, :subject => 'test_create',
143 :status_id => 1, :subject => 'test_create',
144 :description => 'IssueTest#test_create_with_required_custom_field')
144 :description => 'IssueTest#test_create_with_required_custom_field')
145 assert issue.available_custom_fields.include?(field)
145 assert issue.available_custom_fields.include?(field)
146 # No value for the custom field
146 # No value for the custom field
147 assert !issue.save
147 assert !issue.save
148 assert_equal ["Database cannot be blank"], issue.errors.full_messages
148 assert_equal ["Database cannot be blank"], issue.errors.full_messages
149 # Blank value
149 # Blank value
150 issue.custom_field_values = { field.id => '' }
150 issue.custom_field_values = { field.id => '' }
151 assert !issue.save
151 assert !issue.save
152 assert_equal ["Database cannot be blank"], issue.errors.full_messages
152 assert_equal ["Database cannot be blank"], issue.errors.full_messages
153 # Invalid value
153 # Invalid value
154 issue.custom_field_values = { field.id => 'SQLServer' }
154 issue.custom_field_values = { field.id => 'SQLServer' }
155 assert !issue.save
155 assert !issue.save
156 assert_equal ["Database is not included in the list"], issue.errors.full_messages
156 assert_equal ["Database is not included in the list"], issue.errors.full_messages
157 # Valid value
157 # Valid value
158 issue.custom_field_values = { field.id => 'PostgreSQL' }
158 issue.custom_field_values = { field.id => 'PostgreSQL' }
159 assert issue.save
159 assert issue.save
160 issue.reload
160 issue.reload
161 assert_equal 'PostgreSQL', issue.custom_value_for(field).value
161 assert_equal 'PostgreSQL', issue.custom_value_for(field).value
162 end
162 end
163
163
164 def test_create_with_group_assignment
164 def test_create_with_group_assignment
165 with_settings :issue_group_assignment => '1' do
165 with_settings :issue_group_assignment => '1' do
166 assert Issue.new(:project_id => 2, :tracker_id => 1, :author_id => 1,
166 assert Issue.new(:project_id => 2, :tracker_id => 1, :author_id => 1,
167 :subject => 'Group assignment',
167 :subject => 'Group assignment',
168 :assigned_to_id => 11).save
168 :assigned_to_id => 11).save
169 issue = Issue.order('id DESC').first
169 issue = Issue.order('id DESC').first
170 assert_kind_of Group, issue.assigned_to
170 assert_kind_of Group, issue.assigned_to
171 assert_equal Group.find(11), issue.assigned_to
171 assert_equal Group.find(11), issue.assigned_to
172 end
172 end
173 end
173 end
174
174
175 def test_create_with_parent_issue_id
175 def test_create_with_parent_issue_id
176 issue = Issue.new(:project_id => 1, :tracker_id => 1,
176 issue = Issue.new(:project_id => 1, :tracker_id => 1,
177 :author_id => 1, :subject => 'Group assignment',
177 :author_id => 1, :subject => 'Group assignment',
178 :parent_issue_id => 1)
178 :parent_issue_id => 1)
179 assert_save issue
179 assert_save issue
180 assert_equal 1, issue.parent_issue_id
180 assert_equal 1, issue.parent_issue_id
181 assert_equal Issue.find(1), issue.parent
181 assert_equal Issue.find(1), issue.parent
182 end
182 end
183
183
184 def test_create_with_sharp_parent_issue_id
184 def test_create_with_sharp_parent_issue_id
185 issue = Issue.new(:project_id => 1, :tracker_id => 1,
185 issue = Issue.new(:project_id => 1, :tracker_id => 1,
186 :author_id => 1, :subject => 'Group assignment',
186 :author_id => 1, :subject => 'Group assignment',
187 :parent_issue_id => "#1")
187 :parent_issue_id => "#1")
188 assert_save issue
188 assert_save issue
189 assert_equal 1, issue.parent_issue_id
189 assert_equal 1, issue.parent_issue_id
190 assert_equal Issue.find(1), issue.parent
190 assert_equal Issue.find(1), issue.parent
191 end
191 end
192
192
193 def test_create_with_invalid_parent_issue_id
193 def test_create_with_invalid_parent_issue_id
194 set_language_if_valid 'en'
194 set_language_if_valid 'en'
195 issue = Issue.new(:project_id => 1, :tracker_id => 1,
195 issue = Issue.new(:project_id => 1, :tracker_id => 1,
196 :author_id => 1, :subject => 'Group assignment',
196 :author_id => 1, :subject => 'Group assignment',
197 :parent_issue_id => '01ABC')
197 :parent_issue_id => '01ABC')
198 assert !issue.save
198 assert !issue.save
199 assert_equal '01ABC', issue.parent_issue_id
199 assert_equal '01ABC', issue.parent_issue_id
200 assert_include 'Parent task is invalid', issue.errors.full_messages
200 assert_include 'Parent task is invalid', issue.errors.full_messages
201 end
201 end
202
202
203 def test_create_with_invalid_sharp_parent_issue_id
203 def test_create_with_invalid_sharp_parent_issue_id
204 set_language_if_valid 'en'
204 set_language_if_valid 'en'
205 issue = Issue.new(:project_id => 1, :tracker_id => 1,
205 issue = Issue.new(:project_id => 1, :tracker_id => 1,
206 :author_id => 1, :subject => 'Group assignment',
206 :author_id => 1, :subject => 'Group assignment',
207 :parent_issue_id => '#01ABC')
207 :parent_issue_id => '#01ABC')
208 assert !issue.save
208 assert !issue.save
209 assert_equal '#01ABC', issue.parent_issue_id
209 assert_equal '#01ABC', issue.parent_issue_id
210 assert_include 'Parent task is invalid', issue.errors.full_messages
210 assert_include 'Parent task is invalid', issue.errors.full_messages
211 end
211 end
212
212
213 def assert_visibility_match(user, issues)
213 def assert_visibility_match(user, issues)
214 assert_equal issues.collect(&:id).sort, Issue.all.select {|issue| issue.visible?(user)}.collect(&:id).sort
214 assert_equal issues.collect(&:id).sort, Issue.all.select {|issue| issue.visible?(user)}.collect(&:id).sort
215 end
215 end
216
216
217 def test_visible_scope_for_anonymous
217 def test_visible_scope_for_anonymous
218 # Anonymous user should see issues of public projects only
218 # Anonymous user should see issues of public projects only
219 issues = Issue.visible(User.anonymous).to_a
219 issues = Issue.visible(User.anonymous).to_a
220 assert issues.any?
220 assert issues.any?
221 assert_nil issues.detect {|issue| !issue.project.is_public?}
221 assert_nil issues.detect {|issue| !issue.project.is_public?}
222 assert_nil issues.detect {|issue| issue.is_private?}
222 assert_nil issues.detect {|issue| issue.is_private?}
223 assert_visibility_match User.anonymous, issues
223 assert_visibility_match User.anonymous, issues
224 end
224 end
225
225
226 def test_visible_scope_for_anonymous_without_view_issues_permissions
226 def test_visible_scope_for_anonymous_without_view_issues_permissions
227 # Anonymous user should not see issues without permission
227 # Anonymous user should not see issues without permission
228 Role.anonymous.remove_permission!(:view_issues)
228 Role.anonymous.remove_permission!(:view_issues)
229 issues = Issue.visible(User.anonymous).to_a
229 issues = Issue.visible(User.anonymous).to_a
230 assert issues.empty?
230 assert issues.empty?
231 assert_visibility_match User.anonymous, issues
231 assert_visibility_match User.anonymous, issues
232 end
232 end
233
233
234 def test_visible_scope_for_anonymous_without_view_issues_permissions_and_membership
234 def test_visible_scope_for_anonymous_without_view_issues_permissions_and_membership
235 Role.anonymous.remove_permission!(:view_issues)
235 Role.anonymous.remove_permission!(:view_issues)
236 Member.create!(:project_id => 1, :principal => Group.anonymous, :role_ids => [2])
236 Member.create!(:project_id => 1, :principal => Group.anonymous, :role_ids => [2])
237
237
238 issues = Issue.visible(User.anonymous).all
238 issues = Issue.visible(User.anonymous).all
239 assert issues.any?
239 assert issues.any?
240 assert_equal [1], issues.map(&:project_id).uniq.sort
240 assert_equal [1], issues.map(&:project_id).uniq.sort
241 assert_visibility_match User.anonymous, issues
241 assert_visibility_match User.anonymous, issues
242 end
242 end
243
243
244 def test_anonymous_should_not_see_private_issues_with_issues_visibility_set_to_default
244 def test_anonymous_should_not_see_private_issues_with_issues_visibility_set_to_default
245 assert Role.anonymous.update_attribute(:issues_visibility, 'default')
245 assert Role.anonymous.update_attribute(:issues_visibility, 'default')
246 issue = Issue.generate!(:author => User.anonymous, :assigned_to => User.anonymous, :is_private => true)
246 issue = Issue.generate!(:author => User.anonymous, :assigned_to => User.anonymous, :is_private => true)
247 assert_nil Issue.where(:id => issue.id).visible(User.anonymous).first
247 assert_nil Issue.where(:id => issue.id).visible(User.anonymous).first
248 assert !issue.visible?(User.anonymous)
248 assert !issue.visible?(User.anonymous)
249 end
249 end
250
250
251 def test_anonymous_should_not_see_private_issues_with_issues_visibility_set_to_own
251 def test_anonymous_should_not_see_private_issues_with_issues_visibility_set_to_own
252 assert Role.anonymous.update_attribute(:issues_visibility, 'own')
252 assert Role.anonymous.update_attribute(:issues_visibility, 'own')
253 issue = Issue.generate!(:author => User.anonymous, :assigned_to => User.anonymous, :is_private => true)
253 issue = Issue.generate!(:author => User.anonymous, :assigned_to => User.anonymous, :is_private => true)
254 assert_nil Issue.where(:id => issue.id).visible(User.anonymous).first
254 assert_nil Issue.where(:id => issue.id).visible(User.anonymous).first
255 assert !issue.visible?(User.anonymous)
255 assert !issue.visible?(User.anonymous)
256 end
256 end
257
257
258 def test_visible_scope_for_non_member
258 def test_visible_scope_for_non_member
259 user = User.find(9)
259 user = User.find(9)
260 assert user.projects.empty?
260 assert user.projects.empty?
261 # Non member user should see issues of public projects only
261 # Non member user should see issues of public projects only
262 issues = Issue.visible(user).to_a
262 issues = Issue.visible(user).to_a
263 assert issues.any?
263 assert issues.any?
264 assert_nil issues.detect {|issue| !issue.project.is_public?}
264 assert_nil issues.detect {|issue| !issue.project.is_public?}
265 assert_nil issues.detect {|issue| issue.is_private?}
265 assert_nil issues.detect {|issue| issue.is_private?}
266 assert_visibility_match user, issues
266 assert_visibility_match user, issues
267 end
267 end
268
268
269 def test_visible_scope_for_non_member_with_own_issues_visibility
269 def test_visible_scope_for_non_member_with_own_issues_visibility
270 Role.non_member.update_attribute :issues_visibility, 'own'
270 Role.non_member.update_attribute :issues_visibility, 'own'
271 Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 9, :subject => 'Issue by non member')
271 Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 9, :subject => 'Issue by non member')
272 user = User.find(9)
272 user = User.find(9)
273
273
274 issues = Issue.visible(user).to_a
274 issues = Issue.visible(user).to_a
275 assert issues.any?
275 assert issues.any?
276 assert_nil issues.detect {|issue| issue.author != user}
276 assert_nil issues.detect {|issue| issue.author != user}
277 assert_visibility_match user, issues
277 assert_visibility_match user, issues
278 end
278 end
279
279
280 def test_visible_scope_for_non_member_without_view_issues_permissions
280 def test_visible_scope_for_non_member_without_view_issues_permissions
281 # Non member user should not see issues without permission
281 # Non member user should not see issues without permission
282 Role.non_member.remove_permission!(:view_issues)
282 Role.non_member.remove_permission!(:view_issues)
283 user = User.find(9)
283 user = User.find(9)
284 assert user.projects.empty?
284 assert user.projects.empty?
285 issues = Issue.visible(user).to_a
285 issues = Issue.visible(user).to_a
286 assert issues.empty?
286 assert issues.empty?
287 assert_visibility_match user, issues
287 assert_visibility_match user, issues
288 end
288 end
289
289
290 def test_visible_scope_for_non_member_without_view_issues_permissions_and_membership
290 def test_visible_scope_for_non_member_without_view_issues_permissions_and_membership
291 Role.non_member.remove_permission!(:view_issues)
291 Role.non_member.remove_permission!(:view_issues)
292 Member.create!(:project_id => 1, :principal => Group.non_member, :role_ids => [2])
292 Member.create!(:project_id => 1, :principal => Group.non_member, :role_ids => [2])
293 user = User.find(9)
293 user = User.find(9)
294
294
295 issues = Issue.visible(user).all
295 issues = Issue.visible(user).all
296 assert issues.any?
296 assert issues.any?
297 assert_equal [1], issues.map(&:project_id).uniq.sort
297 assert_equal [1], issues.map(&:project_id).uniq.sort
298 assert_visibility_match user, issues
298 assert_visibility_match user, issues
299 end
299 end
300
300
301 def test_visible_scope_for_member
301 def test_visible_scope_for_member
302 user = User.find(9)
302 user = User.find(9)
303 # User should see issues of projects for which user has view_issues permissions only
303 # User should see issues of projects for which user has view_issues permissions only
304 Role.non_member.remove_permission!(:view_issues)
304 Role.non_member.remove_permission!(:view_issues)
305 Member.create!(:principal => user, :project_id => 3, :role_ids => [2])
305 Member.create!(:principal => user, :project_id => 3, :role_ids => [2])
306 issues = Issue.visible(user).to_a
306 issues = Issue.visible(user).to_a
307 assert issues.any?
307 assert issues.any?
308 assert_nil issues.detect {|issue| issue.project_id != 3}
308 assert_nil issues.detect {|issue| issue.project_id != 3}
309 assert_nil issues.detect {|issue| issue.is_private?}
309 assert_nil issues.detect {|issue| issue.is_private?}
310 assert_visibility_match user, issues
310 assert_visibility_match user, issues
311 end
311 end
312
312
313 def test_visible_scope_for_member_without_view_issues_permission_and_non_member_role_having_the_permission
313 def test_visible_scope_for_member_without_view_issues_permission_and_non_member_role_having_the_permission
314 Role.non_member.add_permission!(:view_issues)
314 Role.non_member.add_permission!(:view_issues)
315 Role.find(1).remove_permission!(:view_issues)
315 Role.find(1).remove_permission!(:view_issues)
316 user = User.find(2)
316 user = User.find(2)
317
317
318 assert_equal 0, Issue.where(:project_id => 1).visible(user).count
318 assert_equal 0, Issue.where(:project_id => 1).visible(user).count
319 assert_equal false, Issue.where(:project_id => 1).first.visible?(user)
319 assert_equal false, Issue.where(:project_id => 1).first.visible?(user)
320 end
320 end
321
321
322 def test_visible_scope_for_member_with_groups_should_return_assigned_issues
322 def test_visible_scope_for_member_with_groups_should_return_assigned_issues
323 user = User.find(8)
323 user = User.find(8)
324 assert user.groups.any?
324 assert user.groups.any?
325 Member.create!(:principal => user.groups.first, :project_id => 1, :role_ids => [2])
325 Member.create!(:principal => user.groups.first, :project_id => 1, :role_ids => [2])
326 Role.non_member.remove_permission!(:view_issues)
326 Role.non_member.remove_permission!(:view_issues)
327
327
328 issue = Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 3,
328 issue = Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 3,
329 :status_id => 1, :priority => IssuePriority.all.first,
329 :status_id => 1, :priority => IssuePriority.all.first,
330 :subject => 'Assignment test',
330 :subject => 'Assignment test',
331 :assigned_to => user.groups.first,
331 :assigned_to => user.groups.first,
332 :is_private => true)
332 :is_private => true)
333
333
334 Role.find(2).update_attribute :issues_visibility, 'default'
334 Role.find(2).update_attribute :issues_visibility, 'default'
335 issues = Issue.visible(User.find(8)).to_a
335 issues = Issue.visible(User.find(8)).to_a
336 assert issues.any?
336 assert issues.any?
337 assert issues.include?(issue)
337 assert issues.include?(issue)
338
338
339 Role.find(2).update_attribute :issues_visibility, 'own'
339 Role.find(2).update_attribute :issues_visibility, 'own'
340 issues = Issue.visible(User.find(8)).to_a
340 issues = Issue.visible(User.find(8)).to_a
341 assert issues.any?
341 assert issues.any?
342 assert_include issue, issues
342 assert_include issue, issues
343 end
343 end
344
344
345 def test_visible_scope_for_admin
345 def test_visible_scope_for_admin
346 user = User.find(1)
346 user = User.find(1)
347 user.members.each(&:destroy)
347 user.members.each(&:destroy)
348 assert user.projects.empty?
348 assert user.projects.empty?
349 issues = Issue.visible(user).to_a
349 issues = Issue.visible(user).to_a
350 assert issues.any?
350 assert issues.any?
351 # Admin should see issues on private projects that admin does not belong to
351 # Admin should see issues on private projects that admin does not belong to
352 assert issues.detect {|issue| !issue.project.is_public?}
352 assert issues.detect {|issue| !issue.project.is_public?}
353 # Admin should see private issues of other users
353 # Admin should see private issues of other users
354 assert issues.detect {|issue| issue.is_private? && issue.author != user}
354 assert issues.detect {|issue| issue.is_private? && issue.author != user}
355 assert_visibility_match user, issues
355 assert_visibility_match user, issues
356 end
356 end
357
357
358 def test_visible_scope_with_project
358 def test_visible_scope_with_project
359 project = Project.find(1)
359 project = Project.find(1)
360 issues = Issue.visible(User.find(2), :project => project).to_a
360 issues = Issue.visible(User.find(2), :project => project).to_a
361 projects = issues.collect(&:project).uniq
361 projects = issues.collect(&:project).uniq
362 assert_equal 1, projects.size
362 assert_equal 1, projects.size
363 assert_equal project, projects.first
363 assert_equal project, projects.first
364 end
364 end
365
365
366 def test_visible_scope_with_project_and_subprojects
366 def test_visible_scope_with_project_and_subprojects
367 project = Project.find(1)
367 project = Project.find(1)
368 issues = Issue.visible(User.find(2), :project => project, :with_subprojects => true).to_a
368 issues = Issue.visible(User.find(2), :project => project, :with_subprojects => true).to_a
369 projects = issues.collect(&:project).uniq
369 projects = issues.collect(&:project).uniq
370 assert projects.size > 1
370 assert projects.size > 1
371 assert_equal [], projects.select {|p| !p.is_or_is_descendant_of?(project)}
371 assert_equal [], projects.select {|p| !p.is_or_is_descendant_of?(project)}
372 end
372 end
373
373
374 def test_visible_and_nested_set_scopes
374 def test_visible_and_nested_set_scopes
375 user = User.generate!
375 user = User.generate!
376 parent = Issue.generate!(:assigned_to => user)
376 parent = Issue.generate!(:assigned_to => user)
377 assert parent.visible?(user)
377 assert parent.visible?(user)
378 child1 = Issue.generate!(:parent_issue_id => parent.id, :assigned_to => user)
378 child1 = Issue.generate!(:parent_issue_id => parent.id, :assigned_to => user)
379 child2 = Issue.generate!(:parent_issue_id => parent.id, :assigned_to => user)
379 child2 = Issue.generate!(:parent_issue_id => parent.id, :assigned_to => user)
380 parent.reload
380 parent.reload
381 child1.reload
381 child1.reload
382 child2.reload
382 child2.reload
383 assert child1.visible?(user)
383 assert child1.visible?(user)
384 assert child2.visible?(user)
384 assert child2.visible?(user)
385 assert_equal 2, parent.descendants.count
385 assert_equal 2, parent.descendants.count
386 assert_equal 2, parent.descendants.visible(user).count
386 assert_equal 2, parent.descendants.visible(user).count
387 # awesome_nested_set 2-1-stable branch has regression.
387 # awesome_nested_set 2-1-stable branch has regression.
388 # https://github.com/collectiveidea/awesome_nested_set/commit/3d5ac746542b564f6586c2316180254b088bebb6
388 # https://github.com/collectiveidea/awesome_nested_set/commit/3d5ac746542b564f6586c2316180254b088bebb6
389 # ActiveRecord::StatementInvalid: SQLite3::SQLException: ambiguous column name: lft:
389 # ActiveRecord::StatementInvalid: SQLite3::SQLException: ambiguous column name: lft:
390 assert_equal 2, parent.descendants.collect{|i| i}.size
390 assert_equal 2, parent.descendants.collect{|i| i}.size
391 assert_equal 2, parent.descendants.visible(user).collect{|i| i}.size
391 assert_equal 2, parent.descendants.visible(user).collect{|i| i}.size
392 end
392 end
393
393
394 def test_visible_scope_with_unsaved_user_should_not_raise_an_error
394 def test_visible_scope_with_unsaved_user_should_not_raise_an_error
395 user = User.new
395 user = User.new
396 assert_nothing_raised do
396 assert_nothing_raised do
397 Issue.visible(user).to_a
397 Issue.visible(user).to_a
398 end
398 end
399 end
399 end
400
400
401 def test_open_scope
401 def test_open_scope
402 issues = Issue.open.to_a
402 issues = Issue.open.to_a
403 assert_nil issues.detect(&:closed?)
403 assert_nil issues.detect(&:closed?)
404 end
404 end
405
405
406 def test_open_scope_with_arg
406 def test_open_scope_with_arg
407 issues = Issue.open(false).to_a
407 issues = Issue.open(false).to_a
408 assert_equal issues, issues.select(&:closed?)
408 assert_equal issues, issues.select(&:closed?)
409 end
409 end
410
410
411 def test_fixed_version_scope_with_a_version_should_return_its_fixed_issues
411 def test_fixed_version_scope_with_a_version_should_return_its_fixed_issues
412 version = Version.find(2)
412 version = Version.find(2)
413 assert version.fixed_issues.any?
413 assert version.fixed_issues.any?
414 assert_equal version.fixed_issues.to_a.sort, Issue.fixed_version(version).to_a.sort
414 assert_equal version.fixed_issues.to_a.sort, Issue.fixed_version(version).to_a.sort
415 end
415 end
416
416
417 def test_fixed_version_scope_with_empty_array_should_return_no_result
417 def test_fixed_version_scope_with_empty_array_should_return_no_result
418 assert_equal 0, Issue.fixed_version([]).count
418 assert_equal 0, Issue.fixed_version([]).count
419 end
419 end
420
420
421 def test_assigned_to_scope_should_return_issues_assigned_to_the_user
421 def test_assigned_to_scope_should_return_issues_assigned_to_the_user
422 user = User.generate!
422 user = User.generate!
423 issue = Issue.generate!
423 issue = Issue.generate!
424 Issue.where(:id => issue.id).update_all :assigned_to_id => user.id
424 Issue.where(:id => issue.id).update_all :assigned_to_id => user.id
425 assert_equal [issue], Issue.assigned_to(user).to_a
425 assert_equal [issue], Issue.assigned_to(user).to_a
426 end
426 end
427
427
428 def test_assigned_to_scope_should_return_issues_assigned_to_the_user_groups
428 def test_assigned_to_scope_should_return_issues_assigned_to_the_user_groups
429 group = Group.generate!
429 group = Group.generate!
430 user = User.generate!
430 user = User.generate!
431 group.users << user
431 group.users << user
432 issue = Issue.generate!
432 issue = Issue.generate!
433 Issue.where(:id => issue.id).update_all :assigned_to_id => group.id
433 Issue.where(:id => issue.id).update_all :assigned_to_id => group.id
434 assert_equal [issue], Issue.assigned_to(user).to_a
434 assert_equal [issue], Issue.assigned_to(user).to_a
435 end
435 end
436
436
437 def test_errors_full_messages_should_include_custom_fields_errors
437 def test_errors_full_messages_should_include_custom_fields_errors
438 field = IssueCustomField.find_by_name('Database')
438 field = IssueCustomField.find_by_name('Database')
439
439
440 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1,
440 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1,
441 :status_id => 1, :subject => 'test_create',
441 :status_id => 1, :subject => 'test_create',
442 :description => 'IssueTest#test_create_with_required_custom_field')
442 :description => 'IssueTest#test_create_with_required_custom_field')
443 assert issue.available_custom_fields.include?(field)
443 assert issue.available_custom_fields.include?(field)
444 # Invalid value
444 # Invalid value
445 issue.custom_field_values = { field.id => 'SQLServer' }
445 issue.custom_field_values = { field.id => 'SQLServer' }
446
446
447 assert !issue.valid?
447 assert !issue.valid?
448 assert_equal 1, issue.errors.full_messages.size
448 assert_equal 1, issue.errors.full_messages.size
449 assert_equal "Database #{I18n.translate('activerecord.errors.messages.inclusion')}",
449 assert_equal "Database #{I18n.translate('activerecord.errors.messages.inclusion')}",
450 issue.errors.full_messages.first
450 issue.errors.full_messages.first
451 end
451 end
452
452
453 def test_update_issue_with_required_custom_field
453 def test_update_issue_with_required_custom_field
454 field = IssueCustomField.find_by_name('Database')
454 field = IssueCustomField.find_by_name('Database')
455 field.update_attribute(:is_required, true)
455 field.update_attribute(:is_required, true)
456
456
457 issue = Issue.find(1)
457 issue = Issue.find(1)
458 assert_nil issue.custom_value_for(field)
458 assert_nil issue.custom_value_for(field)
459 assert issue.available_custom_fields.include?(field)
459 assert issue.available_custom_fields.include?(field)
460 # No change to custom values, issue can be saved
460 # No change to custom values, issue can be saved
461 assert issue.save
461 assert issue.save
462 # Blank value
462 # Blank value
463 issue.custom_field_values = { field.id => '' }
463 issue.custom_field_values = { field.id => '' }
464 assert !issue.save
464 assert !issue.save
465 # Valid value
465 # Valid value
466 issue.custom_field_values = { field.id => 'PostgreSQL' }
466 issue.custom_field_values = { field.id => 'PostgreSQL' }
467 assert issue.save
467 assert issue.save
468 issue.reload
468 issue.reload
469 assert_equal 'PostgreSQL', issue.custom_value_for(field).value
469 assert_equal 'PostgreSQL', issue.custom_value_for(field).value
470 end
470 end
471
471
472 def test_should_not_update_attributes_if_custom_fields_validation_fails
472 def test_should_not_update_attributes_if_custom_fields_validation_fails
473 issue = Issue.find(1)
473 issue = Issue.find(1)
474 field = IssueCustomField.find_by_name('Database')
474 field = IssueCustomField.find_by_name('Database')
475 assert issue.available_custom_fields.include?(field)
475 assert issue.available_custom_fields.include?(field)
476
476
477 issue.custom_field_values = { field.id => 'Invalid' }
477 issue.custom_field_values = { field.id => 'Invalid' }
478 issue.subject = 'Should be not be saved'
478 issue.subject = 'Should be not be saved'
479 assert !issue.save
479 assert !issue.save
480
480
481 issue.reload
481 issue.reload
482 assert_equal "Cannot print recipes", issue.subject
482 assert_equal "Cannot print recipes", issue.subject
483 end
483 end
484
484
485 def test_should_not_recreate_custom_values_objects_on_update
485 def test_should_not_recreate_custom_values_objects_on_update
486 field = IssueCustomField.find_by_name('Database')
486 field = IssueCustomField.find_by_name('Database')
487
487
488 issue = Issue.find(1)
488 issue = Issue.find(1)
489 issue.custom_field_values = { field.id => 'PostgreSQL' }
489 issue.custom_field_values = { field.id => 'PostgreSQL' }
490 assert issue.save
490 assert issue.save
491 custom_value = issue.custom_value_for(field)
491 custom_value = issue.custom_value_for(field)
492 issue.reload
492 issue.reload
493 issue.custom_field_values = { field.id => 'MySQL' }
493 issue.custom_field_values = { field.id => 'MySQL' }
494 assert issue.save
494 assert issue.save
495 issue.reload
495 issue.reload
496 assert_equal custom_value.id, issue.custom_value_for(field).id
496 assert_equal custom_value.id, issue.custom_value_for(field).id
497 end
497 end
498
498
499 def test_setting_project_should_set_version_to_default_version
500 version = Version.generate!(:project_id => 1)
501 Project.find(1).update_attribute(:default_version_id, version.id)
502
503 issue = Issue.new(:project_id => 1)
504 assert_equal version, issue.fixed_version
505 end
506
499 def test_should_not_update_custom_fields_on_changing_tracker_with_different_custom_fields
507 def test_should_not_update_custom_fields_on_changing_tracker_with_different_custom_fields
500 issue = Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 1,
508 issue = Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 1,
501 :status_id => 1, :subject => 'Test',
509 :status_id => 1, :subject => 'Test',
502 :custom_field_values => {'2' => 'Test'})
510 :custom_field_values => {'2' => 'Test'})
503 assert !Tracker.find(2).custom_field_ids.include?(2)
511 assert !Tracker.find(2).custom_field_ids.include?(2)
504
512
505 issue = Issue.find(issue.id)
513 issue = Issue.find(issue.id)
506 issue.attributes = {:tracker_id => 2, :custom_field_values => {'1' => ''}}
514 issue.attributes = {:tracker_id => 2, :custom_field_values => {'1' => ''}}
507
515
508 issue = Issue.find(issue.id)
516 issue = Issue.find(issue.id)
509 custom_value = issue.custom_value_for(2)
517 custom_value = issue.custom_value_for(2)
510 assert_not_nil custom_value
518 assert_not_nil custom_value
511 assert_equal 'Test', custom_value.value
519 assert_equal 'Test', custom_value.value
512 end
520 end
513
521
514 def test_assigning_tracker_id_should_reload_custom_fields_values
522 def test_assigning_tracker_id_should_reload_custom_fields_values
515 issue = Issue.new(:project => Project.find(1))
523 issue = Issue.new(:project => Project.find(1))
516 assert issue.custom_field_values.empty?
524 assert issue.custom_field_values.empty?
517 issue.tracker_id = 1
525 issue.tracker_id = 1
518 assert issue.custom_field_values.any?
526 assert issue.custom_field_values.any?
519 end
527 end
520
528
521 def test_assigning_attributes_should_assign_project_and_tracker_first
529 def test_assigning_attributes_should_assign_project_and_tracker_first
522 seq = sequence('seq')
530 seq = sequence('seq')
523 issue = Issue.new
531 issue = Issue.new
524 issue.expects(:project_id=).in_sequence(seq)
532 issue.expects(:project_id=).in_sequence(seq)
525 issue.expects(:tracker_id=).in_sequence(seq)
533 issue.expects(:tracker_id=).in_sequence(seq)
526 issue.expects(:subject=).in_sequence(seq)
534 issue.expects(:subject=).in_sequence(seq)
527 issue.attributes = {:tracker_id => 2, :project_id => 1, :subject => 'Test'}
535 issue.attributes = {:tracker_id => 2, :project_id => 1, :subject => 'Test'}
528 end
536 end
529
537
530 def test_assigning_tracker_and_custom_fields_should_assign_custom_fields
538 def test_assigning_tracker_and_custom_fields_should_assign_custom_fields
531 attributes = ActiveSupport::OrderedHash.new
539 attributes = ActiveSupport::OrderedHash.new
532 attributes['custom_field_values'] = { '1' => 'MySQL' }
540 attributes['custom_field_values'] = { '1' => 'MySQL' }
533 attributes['tracker_id'] = '1'
541 attributes['tracker_id'] = '1'
534 issue = Issue.new(:project => Project.find(1))
542 issue = Issue.new(:project => Project.find(1))
535 issue.attributes = attributes
543 issue.attributes = attributes
536 assert_equal 'MySQL', issue.custom_field_value(1)
544 assert_equal 'MySQL', issue.custom_field_value(1)
537 end
545 end
538
546
539 def test_changing_tracker_should_clear_disabled_core_fields
547 def test_changing_tracker_should_clear_disabled_core_fields
540 tracker = Tracker.find(2)
548 tracker = Tracker.find(2)
541 tracker.core_fields = tracker.core_fields - %w(due_date)
549 tracker.core_fields = tracker.core_fields - %w(due_date)
542 tracker.save!
550 tracker.save!
543
551
544 issue = Issue.generate!(:tracker_id => 1, :start_date => Date.today, :due_date => Date.today)
552 issue = Issue.generate!(:tracker_id => 1, :start_date => Date.today, :due_date => Date.today)
545 issue.save!
553 issue.save!
546
554
547 issue.tracker_id = 2
555 issue.tracker_id = 2
548 issue.save!
556 issue.save!
549 assert_not_nil issue.start_date
557 assert_not_nil issue.start_date
550 assert_nil issue.due_date
558 assert_nil issue.due_date
551 end
559 end
552
560
553 def test_changing_tracker_should_not_add_cleared_fields_to_journal
561 def test_changing_tracker_should_not_add_cleared_fields_to_journal
554 tracker = Tracker.find(2)
562 tracker = Tracker.find(2)
555 tracker.core_fields = tracker.core_fields - %w(due_date)
563 tracker.core_fields = tracker.core_fields - %w(due_date)
556 tracker.save!
564 tracker.save!
557
565
558 issue = Issue.generate!(:tracker_id => 1, :due_date => Date.today)
566 issue = Issue.generate!(:tracker_id => 1, :due_date => Date.today)
559 issue.save!
567 issue.save!
560
568
561 assert_difference 'Journal.count' do
569 assert_difference 'Journal.count' do
562 issue.init_journal User.find(1)
570 issue.init_journal User.find(1)
563 issue.tracker_id = 2
571 issue.tracker_id = 2
564 issue.save!
572 issue.save!
565 assert_nil issue.due_date
573 assert_nil issue.due_date
566 end
574 end
567 journal = Journal.order('id DESC').first
575 journal = Journal.order('id DESC').first
568 assert_equal 1, journal.details.count
576 assert_equal 1, journal.details.count
569 end
577 end
570
578
571 def test_reload_should_reload_custom_field_values
579 def test_reload_should_reload_custom_field_values
572 issue = Issue.generate!
580 issue = Issue.generate!
573 issue.custom_field_values = {'2' => 'Foo'}
581 issue.custom_field_values = {'2' => 'Foo'}
574 issue.save!
582 issue.save!
575
583
576 issue = Issue.order('id desc').first
584 issue = Issue.order('id desc').first
577 assert_equal 'Foo', issue.custom_field_value(2)
585 assert_equal 'Foo', issue.custom_field_value(2)
578
586
579 issue.custom_field_values = {'2' => 'Bar'}
587 issue.custom_field_values = {'2' => 'Bar'}
580 assert_equal 'Bar', issue.custom_field_value(2)
588 assert_equal 'Bar', issue.custom_field_value(2)
581
589
582 issue.reload
590 issue.reload
583 assert_equal 'Foo', issue.custom_field_value(2)
591 assert_equal 'Foo', issue.custom_field_value(2)
584 end
592 end
585
593
586 def test_should_update_issue_with_disabled_tracker
594 def test_should_update_issue_with_disabled_tracker
587 p = Project.find(1)
595 p = Project.find(1)
588 issue = Issue.find(1)
596 issue = Issue.find(1)
589
597
590 p.trackers.delete(issue.tracker)
598 p.trackers.delete(issue.tracker)
591 assert !p.trackers.include?(issue.tracker)
599 assert !p.trackers.include?(issue.tracker)
592
600
593 issue.reload
601 issue.reload
594 issue.subject = 'New subject'
602 issue.subject = 'New subject'
595 assert issue.save
603 assert issue.save
596 end
604 end
597
605
598 def test_should_not_set_a_disabled_tracker
606 def test_should_not_set_a_disabled_tracker
599 p = Project.find(1)
607 p = Project.find(1)
600 p.trackers.delete(Tracker.find(2))
608 p.trackers.delete(Tracker.find(2))
601
609
602 issue = Issue.find(1)
610 issue = Issue.find(1)
603 issue.tracker_id = 2
611 issue.tracker_id = 2
604 issue.subject = 'New subject'
612 issue.subject = 'New subject'
605 assert !issue.save
613 assert !issue.save
606 assert_not_equal [], issue.errors[:tracker_id]
614 assert_not_equal [], issue.errors[:tracker_id]
607 end
615 end
608
616
609 def test_category_based_assignment
617 def test_category_based_assignment
610 issue = Issue.create(:project_id => 1, :tracker_id => 1, :author_id => 3,
618 issue = Issue.create(:project_id => 1, :tracker_id => 1, :author_id => 3,
611 :status_id => 1, :priority => IssuePriority.all.first,
619 :status_id => 1, :priority => IssuePriority.all.first,
612 :subject => 'Assignment test',
620 :subject => 'Assignment test',
613 :description => 'Assignment test', :category_id => 1)
621 :description => 'Assignment test', :category_id => 1)
614 assert_equal IssueCategory.find(1).assigned_to, issue.assigned_to
622 assert_equal IssueCategory.find(1).assigned_to, issue.assigned_to
615 end
623 end
616
624
617 def test_new_statuses_allowed_to
625 def test_new_statuses_allowed_to
618 WorkflowTransition.delete_all
626 WorkflowTransition.delete_all
619 WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
627 WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
620 :old_status_id => 1, :new_status_id => 2,
628 :old_status_id => 1, :new_status_id => 2,
621 :author => false, :assignee => false)
629 :author => false, :assignee => false)
622 WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
630 WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
623 :old_status_id => 1, :new_status_id => 3,
631 :old_status_id => 1, :new_status_id => 3,
624 :author => true, :assignee => false)
632 :author => true, :assignee => false)
625 WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
633 WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
626 :old_status_id => 1, :new_status_id => 4,
634 :old_status_id => 1, :new_status_id => 4,
627 :author => false, :assignee => true)
635 :author => false, :assignee => true)
628 WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
636 WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
629 :old_status_id => 1, :new_status_id => 5,
637 :old_status_id => 1, :new_status_id => 5,
630 :author => true, :assignee => true)
638 :author => true, :assignee => true)
631 status = IssueStatus.find(1)
639 status = IssueStatus.find(1)
632 role = Role.find(1)
640 role = Role.find(1)
633 tracker = Tracker.find(1)
641 tracker = Tracker.find(1)
634 user = User.find(2)
642 user = User.find(2)
635
643
636 issue = Issue.generate!(:tracker => tracker, :status => status,
644 issue = Issue.generate!(:tracker => tracker, :status => status,
637 :project_id => 1, :author_id => 1)
645 :project_id => 1, :author_id => 1)
638 assert_equal [1, 2], issue.new_statuses_allowed_to(user).map(&:id)
646 assert_equal [1, 2], issue.new_statuses_allowed_to(user).map(&:id)
639
647
640 issue = Issue.generate!(:tracker => tracker, :status => status,
648 issue = Issue.generate!(:tracker => tracker, :status => status,
641 :project_id => 1, :author => user)
649 :project_id => 1, :author => user)
642 assert_equal [1, 2, 3, 5], issue.new_statuses_allowed_to(user).map(&:id)
650 assert_equal [1, 2, 3, 5], issue.new_statuses_allowed_to(user).map(&:id)
643
651
644 issue = Issue.generate!(:tracker => tracker, :status => status,
652 issue = Issue.generate!(:tracker => tracker, :status => status,
645 :project_id => 1, :author_id => 1,
653 :project_id => 1, :author_id => 1,
646 :assigned_to => user)
654 :assigned_to => user)
647 assert_equal [1, 2, 4, 5], issue.new_statuses_allowed_to(user).map(&:id)
655 assert_equal [1, 2, 4, 5], issue.new_statuses_allowed_to(user).map(&:id)
648
656
649 issue = Issue.generate!(:tracker => tracker, :status => status,
657 issue = Issue.generate!(:tracker => tracker, :status => status,
650 :project_id => 1, :author => user,
658 :project_id => 1, :author => user,
651 :assigned_to => user)
659 :assigned_to => user)
652 assert_equal [1, 2, 3, 4, 5], issue.new_statuses_allowed_to(user).map(&:id)
660 assert_equal [1, 2, 3, 4, 5], issue.new_statuses_allowed_to(user).map(&:id)
653
661
654 group = Group.generate!
662 group = Group.generate!
655 group.users << user
663 group.users << user
656 issue = Issue.generate!(:tracker => tracker, :status => status,
664 issue = Issue.generate!(:tracker => tracker, :status => status,
657 :project_id => 1, :author => user,
665 :project_id => 1, :author => user,
658 :assigned_to => group)
666 :assigned_to => group)
659 assert_equal [1, 2, 3, 4, 5], issue.new_statuses_allowed_to(user).map(&:id)
667 assert_equal [1, 2, 3, 4, 5], issue.new_statuses_allowed_to(user).map(&:id)
660 end
668 end
661
669
662 def test_new_statuses_allowed_to_should_consider_group_assignment
670 def test_new_statuses_allowed_to_should_consider_group_assignment
663 WorkflowTransition.delete_all
671 WorkflowTransition.delete_all
664 WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
672 WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
665 :old_status_id => 1, :new_status_id => 4,
673 :old_status_id => 1, :new_status_id => 4,
666 :author => false, :assignee => true)
674 :author => false, :assignee => true)
667 user = User.find(2)
675 user = User.find(2)
668 group = Group.generate!
676 group = Group.generate!
669 group.users << user
677 group.users << user
670
678
671 issue = Issue.generate!(:author_id => 1, :assigned_to => group)
679 issue = Issue.generate!(:author_id => 1, :assigned_to => group)
672 assert_include 4, issue.new_statuses_allowed_to(user).map(&:id)
680 assert_include 4, issue.new_statuses_allowed_to(user).map(&:id)
673 end
681 end
674
682
675 def test_new_statuses_allowed_to_should_return_all_transitions_for_admin
683 def test_new_statuses_allowed_to_should_return_all_transitions_for_admin
676 admin = User.find(1)
684 admin = User.find(1)
677 issue = Issue.find(1)
685 issue = Issue.find(1)
678 assert !admin.member_of?(issue.project)
686 assert !admin.member_of?(issue.project)
679 expected_statuses = [issue.status] +
687 expected_statuses = [issue.status] +
680 WorkflowTransition.where(:old_status_id => issue.status_id).
688 WorkflowTransition.where(:old_status_id => issue.status_id).
681 map(&:new_status).uniq.sort
689 map(&:new_status).uniq.sort
682 assert_equal expected_statuses, issue.new_statuses_allowed_to(admin)
690 assert_equal expected_statuses, issue.new_statuses_allowed_to(admin)
683 end
691 end
684
692
685 def test_new_statuses_allowed_to_should_return_default_and_current_status_when_copying
693 def test_new_statuses_allowed_to_should_return_default_and_current_status_when_copying
686 issue = Issue.find(1).copy
694 issue = Issue.find(1).copy
687 assert_equal [1], issue.new_statuses_allowed_to(User.find(2)).map(&:id)
695 assert_equal [1], issue.new_statuses_allowed_to(User.find(2)).map(&:id)
688
696
689 issue = Issue.find(2).copy
697 issue = Issue.find(2).copy
690 assert_equal [1, 2], issue.new_statuses_allowed_to(User.find(2)).map(&:id)
698 assert_equal [1, 2], issue.new_statuses_allowed_to(User.find(2)).map(&:id)
691 end
699 end
692
700
693 def test_safe_attributes_names_should_not_include_disabled_field
701 def test_safe_attributes_names_should_not_include_disabled_field
694 tracker = Tracker.new(:core_fields => %w(assigned_to_id fixed_version_id))
702 tracker = Tracker.new(:core_fields => %w(assigned_to_id fixed_version_id))
695
703
696 issue = Issue.new(:tracker => tracker)
704 issue = Issue.new(:tracker => tracker)
697 assert_include 'tracker_id', issue.safe_attribute_names
705 assert_include 'tracker_id', issue.safe_attribute_names
698 assert_include 'status_id', issue.safe_attribute_names
706 assert_include 'status_id', issue.safe_attribute_names
699 assert_include 'subject', issue.safe_attribute_names
707 assert_include 'subject', issue.safe_attribute_names
700 assert_include 'description', issue.safe_attribute_names
708 assert_include 'description', issue.safe_attribute_names
701 assert_include 'custom_field_values', issue.safe_attribute_names
709 assert_include 'custom_field_values', issue.safe_attribute_names
702 assert_include 'custom_fields', issue.safe_attribute_names
710 assert_include 'custom_fields', issue.safe_attribute_names
703 assert_include 'lock_version', issue.safe_attribute_names
711 assert_include 'lock_version', issue.safe_attribute_names
704
712
705 tracker.core_fields.each do |field|
713 tracker.core_fields.each do |field|
706 assert_include field, issue.safe_attribute_names
714 assert_include field, issue.safe_attribute_names
707 end
715 end
708
716
709 tracker.disabled_core_fields.each do |field|
717 tracker.disabled_core_fields.each do |field|
710 assert_not_include field, issue.safe_attribute_names
718 assert_not_include field, issue.safe_attribute_names
711 end
719 end
712 end
720 end
713
721
714 def test_safe_attributes_should_ignore_disabled_fields
722 def test_safe_attributes_should_ignore_disabled_fields
715 tracker = Tracker.find(1)
723 tracker = Tracker.find(1)
716 tracker.core_fields = %w(assigned_to_id due_date)
724 tracker.core_fields = %w(assigned_to_id due_date)
717 tracker.save!
725 tracker.save!
718
726
719 issue = Issue.new(:tracker => tracker)
727 issue = Issue.new(:tracker => tracker)
720 issue.safe_attributes = {'start_date' => '2012-07-14', 'due_date' => '2012-07-14'}
728 issue.safe_attributes = {'start_date' => '2012-07-14', 'due_date' => '2012-07-14'}
721 assert_nil issue.start_date
729 assert_nil issue.start_date
722 assert_equal Date.parse('2012-07-14'), issue.due_date
730 assert_equal Date.parse('2012-07-14'), issue.due_date
723 end
731 end
724
732
725 def test_safe_attributes_should_accept_target_tracker_enabled_fields
733 def test_safe_attributes_should_accept_target_tracker_enabled_fields
726 source = Tracker.find(1)
734 source = Tracker.find(1)
727 source.core_fields = []
735 source.core_fields = []
728 source.save!
736 source.save!
729 target = Tracker.find(2)
737 target = Tracker.find(2)
730 target.core_fields = %w(assigned_to_id due_date)
738 target.core_fields = %w(assigned_to_id due_date)
731 target.save!
739 target.save!
732
740
733 issue = Issue.new(:tracker => source)
741 issue = Issue.new(:tracker => source)
734 issue.safe_attributes = {'tracker_id' => 2, 'due_date' => '2012-07-14'}
742 issue.safe_attributes = {'tracker_id' => 2, 'due_date' => '2012-07-14'}
735 assert_equal target, issue.tracker
743 assert_equal target, issue.tracker
736 assert_equal Date.parse('2012-07-14'), issue.due_date
744 assert_equal Date.parse('2012-07-14'), issue.due_date
737 end
745 end
738
746
739 def test_safe_attributes_should_not_include_readonly_fields
747 def test_safe_attributes_should_not_include_readonly_fields
740 WorkflowPermission.delete_all
748 WorkflowPermission.delete_all
741 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
749 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
742 :role_id => 1, :field_name => 'due_date',
750 :role_id => 1, :field_name => 'due_date',
743 :rule => 'readonly')
751 :rule => 'readonly')
744 user = User.find(2)
752 user = User.find(2)
745
753
746 issue = Issue.new(:project_id => 1, :tracker_id => 1)
754 issue = Issue.new(:project_id => 1, :tracker_id => 1)
747 assert_equal %w(due_date), issue.read_only_attribute_names(user)
755 assert_equal %w(due_date), issue.read_only_attribute_names(user)
748 assert_not_include 'due_date', issue.safe_attribute_names(user)
756 assert_not_include 'due_date', issue.safe_attribute_names(user)
749
757
750 issue.send :safe_attributes=, {'start_date' => '2012-07-14', 'due_date' => '2012-07-14'}, user
758 issue.send :safe_attributes=, {'start_date' => '2012-07-14', 'due_date' => '2012-07-14'}, user
751 assert_equal Date.parse('2012-07-14'), issue.start_date
759 assert_equal Date.parse('2012-07-14'), issue.start_date
752 assert_nil issue.due_date
760 assert_nil issue.due_date
753 end
761 end
754
762
755 def test_safe_attributes_should_not_include_readonly_custom_fields
763 def test_safe_attributes_should_not_include_readonly_custom_fields
756 cf1 = IssueCustomField.create!(:name => 'Writable field',
764 cf1 = IssueCustomField.create!(:name => 'Writable field',
757 :field_format => 'string',
765 :field_format => 'string',
758 :is_for_all => true, :tracker_ids => [1])
766 :is_for_all => true, :tracker_ids => [1])
759 cf2 = IssueCustomField.create!(:name => 'Readonly field',
767 cf2 = IssueCustomField.create!(:name => 'Readonly field',
760 :field_format => 'string',
768 :field_format => 'string',
761 :is_for_all => true, :tracker_ids => [1])
769 :is_for_all => true, :tracker_ids => [1])
762 WorkflowPermission.delete_all
770 WorkflowPermission.delete_all
763 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
771 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
764 :role_id => 1, :field_name => cf2.id.to_s,
772 :role_id => 1, :field_name => cf2.id.to_s,
765 :rule => 'readonly')
773 :rule => 'readonly')
766 user = User.find(2)
774 user = User.find(2)
767 issue = Issue.new(:project_id => 1, :tracker_id => 1)
775 issue = Issue.new(:project_id => 1, :tracker_id => 1)
768 assert_equal [cf2.id.to_s], issue.read_only_attribute_names(user)
776 assert_equal [cf2.id.to_s], issue.read_only_attribute_names(user)
769 assert_not_include cf2.id.to_s, issue.safe_attribute_names(user)
777 assert_not_include cf2.id.to_s, issue.safe_attribute_names(user)
770
778
771 issue.send :safe_attributes=, {'custom_field_values' => {
779 issue.send :safe_attributes=, {'custom_field_values' => {
772 cf1.id.to_s => 'value1', cf2.id.to_s => 'value2'
780 cf1.id.to_s => 'value1', cf2.id.to_s => 'value2'
773 }}, user
781 }}, user
774 assert_equal 'value1', issue.custom_field_value(cf1)
782 assert_equal 'value1', issue.custom_field_value(cf1)
775 assert_nil issue.custom_field_value(cf2)
783 assert_nil issue.custom_field_value(cf2)
776
784
777 issue.send :safe_attributes=, {'custom_fields' => [
785 issue.send :safe_attributes=, {'custom_fields' => [
778 {'id' => cf1.id.to_s, 'value' => 'valuea'},
786 {'id' => cf1.id.to_s, 'value' => 'valuea'},
779 {'id' => cf2.id.to_s, 'value' => 'valueb'}
787 {'id' => cf2.id.to_s, 'value' => 'valueb'}
780 ]}, user
788 ]}, user
781 assert_equal 'valuea', issue.custom_field_value(cf1)
789 assert_equal 'valuea', issue.custom_field_value(cf1)
782 assert_nil issue.custom_field_value(cf2)
790 assert_nil issue.custom_field_value(cf2)
783 end
791 end
784
792
785 def test_editable_custom_field_values_should_return_non_readonly_custom_values
793 def test_editable_custom_field_values_should_return_non_readonly_custom_values
786 cf1 = IssueCustomField.create!(:name => 'Writable field', :field_format => 'string',
794 cf1 = IssueCustomField.create!(:name => 'Writable field', :field_format => 'string',
787 :is_for_all => true, :tracker_ids => [1, 2])
795 :is_for_all => true, :tracker_ids => [1, 2])
788 cf2 = IssueCustomField.create!(:name => 'Readonly field', :field_format => 'string',
796 cf2 = IssueCustomField.create!(:name => 'Readonly field', :field_format => 'string',
789 :is_for_all => true, :tracker_ids => [1, 2])
797 :is_for_all => true, :tracker_ids => [1, 2])
790 WorkflowPermission.delete_all
798 WorkflowPermission.delete_all
791 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, :role_id => 1,
799 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, :role_id => 1,
792 :field_name => cf2.id.to_s, :rule => 'readonly')
800 :field_name => cf2.id.to_s, :rule => 'readonly')
793 user = User.find(2)
801 user = User.find(2)
794
802
795 issue = Issue.new(:project_id => 1, :tracker_id => 1)
803 issue = Issue.new(:project_id => 1, :tracker_id => 1)
796 values = issue.editable_custom_field_values(user)
804 values = issue.editable_custom_field_values(user)
797 assert values.detect {|value| value.custom_field == cf1}
805 assert values.detect {|value| value.custom_field == cf1}
798 assert_nil values.detect {|value| value.custom_field == cf2}
806 assert_nil values.detect {|value| value.custom_field == cf2}
799
807
800 issue.tracker_id = 2
808 issue.tracker_id = 2
801 values = issue.editable_custom_field_values(user)
809 values = issue.editable_custom_field_values(user)
802 assert values.detect {|value| value.custom_field == cf1}
810 assert values.detect {|value| value.custom_field == cf1}
803 assert values.detect {|value| value.custom_field == cf2}
811 assert values.detect {|value| value.custom_field == cf2}
804 end
812 end
805
813
806 def test_editable_custom_fields_should_return_custom_field_that_is_enabled_for_the_role_only
814 def test_editable_custom_fields_should_return_custom_field_that_is_enabled_for_the_role_only
807 enabled_cf = IssueCustomField.generate!(:is_for_all => true, :tracker_ids => [1], :visible => false, :role_ids => [1,2])
815 enabled_cf = IssueCustomField.generate!(:is_for_all => true, :tracker_ids => [1], :visible => false, :role_ids => [1,2])
808 disabled_cf = IssueCustomField.generate!(:is_for_all => true, :tracker_ids => [1], :visible => false, :role_ids => [2])
816 disabled_cf = IssueCustomField.generate!(:is_for_all => true, :tracker_ids => [1], :visible => false, :role_ids => [2])
809 user = User.find(2)
817 user = User.find(2)
810 issue = Issue.new(:project_id => 1, :tracker_id => 1)
818 issue = Issue.new(:project_id => 1, :tracker_id => 1)
811
819
812 assert_include enabled_cf, issue.editable_custom_fields(user)
820 assert_include enabled_cf, issue.editable_custom_fields(user)
813 assert_not_include disabled_cf, issue.editable_custom_fields(user)
821 assert_not_include disabled_cf, issue.editable_custom_fields(user)
814 end
822 end
815
823
816 def test_safe_attributes_should_accept_target_tracker_writable_fields
824 def test_safe_attributes_should_accept_target_tracker_writable_fields
817 WorkflowPermission.delete_all
825 WorkflowPermission.delete_all
818 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
826 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
819 :role_id => 1, :field_name => 'due_date',
827 :role_id => 1, :field_name => 'due_date',
820 :rule => 'readonly')
828 :rule => 'readonly')
821 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 2,
829 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 2,
822 :role_id => 1, :field_name => 'start_date',
830 :role_id => 1, :field_name => 'start_date',
823 :rule => 'readonly')
831 :rule => 'readonly')
824 user = User.find(2)
832 user = User.find(2)
825
833
826 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
834 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
827
835
828 issue.send :safe_attributes=, {'start_date' => '2012-07-12',
836 issue.send :safe_attributes=, {'start_date' => '2012-07-12',
829 'due_date' => '2012-07-14'}, user
837 'due_date' => '2012-07-14'}, user
830 assert_equal Date.parse('2012-07-12'), issue.start_date
838 assert_equal Date.parse('2012-07-12'), issue.start_date
831 assert_nil issue.due_date
839 assert_nil issue.due_date
832
840
833 issue.send :safe_attributes=, {'start_date' => '2012-07-15',
841 issue.send :safe_attributes=, {'start_date' => '2012-07-15',
834 'due_date' => '2012-07-16',
842 'due_date' => '2012-07-16',
835 'tracker_id' => 2}, user
843 'tracker_id' => 2}, user
836 assert_equal Date.parse('2012-07-12'), issue.start_date
844 assert_equal Date.parse('2012-07-12'), issue.start_date
837 assert_equal Date.parse('2012-07-16'), issue.due_date
845 assert_equal Date.parse('2012-07-16'), issue.due_date
838 end
846 end
839
847
840 def test_safe_attributes_should_accept_target_status_writable_fields
848 def test_safe_attributes_should_accept_target_status_writable_fields
841 WorkflowPermission.delete_all
849 WorkflowPermission.delete_all
842 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
850 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
843 :role_id => 1, :field_name => 'due_date',
851 :role_id => 1, :field_name => 'due_date',
844 :rule => 'readonly')
852 :rule => 'readonly')
845 WorkflowPermission.create!(:old_status_id => 2, :tracker_id => 1,
853 WorkflowPermission.create!(:old_status_id => 2, :tracker_id => 1,
846 :role_id => 1, :field_name => 'start_date',
854 :role_id => 1, :field_name => 'start_date',
847 :rule => 'readonly')
855 :rule => 'readonly')
848 user = User.find(2)
856 user = User.find(2)
849
857
850 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
858 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
851
859
852 issue.send :safe_attributes=, {'start_date' => '2012-07-12',
860 issue.send :safe_attributes=, {'start_date' => '2012-07-12',
853 'due_date' => '2012-07-14'},
861 'due_date' => '2012-07-14'},
854 user
862 user
855 assert_equal Date.parse('2012-07-12'), issue.start_date
863 assert_equal Date.parse('2012-07-12'), issue.start_date
856 assert_nil issue.due_date
864 assert_nil issue.due_date
857
865
858 issue.send :safe_attributes=, {'start_date' => '2012-07-15',
866 issue.send :safe_attributes=, {'start_date' => '2012-07-15',
859 'due_date' => '2012-07-16',
867 'due_date' => '2012-07-16',
860 'status_id' => 2},
868 'status_id' => 2},
861 user
869 user
862 assert_equal Date.parse('2012-07-12'), issue.start_date
870 assert_equal Date.parse('2012-07-12'), issue.start_date
863 assert_equal Date.parse('2012-07-16'), issue.due_date
871 assert_equal Date.parse('2012-07-16'), issue.due_date
864 end
872 end
865
873
866 def test_required_attributes_should_be_validated
874 def test_required_attributes_should_be_validated
867 cf = IssueCustomField.create!(:name => 'Foo', :field_format => 'string',
875 cf = IssueCustomField.create!(:name => 'Foo', :field_format => 'string',
868 :is_for_all => true, :tracker_ids => [1, 2])
876 :is_for_all => true, :tracker_ids => [1, 2])
869
877
870 WorkflowPermission.delete_all
878 WorkflowPermission.delete_all
871 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
879 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
872 :role_id => 1, :field_name => 'due_date',
880 :role_id => 1, :field_name => 'due_date',
873 :rule => 'required')
881 :rule => 'required')
874 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
882 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
875 :role_id => 1, :field_name => 'category_id',
883 :role_id => 1, :field_name => 'category_id',
876 :rule => 'required')
884 :rule => 'required')
877 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
885 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
878 :role_id => 1, :field_name => cf.id.to_s,
886 :role_id => 1, :field_name => cf.id.to_s,
879 :rule => 'required')
887 :rule => 'required')
880
888
881 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 2,
889 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 2,
882 :role_id => 1, :field_name => 'start_date',
890 :role_id => 1, :field_name => 'start_date',
883 :rule => 'required')
891 :rule => 'required')
884 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 2,
892 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 2,
885 :role_id => 1, :field_name => cf.id.to_s,
893 :role_id => 1, :field_name => cf.id.to_s,
886 :rule => 'required')
894 :rule => 'required')
887 user = User.find(2)
895 user = User.find(2)
888
896
889 issue = Issue.new(:project_id => 1, :tracker_id => 1,
897 issue = Issue.new(:project_id => 1, :tracker_id => 1,
890 :status_id => 1, :subject => 'Required fields',
898 :status_id => 1, :subject => 'Required fields',
891 :author => user)
899 :author => user)
892 assert_equal [cf.id.to_s, "category_id", "due_date"],
900 assert_equal [cf.id.to_s, "category_id", "due_date"],
893 issue.required_attribute_names(user).sort
901 issue.required_attribute_names(user).sort
894 assert !issue.save, "Issue was saved"
902 assert !issue.save, "Issue was saved"
895 assert_equal ["Category cannot be blank", "Due date cannot be blank", "Foo cannot be blank"],
903 assert_equal ["Category cannot be blank", "Due date cannot be blank", "Foo cannot be blank"],
896 issue.errors.full_messages.sort
904 issue.errors.full_messages.sort
897
905
898 issue.tracker_id = 2
906 issue.tracker_id = 2
899 assert_equal [cf.id.to_s, "start_date"], issue.required_attribute_names(user).sort
907 assert_equal [cf.id.to_s, "start_date"], issue.required_attribute_names(user).sort
900 assert !issue.save, "Issue was saved"
908 assert !issue.save, "Issue was saved"
901 assert_equal ["Foo cannot be blank", "Start date cannot be blank"],
909 assert_equal ["Foo cannot be blank", "Start date cannot be blank"],
902 issue.errors.full_messages.sort
910 issue.errors.full_messages.sort
903
911
904 issue.start_date = Date.today
912 issue.start_date = Date.today
905 issue.custom_field_values = {cf.id.to_s => 'bar'}
913 issue.custom_field_values = {cf.id.to_s => 'bar'}
906 assert issue.save
914 assert issue.save
907 end
915 end
908
916
909 def test_required_attribute_that_is_disabled_for_the_tracker_should_not_be_required
917 def test_required_attribute_that_is_disabled_for_the_tracker_should_not_be_required
910 WorkflowPermission.delete_all
918 WorkflowPermission.delete_all
911 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
919 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
912 :role_id => 1, :field_name => 'start_date',
920 :role_id => 1, :field_name => 'start_date',
913 :rule => 'required')
921 :rule => 'required')
914 user = User.find(2)
922 user = User.find(2)
915
923
916 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
924 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
917 :subject => 'Required fields', :author => user)
925 :subject => 'Required fields', :author => user)
918 assert !issue.save
926 assert !issue.save
919 assert_include "Start date cannot be blank", issue.errors.full_messages
927 assert_include "Start date cannot be blank", issue.errors.full_messages
920
928
921 tracker = Tracker.find(1)
929 tracker = Tracker.find(1)
922 tracker.core_fields -= %w(start_date)
930 tracker.core_fields -= %w(start_date)
923 tracker.save!
931 tracker.save!
924 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
932 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
925 :subject => 'Required fields', :author => user)
933 :subject => 'Required fields', :author => user)
926 assert issue.save
934 assert issue.save
927 end
935 end
928
936
929 def test_category_should_not_be_required_if_project_has_no_categories
937 def test_category_should_not_be_required_if_project_has_no_categories
930 Project.find(1).issue_categories.delete_all
938 Project.find(1).issue_categories.delete_all
931 WorkflowPermission.delete_all
939 WorkflowPermission.delete_all
932 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
940 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
933 :role_id => 1, :field_name => 'category_id',:rule => 'required')
941 :role_id => 1, :field_name => 'category_id',:rule => 'required')
934 user = User.find(2)
942 user = User.find(2)
935
943
936 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
944 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
937 :subject => 'Required fields', :author => user)
945 :subject => 'Required fields', :author => user)
938 assert_save issue
946 assert_save issue
939 end
947 end
940
948
941 def test_fixed_version_should_not_be_required_no_assignable_versions
949 def test_fixed_version_should_not_be_required_no_assignable_versions
942 Version.delete_all
950 Version.delete_all
943 WorkflowPermission.delete_all
951 WorkflowPermission.delete_all
944 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
952 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
945 :role_id => 1, :field_name => 'fixed_version_id',:rule => 'required')
953 :role_id => 1, :field_name => 'fixed_version_id',:rule => 'required')
946 user = User.find(2)
954 user = User.find(2)
947
955
948 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
956 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
949 :subject => 'Required fields', :author => user)
957 :subject => 'Required fields', :author => user)
950 assert_save issue
958 assert_save issue
951 end
959 end
952
960
953 def test_required_custom_field_that_is_not_visible_for_the_user_should_not_be_required
961 def test_required_custom_field_that_is_not_visible_for_the_user_should_not_be_required
954 CustomField.delete_all
962 CustomField.delete_all
955 field = IssueCustomField.generate!(:is_required => true, :visible => false, :role_ids => [1], :trackers => Tracker.all, :is_for_all => true)
963 field = IssueCustomField.generate!(:is_required => true, :visible => false, :role_ids => [1], :trackers => Tracker.all, :is_for_all => true)
956 user = User.generate!
964 user = User.generate!
957 User.add_to_project(user, Project.find(1), Role.find(2))
965 User.add_to_project(user, Project.find(1), Role.find(2))
958
966
959 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
967 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
960 :subject => 'Required fields', :author => user)
968 :subject => 'Required fields', :author => user)
961 assert_save issue
969 assert_save issue
962 end
970 end
963
971
964 def test_required_custom_field_that_is_visible_for_the_user_should_be_required
972 def test_required_custom_field_that_is_visible_for_the_user_should_be_required
965 CustomField.delete_all
973 CustomField.delete_all
966 field = IssueCustomField.generate!(:is_required => true, :visible => false, :role_ids => [1], :trackers => Tracker.all, :is_for_all => true)
974 field = IssueCustomField.generate!(:is_required => true, :visible => false, :role_ids => [1], :trackers => Tracker.all, :is_for_all => true)
967 user = User.generate!
975 user = User.generate!
968 User.add_to_project(user, Project.find(1), Role.find(1))
976 User.add_to_project(user, Project.find(1), Role.find(1))
969
977
970 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
978 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
971 :subject => 'Required fields', :author => user)
979 :subject => 'Required fields', :author => user)
972 assert !issue.save
980 assert !issue.save
973 assert_include "#{field.name} cannot be blank", issue.errors.full_messages
981 assert_include "#{field.name} cannot be blank", issue.errors.full_messages
974 end
982 end
975
983
976 def test_required_attribute_names_for_multiple_roles_should_intersect_rules
984 def test_required_attribute_names_for_multiple_roles_should_intersect_rules
977 WorkflowPermission.delete_all
985 WorkflowPermission.delete_all
978 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
986 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
979 :role_id => 1, :field_name => 'due_date',
987 :role_id => 1, :field_name => 'due_date',
980 :rule => 'required')
988 :rule => 'required')
981 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
989 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
982 :role_id => 1, :field_name => 'start_date',
990 :role_id => 1, :field_name => 'start_date',
983 :rule => 'required')
991 :rule => 'required')
984 user = User.find(2)
992 user = User.find(2)
985 member = Member.find(1)
993 member = Member.find(1)
986 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
994 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
987
995
988 assert_equal %w(due_date start_date), issue.required_attribute_names(user).sort
996 assert_equal %w(due_date start_date), issue.required_attribute_names(user).sort
989
997
990 member.role_ids = [1, 2]
998 member.role_ids = [1, 2]
991 member.save!
999 member.save!
992 assert_equal [], issue.required_attribute_names(user.reload)
1000 assert_equal [], issue.required_attribute_names(user.reload)
993
1001
994 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1002 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
995 :role_id => 2, :field_name => 'due_date',
1003 :role_id => 2, :field_name => 'due_date',
996 :rule => 'required')
1004 :rule => 'required')
997 assert_equal %w(due_date), issue.required_attribute_names(user)
1005 assert_equal %w(due_date), issue.required_attribute_names(user)
998
1006
999 member.role_ids = [1, 2, 3]
1007 member.role_ids = [1, 2, 3]
1000 member.save!
1008 member.save!
1001 assert_equal [], issue.required_attribute_names(user.reload)
1009 assert_equal [], issue.required_attribute_names(user.reload)
1002
1010
1003 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1011 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1004 :role_id => 3, :field_name => 'due_date',
1012 :role_id => 3, :field_name => 'due_date',
1005 :rule => 'readonly')
1013 :rule => 'readonly')
1006 # required + readonly => required
1014 # required + readonly => required
1007 assert_equal %w(due_date), issue.required_attribute_names(user)
1015 assert_equal %w(due_date), issue.required_attribute_names(user)
1008 end
1016 end
1009
1017
1010 def test_read_only_attribute_names_for_multiple_roles_should_intersect_rules
1018 def test_read_only_attribute_names_for_multiple_roles_should_intersect_rules
1011 WorkflowPermission.delete_all
1019 WorkflowPermission.delete_all
1012 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1020 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1013 :role_id => 1, :field_name => 'due_date',
1021 :role_id => 1, :field_name => 'due_date',
1014 :rule => 'readonly')
1022 :rule => 'readonly')
1015 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1023 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1016 :role_id => 1, :field_name => 'start_date',
1024 :role_id => 1, :field_name => 'start_date',
1017 :rule => 'readonly')
1025 :rule => 'readonly')
1018 user = User.find(2)
1026 user = User.find(2)
1019 member = Member.find(1)
1027 member = Member.find(1)
1020 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
1028 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
1021
1029
1022 assert_equal %w(due_date start_date), issue.read_only_attribute_names(user).sort
1030 assert_equal %w(due_date start_date), issue.read_only_attribute_names(user).sort
1023
1031
1024 member.role_ids = [1, 2]
1032 member.role_ids = [1, 2]
1025 member.save!
1033 member.save!
1026 assert_equal [], issue.read_only_attribute_names(user.reload)
1034 assert_equal [], issue.read_only_attribute_names(user.reload)
1027
1035
1028 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1036 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1029 :role_id => 2, :field_name => 'due_date',
1037 :role_id => 2, :field_name => 'due_date',
1030 :rule => 'readonly')
1038 :rule => 'readonly')
1031 assert_equal %w(due_date), issue.read_only_attribute_names(user)
1039 assert_equal %w(due_date), issue.read_only_attribute_names(user)
1032 end
1040 end
1033
1041
1034 # A field that is not visible by role 2 and readonly by role 1 should be readonly for user with role 1 and 2
1042 # A field that is not visible by role 2 and readonly by role 1 should be readonly for user with role 1 and 2
1035 def test_read_only_attribute_names_should_include_custom_fields_that_combine_readonly_and_not_visible_for_roles
1043 def test_read_only_attribute_names_should_include_custom_fields_that_combine_readonly_and_not_visible_for_roles
1036 field = IssueCustomField.generate!(
1044 field = IssueCustomField.generate!(
1037 :is_for_all => true, :trackers => Tracker.all, :visible => false, :role_ids => [1]
1045 :is_for_all => true, :trackers => Tracker.all, :visible => false, :role_ids => [1]
1038 )
1046 )
1039 WorkflowPermission.delete_all
1047 WorkflowPermission.delete_all
1040 WorkflowPermission.create!(
1048 WorkflowPermission.create!(
1041 :old_status_id => 1, :tracker_id => 1, :role_id => 1, :field_name => field.id, :rule => 'readonly'
1049 :old_status_id => 1, :tracker_id => 1, :role_id => 1, :field_name => field.id, :rule => 'readonly'
1042 )
1050 )
1043 user = User.generate!
1051 user = User.generate!
1044 project = Project.find(1)
1052 project = Project.find(1)
1045 User.add_to_project(user, project, Role.where(:id => [1, 2]))
1053 User.add_to_project(user, project, Role.where(:id => [1, 2]))
1046
1054
1047 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
1055 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
1048 assert_equal [field.id.to_s], issue.read_only_attribute_names(user)
1056 assert_equal [field.id.to_s], issue.read_only_attribute_names(user)
1049 end
1057 end
1050
1058
1051 def test_workflow_rules_should_ignore_roles_without_issue_permissions
1059 def test_workflow_rules_should_ignore_roles_without_issue_permissions
1052 role = Role.generate! :permissions => [:view_issues, :edit_issues]
1060 role = Role.generate! :permissions => [:view_issues, :edit_issues]
1053 ignored_role = Role.generate! :permissions => [:view_issues]
1061 ignored_role = Role.generate! :permissions => [:view_issues]
1054
1062
1055 WorkflowPermission.delete_all
1063 WorkflowPermission.delete_all
1056 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1064 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1057 :role => role, :field_name => 'due_date',
1065 :role => role, :field_name => 'due_date',
1058 :rule => 'required')
1066 :rule => 'required')
1059 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1067 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1060 :role => role, :field_name => 'start_date',
1068 :role => role, :field_name => 'start_date',
1061 :rule => 'readonly')
1069 :rule => 'readonly')
1062 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1070 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1063 :role => role, :field_name => 'done_ratio',
1071 :role => role, :field_name => 'done_ratio',
1064 :rule => 'readonly')
1072 :rule => 'readonly')
1065 user = User.generate!
1073 user = User.generate!
1066 User.add_to_project user, Project.find(1), [role, ignored_role]
1074 User.add_to_project user, Project.find(1), [role, ignored_role]
1067
1075
1068 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
1076 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
1069
1077
1070 assert_equal %w(due_date), issue.required_attribute_names(user)
1078 assert_equal %w(due_date), issue.required_attribute_names(user)
1071 assert_equal %w(done_ratio start_date), issue.read_only_attribute_names(user).sort
1079 assert_equal %w(done_ratio start_date), issue.read_only_attribute_names(user).sort
1072 end
1080 end
1073
1081
1074 def test_workflow_rules_should_work_for_member_with_duplicate_role
1082 def test_workflow_rules_should_work_for_member_with_duplicate_role
1075 WorkflowPermission.delete_all
1083 WorkflowPermission.delete_all
1076 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1084 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1077 :role_id => 1, :field_name => 'due_date',
1085 :role_id => 1, :field_name => 'due_date',
1078 :rule => 'required')
1086 :rule => 'required')
1079 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1087 WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1,
1080 :role_id => 1, :field_name => 'start_date',
1088 :role_id => 1, :field_name => 'start_date',
1081 :rule => 'readonly')
1089 :rule => 'readonly')
1082
1090
1083 user = User.generate!
1091 user = User.generate!
1084 m = Member.new(:user_id => user.id, :project_id => 1)
1092 m = Member.new(:user_id => user.id, :project_id => 1)
1085 m.member_roles.build(:role_id => 1)
1093 m.member_roles.build(:role_id => 1)
1086 m.member_roles.build(:role_id => 1)
1094 m.member_roles.build(:role_id => 1)
1087 m.save!
1095 m.save!
1088
1096
1089 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
1097 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1)
1090
1098
1091 assert_equal %w(due_date), issue.required_attribute_names(user)
1099 assert_equal %w(due_date), issue.required_attribute_names(user)
1092 assert_equal %w(start_date), issue.read_only_attribute_names(user)
1100 assert_equal %w(start_date), issue.read_only_attribute_names(user)
1093 end
1101 end
1094
1102
1095 def test_copy
1103 def test_copy
1096 issue = Issue.new.copy_from(1)
1104 issue = Issue.new.copy_from(1)
1097 assert issue.copy?
1105 assert issue.copy?
1098 assert issue.save
1106 assert issue.save
1099 issue.reload
1107 issue.reload
1100 orig = Issue.find(1)
1108 orig = Issue.find(1)
1101 assert_equal orig.subject, issue.subject
1109 assert_equal orig.subject, issue.subject
1102 assert_equal orig.tracker, issue.tracker
1110 assert_equal orig.tracker, issue.tracker
1103 assert_equal "125", issue.custom_value_for(2).value
1111 assert_equal "125", issue.custom_value_for(2).value
1104 end
1112 end
1105
1113
1106 def test_copy_should_copy_status
1114 def test_copy_should_copy_status
1107 orig = Issue.find(8)
1115 orig = Issue.find(8)
1108 assert orig.status != orig.default_status
1116 assert orig.status != orig.default_status
1109
1117
1110 issue = Issue.new.copy_from(orig)
1118 issue = Issue.new.copy_from(orig)
1111 assert issue.save
1119 assert issue.save
1112 issue.reload
1120 issue.reload
1113 assert_equal orig.status, issue.status
1121 assert_equal orig.status, issue.status
1114 end
1122 end
1115
1123
1116 def test_copy_should_add_relation_with_copied_issue
1124 def test_copy_should_add_relation_with_copied_issue
1117 copied = Issue.find(1)
1125 copied = Issue.find(1)
1118 issue = Issue.new.copy_from(copied)
1126 issue = Issue.new.copy_from(copied)
1119 assert issue.save
1127 assert issue.save
1120 issue.reload
1128 issue.reload
1121
1129
1122 assert_equal 1, issue.relations.size
1130 assert_equal 1, issue.relations.size
1123 relation = issue.relations.first
1131 relation = issue.relations.first
1124 assert_equal 'copied_to', relation.relation_type
1132 assert_equal 'copied_to', relation.relation_type
1125 assert_equal copied, relation.issue_from
1133 assert_equal copied, relation.issue_from
1126 assert_equal issue, relation.issue_to
1134 assert_equal issue, relation.issue_to
1127 end
1135 end
1128
1136
1129 def test_copy_should_copy_subtasks
1137 def test_copy_should_copy_subtasks
1130 issue = Issue.generate_with_descendants!
1138 issue = Issue.generate_with_descendants!
1131
1139
1132 copy = issue.reload.copy
1140 copy = issue.reload.copy
1133 copy.author = User.find(7)
1141 copy.author = User.find(7)
1134 assert_difference 'Issue.count', 1+issue.descendants.count do
1142 assert_difference 'Issue.count', 1+issue.descendants.count do
1135 assert copy.save
1143 assert copy.save
1136 end
1144 end
1137 copy.reload
1145 copy.reload
1138 assert_equal %w(Child1 Child2), copy.children.map(&:subject).sort
1146 assert_equal %w(Child1 Child2), copy.children.map(&:subject).sort
1139 child_copy = copy.children.detect {|c| c.subject == 'Child1'}
1147 child_copy = copy.children.detect {|c| c.subject == 'Child1'}
1140 assert_equal %w(Child11), child_copy.children.map(&:subject).sort
1148 assert_equal %w(Child11), child_copy.children.map(&:subject).sort
1141 assert_equal copy.author, child_copy.author
1149 assert_equal copy.author, child_copy.author
1142 end
1150 end
1143
1151
1144 def test_copy_as_a_child_of_copied_issue_should_not_copy_itself
1152 def test_copy_as_a_child_of_copied_issue_should_not_copy_itself
1145 parent = Issue.generate!
1153 parent = Issue.generate!
1146 child1 = Issue.generate!(:parent_issue_id => parent.id, :subject => 'Child 1')
1154 child1 = Issue.generate!(:parent_issue_id => parent.id, :subject => 'Child 1')
1147 child2 = Issue.generate!(:parent_issue_id => parent.id, :subject => 'Child 2')
1155 child2 = Issue.generate!(:parent_issue_id => parent.id, :subject => 'Child 2')
1148
1156
1149 copy = parent.reload.copy
1157 copy = parent.reload.copy
1150 copy.parent_issue_id = parent.id
1158 copy.parent_issue_id = parent.id
1151 copy.author = User.find(7)
1159 copy.author = User.find(7)
1152 assert_difference 'Issue.count', 3 do
1160 assert_difference 'Issue.count', 3 do
1153 assert copy.save
1161 assert copy.save
1154 end
1162 end
1155 parent.reload
1163 parent.reload
1156 copy.reload
1164 copy.reload
1157 assert_equal parent, copy.parent
1165 assert_equal parent, copy.parent
1158 assert_equal 3, parent.children.count
1166 assert_equal 3, parent.children.count
1159 assert_equal 5, parent.descendants.count
1167 assert_equal 5, parent.descendants.count
1160 assert_equal 2, copy.children.count
1168 assert_equal 2, copy.children.count
1161 assert_equal 2, copy.descendants.count
1169 assert_equal 2, copy.descendants.count
1162 end
1170 end
1163
1171
1164 def test_copy_as_a_descendant_of_copied_issue_should_not_copy_itself
1172 def test_copy_as_a_descendant_of_copied_issue_should_not_copy_itself
1165 parent = Issue.generate!
1173 parent = Issue.generate!
1166 child1 = Issue.generate!(:parent_issue_id => parent.id, :subject => 'Child 1')
1174 child1 = Issue.generate!(:parent_issue_id => parent.id, :subject => 'Child 1')
1167 child2 = Issue.generate!(:parent_issue_id => parent.id, :subject => 'Child 2')
1175 child2 = Issue.generate!(:parent_issue_id => parent.id, :subject => 'Child 2')
1168
1176
1169 copy = parent.reload.copy
1177 copy = parent.reload.copy
1170 copy.parent_issue_id = child1.id
1178 copy.parent_issue_id = child1.id
1171 copy.author = User.find(7)
1179 copy.author = User.find(7)
1172 assert_difference 'Issue.count', 3 do
1180 assert_difference 'Issue.count', 3 do
1173 assert copy.save
1181 assert copy.save
1174 end
1182 end
1175 parent.reload
1183 parent.reload
1176 child1.reload
1184 child1.reload
1177 copy.reload
1185 copy.reload
1178 assert_equal child1, copy.parent
1186 assert_equal child1, copy.parent
1179 assert_equal 2, parent.children.count
1187 assert_equal 2, parent.children.count
1180 assert_equal 5, parent.descendants.count
1188 assert_equal 5, parent.descendants.count
1181 assert_equal 1, child1.children.count
1189 assert_equal 1, child1.children.count
1182 assert_equal 3, child1.descendants.count
1190 assert_equal 3, child1.descendants.count
1183 assert_equal 2, copy.children.count
1191 assert_equal 2, copy.children.count
1184 assert_equal 2, copy.descendants.count
1192 assert_equal 2, copy.descendants.count
1185 end
1193 end
1186
1194
1187 def test_copy_should_copy_subtasks_to_target_project
1195 def test_copy_should_copy_subtasks_to_target_project
1188 issue = Issue.generate_with_descendants!
1196 issue = Issue.generate_with_descendants!
1189
1197
1190 copy = issue.copy(:project_id => 3)
1198 copy = issue.copy(:project_id => 3)
1191 assert_difference 'Issue.count', 1+issue.descendants.count do
1199 assert_difference 'Issue.count', 1+issue.descendants.count do
1192 assert copy.save
1200 assert copy.save
1193 end
1201 end
1194 assert_equal [3], copy.reload.descendants.map(&:project_id).uniq
1202 assert_equal [3], copy.reload.descendants.map(&:project_id).uniq
1195 end
1203 end
1196
1204
1197 def test_copy_should_not_copy_subtasks_twice_when_saving_twice
1205 def test_copy_should_not_copy_subtasks_twice_when_saving_twice
1198 issue = Issue.generate_with_descendants!
1206 issue = Issue.generate_with_descendants!
1199
1207
1200 copy = issue.reload.copy
1208 copy = issue.reload.copy
1201 assert_difference 'Issue.count', 1+issue.descendants.count do
1209 assert_difference 'Issue.count', 1+issue.descendants.count do
1202 assert copy.save
1210 assert copy.save
1203 assert copy.save
1211 assert copy.save
1204 end
1212 end
1205 end
1213 end
1206
1214
1207 def test_should_not_call_after_project_change_on_creation
1215 def test_should_not_call_after_project_change_on_creation
1208 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
1216 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
1209 :subject => 'Test', :author_id => 1)
1217 :subject => 'Test', :author_id => 1)
1210 issue.expects(:after_project_change).never
1218 issue.expects(:after_project_change).never
1211 issue.save!
1219 issue.save!
1212 end
1220 end
1213
1221
1214 def test_should_not_call_after_project_change_on_update
1222 def test_should_not_call_after_project_change_on_update
1215 issue = Issue.find(1)
1223 issue = Issue.find(1)
1216 issue.project = Project.find(1)
1224 issue.project = Project.find(1)
1217 issue.subject = 'No project change'
1225 issue.subject = 'No project change'
1218 issue.expects(:after_project_change).never
1226 issue.expects(:after_project_change).never
1219 issue.save!
1227 issue.save!
1220 end
1228 end
1221
1229
1222 def test_should_call_after_project_change_on_project_change
1230 def test_should_call_after_project_change_on_project_change
1223 issue = Issue.find(1)
1231 issue = Issue.find(1)
1224 issue.project = Project.find(2)
1232 issue.project = Project.find(2)
1225 issue.expects(:after_project_change).once
1233 issue.expects(:after_project_change).once
1226 issue.save!
1234 issue.save!
1227 end
1235 end
1228
1236
1229 def test_adding_journal_should_update_timestamp
1237 def test_adding_journal_should_update_timestamp
1230 issue = Issue.find(1)
1238 issue = Issue.find(1)
1231 updated_on_was = issue.updated_on
1239 updated_on_was = issue.updated_on
1232
1240
1233 issue.init_journal(User.first, "Adding notes")
1241 issue.init_journal(User.first, "Adding notes")
1234 assert_difference 'Journal.count' do
1242 assert_difference 'Journal.count' do
1235 assert issue.save
1243 assert issue.save
1236 end
1244 end
1237 issue.reload
1245 issue.reload
1238
1246
1239 assert_not_equal updated_on_was, issue.updated_on
1247 assert_not_equal updated_on_was, issue.updated_on
1240 end
1248 end
1241
1249
1242 def test_should_close_duplicates
1250 def test_should_close_duplicates
1243 # Create 3 issues
1251 # Create 3 issues
1244 issue1 = Issue.generate!
1252 issue1 = Issue.generate!
1245 issue2 = Issue.generate!
1253 issue2 = Issue.generate!
1246 issue3 = Issue.generate!
1254 issue3 = Issue.generate!
1247
1255
1248 # 2 is a dupe of 1
1256 # 2 is a dupe of 1
1249 IssueRelation.create!(:issue_from => issue2, :issue_to => issue1,
1257 IssueRelation.create!(:issue_from => issue2, :issue_to => issue1,
1250 :relation_type => IssueRelation::TYPE_DUPLICATES)
1258 :relation_type => IssueRelation::TYPE_DUPLICATES)
1251 # And 3 is a dupe of 2
1259 # And 3 is a dupe of 2
1252 # IssueRelation.create!(:issue_from => issue3, :issue_to => issue2,
1260 # IssueRelation.create!(:issue_from => issue3, :issue_to => issue2,
1253 # :relation_type => IssueRelation::TYPE_DUPLICATES)
1261 # :relation_type => IssueRelation::TYPE_DUPLICATES)
1254 # And 3 is a dupe of 1 (circular duplicates)
1262 # And 3 is a dupe of 1 (circular duplicates)
1255 IssueRelation.create!(:issue_from => issue3, :issue_to => issue1,
1263 IssueRelation.create!(:issue_from => issue3, :issue_to => issue1,
1256 :relation_type => IssueRelation::TYPE_DUPLICATES)
1264 :relation_type => IssueRelation::TYPE_DUPLICATES)
1257
1265
1258 assert issue1.reload.duplicates.include?(issue2)
1266 assert issue1.reload.duplicates.include?(issue2)
1259
1267
1260 # Closing issue 1
1268 # Closing issue 1
1261 issue1.init_journal(User.first, "Closing issue1")
1269 issue1.init_journal(User.first, "Closing issue1")
1262 issue1.status = IssueStatus.where(:is_closed => true).first
1270 issue1.status = IssueStatus.where(:is_closed => true).first
1263 assert issue1.save
1271 assert issue1.save
1264 # 2 and 3 should be also closed
1272 # 2 and 3 should be also closed
1265 assert issue2.reload.closed?
1273 assert issue2.reload.closed?
1266 assert issue3.reload.closed?
1274 assert issue3.reload.closed?
1267 end
1275 end
1268
1276
1269 def test_should_not_close_duplicated_issue
1277 def test_should_not_close_duplicated_issue
1270 issue1 = Issue.generate!
1278 issue1 = Issue.generate!
1271 issue2 = Issue.generate!
1279 issue2 = Issue.generate!
1272
1280
1273 # 2 is a dupe of 1
1281 # 2 is a dupe of 1
1274 IssueRelation.create(:issue_from => issue2, :issue_to => issue1,
1282 IssueRelation.create(:issue_from => issue2, :issue_to => issue1,
1275 :relation_type => IssueRelation::TYPE_DUPLICATES)
1283 :relation_type => IssueRelation::TYPE_DUPLICATES)
1276 # 2 is a dup of 1 but 1 is not a duplicate of 2
1284 # 2 is a dup of 1 but 1 is not a duplicate of 2
1277 assert !issue2.reload.duplicates.include?(issue1)
1285 assert !issue2.reload.duplicates.include?(issue1)
1278
1286
1279 # Closing issue 2
1287 # Closing issue 2
1280 issue2.init_journal(User.first, "Closing issue2")
1288 issue2.init_journal(User.first, "Closing issue2")
1281 issue2.status = IssueStatus.where(:is_closed => true).first
1289 issue2.status = IssueStatus.where(:is_closed => true).first
1282 assert issue2.save
1290 assert issue2.save
1283 # 1 should not be also closed
1291 # 1 should not be also closed
1284 assert !issue1.reload.closed?
1292 assert !issue1.reload.closed?
1285 end
1293 end
1286
1294
1287 def test_assignable_versions
1295 def test_assignable_versions
1288 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1,
1296 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1,
1289 :status_id => 1, :fixed_version_id => 1,
1297 :status_id => 1, :fixed_version_id => 1,
1290 :subject => 'New issue')
1298 :subject => 'New issue')
1291 assert_equal ['open'], issue.assignable_versions.collect(&:status).uniq
1299 assert_equal ['open'], issue.assignable_versions.collect(&:status).uniq
1292 end
1300 end
1293
1301
1294 def test_should_not_be_able_to_assign_a_new_issue_to_a_closed_version
1302 def test_should_not_be_able_to_assign_a_new_issue_to_a_closed_version
1295 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1,
1303 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1,
1296 :status_id => 1, :fixed_version_id => 1,
1304 :status_id => 1, :fixed_version_id => 1,
1297 :subject => 'New issue')
1305 :subject => 'New issue')
1298 assert !issue.save
1306 assert !issue.save
1299 assert_not_equal [], issue.errors[:fixed_version_id]
1307 assert_not_equal [], issue.errors[:fixed_version_id]
1300 end
1308 end
1301
1309
1302 def test_should_not_be_able_to_assign_a_new_issue_to_a_locked_version
1310 def test_should_not_be_able_to_assign_a_new_issue_to_a_locked_version
1303 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1,
1311 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1,
1304 :status_id => 1, :fixed_version_id => 2,
1312 :status_id => 1, :fixed_version_id => 2,
1305 :subject => 'New issue')
1313 :subject => 'New issue')
1306 assert !issue.save
1314 assert !issue.save
1307 assert_not_equal [], issue.errors[:fixed_version_id]
1315 assert_not_equal [], issue.errors[:fixed_version_id]
1308 end
1316 end
1309
1317
1310 def test_should_be_able_to_assign_a_new_issue_to_an_open_version
1318 def test_should_be_able_to_assign_a_new_issue_to_an_open_version
1311 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1,
1319 issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1,
1312 :status_id => 1, :fixed_version_id => 3,
1320 :status_id => 1, :fixed_version_id => 3,
1313 :subject => 'New issue')
1321 :subject => 'New issue')
1314 assert issue.save
1322 assert issue.save
1315 end
1323 end
1316
1324
1317 def test_should_be_able_to_update_an_issue_assigned_to_a_closed_version
1325 def test_should_be_able_to_update_an_issue_assigned_to_a_closed_version
1318 issue = Issue.find(11)
1326 issue = Issue.find(11)
1319 assert_equal 'closed', issue.fixed_version.status
1327 assert_equal 'closed', issue.fixed_version.status
1320 issue.subject = 'Subject changed'
1328 issue.subject = 'Subject changed'
1321 assert issue.save
1329 assert issue.save
1322 end
1330 end
1323
1331
1324 def test_should_not_be_able_to_reopen_an_issue_assigned_to_a_closed_version
1332 def test_should_not_be_able_to_reopen_an_issue_assigned_to_a_closed_version
1325 issue = Issue.find(11)
1333 issue = Issue.find(11)
1326 issue.status_id = 1
1334 issue.status_id = 1
1327 assert !issue.save
1335 assert !issue.save
1328 assert_not_equal [], issue.errors[:base]
1336 assert_not_equal [], issue.errors[:base]
1329 end
1337 end
1330
1338
1331 def test_should_be_able_to_reopen_and_reassign_an_issue_assigned_to_a_closed_version
1339 def test_should_be_able_to_reopen_and_reassign_an_issue_assigned_to_a_closed_version
1332 issue = Issue.find(11)
1340 issue = Issue.find(11)
1333 issue.status_id = 1
1341 issue.status_id = 1
1334 issue.fixed_version_id = 3
1342 issue.fixed_version_id = 3
1335 assert issue.save
1343 assert issue.save
1336 end
1344 end
1337
1345
1338 def test_should_be_able_to_reopen_an_issue_assigned_to_a_locked_version
1346 def test_should_be_able_to_reopen_an_issue_assigned_to_a_locked_version
1339 issue = Issue.find(12)
1347 issue = Issue.find(12)
1340 assert_equal 'locked', issue.fixed_version.status
1348 assert_equal 'locked', issue.fixed_version.status
1341 issue.status_id = 1
1349 issue.status_id = 1
1342 assert issue.save
1350 assert issue.save
1343 end
1351 end
1344
1352
1345 def test_should_not_be_able_to_keep_unshared_version_when_changing_project
1353 def test_should_not_be_able_to_keep_unshared_version_when_changing_project
1346 issue = Issue.find(2)
1354 issue = Issue.find(2)
1347 assert_equal 2, issue.fixed_version_id
1355 assert_equal 2, issue.fixed_version_id
1348 issue.project_id = 3
1356 issue.project_id = 3
1349 assert_nil issue.fixed_version_id
1357 assert_nil issue.fixed_version_id
1350 issue.fixed_version_id = 2
1358 issue.fixed_version_id = 2
1351 assert !issue.save
1359 assert !issue.save
1352 assert_include 'Target version is not included in the list', issue.errors.full_messages
1360 assert_include 'Target version is not included in the list', issue.errors.full_messages
1353 end
1361 end
1354
1362
1355 def test_should_keep_shared_version_when_changing_project
1363 def test_should_keep_shared_version_when_changing_project
1356 Version.find(2).update_attribute :sharing, 'tree'
1364 Version.find(2).update_attribute :sharing, 'tree'
1357
1365
1358 issue = Issue.find(2)
1366 issue = Issue.find(2)
1359 assert_equal 2, issue.fixed_version_id
1367 assert_equal 2, issue.fixed_version_id
1360 issue.project_id = 3
1368 issue.project_id = 3
1361 assert_equal 2, issue.fixed_version_id
1369 assert_equal 2, issue.fixed_version_id
1362 assert issue.save
1370 assert issue.save
1363 end
1371 end
1364
1372
1365 def test_allowed_target_projects_should_include_projects_with_issue_tracking_enabled
1373 def test_allowed_target_projects_should_include_projects_with_issue_tracking_enabled
1366 assert_include Project.find(2), Issue.allowed_target_projects(User.find(2))
1374 assert_include Project.find(2), Issue.allowed_target_projects(User.find(2))
1367 end
1375 end
1368
1376
1369 def test_allowed_target_projects_should_not_include_projects_with_issue_tracking_disabled
1377 def test_allowed_target_projects_should_not_include_projects_with_issue_tracking_disabled
1370 Project.find(2).disable_module! :issue_tracking
1378 Project.find(2).disable_module! :issue_tracking
1371 assert_not_include Project.find(2), Issue.allowed_target_projects(User.find(2))
1379 assert_not_include Project.find(2), Issue.allowed_target_projects(User.find(2))
1372 end
1380 end
1373
1381
1374 def test_allowed_target_projects_should_not_include_projects_without_trackers
1382 def test_allowed_target_projects_should_not_include_projects_without_trackers
1375 project = Project.generate!(:tracker_ids => [])
1383 project = Project.generate!(:tracker_ids => [])
1376 assert project.trackers.empty?
1384 assert project.trackers.empty?
1377 assert_not_include project, Issue.allowed_target_projects(User.find(1))
1385 assert_not_include project, Issue.allowed_target_projects(User.find(1))
1378 end
1386 end
1379
1387
1380 def test_move_to_another_project_with_same_category
1388 def test_move_to_another_project_with_same_category
1381 issue = Issue.find(1)
1389 issue = Issue.find(1)
1382 issue.project = Project.find(2)
1390 issue.project = Project.find(2)
1383 assert issue.save
1391 assert issue.save
1384 issue.reload
1392 issue.reload
1385 assert_equal 2, issue.project_id
1393 assert_equal 2, issue.project_id
1386 # Category changes
1394 # Category changes
1387 assert_equal 4, issue.category_id
1395 assert_equal 4, issue.category_id
1388 # Make sure time entries were move to the target project
1396 # Make sure time entries were move to the target project
1389 assert_equal 2, issue.time_entries.first.project_id
1397 assert_equal 2, issue.time_entries.first.project_id
1390 end
1398 end
1391
1399
1392 def test_move_to_another_project_without_same_category
1400 def test_move_to_another_project_without_same_category
1393 issue = Issue.find(2)
1401 issue = Issue.find(2)
1394 issue.project = Project.find(2)
1402 issue.project = Project.find(2)
1395 assert issue.save
1403 assert issue.save
1396 issue.reload
1404 issue.reload
1397 assert_equal 2, issue.project_id
1405 assert_equal 2, issue.project_id
1398 # Category cleared
1406 # Category cleared
1399 assert_nil issue.category_id
1407 assert_nil issue.category_id
1400 end
1408 end
1401
1409
1402 def test_move_to_another_project_should_clear_fixed_version_when_not_shared
1410 def test_move_to_another_project_should_clear_fixed_version_when_not_shared
1403 issue = Issue.find(1)
1411 issue = Issue.find(1)
1404 issue.update_attribute(:fixed_version_id, 1)
1412 issue.update_attribute(:fixed_version_id, 1)
1405 issue.project = Project.find(2)
1413 issue.project = Project.find(2)
1406 assert issue.save
1414 assert issue.save
1407 issue.reload
1415 issue.reload
1408 assert_equal 2, issue.project_id
1416 assert_equal 2, issue.project_id
1409 # Cleared fixed_version
1417 # Cleared fixed_version
1410 assert_equal nil, issue.fixed_version
1418 assert_equal nil, issue.fixed_version
1411 end
1419 end
1412
1420
1413 def test_move_to_another_project_should_keep_fixed_version_when_shared_with_the_target_project
1421 def test_move_to_another_project_should_keep_fixed_version_when_shared_with_the_target_project
1414 issue = Issue.find(1)
1422 issue = Issue.find(1)
1415 issue.update_attribute(:fixed_version_id, 4)
1423 issue.update_attribute(:fixed_version_id, 4)
1416 issue.project = Project.find(5)
1424 issue.project = Project.find(5)
1417 assert issue.save
1425 assert issue.save
1418 issue.reload
1426 issue.reload
1419 assert_equal 5, issue.project_id
1427 assert_equal 5, issue.project_id
1420 # Keep fixed_version
1428 # Keep fixed_version
1421 assert_equal 4, issue.fixed_version_id
1429 assert_equal 4, issue.fixed_version_id
1422 end
1430 end
1423
1431
1424 def test_move_to_another_project_should_clear_fixed_version_when_not_shared_with_the_target_project
1432 def test_move_to_another_project_should_clear_fixed_version_when_not_shared_with_the_target_project
1425 issue = Issue.find(1)
1433 issue = Issue.find(1)
1426 issue.update_attribute(:fixed_version_id, 1)
1434 issue.update_attribute(:fixed_version_id, 1)
1427 issue.project = Project.find(5)
1435 issue.project = Project.find(5)
1428 assert issue.save
1436 assert issue.save
1429 issue.reload
1437 issue.reload
1430 assert_equal 5, issue.project_id
1438 assert_equal 5, issue.project_id
1431 # Cleared fixed_version
1439 # Cleared fixed_version
1432 assert_equal nil, issue.fixed_version
1440 assert_equal nil, issue.fixed_version
1433 end
1441 end
1434
1442
1435 def test_move_to_another_project_should_keep_fixed_version_when_shared_systemwide
1443 def test_move_to_another_project_should_keep_fixed_version_when_shared_systemwide
1436 issue = Issue.find(1)
1444 issue = Issue.find(1)
1437 issue.update_attribute(:fixed_version_id, 7)
1445 issue.update_attribute(:fixed_version_id, 7)
1438 issue.project = Project.find(2)
1446 issue.project = Project.find(2)
1439 assert issue.save
1447 assert issue.save
1440 issue.reload
1448 issue.reload
1441 assert_equal 2, issue.project_id
1449 assert_equal 2, issue.project_id
1442 # Keep fixed_version
1450 # Keep fixed_version
1443 assert_equal 7, issue.fixed_version_id
1451 assert_equal 7, issue.fixed_version_id
1444 end
1452 end
1445
1453
1446 def test_move_to_another_project_should_keep_parent_if_valid
1454 def test_move_to_another_project_should_keep_parent_if_valid
1447 issue = Issue.find(1)
1455 issue = Issue.find(1)
1448 issue.update_attribute(:parent_issue_id, 2)
1456 issue.update_attribute(:parent_issue_id, 2)
1449 issue.project = Project.find(3)
1457 issue.project = Project.find(3)
1450 assert issue.save
1458 assert issue.save
1451 issue.reload
1459 issue.reload
1452 assert_equal 2, issue.parent_id
1460 assert_equal 2, issue.parent_id
1453 end
1461 end
1454
1462
1455 def test_move_to_another_project_should_clear_parent_if_not_valid
1463 def test_move_to_another_project_should_clear_parent_if_not_valid
1456 issue = Issue.find(1)
1464 issue = Issue.find(1)
1457 issue.update_attribute(:parent_issue_id, 2)
1465 issue.update_attribute(:parent_issue_id, 2)
1458 issue.project = Project.find(2)
1466 issue.project = Project.find(2)
1459 assert issue.save
1467 assert issue.save
1460 issue.reload
1468 issue.reload
1461 assert_nil issue.parent_id
1469 assert_nil issue.parent_id
1462 end
1470 end
1463
1471
1464 def test_move_to_another_project_with_disabled_tracker
1472 def test_move_to_another_project_with_disabled_tracker
1465 issue = Issue.find(1)
1473 issue = Issue.find(1)
1466 target = Project.find(2)
1474 target = Project.find(2)
1467 target.tracker_ids = [3]
1475 target.tracker_ids = [3]
1468 target.save
1476 target.save
1469 issue.project = target
1477 issue.project = target
1470 assert issue.save
1478 assert issue.save
1471 issue.reload
1479 issue.reload
1472 assert_equal 2, issue.project_id
1480 assert_equal 2, issue.project_id
1473 assert_equal 3, issue.tracker_id
1481 assert_equal 3, issue.tracker_id
1474 end
1482 end
1475
1483
1476 def test_copy_to_the_same_project
1484 def test_copy_to_the_same_project
1477 issue = Issue.find(1)
1485 issue = Issue.find(1)
1478 copy = issue.copy
1486 copy = issue.copy
1479 assert_difference 'Issue.count' do
1487 assert_difference 'Issue.count' do
1480 copy.save!
1488 copy.save!
1481 end
1489 end
1482 assert_kind_of Issue, copy
1490 assert_kind_of Issue, copy
1483 assert_equal issue.project, copy.project
1491 assert_equal issue.project, copy.project
1484 assert_equal "125", copy.custom_value_for(2).value
1492 assert_equal "125", copy.custom_value_for(2).value
1485 end
1493 end
1486
1494
1487 def test_copy_to_another_project_and_tracker
1495 def test_copy_to_another_project_and_tracker
1488 issue = Issue.find(1)
1496 issue = Issue.find(1)
1489 copy = issue.copy(:project_id => 3, :tracker_id => 2)
1497 copy = issue.copy(:project_id => 3, :tracker_id => 2)
1490 assert_difference 'Issue.count' do
1498 assert_difference 'Issue.count' do
1491 copy.save!
1499 copy.save!
1492 end
1500 end
1493 copy.reload
1501 copy.reload
1494 assert_kind_of Issue, copy
1502 assert_kind_of Issue, copy
1495 assert_equal Project.find(3), copy.project
1503 assert_equal Project.find(3), copy.project
1496 assert_equal Tracker.find(2), copy.tracker
1504 assert_equal Tracker.find(2), copy.tracker
1497 # Custom field #2 is not associated with target tracker
1505 # Custom field #2 is not associated with target tracker
1498 assert_nil copy.custom_value_for(2)
1506 assert_nil copy.custom_value_for(2)
1499 end
1507 end
1500
1508
1501 test "#copy should not create a journal" do
1509 test "#copy should not create a journal" do
1502 copy = Issue.find(1).copy({:project_id => 3, :tracker_id => 2, :assigned_to_id => 3}, :link => false)
1510 copy = Issue.find(1).copy({:project_id => 3, :tracker_id => 2, :assigned_to_id => 3}, :link => false)
1503 copy.save!
1511 copy.save!
1504 assert_equal 0, copy.reload.journals.size
1512 assert_equal 0, copy.reload.journals.size
1505 end
1513 end
1506
1514
1507 test "#copy should allow assigned_to changes" do
1515 test "#copy should allow assigned_to changes" do
1508 copy = Issue.find(1).copy(:project_id => 3, :tracker_id => 2, :assigned_to_id => 3)
1516 copy = Issue.find(1).copy(:project_id => 3, :tracker_id => 2, :assigned_to_id => 3)
1509 assert_equal 3, copy.assigned_to_id
1517 assert_equal 3, copy.assigned_to_id
1510 end
1518 end
1511
1519
1512 test "#copy should allow status changes" do
1520 test "#copy should allow status changes" do
1513 copy = Issue.find(1).copy(:project_id => 3, :tracker_id => 2, :status_id => 2)
1521 copy = Issue.find(1).copy(:project_id => 3, :tracker_id => 2, :status_id => 2)
1514 assert_equal 2, copy.status_id
1522 assert_equal 2, copy.status_id
1515 end
1523 end
1516
1524
1517 test "#copy should allow start date changes" do
1525 test "#copy should allow start date changes" do
1518 date = Date.today
1526 date = Date.today
1519 copy = Issue.find(1).copy(:project_id => 3, :tracker_id => 2, :start_date => date)
1527 copy = Issue.find(1).copy(:project_id => 3, :tracker_id => 2, :start_date => date)
1520 assert_equal date, copy.start_date
1528 assert_equal date, copy.start_date
1521 end
1529 end
1522
1530
1523 test "#copy should allow due date changes" do
1531 test "#copy should allow due date changes" do
1524 date = Date.today
1532 date = Date.today
1525 copy = Issue.find(1).copy(:project_id => 3, :tracker_id => 2, :due_date => date)
1533 copy = Issue.find(1).copy(:project_id => 3, :tracker_id => 2, :due_date => date)
1526 assert_equal date, copy.due_date
1534 assert_equal date, copy.due_date
1527 end
1535 end
1528
1536
1529 test "#copy should set current user as author" do
1537 test "#copy should set current user as author" do
1530 User.current = User.find(9)
1538 User.current = User.find(9)
1531 copy = Issue.find(1).copy(:project_id => 3, :tracker_id => 2)
1539 copy = Issue.find(1).copy(:project_id => 3, :tracker_id => 2)
1532 assert_equal User.current, copy.author
1540 assert_equal User.current, copy.author
1533 end
1541 end
1534
1542
1535 test "#copy should create a journal with notes" do
1543 test "#copy should create a journal with notes" do
1536 date = Date.today
1544 date = Date.today
1537 notes = "Notes added when copying"
1545 notes = "Notes added when copying"
1538 copy = Issue.find(1).copy({:project_id => 3, :tracker_id => 2, :start_date => date}, :link => false)
1546 copy = Issue.find(1).copy({:project_id => 3, :tracker_id => 2, :start_date => date}, :link => false)
1539 copy.init_journal(User.current, notes)
1547 copy.init_journal(User.current, notes)
1540 copy.save!
1548 copy.save!
1541
1549
1542 assert_equal 1, copy.journals.size
1550 assert_equal 1, copy.journals.size
1543 journal = copy.journals.first
1551 journal = copy.journals.first
1544 assert_equal 0, journal.details.size
1552 assert_equal 0, journal.details.size
1545 assert_equal notes, journal.notes
1553 assert_equal notes, journal.notes
1546 end
1554 end
1547
1555
1548 def test_valid_parent_project
1556 def test_valid_parent_project
1549 issue = Issue.find(1)
1557 issue = Issue.find(1)
1550 issue_in_same_project = Issue.find(2)
1558 issue_in_same_project = Issue.find(2)
1551 issue_in_child_project = Issue.find(5)
1559 issue_in_child_project = Issue.find(5)
1552 issue_in_grandchild_project = Issue.generate!(:project_id => 6, :tracker_id => 1)
1560 issue_in_grandchild_project = Issue.generate!(:project_id => 6, :tracker_id => 1)
1553 issue_in_other_child_project = Issue.find(6)
1561 issue_in_other_child_project = Issue.find(6)
1554 issue_in_different_tree = Issue.find(4)
1562 issue_in_different_tree = Issue.find(4)
1555
1563
1556 with_settings :cross_project_subtasks => '' do
1564 with_settings :cross_project_subtasks => '' do
1557 assert_equal true, issue.valid_parent_project?(issue_in_same_project)
1565 assert_equal true, issue.valid_parent_project?(issue_in_same_project)
1558 assert_equal false, issue.valid_parent_project?(issue_in_child_project)
1566 assert_equal false, issue.valid_parent_project?(issue_in_child_project)
1559 assert_equal false, issue.valid_parent_project?(issue_in_grandchild_project)
1567 assert_equal false, issue.valid_parent_project?(issue_in_grandchild_project)
1560 assert_equal false, issue.valid_parent_project?(issue_in_different_tree)
1568 assert_equal false, issue.valid_parent_project?(issue_in_different_tree)
1561 end
1569 end
1562
1570
1563 with_settings :cross_project_subtasks => 'system' do
1571 with_settings :cross_project_subtasks => 'system' do
1564 assert_equal true, issue.valid_parent_project?(issue_in_same_project)
1572 assert_equal true, issue.valid_parent_project?(issue_in_same_project)
1565 assert_equal true, issue.valid_parent_project?(issue_in_child_project)
1573 assert_equal true, issue.valid_parent_project?(issue_in_child_project)
1566 assert_equal true, issue.valid_parent_project?(issue_in_different_tree)
1574 assert_equal true, issue.valid_parent_project?(issue_in_different_tree)
1567 end
1575 end
1568
1576
1569 with_settings :cross_project_subtasks => 'tree' do
1577 with_settings :cross_project_subtasks => 'tree' do
1570 assert_equal true, issue.valid_parent_project?(issue_in_same_project)
1578 assert_equal true, issue.valid_parent_project?(issue_in_same_project)
1571 assert_equal true, issue.valid_parent_project?(issue_in_child_project)
1579 assert_equal true, issue.valid_parent_project?(issue_in_child_project)
1572 assert_equal true, issue.valid_parent_project?(issue_in_grandchild_project)
1580 assert_equal true, issue.valid_parent_project?(issue_in_grandchild_project)
1573 assert_equal false, issue.valid_parent_project?(issue_in_different_tree)
1581 assert_equal false, issue.valid_parent_project?(issue_in_different_tree)
1574
1582
1575 assert_equal true, issue_in_child_project.valid_parent_project?(issue_in_same_project)
1583 assert_equal true, issue_in_child_project.valid_parent_project?(issue_in_same_project)
1576 assert_equal true, issue_in_child_project.valid_parent_project?(issue_in_other_child_project)
1584 assert_equal true, issue_in_child_project.valid_parent_project?(issue_in_other_child_project)
1577 end
1585 end
1578
1586
1579 with_settings :cross_project_subtasks => 'descendants' do
1587 with_settings :cross_project_subtasks => 'descendants' do
1580 assert_equal true, issue.valid_parent_project?(issue_in_same_project)
1588 assert_equal true, issue.valid_parent_project?(issue_in_same_project)
1581 assert_equal false, issue.valid_parent_project?(issue_in_child_project)
1589 assert_equal false, issue.valid_parent_project?(issue_in_child_project)
1582 assert_equal false, issue.valid_parent_project?(issue_in_grandchild_project)
1590 assert_equal false, issue.valid_parent_project?(issue_in_grandchild_project)
1583 assert_equal false, issue.valid_parent_project?(issue_in_different_tree)
1591 assert_equal false, issue.valid_parent_project?(issue_in_different_tree)
1584
1592
1585 assert_equal true, issue_in_child_project.valid_parent_project?(issue)
1593 assert_equal true, issue_in_child_project.valid_parent_project?(issue)
1586 assert_equal false, issue_in_child_project.valid_parent_project?(issue_in_other_child_project)
1594 assert_equal false, issue_in_child_project.valid_parent_project?(issue_in_other_child_project)
1587 end
1595 end
1588 end
1596 end
1589
1597
1590 def test_recipients_should_include_previous_assignee
1598 def test_recipients_should_include_previous_assignee
1591 user = User.find(3)
1599 user = User.find(3)
1592 user.members.update_all ["mail_notification = ?", false]
1600 user.members.update_all ["mail_notification = ?", false]
1593 user.update_attribute :mail_notification, 'only_assigned'
1601 user.update_attribute :mail_notification, 'only_assigned'
1594
1602
1595 issue = Issue.find(2)
1603 issue = Issue.find(2)
1596 issue.assigned_to = nil
1604 issue.assigned_to = nil
1597 assert_include user.mail, issue.recipients
1605 assert_include user.mail, issue.recipients
1598 issue.save!
1606 issue.save!
1599 assert !issue.recipients.include?(user.mail)
1607 assert !issue.recipients.include?(user.mail)
1600 end
1608 end
1601
1609
1602 def test_recipients_should_not_include_users_that_cannot_view_the_issue
1610 def test_recipients_should_not_include_users_that_cannot_view_the_issue
1603 issue = Issue.find(12)
1611 issue = Issue.find(12)
1604 assert issue.recipients.include?(issue.author.mail)
1612 assert issue.recipients.include?(issue.author.mail)
1605 # copy the issue to a private project
1613 # copy the issue to a private project
1606 copy = issue.copy(:project_id => 5, :tracker_id => 2)
1614 copy = issue.copy(:project_id => 5, :tracker_id => 2)
1607 # author is not a member of project anymore
1615 # author is not a member of project anymore
1608 assert !copy.recipients.include?(copy.author.mail)
1616 assert !copy.recipients.include?(copy.author.mail)
1609 end
1617 end
1610
1618
1611 def test_recipients_should_include_the_assigned_group_members
1619 def test_recipients_should_include_the_assigned_group_members
1612 group_member = User.generate!
1620 group_member = User.generate!
1613 group = Group.generate!
1621 group = Group.generate!
1614 group.users << group_member
1622 group.users << group_member
1615
1623
1616 issue = Issue.find(12)
1624 issue = Issue.find(12)
1617 issue.assigned_to = group
1625 issue.assigned_to = group
1618 assert issue.recipients.include?(group_member.mail)
1626 assert issue.recipients.include?(group_member.mail)
1619 end
1627 end
1620
1628
1621 def test_watcher_recipients_should_not_include_users_that_cannot_view_the_issue
1629 def test_watcher_recipients_should_not_include_users_that_cannot_view_the_issue
1622 user = User.find(3)
1630 user = User.find(3)
1623 issue = Issue.find(9)
1631 issue = Issue.find(9)
1624 Watcher.create!(:user => user, :watchable => issue)
1632 Watcher.create!(:user => user, :watchable => issue)
1625 assert issue.watched_by?(user)
1633 assert issue.watched_by?(user)
1626 assert !issue.watcher_recipients.include?(user.mail)
1634 assert !issue.watcher_recipients.include?(user.mail)
1627 end
1635 end
1628
1636
1629 def test_issue_destroy
1637 def test_issue_destroy
1630 Issue.find(1).destroy
1638 Issue.find(1).destroy
1631 assert_nil Issue.find_by_id(1)
1639 assert_nil Issue.find_by_id(1)
1632 assert_nil TimeEntry.find_by_issue_id(1)
1640 assert_nil TimeEntry.find_by_issue_id(1)
1633 end
1641 end
1634
1642
1635 def test_destroy_should_delete_time_entries_custom_values
1643 def test_destroy_should_delete_time_entries_custom_values
1636 issue = Issue.generate!
1644 issue = Issue.generate!
1637 time_entry = TimeEntry.generate!(:issue => issue, :custom_field_values => {10 => '1'})
1645 time_entry = TimeEntry.generate!(:issue => issue, :custom_field_values => {10 => '1'})
1638
1646
1639 assert_difference 'CustomValue.where(:customized_type => "TimeEntry").count', -1 do
1647 assert_difference 'CustomValue.where(:customized_type => "TimeEntry").count', -1 do
1640 assert issue.destroy
1648 assert issue.destroy
1641 end
1649 end
1642 end
1650 end
1643
1651
1644 def test_destroying_a_deleted_issue_should_not_raise_an_error
1652 def test_destroying_a_deleted_issue_should_not_raise_an_error
1645 issue = Issue.find(1)
1653 issue = Issue.find(1)
1646 Issue.find(1).destroy
1654 Issue.find(1).destroy
1647
1655
1648 assert_nothing_raised do
1656 assert_nothing_raised do
1649 assert_no_difference 'Issue.count' do
1657 assert_no_difference 'Issue.count' do
1650 issue.destroy
1658 issue.destroy
1651 end
1659 end
1652 assert issue.destroyed?
1660 assert issue.destroyed?
1653 end
1661 end
1654 end
1662 end
1655
1663
1656 def test_destroying_a_stale_issue_should_not_raise_an_error
1664 def test_destroying_a_stale_issue_should_not_raise_an_error
1657 issue = Issue.find(1)
1665 issue = Issue.find(1)
1658 Issue.find(1).update_attribute :subject, "Updated"
1666 Issue.find(1).update_attribute :subject, "Updated"
1659
1667
1660 assert_nothing_raised do
1668 assert_nothing_raised do
1661 assert_difference 'Issue.count', -1 do
1669 assert_difference 'Issue.count', -1 do
1662 issue.destroy
1670 issue.destroy
1663 end
1671 end
1664 assert issue.destroyed?
1672 assert issue.destroyed?
1665 end
1673 end
1666 end
1674 end
1667
1675
1668 def test_blocked
1676 def test_blocked
1669 blocked_issue = Issue.find(9)
1677 blocked_issue = Issue.find(9)
1670 blocking_issue = Issue.find(10)
1678 blocking_issue = Issue.find(10)
1671
1679
1672 assert blocked_issue.blocked?
1680 assert blocked_issue.blocked?
1673 assert !blocking_issue.blocked?
1681 assert !blocking_issue.blocked?
1674 end
1682 end
1675
1683
1676 def test_blocked_issues_dont_allow_closed_statuses
1684 def test_blocked_issues_dont_allow_closed_statuses
1677 blocked_issue = Issue.find(9)
1685 blocked_issue = Issue.find(9)
1678
1686
1679 allowed_statuses = blocked_issue.new_statuses_allowed_to(users(:users_002))
1687 allowed_statuses = blocked_issue.new_statuses_allowed_to(users(:users_002))
1680 assert !allowed_statuses.empty?
1688 assert !allowed_statuses.empty?
1681 closed_statuses = allowed_statuses.select {|st| st.is_closed?}
1689 closed_statuses = allowed_statuses.select {|st| st.is_closed?}
1682 assert closed_statuses.empty?
1690 assert closed_statuses.empty?
1683 end
1691 end
1684
1692
1685 def test_unblocked_issues_allow_closed_statuses
1693 def test_unblocked_issues_allow_closed_statuses
1686 blocking_issue = Issue.find(10)
1694 blocking_issue = Issue.find(10)
1687
1695
1688 allowed_statuses = blocking_issue.new_statuses_allowed_to(users(:users_002))
1696 allowed_statuses = blocking_issue.new_statuses_allowed_to(users(:users_002))
1689 assert !allowed_statuses.empty?
1697 assert !allowed_statuses.empty?
1690 closed_statuses = allowed_statuses.select {|st| st.is_closed?}
1698 closed_statuses = allowed_statuses.select {|st| st.is_closed?}
1691 assert !closed_statuses.empty?
1699 assert !closed_statuses.empty?
1692 end
1700 end
1693
1701
1694 def test_reschedule_an_issue_without_dates
1702 def test_reschedule_an_issue_without_dates
1695 with_settings :non_working_week_days => [] do
1703 with_settings :non_working_week_days => [] do
1696 issue = Issue.new(:start_date => nil, :due_date => nil)
1704 issue = Issue.new(:start_date => nil, :due_date => nil)
1697 issue.reschedule_on '2012-10-09'.to_date
1705 issue.reschedule_on '2012-10-09'.to_date
1698 assert_equal '2012-10-09'.to_date, issue.start_date
1706 assert_equal '2012-10-09'.to_date, issue.start_date
1699 assert_equal '2012-10-09'.to_date, issue.due_date
1707 assert_equal '2012-10-09'.to_date, issue.due_date
1700 end
1708 end
1701
1709
1702 with_settings :non_working_week_days => %w(6 7) do
1710 with_settings :non_working_week_days => %w(6 7) do
1703 issue = Issue.new(:start_date => nil, :due_date => nil)
1711 issue = Issue.new(:start_date => nil, :due_date => nil)
1704 issue.reschedule_on '2012-10-09'.to_date
1712 issue.reschedule_on '2012-10-09'.to_date
1705 assert_equal '2012-10-09'.to_date, issue.start_date
1713 assert_equal '2012-10-09'.to_date, issue.start_date
1706 assert_equal '2012-10-09'.to_date, issue.due_date
1714 assert_equal '2012-10-09'.to_date, issue.due_date
1707
1715
1708 issue = Issue.new(:start_date => nil, :due_date => nil)
1716 issue = Issue.new(:start_date => nil, :due_date => nil)
1709 issue.reschedule_on '2012-10-13'.to_date
1717 issue.reschedule_on '2012-10-13'.to_date
1710 assert_equal '2012-10-15'.to_date, issue.start_date
1718 assert_equal '2012-10-15'.to_date, issue.start_date
1711 assert_equal '2012-10-15'.to_date, issue.due_date
1719 assert_equal '2012-10-15'.to_date, issue.due_date
1712 end
1720 end
1713 end
1721 end
1714
1722
1715 def test_reschedule_an_issue_with_start_date
1723 def test_reschedule_an_issue_with_start_date
1716 with_settings :non_working_week_days => [] do
1724 with_settings :non_working_week_days => [] do
1717 issue = Issue.new(:start_date => '2012-10-09', :due_date => nil)
1725 issue = Issue.new(:start_date => '2012-10-09', :due_date => nil)
1718 issue.reschedule_on '2012-10-13'.to_date
1726 issue.reschedule_on '2012-10-13'.to_date
1719 assert_equal '2012-10-13'.to_date, issue.start_date
1727 assert_equal '2012-10-13'.to_date, issue.start_date
1720 assert_equal '2012-10-13'.to_date, issue.due_date
1728 assert_equal '2012-10-13'.to_date, issue.due_date
1721 end
1729 end
1722
1730
1723 with_settings :non_working_week_days => %w(6 7) do
1731 with_settings :non_working_week_days => %w(6 7) do
1724 issue = Issue.new(:start_date => '2012-10-09', :due_date => nil)
1732 issue = Issue.new(:start_date => '2012-10-09', :due_date => nil)
1725 issue.reschedule_on '2012-10-11'.to_date
1733 issue.reschedule_on '2012-10-11'.to_date
1726 assert_equal '2012-10-11'.to_date, issue.start_date
1734 assert_equal '2012-10-11'.to_date, issue.start_date
1727 assert_equal '2012-10-11'.to_date, issue.due_date
1735 assert_equal '2012-10-11'.to_date, issue.due_date
1728
1736
1729 issue = Issue.new(:start_date => '2012-10-09', :due_date => nil)
1737 issue = Issue.new(:start_date => '2012-10-09', :due_date => nil)
1730 issue.reschedule_on '2012-10-13'.to_date
1738 issue.reschedule_on '2012-10-13'.to_date
1731 assert_equal '2012-10-15'.to_date, issue.start_date
1739 assert_equal '2012-10-15'.to_date, issue.start_date
1732 assert_equal '2012-10-15'.to_date, issue.due_date
1740 assert_equal '2012-10-15'.to_date, issue.due_date
1733 end
1741 end
1734 end
1742 end
1735
1743
1736 def test_reschedule_an_issue_with_start_and_due_dates
1744 def test_reschedule_an_issue_with_start_and_due_dates
1737 with_settings :non_working_week_days => [] do
1745 with_settings :non_working_week_days => [] do
1738 issue = Issue.new(:start_date => '2012-10-09', :due_date => '2012-10-15')
1746 issue = Issue.new(:start_date => '2012-10-09', :due_date => '2012-10-15')
1739 issue.reschedule_on '2012-10-13'.to_date
1747 issue.reschedule_on '2012-10-13'.to_date
1740 assert_equal '2012-10-13'.to_date, issue.start_date
1748 assert_equal '2012-10-13'.to_date, issue.start_date
1741 assert_equal '2012-10-19'.to_date, issue.due_date
1749 assert_equal '2012-10-19'.to_date, issue.due_date
1742 end
1750 end
1743
1751
1744 with_settings :non_working_week_days => %w(6 7) do
1752 with_settings :non_working_week_days => %w(6 7) do
1745 issue = Issue.new(:start_date => '2012-10-09', :due_date => '2012-10-19') # 8 working days
1753 issue = Issue.new(:start_date => '2012-10-09', :due_date => '2012-10-19') # 8 working days
1746 issue.reschedule_on '2012-10-11'.to_date
1754 issue.reschedule_on '2012-10-11'.to_date
1747 assert_equal '2012-10-11'.to_date, issue.start_date
1755 assert_equal '2012-10-11'.to_date, issue.start_date
1748 assert_equal '2012-10-23'.to_date, issue.due_date
1756 assert_equal '2012-10-23'.to_date, issue.due_date
1749
1757
1750 issue = Issue.new(:start_date => '2012-10-09', :due_date => '2012-10-19')
1758 issue = Issue.new(:start_date => '2012-10-09', :due_date => '2012-10-19')
1751 issue.reschedule_on '2012-10-13'.to_date
1759 issue.reschedule_on '2012-10-13'.to_date
1752 assert_equal '2012-10-15'.to_date, issue.start_date
1760 assert_equal '2012-10-15'.to_date, issue.start_date
1753 assert_equal '2012-10-25'.to_date, issue.due_date
1761 assert_equal '2012-10-25'.to_date, issue.due_date
1754 end
1762 end
1755 end
1763 end
1756
1764
1757 def test_rescheduling_an_issue_to_a_later_due_date_should_reschedule_following_issue
1765 def test_rescheduling_an_issue_to_a_later_due_date_should_reschedule_following_issue
1758 issue1 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1766 issue1 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1759 issue2 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1767 issue2 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1760 IssueRelation.create!(:issue_from => issue1, :issue_to => issue2,
1768 IssueRelation.create!(:issue_from => issue1, :issue_to => issue2,
1761 :relation_type => IssueRelation::TYPE_PRECEDES)
1769 :relation_type => IssueRelation::TYPE_PRECEDES)
1762 assert_equal Date.parse('2012-10-18'), issue2.reload.start_date
1770 assert_equal Date.parse('2012-10-18'), issue2.reload.start_date
1763
1771
1764 issue1.reload
1772 issue1.reload
1765 issue1.due_date = '2012-10-23'
1773 issue1.due_date = '2012-10-23'
1766 issue1.save!
1774 issue1.save!
1767 issue2.reload
1775 issue2.reload
1768 assert_equal Date.parse('2012-10-24'), issue2.start_date
1776 assert_equal Date.parse('2012-10-24'), issue2.start_date
1769 assert_equal Date.parse('2012-10-26'), issue2.due_date
1777 assert_equal Date.parse('2012-10-26'), issue2.due_date
1770 end
1778 end
1771
1779
1772 def test_rescheduling_an_issue_to_an_earlier_due_date_should_reschedule_following_issue
1780 def test_rescheduling_an_issue_to_an_earlier_due_date_should_reschedule_following_issue
1773 issue1 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1781 issue1 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1774 issue2 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1782 issue2 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1775 IssueRelation.create!(:issue_from => issue1, :issue_to => issue2,
1783 IssueRelation.create!(:issue_from => issue1, :issue_to => issue2,
1776 :relation_type => IssueRelation::TYPE_PRECEDES)
1784 :relation_type => IssueRelation::TYPE_PRECEDES)
1777 assert_equal Date.parse('2012-10-18'), issue2.reload.start_date
1785 assert_equal Date.parse('2012-10-18'), issue2.reload.start_date
1778
1786
1779 issue1.reload
1787 issue1.reload
1780 issue1.start_date = '2012-09-17'
1788 issue1.start_date = '2012-09-17'
1781 issue1.due_date = '2012-09-18'
1789 issue1.due_date = '2012-09-18'
1782 issue1.save!
1790 issue1.save!
1783 issue2.reload
1791 issue2.reload
1784 assert_equal Date.parse('2012-09-19'), issue2.start_date
1792 assert_equal Date.parse('2012-09-19'), issue2.start_date
1785 assert_equal Date.parse('2012-09-21'), issue2.due_date
1793 assert_equal Date.parse('2012-09-21'), issue2.due_date
1786 end
1794 end
1787
1795
1788 def test_rescheduling_reschedule_following_issue_earlier_should_consider_other_preceding_issues
1796 def test_rescheduling_reschedule_following_issue_earlier_should_consider_other_preceding_issues
1789 issue1 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1797 issue1 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1790 issue2 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1798 issue2 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1791 issue3 = Issue.generate!(:start_date => '2012-10-01', :due_date => '2012-10-02')
1799 issue3 = Issue.generate!(:start_date => '2012-10-01', :due_date => '2012-10-02')
1792 IssueRelation.create!(:issue_from => issue1, :issue_to => issue2,
1800 IssueRelation.create!(:issue_from => issue1, :issue_to => issue2,
1793 :relation_type => IssueRelation::TYPE_PRECEDES)
1801 :relation_type => IssueRelation::TYPE_PRECEDES)
1794 IssueRelation.create!(:issue_from => issue3, :issue_to => issue2,
1802 IssueRelation.create!(:issue_from => issue3, :issue_to => issue2,
1795 :relation_type => IssueRelation::TYPE_PRECEDES)
1803 :relation_type => IssueRelation::TYPE_PRECEDES)
1796 assert_equal Date.parse('2012-10-18'), issue2.reload.start_date
1804 assert_equal Date.parse('2012-10-18'), issue2.reload.start_date
1797
1805
1798 issue1.reload
1806 issue1.reload
1799 issue1.start_date = '2012-09-17'
1807 issue1.start_date = '2012-09-17'
1800 issue1.due_date = '2012-09-18'
1808 issue1.due_date = '2012-09-18'
1801 issue1.save!
1809 issue1.save!
1802 issue2.reload
1810 issue2.reload
1803 # Issue 2 must start after Issue 3
1811 # Issue 2 must start after Issue 3
1804 assert_equal Date.parse('2012-10-03'), issue2.start_date
1812 assert_equal Date.parse('2012-10-03'), issue2.start_date
1805 assert_equal Date.parse('2012-10-05'), issue2.due_date
1813 assert_equal Date.parse('2012-10-05'), issue2.due_date
1806 end
1814 end
1807
1815
1808 def test_rescheduling_a_stale_issue_should_not_raise_an_error
1816 def test_rescheduling_a_stale_issue_should_not_raise_an_error
1809 with_settings :non_working_week_days => [] do
1817 with_settings :non_working_week_days => [] do
1810 stale = Issue.find(1)
1818 stale = Issue.find(1)
1811 issue = Issue.find(1)
1819 issue = Issue.find(1)
1812 issue.subject = "Updated"
1820 issue.subject = "Updated"
1813 issue.save!
1821 issue.save!
1814 date = 10.days.from_now.to_date
1822 date = 10.days.from_now.to_date
1815 assert_nothing_raised do
1823 assert_nothing_raised do
1816 stale.reschedule_on!(date)
1824 stale.reschedule_on!(date)
1817 end
1825 end
1818 assert_equal date, stale.reload.start_date
1826 assert_equal date, stale.reload.start_date
1819 end
1827 end
1820 end
1828 end
1821
1829
1822 def test_child_issue_should_consider_parent_soonest_start_on_create
1830 def test_child_issue_should_consider_parent_soonest_start_on_create
1823 set_language_if_valid 'en'
1831 set_language_if_valid 'en'
1824 issue1 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1832 issue1 = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1825 issue2 = Issue.generate!(:start_date => '2012-10-18', :due_date => '2012-10-20')
1833 issue2 = Issue.generate!(:start_date => '2012-10-18', :due_date => '2012-10-20')
1826 IssueRelation.create!(:issue_from => issue1, :issue_to => issue2,
1834 IssueRelation.create!(:issue_from => issue1, :issue_to => issue2,
1827 :relation_type => IssueRelation::TYPE_PRECEDES)
1835 :relation_type => IssueRelation::TYPE_PRECEDES)
1828 issue1.reload
1836 issue1.reload
1829 issue2.reload
1837 issue2.reload
1830 assert_equal Date.parse('2012-10-18'), issue2.start_date
1838 assert_equal Date.parse('2012-10-18'), issue2.start_date
1831
1839
1832 with_settings :date_format => '%m/%d/%Y' do
1840 with_settings :date_format => '%m/%d/%Y' do
1833 child = Issue.new(:parent_issue_id => issue2.id, :start_date => '2012-10-16',
1841 child = Issue.new(:parent_issue_id => issue2.id, :start_date => '2012-10-16',
1834 :project_id => 1, :tracker_id => 1, :status_id => 1, :subject => 'Child', :author_id => 1)
1842 :project_id => 1, :tracker_id => 1, :status_id => 1, :subject => 'Child', :author_id => 1)
1835 assert !child.valid?
1843 assert !child.valid?
1836 assert_include 'Start date cannot be earlier than 10/18/2012 because of preceding issues', child.errors.full_messages
1844 assert_include 'Start date cannot be earlier than 10/18/2012 because of preceding issues', child.errors.full_messages
1837 assert_equal Date.parse('2012-10-18'), child.soonest_start
1845 assert_equal Date.parse('2012-10-18'), child.soonest_start
1838 child.start_date = '2012-10-18'
1846 child.start_date = '2012-10-18'
1839 assert child.save
1847 assert child.save
1840 end
1848 end
1841 end
1849 end
1842
1850
1843 def test_setting_parent_to_a_dependent_issue_should_not_validate
1851 def test_setting_parent_to_a_dependent_issue_should_not_validate
1844 set_language_if_valid 'en'
1852 set_language_if_valid 'en'
1845 issue1 = Issue.generate!
1853 issue1 = Issue.generate!
1846 issue2 = Issue.generate!
1854 issue2 = Issue.generate!
1847 issue3 = Issue.generate!
1855 issue3 = Issue.generate!
1848 IssueRelation.create!(:issue_from => issue1, :issue_to => issue2, :relation_type => IssueRelation::TYPE_PRECEDES)
1856 IssueRelation.create!(:issue_from => issue1, :issue_to => issue2, :relation_type => IssueRelation::TYPE_PRECEDES)
1849 IssueRelation.create!(:issue_from => issue3, :issue_to => issue1, :relation_type => IssueRelation::TYPE_PRECEDES)
1857 IssueRelation.create!(:issue_from => issue3, :issue_to => issue1, :relation_type => IssueRelation::TYPE_PRECEDES)
1850 issue3.reload
1858 issue3.reload
1851 issue3.parent_issue_id = issue2.id
1859 issue3.parent_issue_id = issue2.id
1852 assert !issue3.valid?
1860 assert !issue3.valid?
1853 assert_include 'Parent task is invalid', issue3.errors.full_messages
1861 assert_include 'Parent task is invalid', issue3.errors.full_messages
1854 end
1862 end
1855
1863
1856 def test_setting_parent_should_not_allow_circular_dependency
1864 def test_setting_parent_should_not_allow_circular_dependency
1857 set_language_if_valid 'en'
1865 set_language_if_valid 'en'
1858 issue1 = Issue.generate!
1866 issue1 = Issue.generate!
1859 issue2 = Issue.generate!
1867 issue2 = Issue.generate!
1860 IssueRelation.create!(:issue_from => issue1, :issue_to => issue2, :relation_type => IssueRelation::TYPE_PRECEDES)
1868 IssueRelation.create!(:issue_from => issue1, :issue_to => issue2, :relation_type => IssueRelation::TYPE_PRECEDES)
1861 issue3 = Issue.generate!
1869 issue3 = Issue.generate!
1862 issue2.reload
1870 issue2.reload
1863 issue2.parent_issue_id = issue3.id
1871 issue2.parent_issue_id = issue3.id
1864 issue2.save!
1872 issue2.save!
1865 issue4 = Issue.generate!
1873 issue4 = Issue.generate!
1866 IssueRelation.create!(:issue_from => issue3, :issue_to => issue4, :relation_type => IssueRelation::TYPE_PRECEDES)
1874 IssueRelation.create!(:issue_from => issue3, :issue_to => issue4, :relation_type => IssueRelation::TYPE_PRECEDES)
1867 issue4.reload
1875 issue4.reload
1868 issue4.parent_issue_id = issue1.id
1876 issue4.parent_issue_id = issue1.id
1869 assert !issue4.valid?
1877 assert !issue4.valid?
1870 assert_include 'Parent task is invalid', issue4.errors.full_messages
1878 assert_include 'Parent task is invalid', issue4.errors.full_messages
1871 end
1879 end
1872
1880
1873 def test_overdue
1881 def test_overdue
1874 assert Issue.new(:due_date => 1.day.ago.to_date).overdue?
1882 assert Issue.new(:due_date => 1.day.ago.to_date).overdue?
1875 assert !Issue.new(:due_date => Date.today).overdue?
1883 assert !Issue.new(:due_date => Date.today).overdue?
1876 assert !Issue.new(:due_date => 1.day.from_now.to_date).overdue?
1884 assert !Issue.new(:due_date => 1.day.from_now.to_date).overdue?
1877 assert !Issue.new(:due_date => nil).overdue?
1885 assert !Issue.new(:due_date => nil).overdue?
1878 assert !Issue.new(:due_date => 1.day.ago.to_date,
1886 assert !Issue.new(:due_date => 1.day.ago.to_date,
1879 :status => IssueStatus.where(:is_closed => true).first
1887 :status => IssueStatus.where(:is_closed => true).first
1880 ).overdue?
1888 ).overdue?
1881 end
1889 end
1882
1890
1883 test "#behind_schedule? should be false if the issue has no start_date" do
1891 test "#behind_schedule? should be false if the issue has no start_date" do
1884 assert !Issue.new(:start_date => nil,
1892 assert !Issue.new(:start_date => nil,
1885 :due_date => 1.day.from_now.to_date,
1893 :due_date => 1.day.from_now.to_date,
1886 :done_ratio => 0).behind_schedule?
1894 :done_ratio => 0).behind_schedule?
1887 end
1895 end
1888
1896
1889 test "#behind_schedule? should be false if the issue has no end_date" do
1897 test "#behind_schedule? should be false if the issue has no end_date" do
1890 assert !Issue.new(:start_date => 1.day.from_now.to_date,
1898 assert !Issue.new(:start_date => 1.day.from_now.to_date,
1891 :due_date => nil,
1899 :due_date => nil,
1892 :done_ratio => 0).behind_schedule?
1900 :done_ratio => 0).behind_schedule?
1893 end
1901 end
1894
1902
1895 test "#behind_schedule? should be false if the issue has more done than it's calendar time" do
1903 test "#behind_schedule? should be false if the issue has more done than it's calendar time" do
1896 assert !Issue.new(:start_date => 50.days.ago.to_date,
1904 assert !Issue.new(:start_date => 50.days.ago.to_date,
1897 :due_date => 50.days.from_now.to_date,
1905 :due_date => 50.days.from_now.to_date,
1898 :done_ratio => 90).behind_schedule?
1906 :done_ratio => 90).behind_schedule?
1899 end
1907 end
1900
1908
1901 test "#behind_schedule? should be true if the issue hasn't been started at all" do
1909 test "#behind_schedule? should be true if the issue hasn't been started at all" do
1902 assert Issue.new(:start_date => 1.day.ago.to_date,
1910 assert Issue.new(:start_date => 1.day.ago.to_date,
1903 :due_date => 1.day.from_now.to_date,
1911 :due_date => 1.day.from_now.to_date,
1904 :done_ratio => 0).behind_schedule?
1912 :done_ratio => 0).behind_schedule?
1905 end
1913 end
1906
1914
1907 test "#behind_schedule? should be true if the issue has used more calendar time than it's done ratio" do
1915 test "#behind_schedule? should be true if the issue has used more calendar time than it's done ratio" do
1908 assert Issue.new(:start_date => 100.days.ago.to_date,
1916 assert Issue.new(:start_date => 100.days.ago.to_date,
1909 :due_date => Date.today,
1917 :due_date => Date.today,
1910 :done_ratio => 90).behind_schedule?
1918 :done_ratio => 90).behind_schedule?
1911 end
1919 end
1912
1920
1913 test "#assignable_users should be Users" do
1921 test "#assignable_users should be Users" do
1914 assert_kind_of User, Issue.find(1).assignable_users.first
1922 assert_kind_of User, Issue.find(1).assignable_users.first
1915 end
1923 end
1916
1924
1917 test "#assignable_users should include the issue author" do
1925 test "#assignable_users should include the issue author" do
1918 non_project_member = User.generate!
1926 non_project_member = User.generate!
1919 issue = Issue.generate!(:author => non_project_member)
1927 issue = Issue.generate!(:author => non_project_member)
1920
1928
1921 assert issue.assignable_users.include?(non_project_member)
1929 assert issue.assignable_users.include?(non_project_member)
1922 end
1930 end
1923
1931
1924 test "#assignable_users should include the current assignee" do
1932 test "#assignable_users should include the current assignee" do
1925 user = User.generate!
1933 user = User.generate!
1926 issue = Issue.generate!(:assigned_to => user)
1934 issue = Issue.generate!(:assigned_to => user)
1927 user.lock!
1935 user.lock!
1928
1936
1929 assert Issue.find(issue.id).assignable_users.include?(user)
1937 assert Issue.find(issue.id).assignable_users.include?(user)
1930 end
1938 end
1931
1939
1932 test "#assignable_users should not show the issue author twice" do
1940 test "#assignable_users should not show the issue author twice" do
1933 assignable_user_ids = Issue.find(1).assignable_users.collect(&:id)
1941 assignable_user_ids = Issue.find(1).assignable_users.collect(&:id)
1934 assert_equal 2, assignable_user_ids.length
1942 assert_equal 2, assignable_user_ids.length
1935
1943
1936 assignable_user_ids.each do |user_id|
1944 assignable_user_ids.each do |user_id|
1937 assert_equal 1, assignable_user_ids.select {|i| i == user_id}.length,
1945 assert_equal 1, assignable_user_ids.select {|i| i == user_id}.length,
1938 "User #{user_id} appears more or less than once"
1946 "User #{user_id} appears more or less than once"
1939 end
1947 end
1940 end
1948 end
1941
1949
1942 test "#assignable_users with issue_group_assignment should include groups" do
1950 test "#assignable_users with issue_group_assignment should include groups" do
1943 issue = Issue.new(:project => Project.find(2))
1951 issue = Issue.new(:project => Project.find(2))
1944
1952
1945 with_settings :issue_group_assignment => '1' do
1953 with_settings :issue_group_assignment => '1' do
1946 assert_equal %w(Group User), issue.assignable_users.map {|a| a.class.name}.uniq.sort
1954 assert_equal %w(Group User), issue.assignable_users.map {|a| a.class.name}.uniq.sort
1947 assert issue.assignable_users.include?(Group.find(11))
1955 assert issue.assignable_users.include?(Group.find(11))
1948 end
1956 end
1949 end
1957 end
1950
1958
1951 test "#assignable_users without issue_group_assignment should not include groups" do
1959 test "#assignable_users without issue_group_assignment should not include groups" do
1952 issue = Issue.new(:project => Project.find(2))
1960 issue = Issue.new(:project => Project.find(2))
1953
1961
1954 with_settings :issue_group_assignment => '0' do
1962 with_settings :issue_group_assignment => '0' do
1955 assert_equal %w(User), issue.assignable_users.map {|a| a.class.name}.uniq.sort
1963 assert_equal %w(User), issue.assignable_users.map {|a| a.class.name}.uniq.sort
1956 assert !issue.assignable_users.include?(Group.find(11))
1964 assert !issue.assignable_users.include?(Group.find(11))
1957 end
1965 end
1958 end
1966 end
1959
1967
1960 def test_assignable_users_should_not_include_builtin_groups
1968 def test_assignable_users_should_not_include_builtin_groups
1961 Member.create!(:project_id => 1, :principal => Group.non_member, :role_ids => [1])
1969 Member.create!(:project_id => 1, :principal => Group.non_member, :role_ids => [1])
1962 Member.create!(:project_id => 1, :principal => Group.anonymous, :role_ids => [1])
1970 Member.create!(:project_id => 1, :principal => Group.anonymous, :role_ids => [1])
1963 issue = Issue.new(:project => Project.find(1))
1971 issue = Issue.new(:project => Project.find(1))
1964
1972
1965 with_settings :issue_group_assignment => '1' do
1973 with_settings :issue_group_assignment => '1' do
1966 assert_nil issue.assignable_users.detect {|u| u.is_a?(GroupBuiltin)}
1974 assert_nil issue.assignable_users.detect {|u| u.is_a?(GroupBuiltin)}
1967 end
1975 end
1968 end
1976 end
1969
1977
1970 def test_create_should_send_email_notification
1978 def test_create_should_send_email_notification
1971 ActionMailer::Base.deliveries.clear
1979 ActionMailer::Base.deliveries.clear
1972 issue = Issue.new(:project_id => 1, :tracker_id => 1,
1980 issue = Issue.new(:project_id => 1, :tracker_id => 1,
1973 :author_id => 3, :status_id => 1,
1981 :author_id => 3, :status_id => 1,
1974 :priority => IssuePriority.all.first,
1982 :priority => IssuePriority.all.first,
1975 :subject => 'test_create', :estimated_hours => '1:30')
1983 :subject => 'test_create', :estimated_hours => '1:30')
1976 with_settings :notified_events => %w(issue_added) do
1984 with_settings :notified_events => %w(issue_added) do
1977 assert issue.save
1985 assert issue.save
1978 assert_equal 1, ActionMailer::Base.deliveries.size
1986 assert_equal 1, ActionMailer::Base.deliveries.size
1979 end
1987 end
1980 end
1988 end
1981
1989
1982 def test_create_should_send_one_email_notification_with_both_settings
1990 def test_create_should_send_one_email_notification_with_both_settings
1983 ActionMailer::Base.deliveries.clear
1991 ActionMailer::Base.deliveries.clear
1984 issue = Issue.new(:project_id => 1, :tracker_id => 1,
1992 issue = Issue.new(:project_id => 1, :tracker_id => 1,
1985 :author_id => 3, :status_id => 1,
1993 :author_id => 3, :status_id => 1,
1986 :priority => IssuePriority.all.first,
1994 :priority => IssuePriority.all.first,
1987 :subject => 'test_create', :estimated_hours => '1:30')
1995 :subject => 'test_create', :estimated_hours => '1:30')
1988 with_settings :notified_events => %w(issue_added issue_updated) do
1996 with_settings :notified_events => %w(issue_added issue_updated) do
1989 assert issue.save
1997 assert issue.save
1990 assert_equal 1, ActionMailer::Base.deliveries.size
1998 assert_equal 1, ActionMailer::Base.deliveries.size
1991 end
1999 end
1992 end
2000 end
1993
2001
1994 def test_create_should_not_send_email_notification_with_no_setting
2002 def test_create_should_not_send_email_notification_with_no_setting
1995 ActionMailer::Base.deliveries.clear
2003 ActionMailer::Base.deliveries.clear
1996 issue = Issue.new(:project_id => 1, :tracker_id => 1,
2004 issue = Issue.new(:project_id => 1, :tracker_id => 1,
1997 :author_id => 3, :status_id => 1,
2005 :author_id => 3, :status_id => 1,
1998 :priority => IssuePriority.all.first,
2006 :priority => IssuePriority.all.first,
1999 :subject => 'test_create', :estimated_hours => '1:30')
2007 :subject => 'test_create', :estimated_hours => '1:30')
2000 with_settings :notified_events => [] do
2008 with_settings :notified_events => [] do
2001 assert issue.save
2009 assert issue.save
2002 assert_equal 0, ActionMailer::Base.deliveries.size
2010 assert_equal 0, ActionMailer::Base.deliveries.size
2003 end
2011 end
2004 end
2012 end
2005
2013
2006 def test_update_should_notify_previous_assignee
2014 def test_update_should_notify_previous_assignee
2007 ActionMailer::Base.deliveries.clear
2015 ActionMailer::Base.deliveries.clear
2008 user = User.find(3)
2016 user = User.find(3)
2009 user.members.update_all ["mail_notification = ?", false]
2017 user.members.update_all ["mail_notification = ?", false]
2010 user.update_attribute :mail_notification, 'only_assigned'
2018 user.update_attribute :mail_notification, 'only_assigned'
2011
2019
2012 with_settings :notified_events => %w(issue_updated) do
2020 with_settings :notified_events => %w(issue_updated) do
2013 issue = Issue.find(2)
2021 issue = Issue.find(2)
2014 issue.init_journal User.find(1)
2022 issue.init_journal User.find(1)
2015 issue.assigned_to = nil
2023 issue.assigned_to = nil
2016 issue.save!
2024 issue.save!
2017 assert_include user.mail, ActionMailer::Base.deliveries.last.bcc
2025 assert_include user.mail, ActionMailer::Base.deliveries.last.bcc
2018 end
2026 end
2019 end
2027 end
2020
2028
2021 def test_stale_issue_should_not_send_email_notification
2029 def test_stale_issue_should_not_send_email_notification
2022 ActionMailer::Base.deliveries.clear
2030 ActionMailer::Base.deliveries.clear
2023 issue = Issue.find(1)
2031 issue = Issue.find(1)
2024 stale = Issue.find(1)
2032 stale = Issue.find(1)
2025
2033
2026 issue.init_journal(User.find(1))
2034 issue.init_journal(User.find(1))
2027 issue.subject = 'Subjet update'
2035 issue.subject = 'Subjet update'
2028 with_settings :notified_events => %w(issue_updated) do
2036 with_settings :notified_events => %w(issue_updated) do
2029 assert issue.save
2037 assert issue.save
2030 assert_equal 1, ActionMailer::Base.deliveries.size
2038 assert_equal 1, ActionMailer::Base.deliveries.size
2031 ActionMailer::Base.deliveries.clear
2039 ActionMailer::Base.deliveries.clear
2032
2040
2033 stale.init_journal(User.find(1))
2041 stale.init_journal(User.find(1))
2034 stale.subject = 'Another subjet update'
2042 stale.subject = 'Another subjet update'
2035 assert_raise ActiveRecord::StaleObjectError do
2043 assert_raise ActiveRecord::StaleObjectError do
2036 stale.save
2044 stale.save
2037 end
2045 end
2038 assert ActionMailer::Base.deliveries.empty?
2046 assert ActionMailer::Base.deliveries.empty?
2039 end
2047 end
2040 end
2048 end
2041
2049
2042 def test_journalized_description
2050 def test_journalized_description
2043 IssueCustomField.delete_all
2051 IssueCustomField.delete_all
2044
2052
2045 i = Issue.first
2053 i = Issue.first
2046 old_description = i.description
2054 old_description = i.description
2047 new_description = "This is the new description"
2055 new_description = "This is the new description"
2048
2056
2049 i.init_journal(User.find(2))
2057 i.init_journal(User.find(2))
2050 i.description = new_description
2058 i.description = new_description
2051 assert_difference 'Journal.count', 1 do
2059 assert_difference 'Journal.count', 1 do
2052 assert_difference 'JournalDetail.count', 1 do
2060 assert_difference 'JournalDetail.count', 1 do
2053 i.save!
2061 i.save!
2054 end
2062 end
2055 end
2063 end
2056
2064
2057 detail = JournalDetail.order('id DESC').first
2065 detail = JournalDetail.order('id DESC').first
2058 assert_equal i, detail.journal.journalized
2066 assert_equal i, detail.journal.journalized
2059 assert_equal 'attr', detail.property
2067 assert_equal 'attr', detail.property
2060 assert_equal 'description', detail.prop_key
2068 assert_equal 'description', detail.prop_key
2061 assert_equal old_description, detail.old_value
2069 assert_equal old_description, detail.old_value
2062 assert_equal new_description, detail.value
2070 assert_equal new_description, detail.value
2063 end
2071 end
2064
2072
2065 def test_blank_descriptions_should_not_be_journalized
2073 def test_blank_descriptions_should_not_be_journalized
2066 IssueCustomField.delete_all
2074 IssueCustomField.delete_all
2067 Issue.where(:id => 1).update_all("description = NULL")
2075 Issue.where(:id => 1).update_all("description = NULL")
2068
2076
2069 i = Issue.find(1)
2077 i = Issue.find(1)
2070 i.init_journal(User.find(2))
2078 i.init_journal(User.find(2))
2071 i.subject = "blank description"
2079 i.subject = "blank description"
2072 i.description = "\r\n"
2080 i.description = "\r\n"
2073
2081
2074 assert_difference 'Journal.count', 1 do
2082 assert_difference 'Journal.count', 1 do
2075 assert_difference 'JournalDetail.count', 1 do
2083 assert_difference 'JournalDetail.count', 1 do
2076 i.save!
2084 i.save!
2077 end
2085 end
2078 end
2086 end
2079 end
2087 end
2080
2088
2081 def test_journalized_multi_custom_field
2089 def test_journalized_multi_custom_field
2082 field = IssueCustomField.create!(:name => 'filter', :field_format => 'list',
2090 field = IssueCustomField.create!(:name => 'filter', :field_format => 'list',
2083 :is_filter => true, :is_for_all => true,
2091 :is_filter => true, :is_for_all => true,
2084 :tracker_ids => [1],
2092 :tracker_ids => [1],
2085 :possible_values => ['value1', 'value2', 'value3'],
2093 :possible_values => ['value1', 'value2', 'value3'],
2086 :multiple => true)
2094 :multiple => true)
2087
2095
2088 issue = Issue.create!(:project_id => 1, :tracker_id => 1,
2096 issue = Issue.create!(:project_id => 1, :tracker_id => 1,
2089 :subject => 'Test', :author_id => 1)
2097 :subject => 'Test', :author_id => 1)
2090
2098
2091 assert_difference 'Journal.count' do
2099 assert_difference 'Journal.count' do
2092 assert_difference 'JournalDetail.count' do
2100 assert_difference 'JournalDetail.count' do
2093 issue.init_journal(User.first)
2101 issue.init_journal(User.first)
2094 issue.custom_field_values = {field.id => ['value1']}
2102 issue.custom_field_values = {field.id => ['value1']}
2095 issue.save!
2103 issue.save!
2096 end
2104 end
2097 assert_difference 'JournalDetail.count' do
2105 assert_difference 'JournalDetail.count' do
2098 issue.init_journal(User.first)
2106 issue.init_journal(User.first)
2099 issue.custom_field_values = {field.id => ['value1', 'value2']}
2107 issue.custom_field_values = {field.id => ['value1', 'value2']}
2100 issue.save!
2108 issue.save!
2101 end
2109 end
2102 assert_difference 'JournalDetail.count', 2 do
2110 assert_difference 'JournalDetail.count', 2 do
2103 issue.init_journal(User.first)
2111 issue.init_journal(User.first)
2104 issue.custom_field_values = {field.id => ['value3', 'value2']}
2112 issue.custom_field_values = {field.id => ['value3', 'value2']}
2105 issue.save!
2113 issue.save!
2106 end
2114 end
2107 assert_difference 'JournalDetail.count', 2 do
2115 assert_difference 'JournalDetail.count', 2 do
2108 issue.init_journal(User.first)
2116 issue.init_journal(User.first)
2109 issue.custom_field_values = {field.id => nil}
2117 issue.custom_field_values = {field.id => nil}
2110 issue.save!
2118 issue.save!
2111 end
2119 end
2112 end
2120 end
2113 end
2121 end
2114
2122
2115 def test_description_eol_should_be_normalized
2123 def test_description_eol_should_be_normalized
2116 i = Issue.new(:description => "CR \r LF \n CRLF \r\n")
2124 i = Issue.new(:description => "CR \r LF \n CRLF \r\n")
2117 assert_equal "CR \r\n LF \r\n CRLF \r\n", i.description
2125 assert_equal "CR \r\n LF \r\n CRLF \r\n", i.description
2118 end
2126 end
2119
2127
2120 def test_saving_twice_should_not_duplicate_journal_details
2128 def test_saving_twice_should_not_duplicate_journal_details
2121 i = Issue.first
2129 i = Issue.first
2122 i.init_journal(User.find(2), 'Some notes')
2130 i.init_journal(User.find(2), 'Some notes')
2123 # initial changes
2131 # initial changes
2124 i.subject = 'New subject'
2132 i.subject = 'New subject'
2125 i.done_ratio = i.done_ratio + 10
2133 i.done_ratio = i.done_ratio + 10
2126 assert_difference 'Journal.count' do
2134 assert_difference 'Journal.count' do
2127 assert i.save
2135 assert i.save
2128 end
2136 end
2129 # 1 more change
2137 # 1 more change
2130 i.priority = IssuePriority.where("id <> ?", i.priority_id).first
2138 i.priority = IssuePriority.where("id <> ?", i.priority_id).first
2131 assert_no_difference 'Journal.count' do
2139 assert_no_difference 'Journal.count' do
2132 assert_difference 'JournalDetail.count', 1 do
2140 assert_difference 'JournalDetail.count', 1 do
2133 i.save
2141 i.save
2134 end
2142 end
2135 end
2143 end
2136 # no more change
2144 # no more change
2137 assert_no_difference 'Journal.count' do
2145 assert_no_difference 'Journal.count' do
2138 assert_no_difference 'JournalDetail.count' do
2146 assert_no_difference 'JournalDetail.count' do
2139 i.save
2147 i.save
2140 end
2148 end
2141 end
2149 end
2142 end
2150 end
2143
2151
2144 def test_all_dependent_issues
2152 def test_all_dependent_issues
2145 IssueRelation.delete_all
2153 IssueRelation.delete_all
2146 assert IssueRelation.create!(:issue_from => Issue.find(1),
2154 assert IssueRelation.create!(:issue_from => Issue.find(1),
2147 :issue_to => Issue.find(2),
2155 :issue_to => Issue.find(2),
2148 :relation_type => IssueRelation::TYPE_PRECEDES)
2156 :relation_type => IssueRelation::TYPE_PRECEDES)
2149 assert IssueRelation.create!(:issue_from => Issue.find(2),
2157 assert IssueRelation.create!(:issue_from => Issue.find(2),
2150 :issue_to => Issue.find(3),
2158 :issue_to => Issue.find(3),
2151 :relation_type => IssueRelation::TYPE_PRECEDES)
2159 :relation_type => IssueRelation::TYPE_PRECEDES)
2152 assert IssueRelation.create!(:issue_from => Issue.find(3),
2160 assert IssueRelation.create!(:issue_from => Issue.find(3),
2153 :issue_to => Issue.find(8),
2161 :issue_to => Issue.find(8),
2154 :relation_type => IssueRelation::TYPE_PRECEDES)
2162 :relation_type => IssueRelation::TYPE_PRECEDES)
2155
2163
2156 assert_equal [2, 3, 8], Issue.find(1).all_dependent_issues.collect(&:id).sort
2164 assert_equal [2, 3, 8], Issue.find(1).all_dependent_issues.collect(&:id).sort
2157 end
2165 end
2158
2166
2159 def test_all_dependent_issues_with_subtask
2167 def test_all_dependent_issues_with_subtask
2160 IssueRelation.delete_all
2168 IssueRelation.delete_all
2161
2169
2162 project = Project.generate!(:name => "testproject")
2170 project = Project.generate!(:name => "testproject")
2163
2171
2164 parentIssue = Issue.generate!(:project => project)
2172 parentIssue = Issue.generate!(:project => project)
2165 childIssue1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue.id)
2173 childIssue1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue.id)
2166 childIssue2 = Issue.generate!(:project => project, :parent_issue_id => parentIssue.id)
2174 childIssue2 = Issue.generate!(:project => project, :parent_issue_id => parentIssue.id)
2167
2175
2168 assert_equal [childIssue1.id, childIssue2.id].sort, parentIssue.all_dependent_issues.collect(&:id).uniq.sort
2176 assert_equal [childIssue1.id, childIssue2.id].sort, parentIssue.all_dependent_issues.collect(&:id).uniq.sort
2169 end
2177 end
2170
2178
2171 def test_all_dependent_issues_does_not_include_self
2179 def test_all_dependent_issues_does_not_include_self
2172 IssueRelation.delete_all
2180 IssueRelation.delete_all
2173
2181
2174 project = Project.generate!(:name => "testproject")
2182 project = Project.generate!(:name => "testproject")
2175
2183
2176 parentIssue = Issue.generate!(:project => project)
2184 parentIssue = Issue.generate!(:project => project)
2177 childIssue = Issue.generate!(:project => project, :parent_issue_id => parentIssue.id)
2185 childIssue = Issue.generate!(:project => project, :parent_issue_id => parentIssue.id)
2178
2186
2179 assert_equal [childIssue.id], parentIssue.all_dependent_issues.collect(&:id)
2187 assert_equal [childIssue.id], parentIssue.all_dependent_issues.collect(&:id)
2180 end
2188 end
2181
2189
2182 def test_all_dependent_issues_with_parenttask_and_sibling
2190 def test_all_dependent_issues_with_parenttask_and_sibling
2183 IssueRelation.delete_all
2191 IssueRelation.delete_all
2184
2192
2185 project = Project.generate!(:name => "testproject")
2193 project = Project.generate!(:name => "testproject")
2186
2194
2187 parentIssue = Issue.generate!(:project => project)
2195 parentIssue = Issue.generate!(:project => project)
2188 childIssue1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue.id)
2196 childIssue1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue.id)
2189 childIssue2 = Issue.generate!(:project => project, :parent_issue_id => parentIssue.id)
2197 childIssue2 = Issue.generate!(:project => project, :parent_issue_id => parentIssue.id)
2190
2198
2191 assert_equal [parentIssue.id].sort, childIssue1.all_dependent_issues.collect(&:id)
2199 assert_equal [parentIssue.id].sort, childIssue1.all_dependent_issues.collect(&:id)
2192 end
2200 end
2193
2201
2194 def test_all_dependent_issues_with_relation_to_leaf_in_other_tree
2202 def test_all_dependent_issues_with_relation_to_leaf_in_other_tree
2195 IssueRelation.delete_all
2203 IssueRelation.delete_all
2196
2204
2197 project = Project.generate!(:name => "testproject")
2205 project = Project.generate!(:name => "testproject")
2198
2206
2199 parentIssue1 = Issue.generate!(:project => project)
2207 parentIssue1 = Issue.generate!(:project => project)
2200 childIssue1_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue1.id)
2208 childIssue1_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue1.id)
2201 childIssue1_2 = Issue.generate!(:project => project, :parent_issue_id => parentIssue1.id)
2209 childIssue1_2 = Issue.generate!(:project => project, :parent_issue_id => parentIssue1.id)
2202
2210
2203 parentIssue2 = Issue.generate!(:project => project)
2211 parentIssue2 = Issue.generate!(:project => project)
2204 childIssue2_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue2.id)
2212 childIssue2_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue2.id)
2205 childIssue2_2 = Issue.generate!(:project => project, :parent_issue_id => parentIssue2.id)
2213 childIssue2_2 = Issue.generate!(:project => project, :parent_issue_id => parentIssue2.id)
2206
2214
2207
2215
2208 assert IssueRelation.create(:issue_from => parentIssue1,
2216 assert IssueRelation.create(:issue_from => parentIssue1,
2209 :issue_to => childIssue2_2,
2217 :issue_to => childIssue2_2,
2210 :relation_type => IssueRelation::TYPE_BLOCKS)
2218 :relation_type => IssueRelation::TYPE_BLOCKS)
2211
2219
2212 assert_equal [childIssue1_1.id, childIssue1_2.id, parentIssue2.id, childIssue2_2.id].sort,
2220 assert_equal [childIssue1_1.id, childIssue1_2.id, parentIssue2.id, childIssue2_2.id].sort,
2213 parentIssue1.all_dependent_issues.collect(&:id).uniq.sort
2221 parentIssue1.all_dependent_issues.collect(&:id).uniq.sort
2214 end
2222 end
2215
2223
2216 def test_all_dependent_issues_with_relation_to_parent_in_other_tree
2224 def test_all_dependent_issues_with_relation_to_parent_in_other_tree
2217 IssueRelation.delete_all
2225 IssueRelation.delete_all
2218
2226
2219 project = Project.generate!(:name => "testproject")
2227 project = Project.generate!(:name => "testproject")
2220
2228
2221 parentIssue1 = Issue.generate!(:project => project)
2229 parentIssue1 = Issue.generate!(:project => project)
2222 childIssue1_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue1.id)
2230 childIssue1_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue1.id)
2223 childIssue1_2 = Issue.generate!(:project => project, :parent_issue_id => parentIssue1.id)
2231 childIssue1_2 = Issue.generate!(:project => project, :parent_issue_id => parentIssue1.id)
2224
2232
2225 parentIssue2 = Issue.generate!(:project => project)
2233 parentIssue2 = Issue.generate!(:project => project)
2226 childIssue2_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue2.id)
2234 childIssue2_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue2.id)
2227 childIssue2_2 = Issue.generate!(:project => project, :parent_issue_id => parentIssue2.id)
2235 childIssue2_2 = Issue.generate!(:project => project, :parent_issue_id => parentIssue2.id)
2228
2236
2229
2237
2230 assert IssueRelation.create(:issue_from => parentIssue1,
2238 assert IssueRelation.create(:issue_from => parentIssue1,
2231 :issue_to => parentIssue2,
2239 :issue_to => parentIssue2,
2232 :relation_type => IssueRelation::TYPE_BLOCKS)
2240 :relation_type => IssueRelation::TYPE_BLOCKS)
2233
2241
2234 assert_equal [childIssue1_1.id, childIssue1_2.id, parentIssue2.id, childIssue2_1.id, childIssue2_2.id].sort,
2242 assert_equal [childIssue1_1.id, childIssue1_2.id, parentIssue2.id, childIssue2_1.id, childIssue2_2.id].sort,
2235 parentIssue1.all_dependent_issues.collect(&:id).uniq.sort
2243 parentIssue1.all_dependent_issues.collect(&:id).uniq.sort
2236 end
2244 end
2237
2245
2238 def test_all_dependent_issues_with_transitive_relation
2246 def test_all_dependent_issues_with_transitive_relation
2239 IssueRelation.delete_all
2247 IssueRelation.delete_all
2240
2248
2241 project = Project.generate!(:name => "testproject")
2249 project = Project.generate!(:name => "testproject")
2242
2250
2243 parentIssue1 = Issue.generate!(:project => project)
2251 parentIssue1 = Issue.generate!(:project => project)
2244 childIssue1_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue1.id)
2252 childIssue1_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue1.id)
2245
2253
2246 parentIssue2 = Issue.generate!(:project => project)
2254 parentIssue2 = Issue.generate!(:project => project)
2247 childIssue2_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue2.id)
2255 childIssue2_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue2.id)
2248
2256
2249 independentIssue = Issue.generate!(:project => project)
2257 independentIssue = Issue.generate!(:project => project)
2250
2258
2251 assert IssueRelation.create(:issue_from => parentIssue1,
2259 assert IssueRelation.create(:issue_from => parentIssue1,
2252 :issue_to => childIssue2_1,
2260 :issue_to => childIssue2_1,
2253 :relation_type => IssueRelation::TYPE_RELATES)
2261 :relation_type => IssueRelation::TYPE_RELATES)
2254
2262
2255 assert IssueRelation.create(:issue_from => childIssue2_1,
2263 assert IssueRelation.create(:issue_from => childIssue2_1,
2256 :issue_to => independentIssue,
2264 :issue_to => independentIssue,
2257 :relation_type => IssueRelation::TYPE_RELATES)
2265 :relation_type => IssueRelation::TYPE_RELATES)
2258
2266
2259 assert_equal [childIssue1_1.id, parentIssue2.id, childIssue2_1.id, independentIssue.id].sort,
2267 assert_equal [childIssue1_1.id, parentIssue2.id, childIssue2_1.id, independentIssue.id].sort,
2260 parentIssue1.all_dependent_issues.collect(&:id).uniq.sort
2268 parentIssue1.all_dependent_issues.collect(&:id).uniq.sort
2261 end
2269 end
2262
2270
2263 def test_all_dependent_issues_with_transitive_relation2
2271 def test_all_dependent_issues_with_transitive_relation2
2264 IssueRelation.delete_all
2272 IssueRelation.delete_all
2265
2273
2266 project = Project.generate!(:name => "testproject")
2274 project = Project.generate!(:name => "testproject")
2267
2275
2268 parentIssue1 = Issue.generate!(:project => project)
2276 parentIssue1 = Issue.generate!(:project => project)
2269 childIssue1_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue1.id)
2277 childIssue1_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue1.id)
2270
2278
2271 parentIssue2 = Issue.generate!(:project => project)
2279 parentIssue2 = Issue.generate!(:project => project)
2272 childIssue2_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue2.id)
2280 childIssue2_1 = Issue.generate!(:project => project, :parent_issue_id => parentIssue2.id)
2273
2281
2274 independentIssue = Issue.generate!(:project => project)
2282 independentIssue = Issue.generate!(:project => project)
2275
2283
2276 assert IssueRelation.create(:issue_from => parentIssue1,
2284 assert IssueRelation.create(:issue_from => parentIssue1,
2277 :issue_to => independentIssue,
2285 :issue_to => independentIssue,
2278 :relation_type => IssueRelation::TYPE_RELATES)
2286 :relation_type => IssueRelation::TYPE_RELATES)
2279
2287
2280 assert IssueRelation.create(:issue_from => independentIssue,
2288 assert IssueRelation.create(:issue_from => independentIssue,
2281 :issue_to => childIssue2_1,
2289 :issue_to => childIssue2_1,
2282 :relation_type => IssueRelation::TYPE_RELATES)
2290 :relation_type => IssueRelation::TYPE_RELATES)
2283
2291
2284 assert_equal [childIssue1_1.id, parentIssue2.id, childIssue2_1.id, independentIssue.id].sort,
2292 assert_equal [childIssue1_1.id, parentIssue2.id, childIssue2_1.id, independentIssue.id].sort,
2285 parentIssue1.all_dependent_issues.collect(&:id).uniq.sort
2293 parentIssue1.all_dependent_issues.collect(&:id).uniq.sort
2286
2294
2287 end
2295 end
2288
2296
2289 def test_all_dependent_issues_with_persistent_circular_dependency
2297 def test_all_dependent_issues_with_persistent_circular_dependency
2290 IssueRelation.delete_all
2298 IssueRelation.delete_all
2291 assert IssueRelation.create!(:issue_from => Issue.find(1),
2299 assert IssueRelation.create!(:issue_from => Issue.find(1),
2292 :issue_to => Issue.find(2),
2300 :issue_to => Issue.find(2),
2293 :relation_type => IssueRelation::TYPE_PRECEDES)
2301 :relation_type => IssueRelation::TYPE_PRECEDES)
2294 assert IssueRelation.create!(:issue_from => Issue.find(2),
2302 assert IssueRelation.create!(:issue_from => Issue.find(2),
2295 :issue_to => Issue.find(3),
2303 :issue_to => Issue.find(3),
2296 :relation_type => IssueRelation::TYPE_PRECEDES)
2304 :relation_type => IssueRelation::TYPE_PRECEDES)
2297
2305
2298 r = IssueRelation.create!(:issue_from => Issue.find(3),
2306 r = IssueRelation.create!(:issue_from => Issue.find(3),
2299 :issue_to => Issue.find(7),
2307 :issue_to => Issue.find(7),
2300 :relation_type => IssueRelation::TYPE_PRECEDES)
2308 :relation_type => IssueRelation::TYPE_PRECEDES)
2301 IssueRelation.where(["id = ?", r.id]).update_all("issue_to_id = 1")
2309 IssueRelation.where(["id = ?", r.id]).update_all("issue_to_id = 1")
2302
2310
2303 assert_equal [2, 3], Issue.find(1).all_dependent_issues.collect(&:id).sort
2311 assert_equal [2, 3], Issue.find(1).all_dependent_issues.collect(&:id).sort
2304 end
2312 end
2305
2313
2306 def test_all_dependent_issues_with_persistent_multiple_circular_dependencies
2314 def test_all_dependent_issues_with_persistent_multiple_circular_dependencies
2307 IssueRelation.delete_all
2315 IssueRelation.delete_all
2308 assert IssueRelation.create!(:issue_from => Issue.find(1),
2316 assert IssueRelation.create!(:issue_from => Issue.find(1),
2309 :issue_to => Issue.find(2),
2317 :issue_to => Issue.find(2),
2310 :relation_type => IssueRelation::TYPE_RELATES)
2318 :relation_type => IssueRelation::TYPE_RELATES)
2311 assert IssueRelation.create!(:issue_from => Issue.find(2),
2319 assert IssueRelation.create!(:issue_from => Issue.find(2),
2312 :issue_to => Issue.find(3),
2320 :issue_to => Issue.find(3),
2313 :relation_type => IssueRelation::TYPE_RELATES)
2321 :relation_type => IssueRelation::TYPE_RELATES)
2314 assert IssueRelation.create!(:issue_from => Issue.find(3),
2322 assert IssueRelation.create!(:issue_from => Issue.find(3),
2315 :issue_to => Issue.find(8),
2323 :issue_to => Issue.find(8),
2316 :relation_type => IssueRelation::TYPE_RELATES)
2324 :relation_type => IssueRelation::TYPE_RELATES)
2317
2325
2318 r = IssueRelation.create!(:issue_from => Issue.find(8),
2326 r = IssueRelation.create!(:issue_from => Issue.find(8),
2319 :issue_to => Issue.find(7),
2327 :issue_to => Issue.find(7),
2320 :relation_type => IssueRelation::TYPE_RELATES)
2328 :relation_type => IssueRelation::TYPE_RELATES)
2321 IssueRelation.where(["id = ?", r.id]).update_all("issue_to_id = 2")
2329 IssueRelation.where(["id = ?", r.id]).update_all("issue_to_id = 2")
2322
2330
2323 r = IssueRelation.create!(:issue_from => Issue.find(3),
2331 r = IssueRelation.create!(:issue_from => Issue.find(3),
2324 :issue_to => Issue.find(7),
2332 :issue_to => Issue.find(7),
2325 :relation_type => IssueRelation::TYPE_RELATES)
2333 :relation_type => IssueRelation::TYPE_RELATES)
2326 IssueRelation.where(["id = ?", r.id]).update_all("issue_to_id = 1")
2334 IssueRelation.where(["id = ?", r.id]).update_all("issue_to_id = 1")
2327
2335
2328 assert_equal [2, 3, 8], Issue.find(1).all_dependent_issues.collect(&:id).sort
2336 assert_equal [2, 3, 8], Issue.find(1).all_dependent_issues.collect(&:id).sort
2329 end
2337 end
2330
2338
2331 test "#done_ratio should use the issue_status according to Setting.issue_done_ratio" do
2339 test "#done_ratio should use the issue_status according to Setting.issue_done_ratio" do
2332 @issue = Issue.find(1)
2340 @issue = Issue.find(1)
2333 @issue_status = IssueStatus.find(1)
2341 @issue_status = IssueStatus.find(1)
2334 @issue_status.update_attribute(:default_done_ratio, 50)
2342 @issue_status.update_attribute(:default_done_ratio, 50)
2335 @issue2 = Issue.find(2)
2343 @issue2 = Issue.find(2)
2336 @issue_status2 = IssueStatus.find(2)
2344 @issue_status2 = IssueStatus.find(2)
2337 @issue_status2.update_attribute(:default_done_ratio, 0)
2345 @issue_status2.update_attribute(:default_done_ratio, 0)
2338
2346
2339 with_settings :issue_done_ratio => 'issue_field' do
2347 with_settings :issue_done_ratio => 'issue_field' do
2340 assert_equal 0, @issue.done_ratio
2348 assert_equal 0, @issue.done_ratio
2341 assert_equal 30, @issue2.done_ratio
2349 assert_equal 30, @issue2.done_ratio
2342 end
2350 end
2343
2351
2344 with_settings :issue_done_ratio => 'issue_status' do
2352 with_settings :issue_done_ratio => 'issue_status' do
2345 assert_equal 50, @issue.done_ratio
2353 assert_equal 50, @issue.done_ratio
2346 assert_equal 0, @issue2.done_ratio
2354 assert_equal 0, @issue2.done_ratio
2347 end
2355 end
2348 end
2356 end
2349
2357
2350 test "#update_done_ratio_from_issue_status should update done_ratio according to Setting.issue_done_ratio" do
2358 test "#update_done_ratio_from_issue_status should update done_ratio according to Setting.issue_done_ratio" do
2351 @issue = Issue.find(1)
2359 @issue = Issue.find(1)
2352 @issue_status = IssueStatus.find(1)
2360 @issue_status = IssueStatus.find(1)
2353 @issue_status.update_attribute(:default_done_ratio, 50)
2361 @issue_status.update_attribute(:default_done_ratio, 50)
2354 @issue2 = Issue.find(2)
2362 @issue2 = Issue.find(2)
2355 @issue_status2 = IssueStatus.find(2)
2363 @issue_status2 = IssueStatus.find(2)
2356 @issue_status2.update_attribute(:default_done_ratio, 0)
2364 @issue_status2.update_attribute(:default_done_ratio, 0)
2357
2365
2358 with_settings :issue_done_ratio => 'issue_field' do
2366 with_settings :issue_done_ratio => 'issue_field' do
2359 @issue.update_done_ratio_from_issue_status
2367 @issue.update_done_ratio_from_issue_status
2360 @issue2.update_done_ratio_from_issue_status
2368 @issue2.update_done_ratio_from_issue_status
2361
2369
2362 assert_equal 0, @issue.read_attribute(:done_ratio)
2370 assert_equal 0, @issue.read_attribute(:done_ratio)
2363 assert_equal 30, @issue2.read_attribute(:done_ratio)
2371 assert_equal 30, @issue2.read_attribute(:done_ratio)
2364 end
2372 end
2365
2373
2366 with_settings :issue_done_ratio => 'issue_status' do
2374 with_settings :issue_done_ratio => 'issue_status' do
2367 @issue.update_done_ratio_from_issue_status
2375 @issue.update_done_ratio_from_issue_status
2368 @issue2.update_done_ratio_from_issue_status
2376 @issue2.update_done_ratio_from_issue_status
2369
2377
2370 assert_equal 50, @issue.read_attribute(:done_ratio)
2378 assert_equal 50, @issue.read_attribute(:done_ratio)
2371 assert_equal 0, @issue2.read_attribute(:done_ratio)
2379 assert_equal 0, @issue2.read_attribute(:done_ratio)
2372 end
2380 end
2373 end
2381 end
2374
2382
2375 test "#by_tracker" do
2383 test "#by_tracker" do
2376 User.current = User.anonymous
2384 User.current = User.anonymous
2377 groups = Issue.by_tracker(Project.find(1))
2385 groups = Issue.by_tracker(Project.find(1))
2378 assert_equal 3, groups.count
2386 assert_equal 3, groups.count
2379 assert_equal 7, groups.inject(0) {|sum, group| sum + group['total'].to_i}
2387 assert_equal 7, groups.inject(0) {|sum, group| sum + group['total'].to_i}
2380 end
2388 end
2381
2389
2382 test "#by_version" do
2390 test "#by_version" do
2383 User.current = User.anonymous
2391 User.current = User.anonymous
2384 groups = Issue.by_version(Project.find(1))
2392 groups = Issue.by_version(Project.find(1))
2385 assert_equal 3, groups.count
2393 assert_equal 3, groups.count
2386 assert_equal 3, groups.inject(0) {|sum, group| sum + group['total'].to_i}
2394 assert_equal 3, groups.inject(0) {|sum, group| sum + group['total'].to_i}
2387 end
2395 end
2388
2396
2389 test "#by_priority" do
2397 test "#by_priority" do
2390 User.current = User.anonymous
2398 User.current = User.anonymous
2391 groups = Issue.by_priority(Project.find(1))
2399 groups = Issue.by_priority(Project.find(1))
2392 assert_equal 4, groups.count
2400 assert_equal 4, groups.count
2393 assert_equal 7, groups.inject(0) {|sum, group| sum + group['total'].to_i}
2401 assert_equal 7, groups.inject(0) {|sum, group| sum + group['total'].to_i}
2394 end
2402 end
2395
2403
2396 test "#by_category" do
2404 test "#by_category" do
2397 User.current = User.anonymous
2405 User.current = User.anonymous
2398 groups = Issue.by_category(Project.find(1))
2406 groups = Issue.by_category(Project.find(1))
2399 assert_equal 2, groups.count
2407 assert_equal 2, groups.count
2400 assert_equal 3, groups.inject(0) {|sum, group| sum + group['total'].to_i}
2408 assert_equal 3, groups.inject(0) {|sum, group| sum + group['total'].to_i}
2401 end
2409 end
2402
2410
2403 test "#by_assigned_to" do
2411 test "#by_assigned_to" do
2404 User.current = User.anonymous
2412 User.current = User.anonymous
2405 groups = Issue.by_assigned_to(Project.find(1))
2413 groups = Issue.by_assigned_to(Project.find(1))
2406 assert_equal 2, groups.count
2414 assert_equal 2, groups.count
2407 assert_equal 2, groups.inject(0) {|sum, group| sum + group['total'].to_i}
2415 assert_equal 2, groups.inject(0) {|sum, group| sum + group['total'].to_i}
2408 end
2416 end
2409
2417
2410 test "#by_author" do
2418 test "#by_author" do
2411 User.current = User.anonymous
2419 User.current = User.anonymous
2412 groups = Issue.by_author(Project.find(1))
2420 groups = Issue.by_author(Project.find(1))
2413 assert_equal 4, groups.count
2421 assert_equal 4, groups.count
2414 assert_equal 7, groups.inject(0) {|sum, group| sum + group['total'].to_i}
2422 assert_equal 7, groups.inject(0) {|sum, group| sum + group['total'].to_i}
2415 end
2423 end
2416
2424
2417 test "#by_subproject" do
2425 test "#by_subproject" do
2418 User.current = User.anonymous
2426 User.current = User.anonymous
2419 groups = Issue.by_subproject(Project.find(1))
2427 groups = Issue.by_subproject(Project.find(1))
2420 # Private descendant not visible
2428 # Private descendant not visible
2421 assert_equal 1, groups.count
2429 assert_equal 1, groups.count
2422 assert_equal 2, groups.inject(0) {|sum, group| sum + group['total'].to_i}
2430 assert_equal 2, groups.inject(0) {|sum, group| sum + group['total'].to_i}
2423 end
2431 end
2424
2432
2425 def test_recently_updated_scope
2433 def test_recently_updated_scope
2426 #should return the last updated issue
2434 #should return the last updated issue
2427 assert_equal Issue.reorder("updated_on DESC").first, Issue.recently_updated.limit(1).first
2435 assert_equal Issue.reorder("updated_on DESC").first, Issue.recently_updated.limit(1).first
2428 end
2436 end
2429
2437
2430 def test_on_active_projects_scope
2438 def test_on_active_projects_scope
2431 assert Project.find(2).archive
2439 assert Project.find(2).archive
2432
2440
2433 before = Issue.on_active_project.length
2441 before = Issue.on_active_project.length
2434 # test inclusion to results
2442 # test inclusion to results
2435 issue = Issue.generate!(:tracker => Project.find(2).trackers.first)
2443 issue = Issue.generate!(:tracker => Project.find(2).trackers.first)
2436 assert_equal before + 1, Issue.on_active_project.length
2444 assert_equal before + 1, Issue.on_active_project.length
2437
2445
2438 # Move to an archived project
2446 # Move to an archived project
2439 issue.project = Project.find(2)
2447 issue.project = Project.find(2)
2440 assert issue.save
2448 assert issue.save
2441 assert_equal before, Issue.on_active_project.length
2449 assert_equal before, Issue.on_active_project.length
2442 end
2450 end
2443
2451
2444 test "Issue#recipients should include project recipients" do
2452 test "Issue#recipients should include project recipients" do
2445 issue = Issue.generate!
2453 issue = Issue.generate!
2446 assert issue.project.recipients.present?
2454 assert issue.project.recipients.present?
2447 issue.project.recipients.each do |project_recipient|
2455 issue.project.recipients.each do |project_recipient|
2448 assert issue.recipients.include?(project_recipient)
2456 assert issue.recipients.include?(project_recipient)
2449 end
2457 end
2450 end
2458 end
2451
2459
2452 test "Issue#recipients should include the author if the author is active" do
2460 test "Issue#recipients should include the author if the author is active" do
2453 issue = Issue.generate!(:author => User.generate!)
2461 issue = Issue.generate!(:author => User.generate!)
2454 assert issue.author, "No author set for Issue"
2462 assert issue.author, "No author set for Issue"
2455 assert issue.recipients.include?(issue.author.mail)
2463 assert issue.recipients.include?(issue.author.mail)
2456 end
2464 end
2457
2465
2458 test "Issue#recipients should include the assigned to user if the assigned to user is active" do
2466 test "Issue#recipients should include the assigned to user if the assigned to user is active" do
2459 issue = Issue.generate!(:assigned_to => User.generate!)
2467 issue = Issue.generate!(:assigned_to => User.generate!)
2460 assert issue.assigned_to, "No assigned_to set for Issue"
2468 assert issue.assigned_to, "No assigned_to set for Issue"
2461 assert issue.recipients.include?(issue.assigned_to.mail)
2469 assert issue.recipients.include?(issue.assigned_to.mail)
2462 end
2470 end
2463
2471
2464 test "Issue#recipients should not include users who opt out of all email" do
2472 test "Issue#recipients should not include users who opt out of all email" do
2465 issue = Issue.generate!(:author => User.generate!)
2473 issue = Issue.generate!(:author => User.generate!)
2466 issue.author.update_attribute(:mail_notification, :none)
2474 issue.author.update_attribute(:mail_notification, :none)
2467 assert !issue.recipients.include?(issue.author.mail)
2475 assert !issue.recipients.include?(issue.author.mail)
2468 end
2476 end
2469
2477
2470 test "Issue#recipients should not include the issue author if they are only notified of assigned issues" do
2478 test "Issue#recipients should not include the issue author if they are only notified of assigned issues" do
2471 issue = Issue.generate!(:author => User.generate!)
2479 issue = Issue.generate!(:author => User.generate!)
2472 issue.author.update_attribute(:mail_notification, :only_assigned)
2480 issue.author.update_attribute(:mail_notification, :only_assigned)
2473 assert !issue.recipients.include?(issue.author.mail)
2481 assert !issue.recipients.include?(issue.author.mail)
2474 end
2482 end
2475
2483
2476 test "Issue#recipients should not include the assigned user if they are only notified of owned issues" do
2484 test "Issue#recipients should not include the assigned user if they are only notified of owned issues" do
2477 issue = Issue.generate!(:assigned_to => User.generate!)
2485 issue = Issue.generate!(:assigned_to => User.generate!)
2478 issue.assigned_to.update_attribute(:mail_notification, :only_owner)
2486 issue.assigned_to.update_attribute(:mail_notification, :only_owner)
2479 assert !issue.recipients.include?(issue.assigned_to.mail)
2487 assert !issue.recipients.include?(issue.assigned_to.mail)
2480 end
2488 end
2481
2489
2482 def test_last_journal_id_with_journals_should_return_the_journal_id
2490 def test_last_journal_id_with_journals_should_return_the_journal_id
2483 assert_equal 2, Issue.find(1).last_journal_id
2491 assert_equal 2, Issue.find(1).last_journal_id
2484 end
2492 end
2485
2493
2486 def test_last_journal_id_without_journals_should_return_nil
2494 def test_last_journal_id_without_journals_should_return_nil
2487 assert_nil Issue.find(3).last_journal_id
2495 assert_nil Issue.find(3).last_journal_id
2488 end
2496 end
2489
2497
2490 def test_journals_after_should_return_journals_with_greater_id
2498 def test_journals_after_should_return_journals_with_greater_id
2491 assert_equal [Journal.find(2)], Issue.find(1).journals_after('1')
2499 assert_equal [Journal.find(2)], Issue.find(1).journals_after('1')
2492 assert_equal [], Issue.find(1).journals_after('2')
2500 assert_equal [], Issue.find(1).journals_after('2')
2493 end
2501 end
2494
2502
2495 def test_journals_after_with_blank_arg_should_return_all_journals
2503 def test_journals_after_with_blank_arg_should_return_all_journals
2496 assert_equal [Journal.find(1), Journal.find(2)], Issue.find(1).journals_after('')
2504 assert_equal [Journal.find(1), Journal.find(2)], Issue.find(1).journals_after('')
2497 end
2505 end
2498
2506
2499 def test_css_classes_should_include_tracker
2507 def test_css_classes_should_include_tracker
2500 issue = Issue.new(:tracker => Tracker.find(2))
2508 issue = Issue.new(:tracker => Tracker.find(2))
2501 classes = issue.css_classes.split(' ')
2509 classes = issue.css_classes.split(' ')
2502 assert_include 'tracker-2', classes
2510 assert_include 'tracker-2', classes
2503 end
2511 end
2504
2512
2505 def test_css_classes_should_include_priority
2513 def test_css_classes_should_include_priority
2506 issue = Issue.new(:priority => IssuePriority.find(8))
2514 issue = Issue.new(:priority => IssuePriority.find(8))
2507 classes = issue.css_classes.split(' ')
2515 classes = issue.css_classes.split(' ')
2508 assert_include 'priority-8', classes
2516 assert_include 'priority-8', classes
2509 assert_include 'priority-highest', classes
2517 assert_include 'priority-highest', classes
2510 end
2518 end
2511
2519
2512 def test_css_classes_should_include_user_and_group_assignment
2520 def test_css_classes_should_include_user_and_group_assignment
2513 project = Project.first
2521 project = Project.first
2514 user = User.generate!
2522 user = User.generate!
2515 group = Group.generate!
2523 group = Group.generate!
2516 Member.create!(:principal => group, :project => project, :role_ids => [1, 2])
2524 Member.create!(:principal => group, :project => project, :role_ids => [1, 2])
2517 group.users << user
2525 group.users << user
2518 assert user.member_of?(project)
2526 assert user.member_of?(project)
2519 issue1 = Issue.generate(:assigned_to_id => group.id)
2527 issue1 = Issue.generate(:assigned_to_id => group.id)
2520 assert_include 'assigned-to-my-group', issue1.css_classes(user)
2528 assert_include 'assigned-to-my-group', issue1.css_classes(user)
2521 assert_not_include 'assigned-to-me', issue1.css_classes(user)
2529 assert_not_include 'assigned-to-me', issue1.css_classes(user)
2522 issue2 = Issue.generate(:assigned_to_id => user.id)
2530 issue2 = Issue.generate(:assigned_to_id => user.id)
2523 assert_not_include 'assigned-to-my-group', issue2.css_classes(user)
2531 assert_not_include 'assigned-to-my-group', issue2.css_classes(user)
2524 assert_include 'assigned-to-me', issue2.css_classes(user)
2532 assert_include 'assigned-to-me', issue2.css_classes(user)
2525 end
2533 end
2526
2534
2527 def test_save_attachments_with_hash_should_save_attachments_in_keys_order
2535 def test_save_attachments_with_hash_should_save_attachments_in_keys_order
2528 set_tmp_attachments_directory
2536 set_tmp_attachments_directory
2529 issue = Issue.generate!
2537 issue = Issue.generate!
2530 issue.save_attachments({
2538 issue.save_attachments({
2531 'p0' => {'file' => mock_file_with_options(:original_filename => 'upload')},
2539 'p0' => {'file' => mock_file_with_options(:original_filename => 'upload')},
2532 '3' => {'file' => mock_file_with_options(:original_filename => 'bar')},
2540 '3' => {'file' => mock_file_with_options(:original_filename => 'bar')},
2533 '1' => {'file' => mock_file_with_options(:original_filename => 'foo')}
2541 '1' => {'file' => mock_file_with_options(:original_filename => 'foo')}
2534 })
2542 })
2535 issue.attach_saved_attachments
2543 issue.attach_saved_attachments
2536
2544
2537 assert_equal 3, issue.reload.attachments.count
2545 assert_equal 3, issue.reload.attachments.count
2538 assert_equal %w(upload foo bar), issue.attachments.map(&:filename)
2546 assert_equal %w(upload foo bar), issue.attachments.map(&:filename)
2539 end
2547 end
2540
2548
2541 def test_closed_on_should_be_nil_when_creating_an_open_issue
2549 def test_closed_on_should_be_nil_when_creating_an_open_issue
2542 issue = Issue.generate!(:status_id => 1).reload
2550 issue = Issue.generate!(:status_id => 1).reload
2543 assert !issue.closed?
2551 assert !issue.closed?
2544 assert_nil issue.closed_on
2552 assert_nil issue.closed_on
2545 end
2553 end
2546
2554
2547 def test_closed_on_should_be_set_when_creating_a_closed_issue
2555 def test_closed_on_should_be_set_when_creating_a_closed_issue
2548 issue = Issue.generate!(:status_id => 5).reload
2556 issue = Issue.generate!(:status_id => 5).reload
2549 assert issue.closed?
2557 assert issue.closed?
2550 assert_not_nil issue.closed_on
2558 assert_not_nil issue.closed_on
2551 assert_equal issue.updated_on, issue.closed_on
2559 assert_equal issue.updated_on, issue.closed_on
2552 assert_equal issue.created_on, issue.closed_on
2560 assert_equal issue.created_on, issue.closed_on
2553 end
2561 end
2554
2562
2555 def test_closed_on_should_be_nil_when_updating_an_open_issue
2563 def test_closed_on_should_be_nil_when_updating_an_open_issue
2556 issue = Issue.find(1)
2564 issue = Issue.find(1)
2557 issue.subject = 'Not closed yet'
2565 issue.subject = 'Not closed yet'
2558 issue.save!
2566 issue.save!
2559 issue.reload
2567 issue.reload
2560 assert_nil issue.closed_on
2568 assert_nil issue.closed_on
2561 end
2569 end
2562
2570
2563 def test_closed_on_should_be_set_when_closing_an_open_issue
2571 def test_closed_on_should_be_set_when_closing_an_open_issue
2564 issue = Issue.find(1)
2572 issue = Issue.find(1)
2565 issue.subject = 'Now closed'
2573 issue.subject = 'Now closed'
2566 issue.status_id = 5
2574 issue.status_id = 5
2567 issue.save!
2575 issue.save!
2568 issue.reload
2576 issue.reload
2569 assert_not_nil issue.closed_on
2577 assert_not_nil issue.closed_on
2570 assert_equal issue.updated_on, issue.closed_on
2578 assert_equal issue.updated_on, issue.closed_on
2571 end
2579 end
2572
2580
2573 def test_closed_on_should_not_be_updated_when_updating_a_closed_issue
2581 def test_closed_on_should_not_be_updated_when_updating_a_closed_issue
2574 issue = Issue.open(false).first
2582 issue = Issue.open(false).first
2575 was_closed_on = issue.closed_on
2583 was_closed_on = issue.closed_on
2576 assert_not_nil was_closed_on
2584 assert_not_nil was_closed_on
2577 issue.subject = 'Updating a closed issue'
2585 issue.subject = 'Updating a closed issue'
2578 issue.save!
2586 issue.save!
2579 issue.reload
2587 issue.reload
2580 assert_equal was_closed_on, issue.closed_on
2588 assert_equal was_closed_on, issue.closed_on
2581 end
2589 end
2582
2590
2583 def test_closed_on_should_be_preserved_when_reopening_a_closed_issue
2591 def test_closed_on_should_be_preserved_when_reopening_a_closed_issue
2584 issue = Issue.open(false).first
2592 issue = Issue.open(false).first
2585 was_closed_on = issue.closed_on
2593 was_closed_on = issue.closed_on
2586 assert_not_nil was_closed_on
2594 assert_not_nil was_closed_on
2587 issue.subject = 'Reopening a closed issue'
2595 issue.subject = 'Reopening a closed issue'
2588 issue.status_id = 1
2596 issue.status_id = 1
2589 issue.save!
2597 issue.save!
2590 issue.reload
2598 issue.reload
2591 assert !issue.closed?
2599 assert !issue.closed?
2592 assert_equal was_closed_on, issue.closed_on
2600 assert_equal was_closed_on, issue.closed_on
2593 end
2601 end
2594
2602
2595 def test_status_was_should_return_nil_for_new_issue
2603 def test_status_was_should_return_nil_for_new_issue
2596 issue = Issue.new
2604 issue = Issue.new
2597 assert_nil issue.status_was
2605 assert_nil issue.status_was
2598 end
2606 end
2599
2607
2600 def test_status_was_should_return_status_before_change
2608 def test_status_was_should_return_status_before_change
2601 issue = Issue.find(1)
2609 issue = Issue.find(1)
2602 issue.status = IssueStatus.find(2)
2610 issue.status = IssueStatus.find(2)
2603 assert_equal IssueStatus.find(1), issue.status_was
2611 assert_equal IssueStatus.find(1), issue.status_was
2604 end
2612 end
2605
2613
2606 def test_status_was_should_return_status_before_change_with_status_id
2614 def test_status_was_should_return_status_before_change_with_status_id
2607 issue = Issue.find(1)
2615 issue = Issue.find(1)
2608 assert_equal IssueStatus.find(1), issue.status
2616 assert_equal IssueStatus.find(1), issue.status
2609 issue.status_id = 2
2617 issue.status_id = 2
2610 assert_equal IssueStatus.find(1), issue.status_was
2618 assert_equal IssueStatus.find(1), issue.status_was
2611 end
2619 end
2612
2620
2613 def test_status_was_should_be_reset_on_save
2621 def test_status_was_should_be_reset_on_save
2614 issue = Issue.find(1)
2622 issue = Issue.find(1)
2615 issue.status = IssueStatus.find(2)
2623 issue.status = IssueStatus.find(2)
2616 assert_equal IssueStatus.find(1), issue.status_was
2624 assert_equal IssueStatus.find(1), issue.status_was
2617 assert issue.save!
2625 assert issue.save!
2618 assert_equal IssueStatus.find(2), issue.status_was
2626 assert_equal IssueStatus.find(2), issue.status_was
2619 end
2627 end
2620
2628
2621 def test_closing_should_return_true_when_closing_an_issue
2629 def test_closing_should_return_true_when_closing_an_issue
2622 issue = Issue.find(1)
2630 issue = Issue.find(1)
2623 issue.status = IssueStatus.find(2)
2631 issue.status = IssueStatus.find(2)
2624 assert_equal false, issue.closing?
2632 assert_equal false, issue.closing?
2625 issue.status = IssueStatus.find(5)
2633 issue.status = IssueStatus.find(5)
2626 assert_equal true, issue.closing?
2634 assert_equal true, issue.closing?
2627 end
2635 end
2628
2636
2629 def test_closing_should_return_true_when_closing_an_issue_with_status_id
2637 def test_closing_should_return_true_when_closing_an_issue_with_status_id
2630 issue = Issue.find(1)
2638 issue = Issue.find(1)
2631 issue.status_id = 2
2639 issue.status_id = 2
2632 assert_equal false, issue.closing?
2640 assert_equal false, issue.closing?
2633 issue.status_id = 5
2641 issue.status_id = 5
2634 assert_equal true, issue.closing?
2642 assert_equal true, issue.closing?
2635 end
2643 end
2636
2644
2637 def test_closing_should_return_true_for_new_closed_issue
2645 def test_closing_should_return_true_for_new_closed_issue
2638 issue = Issue.new
2646 issue = Issue.new
2639 assert_equal false, issue.closing?
2647 assert_equal false, issue.closing?
2640 issue.status = IssueStatus.find(5)
2648 issue.status = IssueStatus.find(5)
2641 assert_equal true, issue.closing?
2649 assert_equal true, issue.closing?
2642 end
2650 end
2643
2651
2644 def test_closing_should_return_true_for_new_closed_issue_with_status_id
2652 def test_closing_should_return_true_for_new_closed_issue_with_status_id
2645 issue = Issue.new
2653 issue = Issue.new
2646 assert_equal false, issue.closing?
2654 assert_equal false, issue.closing?
2647 issue.status_id = 5
2655 issue.status_id = 5
2648 assert_equal true, issue.closing?
2656 assert_equal true, issue.closing?
2649 end
2657 end
2650
2658
2651 def test_closing_should_be_reset_after_save
2659 def test_closing_should_be_reset_after_save
2652 issue = Issue.find(1)
2660 issue = Issue.find(1)
2653 issue.status_id = 5
2661 issue.status_id = 5
2654 assert_equal true, issue.closing?
2662 assert_equal true, issue.closing?
2655 issue.save!
2663 issue.save!
2656 assert_equal false, issue.closing?
2664 assert_equal false, issue.closing?
2657 end
2665 end
2658
2666
2659 def test_reopening_should_return_true_when_reopening_an_issue
2667 def test_reopening_should_return_true_when_reopening_an_issue
2660 issue = Issue.find(8)
2668 issue = Issue.find(8)
2661 issue.status = IssueStatus.find(6)
2669 issue.status = IssueStatus.find(6)
2662 assert_equal false, issue.reopening?
2670 assert_equal false, issue.reopening?
2663 issue.status = IssueStatus.find(2)
2671 issue.status = IssueStatus.find(2)
2664 assert_equal true, issue.reopening?
2672 assert_equal true, issue.reopening?
2665 end
2673 end
2666
2674
2667 def test_reopening_should_return_true_when_reopening_an_issue_with_status_id
2675 def test_reopening_should_return_true_when_reopening_an_issue_with_status_id
2668 issue = Issue.find(8)
2676 issue = Issue.find(8)
2669 issue.status_id = 6
2677 issue.status_id = 6
2670 assert_equal false, issue.reopening?
2678 assert_equal false, issue.reopening?
2671 issue.status_id = 2
2679 issue.status_id = 2
2672 assert_equal true, issue.reopening?
2680 assert_equal true, issue.reopening?
2673 end
2681 end
2674
2682
2675 def test_reopening_should_return_false_for_new_open_issue
2683 def test_reopening_should_return_false_for_new_open_issue
2676 issue = Issue.new
2684 issue = Issue.new
2677 issue.status = IssueStatus.find(1)
2685 issue.status = IssueStatus.find(1)
2678 assert_equal false, issue.reopening?
2686 assert_equal false, issue.reopening?
2679 end
2687 end
2680
2688
2681 def test_reopening_should_be_reset_after_save
2689 def test_reopening_should_be_reset_after_save
2682 issue = Issue.find(8)
2690 issue = Issue.find(8)
2683 issue.status_id = 2
2691 issue.status_id = 2
2684 assert_equal true, issue.reopening?
2692 assert_equal true, issue.reopening?
2685 issue.save!
2693 issue.save!
2686 assert_equal false, issue.reopening?
2694 assert_equal false, issue.reopening?
2687 end
2695 end
2688
2696
2689 def test_default_status_without_tracker_should_be_nil
2697 def test_default_status_without_tracker_should_be_nil
2690 issue = Issue.new
2698 issue = Issue.new
2691 assert_nil issue.tracker
2699 assert_nil issue.tracker
2692 assert_nil issue.default_status
2700 assert_nil issue.default_status
2693 end
2701 end
2694
2702
2695 def test_default_status_should_be_tracker_default_status
2703 def test_default_status_should_be_tracker_default_status
2696 issue = Issue.new(:tracker_id => 1)
2704 issue = Issue.new(:tracker_id => 1)
2697 assert_not_nil issue.status
2705 assert_not_nil issue.status
2698 assert_equal issue.tracker.default_status, issue.default_status
2706 assert_equal issue.tracker.default_status, issue.default_status
2699 end
2707 end
2700
2708
2701 def test_initializing_with_tracker_should_set_default_status
2709 def test_initializing_with_tracker_should_set_default_status
2702 issue = Issue.new(:tracker => Tracker.find(1))
2710 issue = Issue.new(:tracker => Tracker.find(1))
2703 assert_not_nil issue.status
2711 assert_not_nil issue.status
2704 assert_equal issue.default_status, issue.status
2712 assert_equal issue.default_status, issue.status
2705 end
2713 end
2706
2714
2707 def test_initializing_with_tracker_id_should_set_default_status
2715 def test_initializing_with_tracker_id_should_set_default_status
2708 issue = Issue.new(:tracker_id => 1)
2716 issue = Issue.new(:tracker_id => 1)
2709 assert_not_nil issue.status
2717 assert_not_nil issue.status
2710 assert_equal issue.default_status, issue.status
2718 assert_equal issue.default_status, issue.status
2711 end
2719 end
2712
2720
2713 def test_setting_tracker_should_set_default_status
2721 def test_setting_tracker_should_set_default_status
2714 issue = Issue.new
2722 issue = Issue.new
2715 issue.tracker = Tracker.find(1)
2723 issue.tracker = Tracker.find(1)
2716 assert_not_nil issue.status
2724 assert_not_nil issue.status
2717 assert_equal issue.default_status, issue.status
2725 assert_equal issue.default_status, issue.status
2718 end
2726 end
2719
2727
2720 def test_changing_tracker_should_set_default_status_if_status_was_default
2728 def test_changing_tracker_should_set_default_status_if_status_was_default
2721 WorkflowTransition.delete_all
2729 WorkflowTransition.delete_all
2722 WorkflowTransition.create! :role_id => 1, :tracker_id => 2, :old_status_id => 2, :new_status_id => 1
2730 WorkflowTransition.create! :role_id => 1, :tracker_id => 2, :old_status_id => 2, :new_status_id => 1
2723 Tracker.find(2).update! :default_status_id => 2
2731 Tracker.find(2).update! :default_status_id => 2
2724
2732
2725 issue = Issue.new(:tracker_id => 1, :status_id => 1)
2733 issue = Issue.new(:tracker_id => 1, :status_id => 1)
2726 assert_equal IssueStatus.find(1), issue.status
2734 assert_equal IssueStatus.find(1), issue.status
2727 issue.tracker = Tracker.find(2)
2735 issue.tracker = Tracker.find(2)
2728 assert_equal IssueStatus.find(2), issue.status
2736 assert_equal IssueStatus.find(2), issue.status
2729 end
2737 end
2730
2738
2731 def test_changing_tracker_should_set_default_status_if_status_is_not_used_by_tracker
2739 def test_changing_tracker_should_set_default_status_if_status_is_not_used_by_tracker
2732 WorkflowTransition.delete_all
2740 WorkflowTransition.delete_all
2733 Tracker.find(2).update! :default_status_id => 2
2741 Tracker.find(2).update! :default_status_id => 2
2734
2742
2735 issue = Issue.new(:tracker_id => 1, :status_id => 3)
2743 issue = Issue.new(:tracker_id => 1, :status_id => 3)
2736 assert_equal IssueStatus.find(3), issue.status
2744 assert_equal IssueStatus.find(3), issue.status
2737 issue.tracker = Tracker.find(2)
2745 issue.tracker = Tracker.find(2)
2738 assert_equal IssueStatus.find(2), issue.status
2746 assert_equal IssueStatus.find(2), issue.status
2739 end
2747 end
2740
2748
2741 def test_changing_tracker_should_keep_status_if_status_was_not_default_and_is_used_by_tracker
2749 def test_changing_tracker_should_keep_status_if_status_was_not_default_and_is_used_by_tracker
2742 WorkflowTransition.delete_all
2750 WorkflowTransition.delete_all
2743 WorkflowTransition.create! :role_id => 1, :tracker_id => 2, :old_status_id => 2, :new_status_id => 3
2751 WorkflowTransition.create! :role_id => 1, :tracker_id => 2, :old_status_id => 2, :new_status_id => 3
2744 Tracker.find(2).update! :default_status_id => 2
2752 Tracker.find(2).update! :default_status_id => 2
2745
2753
2746 issue = Issue.new(:tracker_id => 1, :status_id => 3)
2754 issue = Issue.new(:tracker_id => 1, :status_id => 3)
2747 assert_equal IssueStatus.find(3), issue.status
2755 assert_equal IssueStatus.find(3), issue.status
2748 issue.tracker = Tracker.find(2)
2756 issue.tracker = Tracker.find(2)
2749 assert_equal IssueStatus.find(3), issue.status
2757 assert_equal IssueStatus.find(3), issue.status
2750 end
2758 end
2751
2759
2752 def test_assigned_to_was_with_a_group
2760 def test_assigned_to_was_with_a_group
2753 group = Group.find(10)
2761 group = Group.find(10)
2754
2762
2755 issue = Issue.generate!(:assigned_to => group)
2763 issue = Issue.generate!(:assigned_to => group)
2756 issue.reload.assigned_to = nil
2764 issue.reload.assigned_to = nil
2757 assert_equal group, issue.assigned_to_was
2765 assert_equal group, issue.assigned_to_was
2758 end
2766 end
2759 end
2767 end
General Comments 0
You need to be logged in to leave comments. Login now