##// END OF EJS Templates
Default status per tracker (#5991)....
Jean-Philippe Lang -
r13153:dfc594c33702
parent child
Show More

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

@@ -0,0 +1,15
1 class AddTrackersDefaultStatusId < ActiveRecord::Migration
2 def up
3 add_column :trackers, :default_status_id, :integer
4
5 status_id = IssueStatus.where(:is_default => true).pluck(:id).first
6 status_id ||= IssueStatus.order(:position).pluck(:id).first
7 if status_id
8 Tracker.update_all :default_status_id => status_id
9 end
10 end
11
12 def down
13 remove_column :trackers, :default_status_id
14 end
15 end
@@ -0,0 +1,12
1 class RemoveIssueStatusesIsDefault < ActiveRecord::Migration
2 def up
3 remove_column :issue_statuses, :is_default
4 end
5
6 def down
7 add_column :issue_statuses, :is_default, :boolean, :null => false, :default => false
8 # Restores the first status as default
9 default_status_id = IssueStatus.order("position").first.pluck(:id)
10 IssueStatus.where(:id => default_status_id).update_all(:is_default => true)
11 end
12 end
@@ -1,487 +1,489
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class IssuesController < ApplicationController
19 19 menu_item :new_issue, :only => [:new, :create]
20 20 default_search_scope :issues
21 21
22 22 before_filter :find_issue, :only => [:show, :edit, :update]
23 23 before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :destroy]
24 24 before_filter :find_project, :only => [:new, :create, :update_form]
25 25 before_filter :authorize, :except => [:index]
26 26 before_filter :find_optional_project, :only => [:index]
27 before_filter :check_for_default_issue_status, :only => [:new, :create]
28 27 before_filter :build_new_issue_from_params, :only => [:new, :create, :update_form]
29 28 accept_rss_auth :index, :show
30 29 accept_api_auth :index, :show, :create, :update, :destroy
31 30
32 31 rescue_from Query::StatementInvalid, :with => :query_statement_invalid
33 32
34 33 helper :journals
35 34 helper :projects
36 35 include ProjectsHelper
37 36 helper :custom_fields
38 37 include CustomFieldsHelper
39 38 helper :issue_relations
40 39 include IssueRelationsHelper
41 40 helper :watchers
42 41 include WatchersHelper
43 42 helper :attachments
44 43 include AttachmentsHelper
45 44 helper :queries
46 45 include QueriesHelper
47 46 helper :repositories
48 47 include RepositoriesHelper
49 48 helper :sort
50 49 include SortHelper
51 50 include IssuesHelper
52 51 helper :timelog
53 52 include Redmine::Export::PDF
54 53
55 54 def index
56 55 retrieve_query
57 56 sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
58 57 sort_update(@query.sortable_columns)
59 58 @query.sort_criteria = sort_criteria.to_a
60 59
61 60 if @query.valid?
62 61 case params[:format]
63 62 when 'csv', 'pdf'
64 63 @limit = Setting.issues_export_limit.to_i
65 64 if params[:columns] == 'all'
66 65 @query.column_names = @query.available_inline_columns.map(&:name)
67 66 end
68 67 when 'atom'
69 68 @limit = Setting.feeds_limit.to_i
70 69 when 'xml', 'json'
71 70 @offset, @limit = api_offset_and_limit
72 71 @query.column_names = %w(author)
73 72 else
74 73 @limit = per_page_option
75 74 end
76 75
77 76 @issue_count = @query.issue_count
78 77 @issue_pages = Paginator.new @issue_count, @limit, params['page']
79 78 @offset ||= @issue_pages.offset
80 79 @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
81 80 :order => sort_clause,
82 81 :offset => @offset,
83 82 :limit => @limit)
84 83 @issue_count_by_group = @query.issue_count_by_group
85 84
86 85 respond_to do |format|
87 86 format.html { render :template => 'issues/index', :layout => !request.xhr? }
88 87 format.api {
89 88 Issue.load_visible_relations(@issues) if include_in_api_response?('relations')
90 89 }
91 90 format.atom { render_feed(@issues, :title => "#{@project || Setting.app_title}: #{l(:label_issue_plural)}") }
92 91 format.csv { send_data(query_to_csv(@issues, @query, params), :type => 'text/csv; header=present', :filename => 'issues.csv') }
93 92 format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'issues.pdf') }
94 93 end
95 94 else
96 95 respond_to do |format|
97 96 format.html { render(:template => 'issues/index', :layout => !request.xhr?) }
98 97 format.any(:atom, :csv, :pdf) { render(:nothing => true) }
99 98 format.api { render_validation_errors(@query) }
100 99 end
101 100 end
102 101 rescue ActiveRecord::RecordNotFound
103 102 render_404
104 103 end
105 104
106 105 def show
107 106 @journals = @issue.journals.includes(:user, :details).
108 107 references(:user, :details).
109 108 reorder("#{Journal.table_name}.id ASC").to_a
110 109 @journals.each_with_index {|j,i| j.indice = i+1}
111 110 @journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
112 111 Journal.preload_journals_details_custom_fields(@journals)
113 112 @journals.select! {|journal| journal.notes? || journal.visible_details.any?}
114 113 @journals.reverse! if User.current.wants_comments_in_reverse_order?
115 114
116 115 @changesets = @issue.changesets.visible.to_a
117 116 @changesets.reverse! if User.current.wants_comments_in_reverse_order?
118 117
119 118 @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
120 119 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
121 120 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
122 121 @priorities = IssuePriority.active
123 122 @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
124 123 @relation = IssueRelation.new
125 124
126 125 respond_to do |format|
127 126 format.html {
128 127 retrieve_previous_and_next_issue_ids
129 128 render :template => 'issues/show'
130 129 }
131 130 format.api
132 131 format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' }
133 132 format.pdf {
134 133 pdf = issue_to_pdf(@issue, :journals => @journals)
135 134 send_data(pdf, :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf")
136 135 }
137 136 end
138 137 end
139 138
140 139 # Add a new issue
141 140 # The new issue will be created from an existing one if copy_from parameter is given
142 141 def new
143 142 respond_to do |format|
144 143 format.html { render :action => 'new', :layout => !request.xhr? }
145 144 end
146 145 end
147 146
148 147 def create
149 148 call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
150 149 @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
151 150 if @issue.save
152 151 call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
153 152 respond_to do |format|
154 153 format.html {
155 154 render_attachment_warning_if_needed(@issue)
156 155 flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("##{@issue.id}", issue_path(@issue), :title => @issue.subject))
157 156 if params[:continue]
158 157 attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?}
159 158 redirect_to new_project_issue_path(@issue.project, :issue => attrs)
160 159 else
161 160 redirect_to issue_path(@issue)
162 161 end
163 162 }
164 163 format.api { render :action => 'show', :status => :created, :location => issue_url(@issue) }
165 164 end
166 165 return
167 166 else
168 167 respond_to do |format|
169 168 format.html { render :action => 'new' }
170 169 format.api { render_validation_errors(@issue) }
171 170 end
172 171 end
173 172 end
174 173
175 174 def edit
176 175 return unless update_issue_from_params
177 176
178 177 respond_to do |format|
179 178 format.html { }
180 179 format.xml { }
181 180 end
182 181 end
183 182
184 183 def update
185 184 return unless update_issue_from_params
186 185 @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
187 186 saved = false
188 187 begin
189 188 saved = save_issue_with_child_records
190 189 rescue ActiveRecord::StaleObjectError
191 190 @conflict = true
192 191 if params[:last_journal_id]
193 192 @conflict_journals = @issue.journals_after(params[:last_journal_id]).to_a
194 193 @conflict_journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
195 194 end
196 195 end
197 196
198 197 if saved
199 198 render_attachment_warning_if_needed(@issue)
200 199 flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record?
201 200
202 201 respond_to do |format|
203 202 format.html { redirect_back_or_default issue_path(@issue) }
204 203 format.api { render_api_ok }
205 204 end
206 205 else
207 206 respond_to do |format|
208 207 format.html { render :action => 'edit' }
209 208 format.api { render_validation_errors(@issue) }
210 209 end
211 210 end
212 211 end
213 212
214 213 # Updates the issue form when changing the project, status or tracker
215 214 # on issue creation/update
216 215 def update_form
217 216 end
218 217
219 218 # Bulk edit/copy a set of issues
220 219 def bulk_edit
221 220 @issues.sort!
222 221 @copy = params[:copy].present?
223 222 @notes = params[:notes]
224 223
225 224 if User.current.allowed_to?(:move_issues, @projects)
226 225 @allowed_projects = Issue.allowed_target_projects_on_move
227 226 if params[:issue]
228 227 @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:issue][:project_id].to_s}
229 228 if @target_project
230 229 target_projects = [@target_project]
231 230 end
232 231 end
233 232 end
234 233 target_projects ||= @projects
235 234
236 235 if @copy
237 @available_statuses = [IssueStatus.default]
236 # Copied issues will get their default statuses
237 @available_statuses = []
238 238 else
239 239 @available_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&)
240 240 end
241 241 @custom_fields = target_projects.map{|p|p.all_issue_custom_fields.visible}.reduce(:&)
242 242 @assignables = target_projects.map(&:assignable_users).reduce(:&)
243 243 @trackers = target_projects.map(&:trackers).reduce(:&)
244 244 @versions = target_projects.map {|p| p.shared_versions.open}.reduce(:&)
245 245 @categories = target_projects.map {|p| p.issue_categories}.reduce(:&)
246 246 if @copy
247 247 @attachments_present = @issues.detect {|i| i.attachments.any?}.present?
248 248 @subtasks_present = @issues.detect {|i| !i.leaf?}.present?
249 249 end
250 250
251 251 @safe_attributes = @issues.map(&:safe_attribute_names).reduce(:&)
252 252
253 253 @issue_params = params[:issue] || {}
254 254 @issue_params[:custom_field_values] ||= {}
255 255 end
256 256
257 257 def bulk_update
258 258 @issues.sort!
259 259 @copy = params[:copy].present?
260 260 attributes = parse_params_for_bulk_issue_attributes(params)
261 261
262 262 unsaved_issues = []
263 263 saved_issues = []
264 264
265 265 if @copy && params[:copy_subtasks].present?
266 266 # Descendant issues will be copied with the parent task
267 267 # Don't copy them twice
268 268 @issues.reject! {|issue| @issues.detect {|other| issue.is_descendant_of?(other)}}
269 269 end
270 270
271 271 @issues.each do |orig_issue|
272 272 orig_issue.reload
273 273 if @copy
274 274 issue = orig_issue.copy({},
275 275 :attachments => params[:copy_attachments].present?,
276 276 :subtasks => params[:copy_subtasks].present?
277 277 )
278 278 else
279 279 issue = orig_issue
280 280 end
281 281 journal = issue.init_journal(User.current, params[:notes])
282 282 issue.safe_attributes = attributes
283 283 call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => issue })
284 284 if issue.save
285 285 saved_issues << issue
286 286 else
287 287 unsaved_issues << orig_issue
288 288 end
289 289 end
290 290
291 291 if unsaved_issues.empty?
292 292 flash[:notice] = l(:notice_successful_update) unless saved_issues.empty?
293 293 if params[:follow]
294 294 if @issues.size == 1 && saved_issues.size == 1
295 295 redirect_to issue_path(saved_issues.first)
296 296 elsif saved_issues.map(&:project).uniq.size == 1
297 297 redirect_to project_issues_path(saved_issues.map(&:project).first)
298 298 end
299 299 else
300 300 redirect_back_or_default _project_issues_path(@project)
301 301 end
302 302 else
303 303 @saved_issues = @issues
304 304 @unsaved_issues = unsaved_issues
305 305 @issues = Issue.visible.where(:id => @unsaved_issues.map(&:id)).to_a
306 306 bulk_edit
307 307 render :action => 'bulk_edit'
308 308 end
309 309 end
310 310
311 311 def destroy
312 312 @hours = TimeEntry.where(:issue_id => @issues.map(&:id)).sum(:hours).to_f
313 313 if @hours > 0
314 314 case params[:todo]
315 315 when 'destroy'
316 316 # nothing to do
317 317 when 'nullify'
318 318 TimeEntry.where(['issue_id IN (?)', @issues]).update_all('issue_id = NULL')
319 319 when 'reassign'
320 320 reassign_to = @project.issues.find_by_id(params[:reassign_to_id])
321 321 if reassign_to.nil?
322 322 flash.now[:error] = l(:error_issue_not_found_in_project)
323 323 return
324 324 else
325 325 TimeEntry.where(['issue_id IN (?)', @issues]).
326 326 update_all("issue_id = #{reassign_to.id}")
327 327 end
328 328 else
329 329 # display the destroy form if it's a user request
330 330 return unless api_request?
331 331 end
332 332 end
333 333 @issues.each do |issue|
334 334 begin
335 335 issue.reload.destroy
336 336 rescue ::ActiveRecord::RecordNotFound # raised by #reload if issue no longer exists
337 337 # nothing to do, issue was already deleted (eg. by a parent)
338 338 end
339 339 end
340 340 respond_to do |format|
341 341 format.html { redirect_back_or_default _project_issues_path(@project) }
342 342 format.api { render_api_ok }
343 343 end
344 344 end
345 345
346 346 private
347 347
348 348 def find_project
349 349 project_id = params[:project_id] || (params[:issue] && params[:issue][:project_id])
350 350 @project = Project.find(project_id)
351 351 rescue ActiveRecord::RecordNotFound
352 352 render_404
353 353 end
354 354
355 355 def retrieve_previous_and_next_issue_ids
356 356 retrieve_query_from_session
357 357 if @query
358 358 sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
359 359 sort_update(@query.sortable_columns, 'issues_index_sort')
360 360 limit = 500
361 361 issue_ids = @query.issue_ids(:order => sort_clause, :limit => (limit + 1), :include => [:assigned_to, :tracker, :priority, :category, :fixed_version])
362 362 if (idx = issue_ids.index(@issue.id)) && idx < limit
363 363 if issue_ids.size < 500
364 364 @issue_position = idx + 1
365 365 @issue_count = issue_ids.size
366 366 end
367 367 @prev_issue_id = issue_ids[idx - 1] if idx > 0
368 368 @next_issue_id = issue_ids[idx + 1] if idx < (issue_ids.size - 1)
369 369 end
370 370 end
371 371 end
372 372
373 373 # Used by #edit and #update to set some common instance variables
374 374 # from the params
375 375 # TODO: Refactor, not everything in here is needed by #edit
376 376 def update_issue_from_params
377 377 @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
378 378 @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
379 379 if params[:time_entry]
380 380 @time_entry.attributes = params[:time_entry]
381 381 end
382 382
383 383 @issue.init_journal(User.current)
384 384
385 385 issue_attributes = params[:issue]
386 386 if issue_attributes && params[:conflict_resolution]
387 387 case params[:conflict_resolution]
388 388 when 'overwrite'
389 389 issue_attributes = issue_attributes.dup
390 390 issue_attributes.delete(:lock_version)
391 391 when 'add_notes'
392 392 issue_attributes = issue_attributes.slice(:notes)
393 393 when 'cancel'
394 394 redirect_to issue_path(@issue)
395 395 return false
396 396 end
397 397 end
398 398 @issue.safe_attributes = issue_attributes
399 399 @priorities = IssuePriority.active
400 400 @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
401 401 true
402 402 end
403 403
404 404 # TODO: Refactor, lots of extra code in here
405 405 # TODO: Changing tracker on an existing issue should not trigger this
406 406 def build_new_issue_from_params
407 407 if params[:id].blank?
408 408 @issue = Issue.new
409 409 @issue.init_journal(User.current)
410 410 if params[:copy_from]
411 411 begin
412 412 @copy_from = Issue.visible.find(params[:copy_from])
413 413 @copy_attachments = params[:copy_attachments].present? || request.get?
414 414 @copy_subtasks = params[:copy_subtasks].present? || request.get?
415 415 @issue.copy_from(@copy_from, :attachments => @copy_attachments, :subtasks => @copy_subtasks)
416 416 rescue ActiveRecord::RecordNotFound
417 417 render_404
418 418 return
419 419 end
420 420 end
421 421 @issue.project = @project
422 422 @issue.author ||= User.current
423 423 @issue.start_date ||= Date.today if Setting.default_issue_start_date_to_creation_date?
424 424 else
425 425 @issue = @project.issues.visible.find(params[:id])
426 426 end
427 427
428 @issue.safe_attributes = params[:issue]
428 if attrs = params[:issue].deep_dup
429 if params[:was_default_status] == attrs[:status_id]
430 attrs.delete(:status_id)
431 end
432 @issue.safe_attributes = attrs
433 end
429 434 @issue.tracker ||= @project.trackers.first
430 435 if @issue.tracker.nil?
431 436 render_error l(:error_no_tracker_in_project)
432 437 return false
433 438 end
439 if @issue.status.nil?
440 render_error l(:error_no_default_issue_status)
441 return false
442 end
434 443
435 444 @priorities = IssuePriority.active
436 445 @allowed_statuses = @issue.new_statuses_allowed_to(User.current, @issue.new_record?)
437 446 @available_watchers = @issue.watcher_users
438 447 if @issue.project.users.count <= 20
439 448 @available_watchers = (@available_watchers + @issue.project.users.sort).uniq
440 449 end
441 450 end
442 451
443 def check_for_default_issue_status
444 if IssueStatus.default.nil?
445 render_error l(:error_no_default_issue_status)
446 return false
447 end
448 end
449
450 452 def parse_params_for_bulk_issue_attributes(params)
451 453 attributes = (params[:issue] || {}).reject {|k,v| v.blank?}
452 454 attributes.keys.each {|k| attributes[k] = '' if attributes[k] == 'none'}
453 455 if custom = attributes[:custom_field_values]
454 456 custom.reject! {|k,v| v.blank?}
455 457 custom.keys.each do |k|
456 458 if custom[k].is_a?(Array)
457 459 custom[k] << '' if custom[k].delete('__none__')
458 460 else
459 461 custom[k] = '' if custom[k] == '__none__'
460 462 end
461 463 end
462 464 end
463 465 attributes
464 466 end
465 467
466 468 # Saves @issue and a time_entry from the parameters
467 469 def save_issue_with_child_records
468 470 Issue.transaction do
469 471 if params[:time_entry] && (params[:time_entry][:hours].present? || params[:time_entry][:comments].present?) && User.current.allowed_to?(:log_time, @issue.project)
470 472 time_entry = @time_entry || TimeEntry.new
471 473 time_entry.project = @issue.project
472 474 time_entry.issue = @issue
473 475 time_entry.user = User.current
474 476 time_entry.spent_on = User.current.today
475 477 time_entry.attributes = params[:time_entry]
476 478 @issue.time_entries << time_entry
477 479 end
478 480
479 481 call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => time_entry, :journal => @issue.current_journal})
480 482 if @issue.save
481 483 call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => time_entry, :journal => @issue.current_journal})
482 484 else
483 485 raise ActiveRecord::Rollback
484 486 end
485 487 end
486 488 end
487 489 end
@@ -1,1640 +1,1683
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class Issue < ActiveRecord::Base
19 19 include Redmine::SafeAttributes
20 20 include Redmine::Utils::DateCalculation
21 21 include Redmine::I18n
22 22
23 23 belongs_to :project
24 24 belongs_to :tracker
25 25 belongs_to :status, :class_name => 'IssueStatus'
26 26 belongs_to :author, :class_name => 'User'
27 27 belongs_to :assigned_to, :class_name => 'Principal'
28 28 belongs_to :fixed_version, :class_name => 'Version'
29 29 belongs_to :priority, :class_name => 'IssuePriority'
30 30 belongs_to :category, :class_name => 'IssueCategory'
31 31
32 32 has_many :journals, :as => :journalized, :dependent => :destroy
33 33 has_many :visible_journals,
34 34 lambda {where(["(#{Journal.table_name}.private_notes = ? OR (#{Project.allowed_to_condition(User.current, :view_private_notes)}))", false])},
35 35 :class_name => 'Journal',
36 36 :as => :journalized
37 37
38 38 has_many :time_entries, :dependent => :destroy
39 39 has_and_belongs_to_many :changesets, lambda {order("#{Changeset.table_name}.committed_on ASC, #{Changeset.table_name}.id ASC")}
40 40
41 41 has_many :relations_from, :class_name => 'IssueRelation', :foreign_key => 'issue_from_id', :dependent => :delete_all
42 42 has_many :relations_to, :class_name => 'IssueRelation', :foreign_key => 'issue_to_id', :dependent => :delete_all
43 43
44 44 acts_as_nested_set :scope => 'root_id', :dependent => :destroy
45 45 acts_as_attachable :after_add => :attachment_added, :after_remove => :attachment_removed
46 46 acts_as_customizable
47 47 acts_as_watchable
48 48 acts_as_searchable :columns => ['subject', "#{table_name}.description", "#{Journal.table_name}.notes"],
49 49 # sort by id so that limited eager loading doesn't break with postgresql
50 50 :order_column => "#{table_name}.id",
51 51 :scope => lambda { joins(:project).
52 52 joins("LEFT OUTER JOIN #{Journal.table_name} ON #{Journal.table_name}.journalized_type='Issue'" +
53 53 " AND #{Journal.table_name}.journalized_id = #{Issue.table_name}.id" +
54 54 " AND (#{Journal.table_name}.private_notes = #{connection.quoted_false}" +
55 55 " OR (#{Project.allowed_to_condition(User.current, :view_private_notes)}))") }
56 56
57 57 acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id} (#{o.status}): #{o.subject}"},
58 58 :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}},
59 59 :type => Proc.new {|o| 'issue' + (o.closed? ? ' closed' : '') }
60 60
61 61 acts_as_activity_provider :scope => preload(:project, :author, :tracker),
62 62 :author_key => :author_id
63 63
64 64 DONE_RATIO_OPTIONS = %w(issue_field issue_status)
65 65
66 66 attr_reader :current_journal
67 67 delegate :notes, :notes=, :private_notes, :private_notes=, :to => :current_journal, :allow_nil => true
68 68
69 69 validates_presence_of :subject, :priority, :project, :tracker, :author, :status
70 70
71 71 validates_length_of :subject, :maximum => 255
72 72 validates_inclusion_of :done_ratio, :in => 0..100
73 73 validates :estimated_hours, :numericality => {:greater_than_or_equal_to => 0, :allow_nil => true, :message => :invalid}
74 74 validates :start_date, :date => true
75 75 validates :due_date, :date => true
76 76 validate :validate_issue, :validate_required_fields
77 77 attr_protected :id
78 78
79 79 scope :visible, lambda {|*args|
80 80 includes(:project).
81 81 references(:project).
82 82 where(Issue.visible_condition(args.shift || User.current, *args))
83 83 }
84 84
85 85 scope :open, lambda {|*args|
86 86 is_closed = args.size > 0 ? !args.first : false
87 87 joins(:status).
88 88 where("#{IssueStatus.table_name}.is_closed = ?", is_closed)
89 89 }
90 90
91 91 scope :recently_updated, lambda { order("#{Issue.table_name}.updated_on DESC") }
92 92 scope :on_active_project, lambda {
93 93 joins(:project).
94 94 where("#{Project.table_name}.status = ?", Project::STATUS_ACTIVE)
95 95 }
96 96 scope :fixed_version, lambda {|versions|
97 97 ids = [versions].flatten.compact.map {|v| v.is_a?(Version) ? v.id : v}
98 98 ids.any? ? where(:fixed_version_id => ids) : where('1=0')
99 99 }
100 100
101 101 before_create :default_assign
102 102 before_save :close_duplicates, :update_done_ratio_from_issue_status,
103 103 :force_updated_on_change, :update_closed_on, :set_assigned_to_was
104 104 after_save {|issue| issue.send :after_project_change if !issue.id_changed? && issue.project_id_changed?}
105 105 after_save :reschedule_following_issues, :update_nested_set_attributes,
106 106 :update_parent_attributes, :create_journal
107 107 # Should be after_create but would be called before previous after_save callbacks
108 108 after_save :after_create_from_copy
109 109 after_destroy :update_parent_attributes
110 110 after_create :send_notification
111 111 # Keep it at the end of after_save callbacks
112 112 after_save :clear_assigned_to_was
113 113
114 114 # Returns a SQL conditions string used to find all issues visible by the specified user
115 115 def self.visible_condition(user, options={})
116 116 Project.allowed_to_condition(user, :view_issues, options) do |role, user|
117 117 if user.id && user.logged?
118 118 case role.issues_visibility
119 119 when 'all'
120 120 nil
121 121 when 'default'
122 122 user_ids = [user.id] + user.groups.map(&:id).compact
123 123 "(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
124 124 when 'own'
125 125 user_ids = [user.id] + user.groups.map(&:id).compact
126 126 "(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
127 127 else
128 128 '1=0'
129 129 end
130 130 else
131 131 "(#{table_name}.is_private = #{connection.quoted_false})"
132 132 end
133 133 end
134 134 end
135 135
136 136 # Returns true if usr or current user is allowed to view the issue
137 137 def visible?(usr=nil)
138 138 (usr || User.current).allowed_to?(:view_issues, self.project) do |role, user|
139 139 if user.logged?
140 140 case role.issues_visibility
141 141 when 'all'
142 142 true
143 143 when 'default'
144 144 !self.is_private? || (self.author == user || user.is_or_belongs_to?(assigned_to))
145 145 when 'own'
146 146 self.author == user || user.is_or_belongs_to?(assigned_to)
147 147 else
148 148 false
149 149 end
150 150 else
151 151 !self.is_private?
152 152 end
153 153 end
154 154 end
155 155
156 156 # Returns true if user or current user is allowed to edit or add a note to the issue
157 157 def editable?(user=User.current)
158 158 user.allowed_to?(:edit_issues, project) || user.allowed_to?(:add_issue_notes, project)
159 159 end
160 160
161 161 def initialize(attributes=nil, *args)
162 162 super
163 163 if new_record?
164 164 # set default values for new records only
165 self.status ||= IssueStatus.default
166 165 self.priority ||= IssuePriority.default
167 166 self.watcher_user_ids = []
168 167 end
169 168 end
170 169
171 170 def create_or_update
172 171 super
173 172 ensure
174 173 @status_was = nil
175 174 end
176 175 private :create_or_update
177 176
178 177 # AR#Persistence#destroy would raise and RecordNotFound exception
179 178 # if the issue was already deleted or updated (non matching lock_version).
180 179 # This is a problem when bulk deleting issues or deleting a project
181 180 # (because an issue may already be deleted if its parent was deleted
182 181 # first).
183 182 # The issue is reloaded by the nested_set before being deleted so
184 183 # the lock_version condition should not be an issue but we handle it.
185 184 def destroy
186 185 super
187 186 rescue ActiveRecord::RecordNotFound
188 187 # Stale or already deleted
189 188 begin
190 189 reload
191 190 rescue ActiveRecord::RecordNotFound
192 191 # The issue was actually already deleted
193 192 @destroyed = true
194 193 return freeze
195 194 end
196 195 # The issue was stale, retry to destroy
197 196 super
198 197 end
199 198
200 199 alias :base_reload :reload
201 200 def reload(*args)
202 201 @workflow_rule_by_attribute = nil
203 202 @assignable_versions = nil
204 203 @relations = nil
205 204 base_reload(*args)
206 205 end
207 206
208 207 # Overrides Redmine::Acts::Customizable::InstanceMethods#available_custom_fields
209 208 def available_custom_fields
210 209 (project && tracker) ? (project.all_issue_custom_fields & tracker.custom_fields) : []
211 210 end
212 211
213 212 def visible_custom_field_values(user=nil)
214 213 user_real = user || User.current
215 214 custom_field_values.select do |value|
216 215 value.custom_field.visible_by?(project, user_real)
217 216 end
218 217 end
219 218
220 219 # Copies attributes from another issue, arg can be an id or an Issue
221 220 def copy_from(arg, options={})
222 221 issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg)
223 222 self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on")
224 223 self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
225 224 self.status = issue.status
226 225 self.author = User.current
227 226 unless options[:attachments] == false
228 227 self.attachments = issue.attachments.map do |attachement|
229 228 attachement.copy(:container => self)
230 229 end
231 230 end
232 231 @copied_from = issue
233 232 @copy_options = options
234 233 self
235 234 end
236 235
237 236 # Returns an unsaved copy of the issue
238 237 def copy(attributes=nil, copy_options={})
239 238 copy = self.class.new.copy_from(self, copy_options)
240 239 copy.attributes = attributes if attributes
241 240 copy
242 241 end
243 242
244 243 # Returns true if the issue is a copy
245 244 def copy?
246 245 @copied_from.present?
247 246 end
248 247
249 248 # Moves/copies an issue to a new project and tracker
250 249 # Returns the moved/copied issue on success, false on failure
251 250 def move_to_project(new_project, new_tracker=nil, options={})
252 251 ActiveSupport::Deprecation.warn "Issue#move_to_project is deprecated, use #project= instead."
253 252
254 253 if options[:copy]
255 254 issue = self.copy
256 255 else
257 256 issue = self
258 257 end
259 258
260 259 issue.init_journal(User.current, options[:notes])
261 260
262 261 # Preserve previous behaviour
263 262 # #move_to_project doesn't change tracker automatically
264 263 issue.send :project=, new_project, true
265 264 if new_tracker
266 265 issue.tracker = new_tracker
267 266 end
268 267 # Allow bulk setting of attributes on the issue
269 268 if options[:attributes]
270 269 issue.attributes = options[:attributes]
271 270 end
272 271
273 272 issue.save ? issue : false
274 273 end
275 274
276 def status_id=(sid)
277 self.status = nil
278 result = write_attribute(:status_id, sid)
279 @workflow_rule_by_attribute = nil
280 result
275 def status_id=(status_id)
276 if status_id.to_s != self.status_id.to_s
277 self.status = (status_id.present? ? IssueStatus.find_by_id(status_id) : nil)
278 end
279 self.status_id
280 end
281
282 # Sets the status.
283 def self.status=(status)
284 if status != self.status
285 @workflow_rule_by_attribute = nil
286 end
287 association(:status).writer(status)
281 288 end
282 289
283 290 def priority_id=(pid)
284 291 self.priority = nil
285 292 write_attribute(:priority_id, pid)
286 293 end
287 294
288 295 def category_id=(cid)
289 296 self.category = nil
290 297 write_attribute(:category_id, cid)
291 298 end
292 299
293 300 def fixed_version_id=(vid)
294 301 self.fixed_version = nil
295 302 write_attribute(:fixed_version_id, vid)
296 303 end
297 304
298 305 def tracker_id=(tracker_id)
299 306 if tracker_id.to_s != self.tracker_id.to_s
300 307 self.tracker = (tracker_id.present? ? Tracker.find_by_id(tracker_id) : nil)
301 308 end
302 309 self.tracker_id
303 310 end
304 311
312 # Sets the tracker.
313 # This will set the status to the default status of the new tracker if:
314 # * the status was the default for the previous tracker
315 # * or if the status was not part of the new tracker statuses
316 # * or the status was nil
305 317 def tracker=(tracker)
306 318 if tracker != self.tracker
319 if status == default_status
320 self.status = nil
321 elsif status && tracker && !tracker.issue_status_ids.include?(status.id)
322 self.status = nil
323 end
307 324 @custom_field_values = nil
308 325 @workflow_rule_by_attribute = nil
309 326 end
310 327 association(:tracker).writer(tracker)
328 self.status ||= default_status
329 self.tracker
311 330 end
312 331
313 332 def project_id=(project_id)
314 333 if project_id.to_s != self.project_id.to_s
315 334 self.project = (project_id.present? ? Project.find_by_id(project_id) : nil)
316 335 end
317 336 self.project_id
318 337 end
319 338
339 # Sets the project.
340 # Unless keep_tracker argument is set to true, this will change the tracker
341 # to the first tracker of the new project if the previous tracker is not part
342 # of the new project trackers.
343 # This will clear the fixed_version is it's no longer valid for the new project.
344 # This will clear the parent issue if it's no longer valid for the new project.
345 # This will set the category to the category with the same name in the new
346 # project if it exists, or clear it if it doesn't.
320 347 def project=(project, keep_tracker=false)
321 348 project_was = self.project
322 349 association(:project).writer(project)
323 350 if project_was && project && project_was != project
324 351 @assignable_versions = nil
325 352
326 353 unless keep_tracker || project.trackers.include?(tracker)
327 354 self.tracker = project.trackers.first
328 355 end
329 356 # Reassign to the category with same name if any
330 357 if category
331 358 self.category = project.issue_categories.find_by_name(category.name)
332 359 end
333 360 # Keep the fixed_version if it's still valid in the new_project
334 361 if fixed_version && fixed_version.project != project && !project.shared_versions.include?(fixed_version)
335 362 self.fixed_version = nil
336 363 end
337 364 # Clear the parent task if it's no longer valid
338 365 unless valid_parent_project?
339 366 self.parent_issue_id = nil
340 367 end
341 368 @custom_field_values = nil
369 @workflow_rule_by_attribute = nil
342 370 end
371 self.project
343 372 end
344 373
345 374 def description=(arg)
346 375 if arg.is_a?(String)
347 376 arg = arg.gsub(/(\r\n|\n|\r)/, "\r\n")
348 377 end
349 378 write_attribute(:description, arg)
350 379 end
351 380
352 381 # Overrides assign_attributes so that project and tracker get assigned first
353 382 def assign_attributes_with_project_and_tracker_first(new_attributes, *args)
354 383 return if new_attributes.nil?
355 384 attrs = new_attributes.dup
356 385 attrs.stringify_keys!
357 386
358 387 %w(project project_id tracker tracker_id).each do |attr|
359 388 if attrs.has_key?(attr)
360 389 send "#{attr}=", attrs.delete(attr)
361 390 end
362 391 end
363 392 send :assign_attributes_without_project_and_tracker_first, attrs, *args
364 393 end
365 394 # Do not redefine alias chain on reload (see #4838)
366 395 alias_method_chain(:assign_attributes, :project_and_tracker_first) unless method_defined?(:assign_attributes_without_project_and_tracker_first)
367 396
368 397 def attributes=(new_attributes)
369 398 assign_attributes new_attributes
370 399 end
371 400
372 401 def estimated_hours=(h)
373 402 write_attribute :estimated_hours, (h.is_a?(String) ? h.to_hours : h)
374 403 end
375 404
376 405 safe_attributes 'project_id',
377 406 :if => lambda {|issue, user|
378 407 if issue.new_record?
379 408 issue.copy?
380 409 elsif user.allowed_to?(:move_issues, issue.project)
381 410 Issue.allowed_target_projects_on_move.count > 1
382 411 end
383 412 }
384 413
385 414 safe_attributes 'tracker_id',
386 415 'status_id',
387 416 'category_id',
388 417 'assigned_to_id',
389 418 'priority_id',
390 419 'fixed_version_id',
391 420 'subject',
392 421 'description',
393 422 'start_date',
394 423 'due_date',
395 424 'done_ratio',
396 425 'estimated_hours',
397 426 'custom_field_values',
398 427 'custom_fields',
399 428 'lock_version',
400 429 'notes',
401 430 :if => lambda {|issue, user| issue.new_record? || user.allowed_to?(:edit_issues, issue.project) }
402 431
403 432 safe_attributes 'status_id',
404 433 'assigned_to_id',
405 434 'fixed_version_id',
406 435 'done_ratio',
407 436 'lock_version',
408 437 'notes',
409 438 :if => lambda {|issue, user| issue.new_statuses_allowed_to(user).any? }
410 439
411 440 safe_attributes 'notes',
412 441 :if => lambda {|issue, user| user.allowed_to?(:add_issue_notes, issue.project)}
413 442
414 443 safe_attributes 'private_notes',
415 444 :if => lambda {|issue, user| !issue.new_record? && user.allowed_to?(:set_notes_private, issue.project)}
416 445
417 446 safe_attributes 'watcher_user_ids',
418 447 :if => lambda {|issue, user| issue.new_record? && user.allowed_to?(:add_issue_watchers, issue.project)}
419 448
420 449 safe_attributes 'is_private',
421 450 :if => lambda {|issue, user|
422 451 user.allowed_to?(:set_issues_private, issue.project) ||
423 452 (issue.author == user && user.allowed_to?(:set_own_issues_private, issue.project))
424 453 }
425 454
426 455 safe_attributes 'parent_issue_id',
427 456 :if => lambda {|issue, user| (issue.new_record? || user.allowed_to?(:edit_issues, issue.project)) &&
428 457 user.allowed_to?(:manage_subtasks, issue.project)}
429 458
430 459 def safe_attribute_names(user=nil)
431 460 names = super
432 461 names -= disabled_core_fields
433 462 names -= read_only_attribute_names(user)
434 463 names
435 464 end
436 465
437 466 # Safely sets attributes
438 467 # Should be called from controllers instead of #attributes=
439 468 # attr_accessible is too rough because we still want things like
440 469 # Issue.new(:project => foo) to work
441 470 def safe_attributes=(attrs, user=User.current)
442 471 return unless attrs.is_a?(Hash)
443 472
444 473 attrs = attrs.deep_dup
445 474
446 475 # Project and Tracker must be set before since new_statuses_allowed_to depends on it.
447 476 if (p = attrs.delete('project_id')) && safe_attribute?('project_id')
448 477 if allowed_target_projects(user).where(:id => p.to_i).exists?
449 478 self.project_id = p
450 479 end
451 480 end
452 481
453 482 if (t = attrs.delete('tracker_id')) && safe_attribute?('tracker_id')
454 483 self.tracker_id = t
455 484 end
456 485
457 486 if (s = attrs.delete('status_id')) && safe_attribute?('status_id')
458 487 if new_statuses_allowed_to(user).collect(&:id).include?(s.to_i)
459 488 self.status_id = s
460 489 end
461 490 end
462 491
463 492 attrs = delete_unsafe_attributes(attrs, user)
464 493 return if attrs.empty?
465 494
466 495 unless leaf?
467 496 attrs.reject! {|k,v| %w(priority_id done_ratio start_date due_date estimated_hours).include?(k)}
468 497 end
469 498
470 499 if attrs['parent_issue_id'].present?
471 500 s = attrs['parent_issue_id'].to_s
472 501 unless (m = s.match(%r{\A#?(\d+)\z})) && (m[1] == parent_id.to_s || Issue.visible(user).exists?(m[1]))
473 502 @invalid_parent_issue_id = attrs.delete('parent_issue_id')
474 503 end
475 504 end
476 505
477 506 if attrs['custom_field_values'].present?
478 507 editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}
479 508 attrs['custom_field_values'].select! {|k, v| editable_custom_field_ids.include?(k.to_s)}
480 509 end
481 510
482 511 if attrs['custom_fields'].present?
483 512 editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}
484 513 attrs['custom_fields'].select! {|c| editable_custom_field_ids.include?(c['id'].to_s)}
485 514 end
486 515
487 516 # mass-assignment security bypass
488 517 assign_attributes attrs, :without_protection => true
489 518 end
490 519
491 520 def disabled_core_fields
492 521 tracker ? tracker.disabled_core_fields : []
493 522 end
494 523
495 524 # Returns the custom_field_values that can be edited by the given user
496 525 def editable_custom_field_values(user=nil)
497 526 visible_custom_field_values(user).reject do |value|
498 527 read_only_attribute_names(user).include?(value.custom_field_id.to_s)
499 528 end
500 529 end
501 530
502 531 # Returns the custom fields that can be edited by the given user
503 532 def editable_custom_fields(user=nil)
504 533 editable_custom_field_values(user).map(&:custom_field).uniq
505 534 end
506 535
507 536 # Returns the names of attributes that are read-only for user or the current user
508 537 # For users with multiple roles, the read-only fields are the intersection of
509 538 # read-only fields of each role
510 539 # The result is an array of strings where sustom fields are represented with their ids
511 540 #
512 541 # Examples:
513 542 # issue.read_only_attribute_names # => ['due_date', '2']
514 543 # issue.read_only_attribute_names(user) # => []
515 544 def read_only_attribute_names(user=nil)
516 545 workflow_rule_by_attribute(user).reject {|attr, rule| rule != 'readonly'}.keys
517 546 end
518 547
519 548 # Returns the names of required attributes for user or the current user
520 549 # For users with multiple roles, the required fields are the intersection of
521 550 # required fields of each role
522 551 # The result is an array of strings where sustom fields are represented with their ids
523 552 #
524 553 # Examples:
525 554 # issue.required_attribute_names # => ['due_date', '2']
526 555 # issue.required_attribute_names(user) # => []
527 556 def required_attribute_names(user=nil)
528 557 workflow_rule_by_attribute(user).reject {|attr, rule| rule != 'required'}.keys
529 558 end
530 559
531 560 # Returns true if the attribute is required for user
532 561 def required_attribute?(name, user=nil)
533 562 required_attribute_names(user).include?(name.to_s)
534 563 end
535 564
536 565 # Returns a hash of the workflow rule by attribute for the given user
537 566 #
538 567 # Examples:
539 568 # issue.workflow_rule_by_attribute # => {'due_date' => 'required', 'start_date' => 'readonly'}
540 569 def workflow_rule_by_attribute(user=nil)
541 570 return @workflow_rule_by_attribute if @workflow_rule_by_attribute && user.nil?
542 571
543 572 user_real = user || User.current
544 573 roles = user_real.admin ? Role.all.to_a : user_real.roles_for_project(project)
545 574 return {} if roles.empty?
546 575
547 576 result = {}
548 577 workflow_permissions = WorkflowPermission.where(:tracker_id => tracker_id, :old_status_id => status_id, :role_id => roles.map(&:id)).to_a
549 578 if workflow_permissions.any?
550 579 workflow_rules = workflow_permissions.inject({}) do |h, wp|
551 580 h[wp.field_name] ||= []
552 581 h[wp.field_name] << wp.rule
553 582 h
554 583 end
555 584 workflow_rules.each do |attr, rules|
556 585 next if rules.size < roles.size
557 586 uniq_rules = rules.uniq
558 587 if uniq_rules.size == 1
559 588 result[attr] = uniq_rules.first
560 589 else
561 590 result[attr] = 'required'
562 591 end
563 592 end
564 593 end
565 594 @workflow_rule_by_attribute = result if user.nil?
566 595 result
567 596 end
568 597 private :workflow_rule_by_attribute
569 598
570 599 def done_ratio
571 600 if Issue.use_status_for_done_ratio? && status && status.default_done_ratio
572 601 status.default_done_ratio
573 602 else
574 603 read_attribute(:done_ratio)
575 604 end
576 605 end
577 606
578 607 def self.use_status_for_done_ratio?
579 608 Setting.issue_done_ratio == 'issue_status'
580 609 end
581 610
582 611 def self.use_field_for_done_ratio?
583 612 Setting.issue_done_ratio == 'issue_field'
584 613 end
585 614
586 615 def validate_issue
587 616 if due_date && start_date && (start_date_changed? || due_date_changed?) && due_date < start_date
588 617 errors.add :due_date, :greater_than_start_date
589 618 end
590 619
591 620 if start_date && start_date_changed? && soonest_start && start_date < soonest_start
592 621 errors.add :start_date, :earlier_than_minimum_start_date, :date => format_date(soonest_start)
593 622 end
594 623
595 624 if fixed_version
596 625 if !assignable_versions.include?(fixed_version)
597 626 errors.add :fixed_version_id, :inclusion
598 627 elsif reopening? && fixed_version.closed?
599 628 errors.add :base, I18n.t(:error_can_not_reopen_issue_on_closed_version)
600 629 end
601 630 end
602 631
603 632 # Checks that the issue can not be added/moved to a disabled tracker
604 633 if project && (tracker_id_changed? || project_id_changed?)
605 634 unless project.trackers.include?(tracker)
606 635 errors.add :tracker_id, :inclusion
607 636 end
608 637 end
609 638
610 639 # Checks parent issue assignment
611 640 if @invalid_parent_issue_id.present?
612 641 errors.add :parent_issue_id, :invalid
613 642 elsif @parent_issue
614 643 if !valid_parent_project?(@parent_issue)
615 644 errors.add :parent_issue_id, :invalid
616 645 elsif (@parent_issue != parent) && (all_dependent_issues.include?(@parent_issue) || @parent_issue.all_dependent_issues.include?(self))
617 646 errors.add :parent_issue_id, :invalid
618 647 elsif !new_record?
619 648 # moving an existing issue
620 649 if @parent_issue.root_id != root_id
621 650 # we can always move to another tree
622 651 elsif move_possible?(@parent_issue)
623 652 # move accepted inside tree
624 653 else
625 654 errors.add :parent_issue_id, :invalid
626 655 end
627 656 end
628 657 end
629 658 end
630 659
631 660 # Validates the issue against additional workflow requirements
632 661 def validate_required_fields
633 662 user = new_record? ? author : current_journal.try(:user)
634 663
635 664 required_attribute_names(user).each do |attribute|
636 665 if attribute =~ /^\d+$/
637 666 attribute = attribute.to_i
638 667 v = custom_field_values.detect {|v| v.custom_field_id == attribute }
639 668 if v && v.value.blank?
640 669 errors.add :base, v.custom_field.name + ' ' + l('activerecord.errors.messages.blank')
641 670 end
642 671 else
643 672 if respond_to?(attribute) && send(attribute).blank?
644 673 errors.add attribute, :blank
645 674 end
646 675 end
647 676 end
648 677 end
649 678
650 679 # Set the done_ratio using the status if that setting is set. This will keep the done_ratios
651 680 # even if the user turns off the setting later
652 681 def update_done_ratio_from_issue_status
653 682 if Issue.use_status_for_done_ratio? && status && status.default_done_ratio
654 683 self.done_ratio = status.default_done_ratio
655 684 end
656 685 end
657 686
658 687 def init_journal(user, notes = "")
659 688 @current_journal ||= Journal.new(:journalized => self, :user => user, :notes => notes)
660 689 if new_record?
661 690 @current_journal.notify = false
662 691 else
663 692 @attributes_before_change = attributes.dup
664 693 @custom_values_before_change = {}
665 694 self.custom_field_values.each {|c| @custom_values_before_change.store c.custom_field_id, c.value }
666 695 end
667 696 @current_journal
668 697 end
669 698
670 699 # Returns the current journal or nil if it's not initialized
671 700 def current_journal
672 701 @current_journal
673 702 end
674 703
675 704 # Returns the id of the last journal or nil
676 705 def last_journal_id
677 706 if new_record?
678 707 nil
679 708 else
680 709 journals.maximum(:id)
681 710 end
682 711 end
683 712
684 713 # Returns a scope for journals that have an id greater than journal_id
685 714 def journals_after(journal_id)
686 715 scope = journals.reorder("#{Journal.table_name}.id ASC")
687 716 if journal_id.present?
688 717 scope = scope.where("#{Journal.table_name}.id > ?", journal_id.to_i)
689 718 end
690 719 scope
691 720 end
692 721
693 722 # Returns the initial status of the issue
694 723 # Returns nil for a new issue
695 724 def status_was
696 725 if status_id_was && status_id_was.to_i > 0
697 726 @status_was ||= IssueStatus.find_by_id(status_id_was)
698 727 end
699 728 end
700 729
701 730 # Return true if the issue is closed, otherwise false
702 731 def closed?
703 732 status.present? && status.is_closed?
704 733 end
705 734
706 735 # Returns true if the issue was closed when loaded
707 736 def was_closed?
708 737 status_was.present? && status_was.is_closed?
709 738 end
710 739
711 740 # Return true if the issue is being reopened
712 741 def reopening?
713 742 if new_record?
714 743 false
715 744 else
716 745 status_id_changed? && !closed? && was_closed?
717 746 end
718 747 end
719 748 alias :reopened? :reopening?
720 749
721 750 # Return true if the issue is being closed
722 751 def closing?
723 752 if new_record?
724 753 closed?
725 754 else
726 755 status_id_changed? && closed? && !was_closed?
727 756 end
728 757 end
729 758
730 759 # Returns true if the issue is overdue
731 760 def overdue?
732 761 due_date.present? && (due_date < Date.today) && !closed?
733 762 end
734 763
735 764 # Is the amount of work done less than it should for the due date
736 765 def behind_schedule?
737 766 return false if start_date.nil? || due_date.nil?
738 767 done_date = start_date + ((due_date - start_date + 1) * done_ratio / 100).floor
739 768 return done_date <= Date.today
740 769 end
741 770
742 771 # Does this issue have children?
743 772 def children?
744 773 !leaf?
745 774 end
746 775
747 776 # Users the issue can be assigned to
748 777 def assignable_users
749 778 users = project.assignable_users.to_a
750 779 users << author if author
751 780 users << assigned_to if assigned_to
752 781 users.uniq.sort
753 782 end
754 783
755 784 # Versions that the issue can be assigned to
756 785 def assignable_versions
757 786 return @assignable_versions if @assignable_versions
758 787
759 788 versions = project.shared_versions.open.to_a
760 789 if fixed_version
761 790 if fixed_version_id_changed?
762 791 # nothing to do
763 792 elsif project_id_changed?
764 793 if project.shared_versions.include?(fixed_version)
765 794 versions << fixed_version
766 795 end
767 796 else
768 797 versions << fixed_version
769 798 end
770 799 end
771 800 @assignable_versions = versions.uniq.sort
772 801 end
773 802
774 803 # Returns true if this issue is blocked by another issue that is still open
775 804 def blocked?
776 805 !relations_to.detect {|ir| ir.relation_type == 'blocks' && !ir.issue_from.closed?}.nil?
777 806 end
778 807
808 # Returns the default status of the issue based on its tracker
809 # Returns nil if tracker is nil
810 def default_status
811 tracker.try(:default_status)
812 end
813
779 814 # Returns an array of statuses that user is able to apply
780 815 def new_statuses_allowed_to(user=User.current, include_default=false)
781 816 if new_record? && @copied_from
782 [IssueStatus.default, @copied_from.status].compact.uniq.sort
817 [default_status, @copied_from.status].compact.uniq.sort
783 818 else
784 819 initial_status = nil
785 820 if new_record?
786 initial_status = IssueStatus.default
821 initial_status = default_status
822 elsif tracker_id_changed?
823 if Tracker.where(:id => tracker_id_was, :default_status_id => status_id_was).any?
824 initial_status = default_status
825 elsif tracker.issue_status_ids.include?(status_id_was)
826 initial_status = IssueStatus.find_by_id(status_id_was)
827 else
828 initial_status = default_status
829 end
787 830 else
788 831 initial_status = status_was
789 832 end
790 833
791 834 initial_assigned_to_id = assigned_to_id_changed? ? assigned_to_id_was : assigned_to_id
792 835 assignee_transitions_allowed = initial_assigned_to_id.present? &&
793 836 (user.id == initial_assigned_to_id || user.group_ids.include?(initial_assigned_to_id))
794 837
795 838 statuses = []
796 839 if initial_status
797 840 statuses += initial_status.find_new_statuses_allowed_to(
798 841 user.admin ? Role.all.to_a : user.roles_for_project(project),
799 842 tracker,
800 843 author == user,
801 844 assignee_transitions_allowed
802 845 )
803 846 end
804 847 statuses << initial_status unless statuses.empty?
805 statuses << IssueStatus.default if include_default
848 statuses << default_status if include_default
806 849 statuses = statuses.compact.uniq.sort
807 850 if blocked?
808 851 statuses.reject!(&:is_closed?)
809 852 end
810 853 statuses
811 854 end
812 855 end
813 856
814 857 # Returns the previous assignee if changed
815 858 def assigned_to_was
816 859 # assigned_to_id_was is reset before after_save callbacks
817 860 user_id = @previous_assigned_to_id || assigned_to_id_was
818 861 if user_id && user_id != assigned_to_id
819 862 @assigned_to_was ||= User.find_by_id(user_id)
820 863 end
821 864 end
822 865
823 866 # Returns the users that should be notified
824 867 def notified_users
825 868 notified = []
826 869 # Author and assignee are always notified unless they have been
827 870 # locked or don't want to be notified
828 871 notified << author if author
829 872 if assigned_to
830 873 notified += (assigned_to.is_a?(Group) ? assigned_to.users : [assigned_to])
831 874 end
832 875 if assigned_to_was
833 876 notified += (assigned_to_was.is_a?(Group) ? assigned_to_was.users : [assigned_to_was])
834 877 end
835 878 notified = notified.select {|u| u.active? && u.notify_about?(self)}
836 879
837 880 notified += project.notified_users
838 881 notified.uniq!
839 882 # Remove users that can not view the issue
840 883 notified.reject! {|user| !visible?(user)}
841 884 notified
842 885 end
843 886
844 887 # Returns the email addresses that should be notified
845 888 def recipients
846 889 notified_users.collect(&:mail)
847 890 end
848 891
849 892 def each_notification(users, &block)
850 893 if users.any?
851 894 if custom_field_values.detect {|value| !value.custom_field.visible?}
852 895 users_by_custom_field_visibility = users.group_by do |user|
853 896 visible_custom_field_values(user).map(&:custom_field_id).sort
854 897 end
855 898 users_by_custom_field_visibility.values.each do |users|
856 899 yield(users)
857 900 end
858 901 else
859 902 yield(users)
860 903 end
861 904 end
862 905 end
863 906
864 907 # Returns the number of hours spent on this issue
865 908 def spent_hours
866 909 @spent_hours ||= time_entries.sum(:hours) || 0
867 910 end
868 911
869 912 # Returns the total number of hours spent on this issue and its descendants
870 913 #
871 914 # Example:
872 915 # spent_hours => 0.0
873 916 # spent_hours => 50.2
874 917 def total_spent_hours
875 918 @total_spent_hours ||=
876 919 self_and_descendants.
877 920 joins("LEFT JOIN #{TimeEntry.table_name} ON #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id").
878 921 sum("#{TimeEntry.table_name}.hours").to_f || 0.0
879 922 end
880 923
881 924 def relations
882 925 @relations ||= IssueRelation::Relations.new(self, (relations_from + relations_to).sort)
883 926 end
884 927
885 928 # Preloads relations for a collection of issues
886 929 def self.load_relations(issues)
887 930 if issues.any?
888 931 relations = IssueRelation.where("issue_from_id IN (:ids) OR issue_to_id IN (:ids)", :ids => issues.map(&:id)).all
889 932 issues.each do |issue|
890 933 issue.instance_variable_set "@relations", relations.select {|r| r.issue_from_id == issue.id || r.issue_to_id == issue.id}
891 934 end
892 935 end
893 936 end
894 937
895 938 # Preloads visible spent time for a collection of issues
896 939 def self.load_visible_spent_hours(issues, user=User.current)
897 940 if issues.any?
898 941 hours_by_issue_id = TimeEntry.visible(user).group(:issue_id).sum(:hours)
899 942 issues.each do |issue|
900 943 issue.instance_variable_set "@spent_hours", (hours_by_issue_id[issue.id] || 0)
901 944 end
902 945 end
903 946 end
904 947
905 948 # Preloads visible relations for a collection of issues
906 949 def self.load_visible_relations(issues, user=User.current)
907 950 if issues.any?
908 951 issue_ids = issues.map(&:id)
909 952 # Relations with issue_from in given issues and visible issue_to
910 953 relations_from = IssueRelation.joins(:issue_to => :project).
911 954 where(visible_condition(user)).where(:issue_from_id => issue_ids).to_a
912 955 # Relations with issue_to in given issues and visible issue_from
913 956 relations_to = IssueRelation.joins(:issue_from => :project).
914 957 where(visible_condition(user)).
915 958 where(:issue_to_id => issue_ids).to_a
916 959 issues.each do |issue|
917 960 relations =
918 961 relations_from.select {|relation| relation.issue_from_id == issue.id} +
919 962 relations_to.select {|relation| relation.issue_to_id == issue.id}
920 963
921 964 issue.instance_variable_set "@relations", IssueRelation::Relations.new(issue, relations.sort)
922 965 end
923 966 end
924 967 end
925 968
926 969 # Finds an issue relation given its id.
927 970 def find_relation(relation_id)
928 971 IssueRelation.where("issue_to_id = ? OR issue_from_id = ?", id, id).find(relation_id)
929 972 end
930 973
931 974 # Returns all the other issues that depend on the issue
932 975 # The algorithm is a modified breadth first search (bfs)
933 976 def all_dependent_issues(except=[])
934 977 # The found dependencies
935 978 dependencies = []
936 979
937 980 # The visited flag for every node (issue) used by the breadth first search
938 981 eNOT_DISCOVERED = 0 # The issue is "new" to the algorithm, it has not seen it before.
939 982
940 983 ePROCESS_ALL = 1 # The issue is added to the queue. Process both children and relations of
941 984 # the issue when it is processed.
942 985
943 986 ePROCESS_RELATIONS_ONLY = 2 # The issue was added to the queue and will be output as dependent issue,
944 987 # but its children will not be added to the queue when it is processed.
945 988
946 989 eRELATIONS_PROCESSED = 3 # The related issues, the parent issue and the issue itself have been added to
947 990 # the queue, but its children have not been added.
948 991
949 992 ePROCESS_CHILDREN_ONLY = 4 # The relations and the parent of the issue have been added to the queue, but
950 993 # the children still need to be processed.
951 994
952 995 eALL_PROCESSED = 5 # The issue and all its children, its parent and its related issues have been
953 996 # added as dependent issues. It needs no further processing.
954 997
955 998 issue_status = Hash.new(eNOT_DISCOVERED)
956 999
957 1000 # The queue
958 1001 queue = []
959 1002
960 1003 # Initialize the bfs, add start node (self) to the queue
961 1004 queue << self
962 1005 issue_status[self] = ePROCESS_ALL
963 1006
964 1007 while (!queue.empty?) do
965 1008 current_issue = queue.shift
966 1009 current_issue_status = issue_status[current_issue]
967 1010 dependencies << current_issue
968 1011
969 1012 # Add parent to queue, if not already in it.
970 1013 parent = current_issue.parent
971 1014 parent_status = issue_status[parent]
972 1015
973 1016 if parent && (parent_status == eNOT_DISCOVERED) && !except.include?(parent)
974 1017 queue << parent
975 1018 issue_status[parent] = ePROCESS_RELATIONS_ONLY
976 1019 end
977 1020
978 1021 # Add children to queue, but only if they are not already in it and
979 1022 # the children of the current node need to be processed.
980 1023 if (current_issue_status == ePROCESS_CHILDREN_ONLY || current_issue_status == ePROCESS_ALL)
981 1024 current_issue.children.each do |child|
982 1025 next if except.include?(child)
983 1026
984 1027 if (issue_status[child] == eNOT_DISCOVERED)
985 1028 queue << child
986 1029 issue_status[child] = ePROCESS_ALL
987 1030 elsif (issue_status[child] == eRELATIONS_PROCESSED)
988 1031 queue << child
989 1032 issue_status[child] = ePROCESS_CHILDREN_ONLY
990 1033 elsif (issue_status[child] == ePROCESS_RELATIONS_ONLY)
991 1034 queue << child
992 1035 issue_status[child] = ePROCESS_ALL
993 1036 end
994 1037 end
995 1038 end
996 1039
997 1040 # Add related issues to the queue, if they are not already in it.
998 1041 current_issue.relations_from.map(&:issue_to).each do |related_issue|
999 1042 next if except.include?(related_issue)
1000 1043
1001 1044 if (issue_status[related_issue] == eNOT_DISCOVERED)
1002 1045 queue << related_issue
1003 1046 issue_status[related_issue] = ePROCESS_ALL
1004 1047 elsif (issue_status[related_issue] == eRELATIONS_PROCESSED)
1005 1048 queue << related_issue
1006 1049 issue_status[related_issue] = ePROCESS_CHILDREN_ONLY
1007 1050 elsif (issue_status[related_issue] == ePROCESS_RELATIONS_ONLY)
1008 1051 queue << related_issue
1009 1052 issue_status[related_issue] = ePROCESS_ALL
1010 1053 end
1011 1054 end
1012 1055
1013 1056 # Set new status for current issue
1014 1057 if (current_issue_status == ePROCESS_ALL) || (current_issue_status == ePROCESS_CHILDREN_ONLY)
1015 1058 issue_status[current_issue] = eALL_PROCESSED
1016 1059 elsif (current_issue_status == ePROCESS_RELATIONS_ONLY)
1017 1060 issue_status[current_issue] = eRELATIONS_PROCESSED
1018 1061 end
1019 1062 end # while
1020 1063
1021 1064 # Remove the issues from the "except" parameter from the result array
1022 1065 dependencies -= except
1023 1066 dependencies.delete(self)
1024 1067
1025 1068 dependencies
1026 1069 end
1027 1070
1028 1071 # Returns an array of issues that duplicate this one
1029 1072 def duplicates
1030 1073 relations_to.select {|r| r.relation_type == IssueRelation::TYPE_DUPLICATES}.collect {|r| r.issue_from}
1031 1074 end
1032 1075
1033 1076 # Returns the due date or the target due date if any
1034 1077 # Used on gantt chart
1035 1078 def due_before
1036 1079 due_date || (fixed_version ? fixed_version.effective_date : nil)
1037 1080 end
1038 1081
1039 1082 # Returns the time scheduled for this issue.
1040 1083 #
1041 1084 # Example:
1042 1085 # Start Date: 2/26/09, End Date: 3/04/09
1043 1086 # duration => 6
1044 1087 def duration
1045 1088 (start_date && due_date) ? due_date - start_date : 0
1046 1089 end
1047 1090
1048 1091 # Returns the duration in working days
1049 1092 def working_duration
1050 1093 (start_date && due_date) ? working_days(start_date, due_date) : 0
1051 1094 end
1052 1095
1053 1096 def soonest_start(reload=false)
1054 1097 @soonest_start = nil if reload
1055 1098 @soonest_start ||= (
1056 1099 relations_to(reload).collect{|relation| relation.successor_soonest_start} +
1057 1100 [(@parent_issue || parent).try(:soonest_start)]
1058 1101 ).compact.max
1059 1102 end
1060 1103
1061 1104 # Sets start_date on the given date or the next working day
1062 1105 # and changes due_date to keep the same working duration.
1063 1106 def reschedule_on(date)
1064 1107 wd = working_duration
1065 1108 date = next_working_date(date)
1066 1109 self.start_date = date
1067 1110 self.due_date = add_working_days(date, wd)
1068 1111 end
1069 1112
1070 1113 # Reschedules the issue on the given date or the next working day and saves the record.
1071 1114 # If the issue is a parent task, this is done by rescheduling its subtasks.
1072 1115 def reschedule_on!(date)
1073 1116 return if date.nil?
1074 1117 if leaf?
1075 1118 if start_date.nil? || start_date != date
1076 1119 if start_date && start_date > date
1077 1120 # Issue can not be moved earlier than its soonest start date
1078 1121 date = [soonest_start(true), date].compact.max
1079 1122 end
1080 1123 reschedule_on(date)
1081 1124 begin
1082 1125 save
1083 1126 rescue ActiveRecord::StaleObjectError
1084 1127 reload
1085 1128 reschedule_on(date)
1086 1129 save
1087 1130 end
1088 1131 end
1089 1132 else
1090 1133 leaves.each do |leaf|
1091 1134 if leaf.start_date
1092 1135 # Only move subtask if it starts at the same date as the parent
1093 1136 # or if it starts before the given date
1094 1137 if start_date == leaf.start_date || date > leaf.start_date
1095 1138 leaf.reschedule_on!(date)
1096 1139 end
1097 1140 else
1098 1141 leaf.reschedule_on!(date)
1099 1142 end
1100 1143 end
1101 1144 end
1102 1145 end
1103 1146
1104 1147 def <=>(issue)
1105 1148 if issue.nil?
1106 1149 -1
1107 1150 elsif root_id != issue.root_id
1108 1151 (root_id || 0) <=> (issue.root_id || 0)
1109 1152 else
1110 1153 (lft || 0) <=> (issue.lft || 0)
1111 1154 end
1112 1155 end
1113 1156
1114 1157 def to_s
1115 1158 "#{tracker} ##{id}: #{subject}"
1116 1159 end
1117 1160
1118 1161 # Returns a string of css classes that apply to the issue
1119 1162 def css_classes(user=User.current)
1120 1163 s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}"
1121 1164 s << ' closed' if closed?
1122 1165 s << ' overdue' if overdue?
1123 1166 s << ' child' if child?
1124 1167 s << ' parent' unless leaf?
1125 1168 s << ' private' if is_private?
1126 1169 if user.logged?
1127 1170 s << ' created-by-me' if author_id == user.id
1128 1171 s << ' assigned-to-me' if assigned_to_id == user.id
1129 1172 s << ' assigned-to-my-group' if user.groups.any? {|g| g.id == assigned_to_id}
1130 1173 end
1131 1174 s
1132 1175 end
1133 1176
1134 1177 # Unassigns issues from +version+ if it's no longer shared with issue's project
1135 1178 def self.update_versions_from_sharing_change(version)
1136 1179 # Update issues assigned to the version
1137 1180 update_versions(["#{Issue.table_name}.fixed_version_id = ?", version.id])
1138 1181 end
1139 1182
1140 1183 # Unassigns issues from versions that are no longer shared
1141 1184 # after +project+ was moved
1142 1185 def self.update_versions_from_hierarchy_change(project)
1143 1186 moved_project_ids = project.self_and_descendants.reload.collect(&:id)
1144 1187 # Update issues of the moved projects and issues assigned to a version of a moved project
1145 1188 Issue.update_versions(
1146 1189 ["#{Version.table_name}.project_id IN (?) OR #{Issue.table_name}.project_id IN (?)",
1147 1190 moved_project_ids, moved_project_ids]
1148 1191 )
1149 1192 end
1150 1193
1151 1194 def parent_issue_id=(arg)
1152 1195 s = arg.to_s.strip.presence
1153 1196 if s && (m = s.match(%r{\A#?(\d+)\z})) && (@parent_issue = Issue.find_by_id(m[1]))
1154 1197 @invalid_parent_issue_id = nil
1155 1198 elsif s.blank?
1156 1199 @parent_issue = nil
1157 1200 @invalid_parent_issue_id = nil
1158 1201 else
1159 1202 @parent_issue = nil
1160 1203 @invalid_parent_issue_id = arg
1161 1204 end
1162 1205 end
1163 1206
1164 1207 def parent_issue_id
1165 1208 if @invalid_parent_issue_id
1166 1209 @invalid_parent_issue_id
1167 1210 elsif instance_variable_defined? :@parent_issue
1168 1211 @parent_issue.nil? ? nil : @parent_issue.id
1169 1212 else
1170 1213 parent_id
1171 1214 end
1172 1215 end
1173 1216
1174 1217 # Returns true if issue's project is a valid
1175 1218 # parent issue project
1176 1219 def valid_parent_project?(issue=parent)
1177 1220 return true if issue.nil? || issue.project_id == project_id
1178 1221
1179 1222 case Setting.cross_project_subtasks
1180 1223 when 'system'
1181 1224 true
1182 1225 when 'tree'
1183 1226 issue.project.root == project.root
1184 1227 when 'hierarchy'
1185 1228 issue.project.is_or_is_ancestor_of?(project) || issue.project.is_descendant_of?(project)
1186 1229 when 'descendants'
1187 1230 issue.project.is_or_is_ancestor_of?(project)
1188 1231 else
1189 1232 false
1190 1233 end
1191 1234 end
1192 1235
1193 1236 # Returns an issue scope based on project and scope
1194 1237 def self.cross_project_scope(project, scope=nil)
1195 1238 if project.nil?
1196 1239 return Issue
1197 1240 end
1198 1241 case scope
1199 1242 when 'all', 'system'
1200 1243 Issue
1201 1244 when 'tree'
1202 1245 Issue.joins(:project).where("(#{Project.table_name}.lft >= :lft AND #{Project.table_name}.rgt <= :rgt)",
1203 1246 :lft => project.root.lft, :rgt => project.root.rgt)
1204 1247 when 'hierarchy'
1205 1248 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)",
1206 1249 :lft => project.lft, :rgt => project.rgt)
1207 1250 when 'descendants'
1208 1251 Issue.joins(:project).where("(#{Project.table_name}.lft >= :lft AND #{Project.table_name}.rgt <= :rgt)",
1209 1252 :lft => project.lft, :rgt => project.rgt)
1210 1253 else
1211 1254 Issue.where(:project_id => project.id)
1212 1255 end
1213 1256 end
1214 1257
1215 1258 def self.by_tracker(project)
1216 1259 count_and_group_by(:project => project, :association => :tracker)
1217 1260 end
1218 1261
1219 1262 def self.by_version(project)
1220 1263 count_and_group_by(:project => project, :association => :fixed_version)
1221 1264 end
1222 1265
1223 1266 def self.by_priority(project)
1224 1267 count_and_group_by(:project => project, :association => :priority)
1225 1268 end
1226 1269
1227 1270 def self.by_category(project)
1228 1271 count_and_group_by(:project => project, :association => :category)
1229 1272 end
1230 1273
1231 1274 def self.by_assigned_to(project)
1232 1275 count_and_group_by(:project => project, :association => :assigned_to)
1233 1276 end
1234 1277
1235 1278 def self.by_author(project)
1236 1279 count_and_group_by(:project => project, :association => :author)
1237 1280 end
1238 1281
1239 1282 def self.by_subproject(project)
1240 1283 r = count_and_group_by(:project => project, :with_subprojects => true, :association => :project)
1241 1284 r.reject {|r| r["project_id"] == project.id.to_s}
1242 1285 end
1243 1286
1244 1287 # Query generator for selecting groups of issue counts for a project
1245 1288 # based on specific criteria
1246 1289 #
1247 1290 # Options
1248 1291 # * project - Project to search in.
1249 1292 # * with_subprojects - Includes subprojects issues if set to true.
1250 1293 # * association - Symbol. Association for grouping.
1251 1294 def self.count_and_group_by(options)
1252 1295 assoc = reflect_on_association(options[:association])
1253 1296 select_field = assoc.foreign_key
1254 1297
1255 1298 Issue.
1256 1299 visible(User.current, :project => options[:project], :with_subprojects => options[:with_subprojects]).
1257 1300 joins(:status, assoc.name).
1258 1301 group(:status_id, :is_closed, select_field).
1259 1302 count.
1260 1303 map do |columns, total|
1261 1304 status_id, is_closed, field_value = columns
1262 1305 is_closed = ['t', 'true', '1'].include?(is_closed.to_s)
1263 1306 {
1264 1307 "status_id" => status_id.to_s,
1265 1308 "closed" => is_closed,
1266 1309 select_field => field_value.to_s,
1267 1310 "total" => total.to_s
1268 1311 }
1269 1312 end
1270 1313 end
1271 1314
1272 1315 # Returns a scope of projects that user can assign the issue to
1273 1316 def allowed_target_projects(user=User.current)
1274 1317 if new_record?
1275 1318 Project.where(Project.allowed_to_condition(user, :add_issues))
1276 1319 else
1277 1320 self.class.allowed_target_projects_on_move(user)
1278 1321 end
1279 1322 end
1280 1323
1281 1324 # Returns a scope of projects that user can move issues to
1282 1325 def self.allowed_target_projects_on_move(user=User.current)
1283 1326 Project.where(Project.allowed_to_condition(user, :move_issues))
1284 1327 end
1285 1328
1286 1329 private
1287 1330
1288 1331 def after_project_change
1289 1332 # Update project_id on related time entries
1290 1333 TimeEntry.where({:issue_id => id}).update_all(["project_id = ?", project_id])
1291 1334
1292 1335 # Delete issue relations
1293 1336 unless Setting.cross_project_issue_relations?
1294 1337 relations_from.clear
1295 1338 relations_to.clear
1296 1339 end
1297 1340
1298 1341 # Move subtasks that were in the same project
1299 1342 children.each do |child|
1300 1343 next unless child.project_id == project_id_was
1301 1344 # Change project and keep project
1302 1345 child.send :project=, project, true
1303 1346 unless child.save
1304 1347 raise ActiveRecord::Rollback
1305 1348 end
1306 1349 end
1307 1350 end
1308 1351
1309 1352 # Callback for after the creation of an issue by copy
1310 1353 # * adds a "copied to" relation with the copied issue
1311 1354 # * copies subtasks from the copied issue
1312 1355 def after_create_from_copy
1313 1356 return unless copy? && !@after_create_from_copy_handled
1314 1357
1315 1358 if (@copied_from.project_id == project_id || Setting.cross_project_issue_relations?) && @copy_options[:link] != false
1316 1359 if @current_journal
1317 1360 @copied_from.init_journal(@current_journal.user)
1318 1361 end
1319 1362 relation = IssueRelation.new(:issue_from => @copied_from, :issue_to => self, :relation_type => IssueRelation::TYPE_COPIED_TO)
1320 1363 unless relation.save
1321 1364 logger.error "Could not create relation while copying ##{@copied_from.id} to ##{id} due to validation errors: #{relation.errors.full_messages.join(', ')}" if logger
1322 1365 end
1323 1366 end
1324 1367
1325 1368 unless @copied_from.leaf? || @copy_options[:subtasks] == false
1326 1369 copy_options = (@copy_options || {}).merge(:subtasks => false)
1327 1370 copied_issue_ids = {@copied_from.id => self.id}
1328 1371 @copied_from.reload.descendants.reorder("#{Issue.table_name}.lft").each do |child|
1329 1372 # Do not copy self when copying an issue as a descendant of the copied issue
1330 1373 next if child == self
1331 1374 # Do not copy subtasks of issues that were not copied
1332 1375 next unless copied_issue_ids[child.parent_id]
1333 1376 # Do not copy subtasks that are not visible to avoid potential disclosure of private data
1334 1377 unless child.visible?
1335 1378 logger.error "Subtask ##{child.id} was not copied during ##{@copied_from.id} copy because it is not visible to the current user" if logger
1336 1379 next
1337 1380 end
1338 1381 copy = Issue.new.copy_from(child, copy_options)
1339 1382 if @current_journal
1340 1383 copy.init_journal(@current_journal.user)
1341 1384 end
1342 1385 copy.author = author
1343 1386 copy.project = project
1344 1387 copy.parent_issue_id = copied_issue_ids[child.parent_id]
1345 1388 unless copy.save
1346 1389 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
1347 1390 next
1348 1391 end
1349 1392 copied_issue_ids[child.id] = copy.id
1350 1393 end
1351 1394 end
1352 1395 @after_create_from_copy_handled = true
1353 1396 end
1354 1397
1355 1398 def update_nested_set_attributes
1356 1399 if root_id.nil?
1357 1400 # issue was just created
1358 1401 self.root_id = (@parent_issue.nil? ? id : @parent_issue.root_id)
1359 1402 Issue.where(["id = ?", id]).update_all(["root_id = ?", root_id])
1360 1403 if @parent_issue
1361 1404 move_to_child_of(@parent_issue)
1362 1405 end
1363 1406 elsif parent_issue_id != parent_id
1364 1407 update_nested_set_attributes_on_parent_change
1365 1408 end
1366 1409 remove_instance_variable(:@parent_issue) if instance_variable_defined?(:@parent_issue)
1367 1410 end
1368 1411
1369 1412 # Updates the nested set for when an existing issue is moved
1370 1413 def update_nested_set_attributes_on_parent_change
1371 1414 former_parent_id = parent_id
1372 1415 # moving an existing issue
1373 1416 if @parent_issue && @parent_issue.root_id == root_id
1374 1417 # inside the same tree
1375 1418 move_to_child_of(@parent_issue)
1376 1419 else
1377 1420 # to another tree
1378 1421 unless root?
1379 1422 move_to_right_of(root)
1380 1423 end
1381 1424 old_root_id = root_id
1382 1425 in_tenacious_transaction do
1383 1426 @parent_issue.reload_nested_set if @parent_issue
1384 1427 self.reload_nested_set
1385 1428 self.root_id = (@parent_issue.nil? ? id : @parent_issue.root_id)
1386 1429 cond = ["root_id = ? AND lft >= ? AND rgt <= ? ", old_root_id, lft, rgt]
1387 1430 self.class.base_class.select('id').lock(true).where(cond)
1388 1431 offset = rdm_right_most_bound + 1 - lft
1389 1432 Issue.where(cond).
1390 1433 update_all(["root_id = ?, lft = lft + ?, rgt = rgt + ?", root_id, offset, offset])
1391 1434 end
1392 1435 if @parent_issue
1393 1436 move_to_child_of(@parent_issue)
1394 1437 end
1395 1438 end
1396 1439 # delete invalid relations of all descendants
1397 1440 self_and_descendants.each do |issue|
1398 1441 issue.relations.each do |relation|
1399 1442 relation.destroy unless relation.valid?
1400 1443 end
1401 1444 end
1402 1445 # update former parent
1403 1446 recalculate_attributes_for(former_parent_id) if former_parent_id
1404 1447 end
1405 1448
1406 1449 def rdm_right_most_bound
1407 1450 right_most_node =
1408 1451 self.class.base_class.unscoped.
1409 1452 order("#{quoted_right_column_full_name} desc").limit(1).lock(true).first
1410 1453 right_most_node ? (right_most_node[right_column_name] || 0 ) : 0
1411 1454 end
1412 1455 private :rdm_right_most_bound
1413 1456
1414 1457 def update_parent_attributes
1415 1458 recalculate_attributes_for(parent_id) if parent_id
1416 1459 end
1417 1460
1418 1461 def recalculate_attributes_for(issue_id)
1419 1462 if issue_id && p = Issue.find_by_id(issue_id)
1420 1463 # priority = highest priority of children
1421 1464 if priority_position = p.children.joins(:priority).maximum("#{IssuePriority.table_name}.position")
1422 1465 p.priority = IssuePriority.find_by_position(priority_position)
1423 1466 end
1424 1467
1425 1468 # start/due dates = lowest/highest dates of children
1426 1469 p.start_date = p.children.minimum(:start_date)
1427 1470 p.due_date = p.children.maximum(:due_date)
1428 1471 if p.start_date && p.due_date && p.due_date < p.start_date
1429 1472 p.start_date, p.due_date = p.due_date, p.start_date
1430 1473 end
1431 1474
1432 1475 # done ratio = weighted average ratio of leaves
1433 1476 unless Issue.use_status_for_done_ratio? && p.status && p.status.default_done_ratio
1434 1477 leaves_count = p.leaves.count
1435 1478 if leaves_count > 0
1436 1479 average = p.leaves.where("estimated_hours > 0").average(:estimated_hours).to_f
1437 1480 if average == 0
1438 1481 average = 1
1439 1482 end
1440 1483 done = p.leaves.joins(:status).
1441 1484 sum("COALESCE(CASE WHEN estimated_hours > 0 THEN estimated_hours ELSE NULL END, #{average}) " +
1442 1485 "* (CASE WHEN is_closed = #{self.class.connection.quoted_true} THEN 100 ELSE COALESCE(done_ratio, 0) END)").to_f
1443 1486 progress = done / (average * leaves_count)
1444 1487 p.done_ratio = progress.round
1445 1488 end
1446 1489 end
1447 1490
1448 1491 # estimate = sum of leaves estimates
1449 1492 p.estimated_hours = p.leaves.sum(:estimated_hours).to_f
1450 1493 p.estimated_hours = nil if p.estimated_hours == 0.0
1451 1494
1452 1495 # ancestors will be recursively updated
1453 1496 p.save(:validate => false)
1454 1497 end
1455 1498 end
1456 1499
1457 1500 # Update issues so their versions are not pointing to a
1458 1501 # fixed_version that is not shared with the issue's project
1459 1502 def self.update_versions(conditions=nil)
1460 1503 # Only need to update issues with a fixed_version from
1461 1504 # a different project and that is not systemwide shared
1462 1505 Issue.joins(:project, :fixed_version).
1463 1506 where("#{Issue.table_name}.fixed_version_id IS NOT NULL" +
1464 1507 " AND #{Issue.table_name}.project_id <> #{Version.table_name}.project_id" +
1465 1508 " AND #{Version.table_name}.sharing <> 'system'").
1466 1509 where(conditions).each do |issue|
1467 1510 next if issue.project.nil? || issue.fixed_version.nil?
1468 1511 unless issue.project.shared_versions.include?(issue.fixed_version)
1469 1512 issue.init_journal(User.current)
1470 1513 issue.fixed_version = nil
1471 1514 issue.save
1472 1515 end
1473 1516 end
1474 1517 end
1475 1518
1476 1519 # Callback on file attachment
1477 1520 def attachment_added(obj)
1478 1521 if @current_journal && !obj.new_record?
1479 1522 @current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => obj.id, :value => obj.filename)
1480 1523 end
1481 1524 end
1482 1525
1483 1526 # Callback on attachment deletion
1484 1527 def attachment_removed(obj)
1485 1528 if @current_journal && !obj.new_record?
1486 1529 @current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => obj.id, :old_value => obj.filename)
1487 1530 @current_journal.save
1488 1531 end
1489 1532 end
1490 1533
1491 1534 # Called after a relation is added
1492 1535 def relation_added(relation)
1493 1536 if @current_journal
1494 1537 @current_journal.details << JournalDetail.new(
1495 1538 :property => 'relation',
1496 1539 :prop_key => relation.relation_type_for(self),
1497 1540 :value => relation.other_issue(self).try(:id)
1498 1541 )
1499 1542 @current_journal.save
1500 1543 end
1501 1544 end
1502 1545
1503 1546 # Called after a relation is removed
1504 1547 def relation_removed(relation)
1505 1548 if @current_journal
1506 1549 @current_journal.details << JournalDetail.new(
1507 1550 :property => 'relation',
1508 1551 :prop_key => relation.relation_type_for(self),
1509 1552 :old_value => relation.other_issue(self).try(:id)
1510 1553 )
1511 1554 @current_journal.save
1512 1555 end
1513 1556 end
1514 1557
1515 1558 # Default assignment based on category
1516 1559 def default_assign
1517 1560 if assigned_to.nil? && category && category.assigned_to
1518 1561 self.assigned_to = category.assigned_to
1519 1562 end
1520 1563 end
1521 1564
1522 1565 # Updates start/due dates of following issues
1523 1566 def reschedule_following_issues
1524 1567 if start_date_changed? || due_date_changed?
1525 1568 relations_from.each do |relation|
1526 1569 relation.set_issue_to_dates
1527 1570 end
1528 1571 end
1529 1572 end
1530 1573
1531 1574 # Closes duplicates if the issue is being closed
1532 1575 def close_duplicates
1533 1576 if closing?
1534 1577 duplicates.each do |duplicate|
1535 1578 # Reload is needed in case the duplicate was updated by a previous duplicate
1536 1579 duplicate.reload
1537 1580 # Don't re-close it if it's already closed
1538 1581 next if duplicate.closed?
1539 1582 # Same user and notes
1540 1583 if @current_journal
1541 1584 duplicate.init_journal(@current_journal.user, @current_journal.notes)
1542 1585 end
1543 1586 duplicate.update_attribute :status, self.status
1544 1587 end
1545 1588 end
1546 1589 end
1547 1590
1548 1591 # Make sure updated_on is updated when adding a note and set updated_on now
1549 1592 # so we can set closed_on with the same value on closing
1550 1593 def force_updated_on_change
1551 1594 if @current_journal || changed?
1552 1595 self.updated_on = current_time_from_proper_timezone
1553 1596 if new_record?
1554 1597 self.created_on = updated_on
1555 1598 end
1556 1599 end
1557 1600 end
1558 1601
1559 1602 # Callback for setting closed_on when the issue is closed.
1560 1603 # The closed_on attribute stores the time of the last closing
1561 1604 # and is preserved when the issue is reopened.
1562 1605 def update_closed_on
1563 1606 if closing?
1564 1607 self.closed_on = updated_on
1565 1608 end
1566 1609 end
1567 1610
1568 1611 # Saves the changes in a Journal
1569 1612 # Called after_save
1570 1613 def create_journal
1571 1614 if @current_journal
1572 1615 # attributes changes
1573 1616 if @attributes_before_change
1574 1617 (Issue.column_names - %w(id root_id lft rgt lock_version created_on updated_on closed_on)).each {|c|
1575 1618 before = @attributes_before_change[c]
1576 1619 after = send(c)
1577 1620 next if before == after || (before.blank? && after.blank?)
1578 1621 @current_journal.details << JournalDetail.new(:property => 'attr',
1579 1622 :prop_key => c,
1580 1623 :old_value => before,
1581 1624 :value => after)
1582 1625 }
1583 1626 end
1584 1627 if @custom_values_before_change
1585 1628 # custom fields changes
1586 1629 custom_field_values.each {|c|
1587 1630 before = @custom_values_before_change[c.custom_field_id]
1588 1631 after = c.value
1589 1632 next if before == after || (before.blank? && after.blank?)
1590 1633
1591 1634 if before.is_a?(Array) || after.is_a?(Array)
1592 1635 before = [before] unless before.is_a?(Array)
1593 1636 after = [after] unless after.is_a?(Array)
1594 1637
1595 1638 # values removed
1596 1639 (before - after).reject(&:blank?).each do |value|
1597 1640 @current_journal.details << JournalDetail.new(:property => 'cf',
1598 1641 :prop_key => c.custom_field_id,
1599 1642 :old_value => value,
1600 1643 :value => nil)
1601 1644 end
1602 1645 # values added
1603 1646 (after - before).reject(&:blank?).each do |value|
1604 1647 @current_journal.details << JournalDetail.new(:property => 'cf',
1605 1648 :prop_key => c.custom_field_id,
1606 1649 :old_value => nil,
1607 1650 :value => value)
1608 1651 end
1609 1652 else
1610 1653 @current_journal.details << JournalDetail.new(:property => 'cf',
1611 1654 :prop_key => c.custom_field_id,
1612 1655 :old_value => before,
1613 1656 :value => after)
1614 1657 end
1615 1658 }
1616 1659 end
1617 1660 @current_journal.save
1618 1661 # reset current journal
1619 1662 init_journal @current_journal.user, @current_journal.notes
1620 1663 end
1621 1664 end
1622 1665
1623 1666 def send_notification
1624 1667 if Setting.notified_events.include?('issue_added')
1625 1668 Mailer.deliver_issue_add(self)
1626 1669 end
1627 1670 end
1628 1671
1629 1672 # Stores the previous assignee so we can still have access
1630 1673 # to it during after_save callbacks (assigned_to_id_was is reset)
1631 1674 def set_assigned_to_was
1632 1675 @previous_assigned_to_id = assigned_to_id_was
1633 1676 end
1634 1677
1635 1678 # Clears the previous assignee at the end of after_save callbacks
1636 1679 def clear_assigned_to_was
1637 1680 @assigned_to_was = nil
1638 1681 @previous_assigned_to_id = nil
1639 1682 end
1640 1683 end
@@ -1,110 +1,104
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class IssueStatus < ActiveRecord::Base
19 19 before_destroy :check_integrity
20 20 has_many :workflows, :class_name => 'WorkflowTransition', :foreign_key => "old_status_id"
21 21 has_many :workflow_transitions_as_new_status, :class_name => 'WorkflowTransition', :foreign_key => "new_status_id"
22 22 acts_as_list
23 23
24 24 before_destroy :delete_workflow_rules
25 after_save :update_default
26 25
27 26 validates_presence_of :name
28 27 validates_uniqueness_of :name
29 28 validates_length_of :name, :maximum => 30
30 29 validates_inclusion_of :default_done_ratio, :in => 0..100, :allow_nil => true
31 30 attr_protected :id
32 31
33 32 scope :sorted, lambda { order(:position) }
34 33 scope :named, lambda {|arg| where("LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip)}
35 34
36 def update_default
37 IssueStatus.where(['id <> ?', id]).update_all({:is_default => false}) if self.is_default?
38 end
39
40 # Returns the default status for new issues
41 def self.default
42 where(:is_default => true).first
43 end
44
45 35 # Update all the +Issues+ setting their done_ratio to the value of their +IssueStatus+
46 36 def self.update_issue_done_ratios
47 37 if Issue.use_status_for_done_ratio?
48 38 IssueStatus.where("default_done_ratio >= 0").each do |status|
49 39 Issue.where({:status_id => status.id}).update_all({:done_ratio => status.default_done_ratio})
50 40 end
51 41 end
52 42
53 43 return Issue.use_status_for_done_ratio?
54 44 end
55 45
56 46 # Returns an array of all statuses the given role can switch to
57 47 # Uses association cache when called more than one time
58 48 def new_statuses_allowed_to(roles, tracker, author=false, assignee=false)
59 49 if roles && tracker
60 50 role_ids = roles.collect(&:id)
61 51 transitions = workflows.select do |w|
62 52 role_ids.include?(w.role_id) &&
63 53 w.tracker_id == tracker.id &&
64 54 ((!w.author && !w.assignee) || (author && w.author) || (assignee && w.assignee))
65 55 end
66 56 transitions.map(&:new_status).compact.sort
67 57 else
68 58 []
69 59 end
70 60 end
71 61
72 62 # Same thing as above but uses a database query
73 63 # More efficient than the previous method if called just once
74 64 def find_new_statuses_allowed_to(roles, tracker, author=false, assignee=false)
75 65 if roles.present? && tracker
76 66 scope = IssueStatus.
77 67 joins(:workflow_transitions_as_new_status).
78 68 where(:workflows => {:old_status_id => id, :role_id => roles.map(&:id), :tracker_id => tracker.id})
79 69
80 70 unless author && assignee
81 71 if author || assignee
82 72 scope = scope.where("author = ? OR assignee = ?", author, assignee)
83 73 else
84 74 scope = scope.where("author = ? AND assignee = ?", false, false)
85 75 end
86 76 end
87 77
88 78 scope.uniq.to_a.sort
89 79 else
90 80 []
91 81 end
92 82 end
93 83
94 84 def <=>(status)
95 85 position <=> status.position
96 86 end
97 87
98 88 def to_s; name end
99 89
100 90 private
101 91
102 92 def check_integrity
103 raise "Can't delete status" if Issue.where(:status_id => id).any?
93 if Issue.where(:status_id => id).any?
94 raise "This status is used by some issues"
95 elsif Tracker.where(:default_status_id => id).any?
96 raise "This status is used as the default status by some trackers"
97 end
104 98 end
105 99
106 100 # Deletes associated workflows
107 101 def delete_workflow_rules
108 102 WorkflowRule.delete_all(["old_status_id = :id OR new_status_id = :id", {:id => id}])
109 103 end
110 104 end
@@ -1,111 +1,114
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class Tracker < ActiveRecord::Base
19 19
20 20 CORE_FIELDS_UNDISABLABLE = %w(project_id tracker_id subject description priority_id is_private).freeze
21 21 # Fields that can be disabled
22 22 # Other (future) fields should be appended, not inserted!
23 23 CORE_FIELDS = %w(assigned_to_id category_id fixed_version_id parent_issue_id start_date due_date estimated_hours done_ratio).freeze
24 24 CORE_FIELDS_ALL = (CORE_FIELDS_UNDISABLABLE + CORE_FIELDS).freeze
25 25
26 26 before_destroy :check_integrity
27 belongs_to :default_status, :class_name => 'IssueStatus'
27 28 has_many :issues
28 29 has_many :workflow_rules, :dependent => :delete_all do
29 30 def copy(source_tracker)
30 31 WorkflowRule.copy(source_tracker, nil, proxy_association.owner, nil)
31 32 end
32 33 end
33 34
34 35 has_and_belongs_to_many :projects
35 36 has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :association_foreign_key => 'custom_field_id'
36 37 acts_as_list
37 38
38 39 attr_protected :fields_bits
39 40
41 validates_presence_of :default_status
40 42 validates_presence_of :name
41 43 validates_uniqueness_of :name
42 44 validates_length_of :name, :maximum => 30
43 45
44 46 scope :sorted, lambda { order(:position) }
45 47 scope :named, lambda {|arg| where("LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip)}
46 48
47 49 def to_s; name end
48 50
49 51 def <=>(tracker)
50 52 position <=> tracker.position
51 53 end
52 54
53 55 # Returns an array of IssueStatus that are used
54 56 # in the tracker's workflows
55 57 def issue_statuses
56 if @issue_statuses
57 return @issue_statuses
58 elsif new_record?
59 return []
60 end
58 @issue_statuses ||= IssueStatus.where(:id => issue_status_ids).to_a.sort
59 end
61 60
62 status_ids = WorkflowTransition.where(:tracker_id => id).uniq.pluck(:old_status_id, :new_status_id).flatten.uniq
63 @issue_statuses = IssueStatus.where(:id => status_ids).to_a.sort
61 def issue_status_ids
62 if new_record?
63 []
64 else
65 @issue_status_ids ||= WorkflowTransition.where(:tracker_id => id).uniq.pluck(:old_status_id, :new_status_id).flatten.uniq
66 end
64 67 end
65 68
66 69 def disabled_core_fields
67 70 i = -1
68 71 @disabled_core_fields ||= CORE_FIELDS.select { i += 1; (fields_bits || 0) & (2 ** i) != 0}
69 72 end
70 73
71 74 def core_fields
72 75 CORE_FIELDS - disabled_core_fields
73 76 end
74 77
75 78 def core_fields=(fields)
76 79 raise ArgumentError.new("Tracker.core_fields takes an array") unless fields.is_a?(Array)
77 80
78 81 bits = 0
79 82 CORE_FIELDS.each_with_index do |field, i|
80 83 unless fields.include?(field)
81 84 bits |= 2 ** i
82 85 end
83 86 end
84 87 self.fields_bits = bits
85 88 @disabled_core_fields = nil
86 89 core_fields
87 90 end
88 91
89 92 # Returns the fields that are disabled for all the given trackers
90 93 def self.disabled_core_fields(trackers)
91 94 if trackers.present?
92 95 trackers.map(&:disabled_core_fields).reduce(:&)
93 96 else
94 97 []
95 98 end
96 99 end
97 100
98 101 # Returns the fields that are enabled for one tracker at least
99 102 def self.core_fields(trackers)
100 103 if trackers.present?
101 104 trackers.uniq.map(&:core_fields).reduce(:|)
102 105 else
103 106 CORE_FIELDS.dup
104 107 end
105 108 end
106 109
107 110 private
108 111 def check_integrity
109 112 raise Exception.new("Can't delete tracker") if Issue.where(:tracker_id => self.id).any?
110 113 end
111 114 end
@@ -1,12 +1,11
1 1 <%= error_messages_for 'issue_status' %>
2 2
3 3 <div class="box tabular">
4 4 <p><%= f.text_field :name, :required => true %></p>
5 5 <% if Issue.use_status_for_done_ratio? %>
6 6 <p><%= f.select :default_done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }), :include_blank => true, :label => :field_done_ratio %></p>
7 7 <% end %>
8 8 <p><%= f.check_box :is_closed %></p>
9 <p><%= f.check_box :is_default %></p>
10 9
11 10 <%= call_hook(:view_issue_statuses_form, :issue_status => @issue_status) %>
12 11 </div>
@@ -1,10 +1,9
1 1 api.array :issue_statuses do
2 2 @issue_statuses.each do |status|
3 3 api.issue_status do
4 4 api.id status.id
5 5 api.name status.name
6 api.is_default status.is_default
7 6 api.is_closed status.is_closed
8 7 end
9 8 end
10 9 end
@@ -1,39 +1,37
1 1 <div class="contextual">
2 2 <%= link_to l(:label_issue_status_new), new_issue_status_path, :class => 'icon icon-add' %>
3 3 <%= link_to(l(:label_update_issue_done_ratios), update_issue_done_ratio_issue_statuses_path, :class => 'icon icon-multiple', :method => 'post', :data => {:confirm => l(:text_are_you_sure)}) if Issue.use_status_for_done_ratio? %>
4 4 </div>
5 5
6 6 <h2><%=l(:label_issue_status_plural)%></h2>
7 7
8 8 <table class="list">
9 9 <thead><tr>
10 10 <th><%=l(:field_status)%></th>
11 11 <% if Issue.use_status_for_done_ratio? %>
12 12 <th><%=l(:field_done_ratio)%></th>
13 13 <% end %>
14 <th><%=l(:field_is_default)%></th>
15 14 <th><%=l(:field_is_closed)%></th>
16 15 <th><%=l(:button_sort)%></th>
17 16 <th></th>
18 17 </tr></thead>
19 18 <tbody>
20 19 <% for status in @issue_statuses %>
21 20 <tr class="<%= cycle("odd", "even") %>">
22 21 <td class="name"><%= link_to h(status.name), edit_issue_status_path(status) %></td>
23 22 <% if Issue.use_status_for_done_ratio? %>
24 23 <td><%= h status.default_done_ratio %></td>
25 24 <% end %>
26 <td><%= checked_image status.is_default? %></td>
27 25 <td><%= checked_image status.is_closed? %></td>
28 26 <td class="reorder"><%= reorder_links('issue_status', {:action => 'update', :id => status}, :put) %></td>
29 27 <td class="buttons">
30 28 <%= delete_link issue_status_path(status) %>
31 29 </td>
32 30 </tr>
33 31 <% end %>
34 32 </tbody>
35 33 </table>
36 34
37 35 <p class="pagination"><%= pagination_links_full @issue_status_pages %></p>
38 36
39 37 <% html_title(l(:label_issue_status_plural)) -%>
@@ -1,81 +1,81
1 1 <%= labelled_fields_for :issue, @issue do |f| %>
2 2
3 3 <div class="splitcontent">
4 4 <div class="splitcontentleft">
5 5 <% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %>
6 6 <p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), {:required => true},
7 7 :onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')" %></p>
8
8 <%= hidden_field_tag 'was_default_status', @issue.status_id, :id => nil if @issue.status == @issue.default_status %>
9 9 <% else %>
10 <p><label><%= l(:field_status) %></label> <%= h(@issue.status.name) %></p>
10 <p><label><%= l(:field_status) %></label> <%= @issue.status %></p>
11 11 <% end %>
12 12
13 13 <% if @issue.safe_attribute? 'priority_id' %>
14 14 <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), {:required => true}, :disabled => !@issue.leaf? %></p>
15 15 <% end %>
16 16
17 17 <% if @issue.safe_attribute? 'assigned_to_id' %>
18 18 <p><%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to), :include_blank => true, :required => @issue.required_attribute?('assigned_to_id') %></p>
19 19 <% end %>
20 20
21 21 <% if @issue.safe_attribute?('category_id') && @issue.project.issue_categories.any? %>
22 22 <p><%= f.select :category_id, (@issue.project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true, :required => @issue.required_attribute?('category_id') %>
23 23 <%= link_to(image_tag('add.png', :style => 'vertical-align: middle;'),
24 24 new_project_issue_category_path(@issue.project),
25 25 :remote => true,
26 26 :method => 'get',
27 27 :title => l(:label_issue_category_new),
28 28 :tabindex => 200) if User.current.allowed_to?(:manage_categories, @issue.project) %></p>
29 29 <% end %>
30 30
31 31 <% if @issue.safe_attribute?('fixed_version_id') && @issue.assignable_versions.any? %>
32 32 <p><%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), :include_blank => true, :required => @issue.required_attribute?('fixed_version_id') %>
33 33 <%= link_to(image_tag('add.png', :style => 'vertical-align: middle;'),
34 34 new_project_version_path(@issue.project),
35 35 :remote => true,
36 36 :method => 'get',
37 37 :title => l(:label_version_new),
38 38 :tabindex => 200) if User.current.allowed_to?(:manage_versions, @issue.project) %>
39 39 </p>
40 40 <% end %>
41 41 </div>
42 42
43 43 <div class="splitcontentright">
44 44 <% if @issue.safe_attribute? 'parent_issue_id' %>
45 45 <p id="parent_issue"><%= f.text_field :parent_issue_id, :size => 10, :required => @issue.required_attribute?('parent_issue_id') %></p>
46 46 <%= javascript_tag "observeAutocompleteField('issue_parent_issue_id', '#{escape_javascript auto_complete_issues_path(:project_id => @issue.project, :scope => Setting.cross_project_subtasks)}')" %>
47 47 <% end %>
48 48
49 49 <% if @issue.safe_attribute? 'start_date' %>
50 50 <p id="start_date_area">
51 51 <%= f.text_field(:start_date, :size => 10, :disabled => !@issue.leaf?,
52 52 :required => @issue.required_attribute?('start_date')) %>
53 53 <%= calendar_for('issue_start_date') if @issue.leaf? %>
54 54 </p>
55 55 <% end %>
56 56
57 57 <% if @issue.safe_attribute? 'due_date' %>
58 58 <p id="due_date_area">
59 59 <%= f.text_field(:due_date, :size => 10, :disabled => !@issue.leaf?,
60 60 :required => @issue.required_attribute?('due_date')) %>
61 61 <%= calendar_for('issue_due_date') if @issue.leaf? %>
62 62 </p>
63 63 <% end %>
64 64
65 65 <% if @issue.safe_attribute? 'estimated_hours' %>
66 66 <p><%= f.text_field :estimated_hours, :size => 3, :disabled => !@issue.leaf?, :required => @issue.required_attribute?('estimated_hours') %> <%= l(:field_hours) %></p>
67 67 <% end %>
68 68
69 69 <% if @issue.safe_attribute?('done_ratio') && @issue.leaf? && Issue.use_field_for_done_ratio? %>
70 70 <p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }), :required => @issue.required_attribute?('done_ratio') %></p>
71 71 <% end %>
72 72 </div>
73 73 </div>
74 74
75 75 <% if @issue.safe_attribute? 'custom_field_values' %>
76 76 <%= render :partial => 'issues/form_custom_fields' %>
77 77 <% end %>
78 78
79 79 <% end %>
80 80
81 81 <% include_calendar_headers_tags %>
@@ -1,52 +1,56
1 1 <%= error_messages_for 'tracker' %>
2 2
3 3 <div class="splitcontentleft">
4 4 <div class="box tabular">
5 5 <!--[form:tracker]-->
6 6 <p><%= f.text_field :name, :required => true %></p>
7 <p><%= f.select :default_status_id,
8 IssueStatus.sorted.map {|s| [s.name, s.id]},
9 :include_blank => @tracker.default_status.nil?,
10 :required => true %>
11 </p>
7 12 <p><%= f.check_box :is_in_roadmap %></p>
8
9 13 <p>
10 14 <label><%= l(:field_core_fields) %></label>
11 15 <% Tracker::CORE_FIELDS.each do |field| %>
12 16 <label class="block">
13 17 <%= check_box_tag 'tracker[core_fields][]', field, @tracker.core_fields.include?(field), :id => nil %>
14 18 <%= l("field_#{field}".sub(/_id$/, '')) %>
15 19 </label>
16 20 <% end %>
17 21 </p>
18 22 <%= hidden_field_tag 'tracker[core_fields][]', '' %>
19 23
20 24 <% if IssueCustomField.all.any? %>
21 25 <p>
22 26 <label><%= l(:label_custom_field_plural) %></label>
23 27 <% IssueCustomField.all.each do |field| %>
24 28 <label class="block">
25 29 <%= check_box_tag 'tracker[custom_field_ids][]',field.id, @tracker.custom_fields.to_a.include?(field), :id => nil %>
26 30 <%=h field.name %>
27 31 </label>
28 32 <% end %>
29 33 </p>
30 34 <%= hidden_field_tag 'tracker[custom_field_ids][]', '' %>
31 35 <% end %>
32 36
33 37 <% if @tracker.new_record? && @trackers.any? %>
34 38 <p><label for="copy_workflow_from"><%= l(:label_copy_workflow_from) %></label>
35 39 <%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@trackers, :id, :name)) %></p>
36 40 <% end %>
37 41 <!--[eoform:tracker]-->
38 42 </div>
39 43 <%= submit_tag l(@tracker.new_record? ? :button_create : :button_save) %>
40 44 </div>
41 45
42 46 <div class="splitcontentright">
43 47 <% if @projects.any? %>
44 48 <fieldset class="box" id="tracker_project_ids"><legend><%= l(:label_project_plural) %></legend>
45 49 <%= render_project_nested_lists(@projects) do |p|
46 50 content_tag('label', check_box_tag('tracker[project_ids][]', p.id, @tracker.projects.to_a.include?(p), :id => nil) + ' ' + h(p))
47 51 end %>
48 52 <%= hidden_field_tag('tracker[project_ids][]', '', :id => nil) %>
49 53 <p><%= check_all_links 'tracker_project_ids' %></p>
50 54 </fieldset>
51 55 <% end %>
52 56 </div>
@@ -1,8 +1,9
1 1 api.array :trackers do
2 2 @trackers.each do |tracker|
3 3 api.tracker do
4 4 api.id tracker.id
5 5 api.name tracker.name
6 api.default_status(:id => tracker.default_status.id, :name => tracker.default_status.name) unless tracker.default_status.nil?
6 7 end
7 8 end
8 9 end
@@ -1,1112 +1,1113
1 1 en:
2 2 # Text direction: Left-to-Right (ltr) or Right-to-Left (rtl)
3 3 direction: ltr
4 4 date:
5 5 formats:
6 6 # Use the strftime parameters for formats.
7 7 # When no format has been given, it uses default.
8 8 # You can provide other formats here if you like!
9 9 default: "%m/%d/%Y"
10 10 short: "%b %d"
11 11 long: "%B %d, %Y"
12 12
13 13 day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
14 14 abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat]
15 15
16 16 # Don't forget the nil at the beginning; there's no such thing as a 0th month
17 17 month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December]
18 18 abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
19 19 # Used in date_select and datime_select.
20 20 order:
21 21 - :year
22 22 - :month
23 23 - :day
24 24
25 25 time:
26 26 formats:
27 27 default: "%m/%d/%Y %I:%M %p"
28 28 time: "%I:%M %p"
29 29 short: "%d %b %H:%M"
30 30 long: "%B %d, %Y %H:%M"
31 31 am: "am"
32 32 pm: "pm"
33 33
34 34 datetime:
35 35 distance_in_words:
36 36 half_a_minute: "half a minute"
37 37 less_than_x_seconds:
38 38 one: "less than 1 second"
39 39 other: "less than %{count} seconds"
40 40 x_seconds:
41 41 one: "1 second"
42 42 other: "%{count} seconds"
43 43 less_than_x_minutes:
44 44 one: "less than a minute"
45 45 other: "less than %{count} minutes"
46 46 x_minutes:
47 47 one: "1 minute"
48 48 other: "%{count} minutes"
49 49 about_x_hours:
50 50 one: "about 1 hour"
51 51 other: "about %{count} hours"
52 52 x_hours:
53 53 one: "1 hour"
54 54 other: "%{count} hours"
55 55 x_days:
56 56 one: "1 day"
57 57 other: "%{count} days"
58 58 about_x_months:
59 59 one: "about 1 month"
60 60 other: "about %{count} months"
61 61 x_months:
62 62 one: "1 month"
63 63 other: "%{count} months"
64 64 about_x_years:
65 65 one: "about 1 year"
66 66 other: "about %{count} years"
67 67 over_x_years:
68 68 one: "over 1 year"
69 69 other: "over %{count} years"
70 70 almost_x_years:
71 71 one: "almost 1 year"
72 72 other: "almost %{count} years"
73 73
74 74 number:
75 75 format:
76 76 separator: "."
77 77 delimiter: ""
78 78 precision: 3
79 79
80 80 human:
81 81 format:
82 82 delimiter: ""
83 83 precision: 3
84 84 storage_units:
85 85 format: "%n %u"
86 86 units:
87 87 byte:
88 88 one: "Byte"
89 89 other: "Bytes"
90 90 kb: "KB"
91 91 mb: "MB"
92 92 gb: "GB"
93 93 tb: "TB"
94 94
95 95 # Used in array.to_sentence.
96 96 support:
97 97 array:
98 98 sentence_connector: "and"
99 99 skip_last_comma: false
100 100
101 101 activerecord:
102 102 errors:
103 103 template:
104 104 header:
105 105 one: "1 error prohibited this %{model} from being saved"
106 106 other: "%{count} errors prohibited this %{model} from being saved"
107 107 messages:
108 108 inclusion: "is not included in the list"
109 109 exclusion: "is reserved"
110 110 invalid: "is invalid"
111 111 confirmation: "doesn't match confirmation"
112 112 accepted: "must be accepted"
113 113 empty: "can't be empty"
114 114 blank: "can't be blank"
115 115 too_long: "is too long (maximum is %{count} characters)"
116 116 too_short: "is too short (minimum is %{count} characters)"
117 117 wrong_length: "is the wrong length (should be %{count} characters)"
118 118 taken: "has already been taken"
119 119 not_a_number: "is not a number"
120 120 not_a_date: "is not a valid date"
121 121 greater_than: "must be greater than %{count}"
122 122 greater_than_or_equal_to: "must be greater than or equal to %{count}"
123 123 equal_to: "must be equal to %{count}"
124 124 less_than: "must be less than %{count}"
125 125 less_than_or_equal_to: "must be less than or equal to %{count}"
126 126 odd: "must be odd"
127 127 even: "must be even"
128 128 greater_than_start_date: "must be greater than start date"
129 129 not_same_project: "doesn't belong to the same project"
130 130 circular_dependency: "This relation would create a circular dependency"
131 131 cant_link_an_issue_with_a_descendant: "An issue cannot be linked to one of its subtasks"
132 132 earlier_than_minimum_start_date: "cannot be earlier than %{date} because of preceding issues"
133 133
134 134 actionview_instancetag_blank_option: Please select
135 135
136 136 general_text_No: 'No'
137 137 general_text_Yes: 'Yes'
138 138 general_text_no: 'no'
139 139 general_text_yes: 'yes'
140 140 general_lang_name: 'English'
141 141 general_csv_separator: ','
142 142 general_csv_decimal_separator: '.'
143 143 general_csv_encoding: ISO-8859-1
144 144 general_pdf_fontname: freesans
145 145 general_first_day_of_week: '7'
146 146
147 147 notice_account_updated: Account was successfully updated.
148 148 notice_account_invalid_creditentials: Invalid user or password
149 149 notice_account_password_updated: Password was successfully updated.
150 150 notice_account_wrong_password: Wrong password
151 151 notice_account_register_done: Account was successfully created. An email containing the instructions to activate your account was sent to %{email}.
152 152 notice_account_unknown_email: Unknown user.
153 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 154 notice_account_locked: Your account is locked.
155 155 notice_can_t_change_password: This account uses an external authentication source. Impossible to change the password.
156 156 notice_account_lost_email_sent: An email with instructions to choose a new password has been sent to you.
157 157 notice_account_activated: Your account has been activated. You can now log in.
158 158 notice_successful_create: Successful creation.
159 159 notice_successful_update: Successful update.
160 160 notice_successful_delete: Successful deletion.
161 161 notice_successful_connection: Successful connection.
162 162 notice_file_not_found: The page you were trying to access doesn't exist or has been removed.
163 163 notice_locking_conflict: Data has been updated by another user.
164 164 notice_not_authorized: You are not authorized to access this page.
165 165 notice_not_authorized_archived_project: The project you're trying to access has been archived.
166 166 notice_email_sent: "An email was sent to %{value}"
167 167 notice_email_error: "An error occurred while sending mail (%{value})"
168 168 notice_feeds_access_key_reseted: Your Atom access key was reset.
169 169 notice_api_access_key_reseted: Your API access key was reset.
170 170 notice_failed_to_save_issues: "Failed to save %{count} issue(s) on %{total} selected: %{ids}."
171 171 notice_failed_to_save_time_entries: "Failed to save %{count} time entrie(s) on %{total} selected: %{ids}."
172 172 notice_failed_to_save_members: "Failed to save member(s): %{errors}."
173 173 notice_no_issue_selected: "No issue is selected! Please, check the issues you want to edit."
174 174 notice_account_pending: "Your account was created and is now pending administrator approval."
175 175 notice_default_data_loaded: Default configuration successfully loaded.
176 176 notice_unable_delete_version: Unable to delete version.
177 177 notice_unable_delete_time_entry: Unable to delete time log entry.
178 178 notice_issue_done_ratios_updated: Issue done ratios updated.
179 179 notice_gantt_chart_truncated: "The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})"
180 180 notice_issue_successful_create: "Issue %{id} created."
181 181 notice_issue_update_conflict: "The issue has been updated by an other user while you were editing it."
182 182 notice_account_deleted: "Your account has been permanently deleted."
183 183 notice_user_successful_create: "User %{id} created."
184 184 notice_new_password_must_be_different: The new password must be different from the current password
185 185
186 186 error_can_t_load_default_data: "Default configuration could not be loaded: %{value}"
187 187 error_scm_not_found: "The entry or revision was not found in the repository."
188 188 error_scm_command_failed: "An error occurred when trying to access the repository: %{value}"
189 189 error_scm_annotate: "The entry does not exist or cannot be annotated."
190 190 error_scm_annotate_big_text_file: "The entry cannot be annotated, as it exceeds the maximum text file size."
191 191 error_issue_not_found_in_project: 'The issue was not found or does not belong to this project'
192 192 error_no_tracker_in_project: 'No tracker is associated to this project. Please check the Project settings.'
193 193 error_no_default_issue_status: 'No default issue status is defined. Please check your configuration (Go to "Administration -> Issue statuses").'
194 194 error_can_not_delete_custom_field: Unable to delete custom field
195 195 error_can_not_delete_tracker: "This tracker contains issues and cannot be deleted."
196 196 error_can_not_remove_role: "This role is in use and cannot be deleted."
197 197 error_can_not_reopen_issue_on_closed_version: 'An issue assigned to a closed version cannot be reopened'
198 198 error_can_not_archive_project: This project cannot be archived
199 199 error_issue_done_ratios_not_updated: "Issue done ratios not updated."
200 200 error_workflow_copy_source: 'Please select a source tracker or role'
201 201 error_workflow_copy_target: 'Please select target tracker(s) and role(s)'
202 202 error_unable_delete_issue_status: 'Unable to delete issue status'
203 203 error_unable_to_connect: "Unable to connect (%{value})"
204 204 error_attachment_too_big: "This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})"
205 205 error_session_expired: "Your session has expired. Please login again."
206 206 warning_attachments_not_saved: "%{count} file(s) could not be saved."
207 207
208 208 mail_subject_lost_password: "Your %{value} password"
209 209 mail_body_lost_password: 'To change your password, click on the following link:'
210 210 mail_subject_register: "Your %{value} account activation"
211 211 mail_body_register: 'To activate your account, click on the following link:'
212 212 mail_body_account_information_external: "You can use your %{value} account to log in."
213 213 mail_body_account_information: Your account information
214 214 mail_subject_account_activation_request: "%{value} account activation request"
215 215 mail_body_account_activation_request: "A new user (%{value}) has registered. The account is pending your approval:"
216 216 mail_subject_reminder: "%{count} issue(s) due in the next %{days} days"
217 217 mail_body_reminder: "%{count} issue(s) that are assigned to you are due in the next %{days} days:"
218 218 mail_subject_wiki_content_added: "'%{id}' wiki page has been added"
219 219 mail_body_wiki_content_added: "The '%{id}' wiki page has been added by %{author}."
220 220 mail_subject_wiki_content_updated: "'%{id}' wiki page has been updated"
221 221 mail_body_wiki_content_updated: "The '%{id}' wiki page has been updated by %{author}."
222 222
223 223 field_name: Name
224 224 field_description: Description
225 225 field_summary: Summary
226 226 field_is_required: Required
227 227 field_firstname: First name
228 228 field_lastname: Last name
229 229 field_mail: Email
230 230 field_filename: File
231 231 field_filesize: Size
232 232 field_downloads: Downloads
233 233 field_author: Author
234 234 field_created_on: Created
235 235 field_updated_on: Updated
236 236 field_closed_on: Closed
237 237 field_field_format: Format
238 238 field_is_for_all: For all projects
239 239 field_possible_values: Possible values
240 240 field_regexp: Regular expression
241 241 field_min_length: Minimum length
242 242 field_max_length: Maximum length
243 243 field_value: Value
244 244 field_category: Category
245 245 field_title: Title
246 246 field_project: Project
247 247 field_issue: Issue
248 248 field_status: Status
249 249 field_notes: Notes
250 250 field_is_closed: Issue closed
251 251 field_is_default: Default value
252 252 field_tracker: Tracker
253 253 field_subject: Subject
254 254 field_due_date: Due date
255 255 field_assigned_to: Assignee
256 256 field_priority: Priority
257 257 field_fixed_version: Target version
258 258 field_user: User
259 259 field_principal: Principal
260 260 field_role: Role
261 261 field_homepage: Homepage
262 262 field_is_public: Public
263 263 field_parent: Subproject of
264 264 field_is_in_roadmap: Issues displayed in roadmap
265 265 field_login: Login
266 266 field_mail_notification: Email notifications
267 267 field_admin: Administrator
268 268 field_last_login_on: Last connection
269 269 field_language: Language
270 270 field_effective_date: Date
271 271 field_password: Password
272 272 field_new_password: New password
273 273 field_password_confirmation: Confirmation
274 274 field_version: Version
275 275 field_type: Type
276 276 field_host: Host
277 277 field_port: Port
278 278 field_account: Account
279 279 field_base_dn: Base DN
280 280 field_attr_login: Login attribute
281 281 field_attr_firstname: Firstname attribute
282 282 field_attr_lastname: Lastname attribute
283 283 field_attr_mail: Email attribute
284 284 field_onthefly: On-the-fly user creation
285 285 field_start_date: Start date
286 286 field_done_ratio: "% Done"
287 287 field_auth_source: Authentication mode
288 288 field_hide_mail: Hide my email address
289 289 field_comments: Comment
290 290 field_url: URL
291 291 field_start_page: Start page
292 292 field_subproject: Subproject
293 293 field_hours: Hours
294 294 field_activity: Activity
295 295 field_spent_on: Date
296 296 field_identifier: Identifier
297 297 field_is_filter: Used as a filter
298 298 field_issue_to: Related issue
299 299 field_delay: Delay
300 300 field_assignable: Issues can be assigned to this role
301 301 field_redirect_existing_links: Redirect existing links
302 302 field_estimated_hours: Estimated time
303 303 field_column_names: Columns
304 304 field_time_entries: Log time
305 305 field_time_zone: Time zone
306 306 field_searchable: Searchable
307 307 field_default_value: Default value
308 308 field_comments_sorting: Display comments
309 309 field_parent_title: Parent page
310 310 field_editable: Editable
311 311 field_watcher: Watcher
312 312 field_identity_url: OpenID URL
313 313 field_content: Content
314 314 field_group_by: Group results by
315 315 field_sharing: Sharing
316 316 field_parent_issue: Parent task
317 317 field_member_of_group: "Assignee's group"
318 318 field_assigned_to_role: "Assignee's role"
319 319 field_text: Text field
320 320 field_visible: Visible
321 321 field_warn_on_leaving_unsaved: "Warn me when leaving a page with unsaved text"
322 322 field_issues_visibility: Issues visibility
323 323 field_is_private: Private
324 324 field_commit_logs_encoding: Commit messages encoding
325 325 field_scm_path_encoding: Path encoding
326 326 field_path_to_repository: Path to repository
327 327 field_root_directory: Root directory
328 328 field_cvsroot: CVSROOT
329 329 field_cvs_module: Module
330 330 field_repository_is_default: Main repository
331 331 field_multiple: Multiple values
332 332 field_auth_source_ldap_filter: LDAP filter
333 333 field_core_fields: Standard fields
334 334 field_timeout: "Timeout (in seconds)"
335 335 field_board_parent: Parent forum
336 336 field_private_notes: Private notes
337 337 field_inherit_members: Inherit members
338 338 field_generate_password: Generate password
339 339 field_must_change_passwd: Must change password at next logon
340 field_default_status: Default status
340 341
341 342 setting_app_title: Application title
342 343 setting_app_subtitle: Application subtitle
343 344 setting_welcome_text: Welcome text
344 345 setting_default_language: Default language
345 346 setting_login_required: Authentication required
346 347 setting_self_registration: Self-registration
347 348 setting_attachment_max_size: Maximum attachment size
348 349 setting_issues_export_limit: Issues export limit
349 350 setting_mail_from: Emission email address
350 351 setting_bcc_recipients: Blind carbon copy recipients (bcc)
351 352 setting_plain_text_mail: Plain text mail (no HTML)
352 353 setting_host_name: Host name and path
353 354 setting_text_formatting: Text formatting
354 355 setting_wiki_compression: Wiki history compression
355 356 setting_feeds_limit: Maximum number of items in Atom feeds
356 357 setting_default_projects_public: New projects are public by default
357 358 setting_autofetch_changesets: Fetch commits automatically
358 359 setting_sys_api_enabled: Enable WS for repository management
359 360 setting_commit_ref_keywords: Referencing keywords
360 361 setting_commit_fix_keywords: Fixing keywords
361 362 setting_autologin: Autologin
362 363 setting_date_format: Date format
363 364 setting_time_format: Time format
364 365 setting_cross_project_issue_relations: Allow cross-project issue relations
365 366 setting_cross_project_subtasks: Allow cross-project subtasks
366 367 setting_issue_list_default_columns: Default columns displayed on the issue list
367 368 setting_repositories_encodings: Attachments and repositories encodings
368 369 setting_emails_header: Email header
369 370 setting_emails_footer: Email footer
370 371 setting_protocol: Protocol
371 372 setting_per_page_options: Objects per page options
372 373 setting_user_format: Users display format
373 374 setting_activity_days_default: Days displayed on project activity
374 375 setting_display_subprojects_issues: Display subprojects issues on main projects by default
375 376 setting_enabled_scm: Enabled SCM
376 377 setting_mail_handler_body_delimiters: "Truncate emails after one of these lines"
377 378 setting_mail_handler_api_enabled: Enable WS for incoming emails
378 379 setting_mail_handler_api_key: API key
379 380 setting_sequential_project_identifiers: Generate sequential project identifiers
380 381 setting_gravatar_enabled: Use Gravatar user icons
381 382 setting_gravatar_default: Default Gravatar image
382 383 setting_diff_max_lines_displayed: Maximum number of diff lines displayed
383 384 setting_file_max_size_displayed: Maximum size of text files displayed inline
384 385 setting_repository_log_display_limit: Maximum number of revisions displayed on file log
385 386 setting_openid: Allow OpenID login and registration
386 387 setting_password_min_length: Minimum password length
387 388 setting_new_project_user_role_id: Role given to a non-admin user who creates a project
388 389 setting_default_projects_modules: Default enabled modules for new projects
389 390 setting_issue_done_ratio: Calculate the issue done ratio with
390 391 setting_issue_done_ratio_issue_field: Use the issue field
391 392 setting_issue_done_ratio_issue_status: Use the issue status
392 393 setting_start_of_week: Start calendars on
393 394 setting_rest_api_enabled: Enable REST web service
394 395 setting_cache_formatted_text: Cache formatted text
395 396 setting_default_notification_option: Default notification option
396 397 setting_commit_logtime_enabled: Enable time logging
397 398 setting_commit_logtime_activity_id: Activity for logged time
398 399 setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
399 400 setting_issue_group_assignment: Allow issue assignment to groups
400 401 setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
401 402 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
402 403 setting_unsubscribe: Allow users to delete their own account
403 404 setting_session_lifetime: Session maximum lifetime
404 405 setting_session_timeout: Session inactivity timeout
405 406 setting_thumbnails_enabled: Display attachment thumbnails
406 407 setting_thumbnails_size: Thumbnails size (in pixels)
407 408 setting_non_working_week_days: Non-working days
408 409 setting_jsonp_enabled: Enable JSONP support
409 410 setting_default_projects_tracker_ids: Default trackers for new projects
410 411 setting_mail_handler_excluded_filenames: Exclude attachments by name
411 412 setting_force_default_language_for_anonymous: Force default language for anonymous users
412 413 setting_force_default_language_for_loggedin: Force default language for logged-in users
413 414
414 415 permission_add_project: Create project
415 416 permission_add_subprojects: Create subprojects
416 417 permission_edit_project: Edit project
417 418 permission_close_project: Close / reopen the project
418 419 permission_select_project_modules: Select project modules
419 420 permission_manage_members: Manage members
420 421 permission_manage_project_activities: Manage project activities
421 422 permission_manage_versions: Manage versions
422 423 permission_manage_categories: Manage issue categories
423 424 permission_view_issues: View Issues
424 425 permission_add_issues: Add issues
425 426 permission_edit_issues: Edit issues
426 427 permission_manage_issue_relations: Manage issue relations
427 428 permission_set_issues_private: Set issues public or private
428 429 permission_set_own_issues_private: Set own issues public or private
429 430 permission_add_issue_notes: Add notes
430 431 permission_edit_issue_notes: Edit notes
431 432 permission_edit_own_issue_notes: Edit own notes
432 433 permission_view_private_notes: View private notes
433 434 permission_set_notes_private: Set notes as private
434 435 permission_move_issues: Move issues
435 436 permission_delete_issues: Delete issues
436 437 permission_manage_public_queries: Manage public queries
437 438 permission_save_queries: Save queries
438 439 permission_view_gantt: View gantt chart
439 440 permission_view_calendar: View calendar
440 441 permission_view_issue_watchers: View watchers list
441 442 permission_add_issue_watchers: Add watchers
442 443 permission_delete_issue_watchers: Delete watchers
443 444 permission_log_time: Log spent time
444 445 permission_view_time_entries: View spent time
445 446 permission_edit_time_entries: Edit time logs
446 447 permission_edit_own_time_entries: Edit own time logs
447 448 permission_manage_news: Manage news
448 449 permission_comment_news: Comment news
449 450 permission_view_documents: View documents
450 451 permission_add_documents: Add documents
451 452 permission_edit_documents: Edit documents
452 453 permission_delete_documents: Delete documents
453 454 permission_manage_files: Manage files
454 455 permission_view_files: View files
455 456 permission_manage_wiki: Manage wiki
456 457 permission_rename_wiki_pages: Rename wiki pages
457 458 permission_delete_wiki_pages: Delete wiki pages
458 459 permission_view_wiki_pages: View wiki
459 460 permission_view_wiki_edits: View wiki history
460 461 permission_edit_wiki_pages: Edit wiki pages
461 462 permission_delete_wiki_pages_attachments: Delete attachments
462 463 permission_protect_wiki_pages: Protect wiki pages
463 464 permission_manage_repository: Manage repository
464 465 permission_browse_repository: Browse repository
465 466 permission_view_changesets: View changesets
466 467 permission_commit_access: Commit access
467 468 permission_manage_boards: Manage forums
468 469 permission_view_messages: View messages
469 470 permission_add_messages: Post messages
470 471 permission_edit_messages: Edit messages
471 472 permission_edit_own_messages: Edit own messages
472 473 permission_delete_messages: Delete messages
473 474 permission_delete_own_messages: Delete own messages
474 475 permission_export_wiki_pages: Export wiki pages
475 476 permission_manage_subtasks: Manage subtasks
476 477 permission_manage_related_issues: Manage related issues
477 478
478 479 project_module_issue_tracking: Issue tracking
479 480 project_module_time_tracking: Time tracking
480 481 project_module_news: News
481 482 project_module_documents: Documents
482 483 project_module_files: Files
483 484 project_module_wiki: Wiki
484 485 project_module_repository: Repository
485 486 project_module_boards: Forums
486 487 project_module_calendar: Calendar
487 488 project_module_gantt: Gantt
488 489
489 490 label_user: User
490 491 label_user_plural: Users
491 492 label_user_new: New user
492 493 label_user_anonymous: Anonymous
493 494 label_project: Project
494 495 label_project_new: New project
495 496 label_project_plural: Projects
496 497 label_x_projects:
497 498 zero: no projects
498 499 one: 1 project
499 500 other: "%{count} projects"
500 501 label_project_all: All Projects
501 502 label_project_latest: Latest projects
502 503 label_issue: Issue
503 504 label_issue_new: New issue
504 505 label_issue_plural: Issues
505 506 label_issue_view_all: View all issues
506 507 label_issues_by: "Issues by %{value}"
507 508 label_issue_added: Issue added
508 509 label_issue_updated: Issue updated
509 510 label_issue_note_added: Note added
510 511 label_issue_status_updated: Status updated
511 512 label_issue_assigned_to_updated: Assignee updated
512 513 label_issue_priority_updated: Priority updated
513 514 label_document: Document
514 515 label_document_new: New document
515 516 label_document_plural: Documents
516 517 label_document_added: Document added
517 518 label_role: Role
518 519 label_role_plural: Roles
519 520 label_role_new: New role
520 521 label_role_and_permissions: Roles and permissions
521 522 label_role_anonymous: Anonymous
522 523 label_role_non_member: Non member
523 524 label_member: Member
524 525 label_member_new: New member
525 526 label_member_plural: Members
526 527 label_tracker: Tracker
527 528 label_tracker_plural: Trackers
528 529 label_tracker_new: New tracker
529 530 label_workflow: Workflow
530 531 label_issue_status: Issue status
531 532 label_issue_status_plural: Issue statuses
532 533 label_issue_status_new: New status
533 534 label_issue_category: Issue category
534 535 label_issue_category_plural: Issue categories
535 536 label_issue_category_new: New category
536 537 label_custom_field: Custom field
537 538 label_custom_field_plural: Custom fields
538 539 label_custom_field_new: New custom field
539 540 label_enumerations: Enumerations
540 541 label_enumeration_new: New value
541 542 label_information: Information
542 543 label_information_plural: Information
543 544 label_please_login: Please log in
544 545 label_register: Register
545 546 label_login_with_open_id_option: or login with OpenID
546 547 label_password_lost: Lost password
547 548 label_home: Home
548 549 label_my_page: My page
549 550 label_my_account: My account
550 551 label_my_projects: My projects
551 552 label_my_page_block: My page block
552 553 label_administration: Administration
553 554 label_login: Sign in
554 555 label_logout: Sign out
555 556 label_help: Help
556 557 label_reported_issues: Reported issues
557 558 label_assigned_to_me_issues: Issues assigned to me
558 559 label_last_login: Last connection
559 560 label_registered_on: Registered on
560 561 label_activity: Activity
561 562 label_overall_activity: Overall activity
562 563 label_user_activity: "%{value}'s activity"
563 564 label_new: New
564 565 label_logged_as: Logged in as
565 566 label_environment: Environment
566 567 label_authentication: Authentication
567 568 label_auth_source: Authentication mode
568 569 label_auth_source_new: New authentication mode
569 570 label_auth_source_plural: Authentication modes
570 571 label_subproject_plural: Subprojects
571 572 label_subproject_new: New subproject
572 573 label_and_its_subprojects: "%{value} and its subprojects"
573 574 label_min_max_length: Min - Max length
574 575 label_list: List
575 576 label_date: Date
576 577 label_integer: Integer
577 578 label_float: Float
578 579 label_boolean: Boolean
579 580 label_string: Text
580 581 label_text: Long text
581 582 label_attribute: Attribute
582 583 label_attribute_plural: Attributes
583 584 label_no_data: No data to display
584 585 label_change_status: Change status
585 586 label_history: History
586 587 label_attachment: File
587 588 label_attachment_new: New file
588 589 label_attachment_delete: Delete file
589 590 label_attachment_plural: Files
590 591 label_file_added: File added
591 592 label_report: Report
592 593 label_report_plural: Reports
593 594 label_news: News
594 595 label_news_new: Add news
595 596 label_news_plural: News
596 597 label_news_latest: Latest news
597 598 label_news_view_all: View all news
598 599 label_news_added: News added
599 600 label_news_comment_added: Comment added to a news
600 601 label_settings: Settings
601 602 label_overview: Overview
602 603 label_version: Version
603 604 label_version_new: New version
604 605 label_version_plural: Versions
605 606 label_close_versions: Close completed versions
606 607 label_confirmation: Confirmation
607 608 label_export_to: 'Also available in:'
608 609 label_read: Read...
609 610 label_public_projects: Public projects
610 611 label_open_issues: open
611 612 label_open_issues_plural: open
612 613 label_closed_issues: closed
613 614 label_closed_issues_plural: closed
614 615 label_x_open_issues_abbr_on_total:
615 616 zero: 0 open / %{total}
616 617 one: 1 open / %{total}
617 618 other: "%{count} open / %{total}"
618 619 label_x_open_issues_abbr:
619 620 zero: 0 open
620 621 one: 1 open
621 622 other: "%{count} open"
622 623 label_x_closed_issues_abbr:
623 624 zero: 0 closed
624 625 one: 1 closed
625 626 other: "%{count} closed"
626 627 label_x_issues:
627 628 zero: 0 issues
628 629 one: 1 issue
629 630 other: "%{count} issues"
630 631 label_total: Total
631 632 label_total_time: Total time
632 633 label_permissions: Permissions
633 634 label_current_status: Current status
634 635 label_new_statuses_allowed: New statuses allowed
635 636 label_all: all
636 637 label_any: any
637 638 label_none: none
638 639 label_nobody: nobody
639 640 label_next: Next
640 641 label_previous: Previous
641 642 label_used_by: Used by
642 643 label_details: Details
643 644 label_add_note: Add a note
644 645 label_per_page: Per page
645 646 label_calendar: Calendar
646 647 label_months_from: months from
647 648 label_gantt: Gantt
648 649 label_internal: Internal
649 650 label_last_changes: "last %{count} changes"
650 651 label_change_view_all: View all changes
651 652 label_personalize_page: Personalize this page
652 653 label_comment: Comment
653 654 label_comment_plural: Comments
654 655 label_x_comments:
655 656 zero: no comments
656 657 one: 1 comment
657 658 other: "%{count} comments"
658 659 label_comment_add: Add a comment
659 660 label_comment_added: Comment added
660 661 label_comment_delete: Delete comments
661 662 label_query: Custom query
662 663 label_query_plural: Custom queries
663 664 label_query_new: New query
664 665 label_my_queries: My custom queries
665 666 label_filter_add: Add filter
666 667 label_filter_plural: Filters
667 668 label_equals: is
668 669 label_not_equals: is not
669 670 label_in_less_than: in less than
670 671 label_in_more_than: in more than
671 672 label_in_the_next_days: in the next
672 673 label_in_the_past_days: in the past
673 674 label_greater_or_equal: '>='
674 675 label_less_or_equal: '<='
675 676 label_between: between
676 677 label_in: in
677 678 label_today: today
678 679 label_all_time: all time
679 680 label_yesterday: yesterday
680 681 label_this_week: this week
681 682 label_last_week: last week
682 683 label_last_n_weeks: "last %{count} weeks"
683 684 label_last_n_days: "last %{count} days"
684 685 label_this_month: this month
685 686 label_last_month: last month
686 687 label_this_year: this year
687 688 label_date_range: Date range
688 689 label_less_than_ago: less than days ago
689 690 label_more_than_ago: more than days ago
690 691 label_ago: days ago
691 692 label_contains: contains
692 693 label_not_contains: doesn't contain
693 694 label_any_issues_in_project: any issues in project
694 695 label_any_issues_not_in_project: any issues not in project
695 696 label_no_issues_in_project: no issues in project
696 697 label_day_plural: days
697 698 label_repository: Repository
698 699 label_repository_new: New repository
699 700 label_repository_plural: Repositories
700 701 label_browse: Browse
701 702 label_branch: Branch
702 703 label_tag: Tag
703 704 label_revision: Revision
704 705 label_revision_plural: Revisions
705 706 label_revision_id: "Revision %{value}"
706 707 label_associated_revisions: Associated revisions
707 708 label_added: added
708 709 label_modified: modified
709 710 label_copied: copied
710 711 label_renamed: renamed
711 712 label_deleted: deleted
712 713 label_latest_revision: Latest revision
713 714 label_latest_revision_plural: Latest revisions
714 715 label_view_revisions: View revisions
715 716 label_view_all_revisions: View all revisions
716 717 label_max_size: Maximum size
717 718 label_sort_highest: Move to top
718 719 label_sort_higher: Move up
719 720 label_sort_lower: Move down
720 721 label_sort_lowest: Move to bottom
721 722 label_roadmap: Roadmap
722 723 label_roadmap_due_in: "Due in %{value}"
723 724 label_roadmap_overdue: "%{value} late"
724 725 label_roadmap_no_issues: No issues for this version
725 726 label_search: Search
726 727 label_result_plural: Results
727 728 label_all_words: All words
728 729 label_wiki: Wiki
729 730 label_wiki_edit: Wiki edit
730 731 label_wiki_edit_plural: Wiki edits
731 732 label_wiki_page: Wiki page
732 733 label_wiki_page_plural: Wiki pages
733 734 label_index_by_title: Index by title
734 735 label_index_by_date: Index by date
735 736 label_current_version: Current version
736 737 label_preview: Preview
737 738 label_feed_plural: Feeds
738 739 label_changes_details: Details of all changes
739 740 label_issue_tracking: Issue tracking
740 741 label_spent_time: Spent time
741 742 label_overall_spent_time: Overall spent time
742 743 label_f_hour: "%{value} hour"
743 744 label_f_hour_plural: "%{value} hours"
744 745 label_time_tracking: Time tracking
745 746 label_change_plural: Changes
746 747 label_statistics: Statistics
747 748 label_commits_per_month: Commits per month
748 749 label_commits_per_author: Commits per author
749 750 label_diff: diff
750 751 label_view_diff: View differences
751 752 label_diff_inline: inline
752 753 label_diff_side_by_side: side by side
753 754 label_options: Options
754 755 label_copy_workflow_from: Copy workflow from
755 756 label_permissions_report: Permissions report
756 757 label_watched_issues: Watched issues
757 758 label_related_issues: Related issues
758 759 label_applied_status: Applied status
759 760 label_loading: Loading...
760 761 label_relation_new: New relation
761 762 label_relation_delete: Delete relation
762 763 label_relates_to: Related to
763 764 label_duplicates: Duplicates
764 765 label_duplicated_by: Duplicated by
765 766 label_blocks: Blocks
766 767 label_blocked_by: Blocked by
767 768 label_precedes: Precedes
768 769 label_follows: Follows
769 770 label_copied_to: Copied to
770 771 label_copied_from: Copied from
771 772 label_end_to_start: end to start
772 773 label_end_to_end: end to end
773 774 label_start_to_start: start to start
774 775 label_start_to_end: start to end
775 776 label_stay_logged_in: Stay logged in
776 777 label_disabled: disabled
777 778 label_show_completed_versions: Show completed versions
778 779 label_me: me
779 780 label_board: Forum
780 781 label_board_new: New forum
781 782 label_board_plural: Forums
782 783 label_board_locked: Locked
783 784 label_board_sticky: Sticky
784 785 label_topic_plural: Topics
785 786 label_message_plural: Messages
786 787 label_message_last: Last message
787 788 label_message_new: New message
788 789 label_message_posted: Message added
789 790 label_reply_plural: Replies
790 791 label_send_information: Send account information to the user
791 792 label_year: Year
792 793 label_month: Month
793 794 label_week: Week
794 795 label_date_from: From
795 796 label_date_to: To
796 797 label_language_based: Based on user's language
797 798 label_sort_by: "Sort by %{value}"
798 799 label_send_test_email: Send a test email
799 800 label_feeds_access_key: Atom access key
800 801 label_missing_feeds_access_key: Missing a Atom access key
801 802 label_feeds_access_key_created_on: "Atom access key created %{value} ago"
802 803 label_module_plural: Modules
803 804 label_added_time_by: "Added by %{author} %{age} ago"
804 805 label_updated_time_by: "Updated by %{author} %{age} ago"
805 806 label_updated_time: "Updated %{value} ago"
806 807 label_jump_to_a_project: Jump to a project...
807 808 label_file_plural: Files
808 809 label_changeset_plural: Changesets
809 810 label_default_columns: Default columns
810 811 label_no_change_option: (No change)
811 812 label_bulk_edit_selected_issues: Bulk edit selected issues
812 813 label_bulk_edit_selected_time_entries: Bulk edit selected time entries
813 814 label_theme: Theme
814 815 label_default: Default
815 816 label_search_titles_only: Search titles only
816 817 label_user_mail_option_all: "For any event on all my projects"
817 818 label_user_mail_option_selected: "For any event on the selected projects only..."
818 819 label_user_mail_option_none: "No events"
819 820 label_user_mail_option_only_my_events: "Only for things I watch or I'm involved in"
820 821 label_user_mail_option_only_assigned: "Only for things I am assigned to"
821 822 label_user_mail_option_only_owner: "Only for things I am the owner of"
822 823 label_user_mail_no_self_notified: "I don't want to be notified of changes that I make myself"
823 824 label_registration_activation_by_email: account activation by email
824 825 label_registration_manual_activation: manual account activation
825 826 label_registration_automatic_activation: automatic account activation
826 827 label_display_per_page: "Per page: %{value}"
827 828 label_age: Age
828 829 label_change_properties: Change properties
829 830 label_general: General
830 831 label_more: More
831 832 label_scm: SCM
832 833 label_plugins: Plugins
833 834 label_ldap_authentication: LDAP authentication
834 835 label_downloads_abbr: D/L
835 836 label_optional_description: Optional description
836 837 label_add_another_file: Add another file
837 838 label_preferences: Preferences
838 839 label_chronological_order: In chronological order
839 840 label_reverse_chronological_order: In reverse chronological order
840 841 label_planning: Planning
841 842 label_incoming_emails: Incoming emails
842 843 label_generate_key: Generate a key
843 844 label_issue_watchers: Watchers
844 845 label_example: Example
845 846 label_display: Display
846 847 label_sort: Sort
847 848 label_ascending: Ascending
848 849 label_descending: Descending
849 850 label_date_from_to: From %{start} to %{end}
850 851 label_wiki_content_added: Wiki page added
851 852 label_wiki_content_updated: Wiki page updated
852 853 label_group: Group
853 854 label_group_plural: Groups
854 855 label_group_new: New group
855 856 label_group_anonymous: Anonymous users
856 857 label_group_non_member: Non member users
857 858 label_time_entry_plural: Spent time
858 859 label_version_sharing_none: Not shared
859 860 label_version_sharing_descendants: With subprojects
860 861 label_version_sharing_hierarchy: With project hierarchy
861 862 label_version_sharing_tree: With project tree
862 863 label_version_sharing_system: With all projects
863 864 label_update_issue_done_ratios: Update issue done ratios
864 865 label_copy_source: Source
865 866 label_copy_target: Target
866 867 label_copy_same_as_target: Same as target
867 868 label_display_used_statuses_only: Only display statuses that are used by this tracker
868 869 label_api_access_key: API access key
869 870 label_missing_api_access_key: Missing an API access key
870 871 label_api_access_key_created_on: "API access key created %{value} ago"
871 872 label_profile: Profile
872 873 label_subtask_plural: Subtasks
873 874 label_project_copy_notifications: Send email notifications during the project copy
874 875 label_principal_search: "Search for user or group:"
875 876 label_user_search: "Search for user:"
876 877 label_additional_workflow_transitions_for_author: Additional transitions allowed when the user is the author
877 878 label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee
878 879 label_issues_visibility_all: All issues
879 880 label_issues_visibility_public: All non private issues
880 881 label_issues_visibility_own: Issues created by or assigned to the user
881 882 label_git_report_last_commit: Report last commit for files and directories
882 883 label_parent_revision: Parent
883 884 label_child_revision: Child
884 885 label_export_options: "%{export_format} export options"
885 886 label_copy_attachments: Copy attachments
886 887 label_copy_subtasks: Copy subtasks
887 888 label_item_position: "%{position} of %{count}"
888 889 label_completed_versions: Completed versions
889 890 label_search_for_watchers: Search for watchers to add
890 891 label_session_expiration: Session expiration
891 892 label_show_closed_projects: View closed projects
892 893 label_status_transitions: Status transitions
893 894 label_fields_permissions: Fields permissions
894 895 label_readonly: Read-only
895 896 label_required: Required
896 897 label_hidden: Hidden
897 898 label_attribute_of_project: "Project's %{name}"
898 899 label_attribute_of_issue: "Issue's %{name}"
899 900 label_attribute_of_author: "Author's %{name}"
900 901 label_attribute_of_assigned_to: "Assignee's %{name}"
901 902 label_attribute_of_user: "User's %{name}"
902 903 label_attribute_of_fixed_version: "Target version's %{name}"
903 904 label_cross_project_descendants: With subprojects
904 905 label_cross_project_tree: With project tree
905 906 label_cross_project_hierarchy: With project hierarchy
906 907 label_cross_project_system: With all projects
907 908 label_gantt_progress_line: Progress line
908 909 label_visibility_private: to me only
909 910 label_visibility_roles: to these roles only
910 911 label_visibility_public: to any users
911 912 label_link: Link
912 913 label_only: only
913 914 label_drop_down_list: drop-down list
914 915 label_checkboxes: checkboxes
915 916 label_radio_buttons: radio buttons
916 917 label_link_values_to: Link values to URL
917 918 label_custom_field_select_type: Select the type of object to which the custom field is to be attached
918 919 label_check_for_updates: Check for updates
919 920 label_latest_compatible_version: Latest compatible version
920 921 label_unknown_plugin: Unknown plugin
921 922 label_add_projects: Add projects
922 923
923 924 button_login: Login
924 925 button_submit: Submit
925 926 button_save: Save
926 927 button_check_all: Check all
927 928 button_uncheck_all: Uncheck all
928 929 button_collapse_all: Collapse all
929 930 button_expand_all: Expand all
930 931 button_delete: Delete
931 932 button_create: Create
932 933 button_create_and_continue: Create and continue
933 934 button_test: Test
934 935 button_edit: Edit
935 936 button_edit_associated_wikipage: "Edit associated Wiki page: %{page_title}"
936 937 button_add: Add
937 938 button_change: Change
938 939 button_apply: Apply
939 940 button_clear: Clear
940 941 button_lock: Lock
941 942 button_unlock: Unlock
942 943 button_download: Download
943 944 button_list: List
944 945 button_view: View
945 946 button_move: Move
946 947 button_move_and_follow: Move and follow
947 948 button_back: Back
948 949 button_cancel: Cancel
949 950 button_activate: Activate
950 951 button_sort: Sort
951 952 button_log_time: Log time
952 953 button_rollback: Rollback to this version
953 954 button_watch: Watch
954 955 button_unwatch: Unwatch
955 956 button_reply: Reply
956 957 button_archive: Archive
957 958 button_unarchive: Unarchive
958 959 button_reset: Reset
959 960 button_rename: Rename
960 961 button_change_password: Change password
961 962 button_copy: Copy
962 963 button_copy_and_follow: Copy and follow
963 964 button_annotate: Annotate
964 965 button_update: Update
965 966 button_configure: Configure
966 967 button_quote: Quote
967 968 button_duplicate: Duplicate
968 969 button_show: Show
969 970 button_hide: Hide
970 971 button_edit_section: Edit this section
971 972 button_export: Export
972 973 button_delete_my_account: Delete my account
973 974 button_close: Close
974 975 button_reopen: Reopen
975 976
976 977 status_active: active
977 978 status_registered: registered
978 979 status_locked: locked
979 980
980 981 project_status_active: active
981 982 project_status_closed: closed
982 983 project_status_archived: archived
983 984
984 985 version_status_open: open
985 986 version_status_locked: locked
986 987 version_status_closed: closed
987 988
988 989 field_active: Active
989 990
990 991 text_select_mail_notifications: Select actions for which email notifications should be sent.
991 992 text_regexp_info: eg. ^[A-Z0-9]+$
992 993 text_min_max_length_info: 0 means no restriction
993 994 text_project_destroy_confirmation: Are you sure you want to delete this project and related data?
994 995 text_subprojects_destroy_warning: "Its subproject(s): %{value} will be also deleted."
995 996 text_workflow_edit: Select a role and a tracker to edit the workflow
996 997 text_are_you_sure: Are you sure?
997 998 text_journal_changed: "%{label} changed from %{old} to %{new}"
998 999 text_journal_changed_no_detail: "%{label} updated"
999 1000 text_journal_set_to: "%{label} set to %{value}"
1000 1001 text_journal_deleted: "%{label} deleted (%{old})"
1001 1002 text_journal_added: "%{label} %{value} added"
1002 1003 text_tip_issue_begin_day: issue beginning this day
1003 1004 text_tip_issue_end_day: issue ending this day
1004 1005 text_tip_issue_begin_end_day: issue beginning and ending this day
1005 1006 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.'
1006 1007 text_caracters_maximum: "%{count} characters maximum."
1007 1008 text_caracters_minimum: "Must be at least %{count} characters long."
1008 1009 text_length_between: "Length between %{min} and %{max} characters."
1009 1010 text_tracker_no_workflow: No workflow defined for this tracker
1010 1011 text_unallowed_characters: Unallowed characters
1011 1012 text_comma_separated: Multiple values allowed (comma separated).
1012 1013 text_line_separated: Multiple values allowed (one line for each value).
1013 1014 text_issues_ref_in_commit_messages: Referencing and fixing issues in commit messages
1014 1015 text_issue_added: "Issue %{id} has been reported by %{author}."
1015 1016 text_issue_updated: "Issue %{id} has been updated by %{author}."
1016 1017 text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content?
1017 1018 text_issue_category_destroy_question: "Some issues (%{count}) are assigned to this category. What do you want to do?"
1018 1019 text_issue_category_destroy_assignments: Remove category assignments
1019 1020 text_issue_category_reassign_to: Reassign issues to this category
1020 1021 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)."
1021 1022 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."
1022 1023 text_load_default_configuration: Load the default configuration
1023 1024 text_status_changed_by_changeset: "Applied in changeset %{value}."
1024 1025 text_time_logged_by_changeset: "Applied in changeset %{value}."
1025 1026 text_issues_destroy_confirmation: 'Are you sure you want to delete the selected issue(s)?'
1026 1027 text_issues_destroy_descendants_confirmation: "This will also delete %{count} subtask(s)."
1027 1028 text_time_entries_destroy_confirmation: 'Are you sure you want to delete the selected time entr(y/ies)?'
1028 1029 text_select_project_modules: 'Select modules to enable for this project:'
1029 1030 text_default_administrator_account_changed: Default administrator account changed
1030 1031 text_file_repository_writable: Attachments directory writable
1031 1032 text_plugin_assets_writable: Plugin assets directory writable
1032 1033 text_rmagick_available: RMagick available (optional)
1033 1034 text_convert_available: ImageMagick convert available (optional)
1034 1035 text_destroy_time_entries_question: "%{hours} hours were reported on the issues you are about to delete. What do you want to do?"
1035 1036 text_destroy_time_entries: Delete reported hours
1036 1037 text_assign_time_entries_to_project: Assign reported hours to the project
1037 1038 text_reassign_time_entries: 'Reassign reported hours to this issue:'
1038 1039 text_user_wrote: "%{value} wrote:"
1039 1040 text_enumeration_destroy_question: "%{count} objects are assigned to this value."
1040 1041 text_enumeration_category_reassign_to: 'Reassign them to this value:'
1041 1042 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."
1042 1043 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."
1043 1044 text_diff_truncated: '... This diff was truncated because it exceeds the maximum size that can be displayed.'
1044 1045 text_custom_field_possible_values_info: 'One line for each value'
1045 1046 text_wiki_page_destroy_question: "This page has %{descendants} child page(s) and descendant(s). What do you want to do?"
1046 1047 text_wiki_page_nullify_children: "Keep child pages as root pages"
1047 1048 text_wiki_page_destroy_children: "Delete child pages and all their descendants"
1048 1049 text_wiki_page_reassign_children: "Reassign child pages to this parent page"
1049 1050 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?"
1050 1051 text_zoom_in: Zoom in
1051 1052 text_zoom_out: Zoom out
1052 1053 text_warn_on_leaving_unsaved: "The current page contains unsaved text that will be lost if you leave this page."
1053 1054 text_scm_path_encoding_note: "Default: UTF-8"
1054 1055 text_git_repository_note: Repository is bare and local (e.g. /gitrepo, c:\gitrepo)
1055 1056 text_mercurial_repository_note: Local repository (e.g. /hgrepo, c:\hgrepo)
1056 1057 text_scm_command: Command
1057 1058 text_scm_command_version: Version
1058 1059 text_scm_config: You can configure your SCM commands in config/configuration.yml. Please restart the application after editing it.
1059 1060 text_scm_command_not_available: SCM command is not available. Please check settings on the administration panel.
1060 1061 text_issue_conflict_resolution_overwrite: "Apply my changes anyway (previous notes will be kept but some changes may be overwritten)"
1061 1062 text_issue_conflict_resolution_add_notes: "Add my notes and discard my other changes"
1062 1063 text_issue_conflict_resolution_cancel: "Discard all my changes and redisplay %{link}"
1063 1064 text_account_destroy_confirmation: "Are you sure you want to proceed?\nYour account will be permanently deleted, with no way to reactivate it."
1064 1065 text_session_expiration_settings: "Warning: changing these settings may expire the current sessions including yours."
1065 1066 text_project_closed: This project is closed and read-only.
1066 1067 text_turning_multiple_off: "If you disable multiple values, multiple values will be removed in order to preserve only one value per item."
1067 1068
1068 1069 default_role_manager: Manager
1069 1070 default_role_developer: Developer
1070 1071 default_role_reporter: Reporter
1071 1072 default_tracker_bug: Bug
1072 1073 default_tracker_feature: Feature
1073 1074 default_tracker_support: Support
1074 1075 default_issue_status_new: New
1075 1076 default_issue_status_in_progress: In Progress
1076 1077 default_issue_status_resolved: Resolved
1077 1078 default_issue_status_feedback: Feedback
1078 1079 default_issue_status_closed: Closed
1079 1080 default_issue_status_rejected: Rejected
1080 1081 default_doc_category_user: User documentation
1081 1082 default_doc_category_tech: Technical documentation
1082 1083 default_priority_low: Low
1083 1084 default_priority_normal: Normal
1084 1085 default_priority_high: High
1085 1086 default_priority_urgent: Urgent
1086 1087 default_priority_immediate: Immediate
1087 1088 default_activity_design: Design
1088 1089 default_activity_development: Development
1089 1090
1090 1091 enumeration_issue_priorities: Issue priorities
1091 1092 enumeration_doc_categories: Document categories
1092 1093 enumeration_activities: Activities (time tracking)
1093 1094 enumeration_system_activity: System Activity
1094 1095 description_filter: Filter
1095 1096 description_search: Searchfield
1096 1097 description_choose_project: Projects
1097 1098 description_project_scope: Search scope
1098 1099 description_notes: Notes
1099 1100 description_message_content: Message content
1100 1101 description_query_sort_criteria_attribute: Sort attribute
1101 1102 description_query_sort_criteria_direction: Sort direction
1102 1103 description_user_mail_notification: Mail notification settings
1103 1104 description_available_columns: Available Columns
1104 1105 description_selected_columns: Selected Columns
1105 1106 description_all_columns: All Columns
1106 1107 description_issue_category_reassign: Choose issue category
1107 1108 description_wiki_subpages_reassign: Choose new parent page
1108 1109 description_date_range_list: Choose range from list
1109 1110 description_date_range_interval: Choose range by selecting start and end date
1110 1111 description_date_from: Enter start date
1111 1112 description_date_to: Enter end date
1112 1113 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,1132 +1,1133
1 1 # French translations for Ruby on Rails
2 2 # by Christian Lescuyer (christian@flyingcoders.com)
3 3 # contributor: Sebastien Grosjean - ZenCocoon.com
4 4 # contributor: Thibaut Cuvelier - Developpez.com
5 5
6 6 fr:
7 7 direction: ltr
8 8 date:
9 9 formats:
10 10 default: "%d/%m/%Y"
11 11 short: "%e %b"
12 12 long: "%e %B %Y"
13 13 long_ordinal: "%e %B %Y"
14 14 only_day: "%e"
15 15
16 16 day_names: [dimanche, lundi, mardi, mercredi, jeudi, vendredi, samedi]
17 17 abbr_day_names: [dim, lun, mar, mer, jeu, ven, sam]
18 18
19 19 # Don't forget the nil at the beginning; there's no such thing as a 0th month
20 20 month_names: [~, janvier, février, mars, avril, mai, juin, juillet, août, septembre, octobre, novembre, décembre]
21 21 abbr_month_names: [~, jan., fév., mar., avr., mai, juin, juil., août, sept., oct., nov., déc.]
22 22 # Used in date_select and datime_select.
23 23 order:
24 24 - :day
25 25 - :month
26 26 - :year
27 27
28 28 time:
29 29 formats:
30 30 default: "%d/%m/%Y %H:%M"
31 31 time: "%H:%M"
32 32 short: "%d %b %H:%M"
33 33 long: "%A %d %B %Y %H:%M:%S %Z"
34 34 long_ordinal: "%A %d %B %Y %H:%M:%S %Z"
35 35 only_second: "%S"
36 36 am: 'am'
37 37 pm: 'pm'
38 38
39 39 datetime:
40 40 distance_in_words:
41 41 half_a_minute: "30 secondes"
42 42 less_than_x_seconds:
43 43 zero: "moins d'une seconde"
44 44 one: "moins d'une seconde"
45 45 other: "moins de %{count} secondes"
46 46 x_seconds:
47 47 one: "1 seconde"
48 48 other: "%{count} secondes"
49 49 less_than_x_minutes:
50 50 zero: "moins d'une minute"
51 51 one: "moins d'une minute"
52 52 other: "moins de %{count} minutes"
53 53 x_minutes:
54 54 one: "1 minute"
55 55 other: "%{count} minutes"
56 56 about_x_hours:
57 57 one: "environ une heure"
58 58 other: "environ %{count} heures"
59 59 x_hours:
60 60 one: "une heure"
61 61 other: "%{count} heures"
62 62 x_days:
63 63 one: "un jour"
64 64 other: "%{count} jours"
65 65 about_x_months:
66 66 one: "environ un mois"
67 67 other: "environ %{count} mois"
68 68 x_months:
69 69 one: "un mois"
70 70 other: "%{count} mois"
71 71 about_x_years:
72 72 one: "environ un an"
73 73 other: "environ %{count} ans"
74 74 over_x_years:
75 75 one: "plus d'un an"
76 76 other: "plus de %{count} ans"
77 77 almost_x_years:
78 78 one: "presqu'un an"
79 79 other: "presque %{count} ans"
80 80 prompts:
81 81 year: "Année"
82 82 month: "Mois"
83 83 day: "Jour"
84 84 hour: "Heure"
85 85 minute: "Minute"
86 86 second: "Seconde"
87 87
88 88 number:
89 89 format:
90 90 precision: 3
91 91 separator: ','
92 92 delimiter: ' '
93 93 currency:
94 94 format:
95 95 unit: '€'
96 96 precision: 2
97 97 format: '%n %u'
98 98 human:
99 99 format:
100 100 precision: 3
101 101 storage_units:
102 102 format: "%n %u"
103 103 units:
104 104 byte:
105 105 one: "octet"
106 106 other: "octets"
107 107 kb: "ko"
108 108 mb: "Mo"
109 109 gb: "Go"
110 110 tb: "To"
111 111
112 112 support:
113 113 array:
114 114 sentence_connector: 'et'
115 115 skip_last_comma: true
116 116 word_connector: ", "
117 117 two_words_connector: " et "
118 118 last_word_connector: " et "
119 119
120 120 activerecord:
121 121 errors:
122 122 template:
123 123 header:
124 124 one: "Impossible d'enregistrer %{model} : une erreur"
125 125 other: "Impossible d'enregistrer %{model} : %{count} erreurs."
126 126 body: "Veuillez vérifier les champs suivants :"
127 127 messages:
128 128 inclusion: "n'est pas inclus(e) dans la liste"
129 129 exclusion: "n'est pas disponible"
130 130 invalid: "n'est pas valide"
131 131 confirmation: "ne concorde pas avec la confirmation"
132 132 accepted: "doit être accepté(e)"
133 133 empty: "doit être renseigné(e)"
134 134 blank: "doit être renseigné(e)"
135 135 too_long: "est trop long (pas plus de %{count} caractères)"
136 136 too_short: "est trop court (au moins %{count} caractères)"
137 137 wrong_length: "ne fait pas la bonne longueur (doit comporter %{count} caractères)"
138 138 taken: "est déjà utilisé"
139 139 not_a_number: "n'est pas un nombre"
140 140 not_a_date: "n'est pas une date valide"
141 141 greater_than: "doit être supérieur à %{count}"
142 142 greater_than_or_equal_to: "doit être supérieur ou égal à %{count}"
143 143 equal_to: "doit être égal à %{count}"
144 144 less_than: "doit être inférieur à %{count}"
145 145 less_than_or_equal_to: "doit être inférieur ou égal à %{count}"
146 146 odd: "doit être impair"
147 147 even: "doit être pair"
148 148 greater_than_start_date: "doit être postérieure à la date de début"
149 149 not_same_project: "n'appartient pas au même projet"
150 150 circular_dependency: "Cette relation créerait une dépendance circulaire"
151 151 cant_link_an_issue_with_a_descendant: "Une demande ne peut pas être liée à l'une de ses sous-tâches"
152 152 earlier_than_minimum_start_date: "ne peut pas être antérieure au %{date} à cause des demandes qui précèdent"
153 153
154 154 actionview_instancetag_blank_option: Choisir
155 155
156 156 general_text_No: 'Non'
157 157 general_text_Yes: 'Oui'
158 158 general_text_no: 'non'
159 159 general_text_yes: 'oui'
160 160 general_lang_name: 'Français'
161 161 general_csv_separator: ';'
162 162 general_csv_decimal_separator: ','
163 163 general_csv_encoding: ISO-8859-1
164 164 general_pdf_fontname: freesans
165 165 general_first_day_of_week: '1'
166 166
167 167 notice_account_updated: Le compte a été mis à jour avec succès.
168 168 notice_account_invalid_creditentials: Identifiant ou mot de passe invalide.
169 169 notice_account_password_updated: Mot de passe mis à jour avec succès.
170 170 notice_account_wrong_password: Mot de passe incorrect
171 171 notice_account_register_done: Un message contenant les instructions pour activer votre compte vous a été envoyé à l'adresse %{email}.
172 172 notice_account_unknown_email: Aucun compte ne correspond à cette adresse.
173 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 174 notice_account_locked: Votre compte est verrouillé.
175 175 notice_can_t_change_password: Ce compte utilise une authentification externe. Impossible de changer le mot de passe.
176 176 notice_account_lost_email_sent: Un message contenant les instructions pour choisir un nouveau mot de passe vous a été envoyé.
177 177 notice_account_activated: Votre compte a été activé. Vous pouvez à présent vous connecter.
178 178 notice_successful_create: Création effectuée avec succès.
179 179 notice_successful_update: Mise à jour effectuée avec succès.
180 180 notice_successful_delete: Suppression effectuée avec succès.
181 181 notice_successful_connection: Connexion réussie.
182 182 notice_file_not_found: "La page à laquelle vous souhaitez accéder n'existe pas ou a été supprimée."
183 183 notice_locking_conflict: Les données ont été mises à jour par un autre utilisateur. Mise à jour impossible.
184 184 notice_not_authorized: "Vous n'êtes pas autorisé à accéder à cette page."
185 185 notice_not_authorized_archived_project: Le projet auquel vous tentez d'accéder a été archivé.
186 186 notice_email_sent: "Un email a été envoyé à %{value}"
187 187 notice_email_error: "Erreur lors de l'envoi de l'email (%{value})"
188 188 notice_feeds_access_key_reseted: "Votre clé d'accès aux flux Atom a été réinitialisée."
189 189 notice_api_access_key_reseted: Votre clé d'accès API a été réinitialisée.
190 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 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 192 notice_failed_to_save_members: "Erreur lors de la sauvegarde des membres: %{errors}."
193 193 notice_no_issue_selected: "Aucune demande sélectionnée ! Cochez les demandes que vous voulez mettre à jour."
194 194 notice_account_pending: "Votre compte a été créé et attend l'approbation de l'administrateur."
195 195 notice_default_data_loaded: Paramétrage par défaut chargé avec succès.
196 196 notice_unable_delete_version: Impossible de supprimer cette version.
197 197 notice_unable_delete_time_entry: Impossible de supprimer le temps passé.
198 198 notice_issue_done_ratios_updated: L'avancement des demandes a été mis à jour.
199 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 200 notice_issue_successful_create: "Demande %{id} créée."
201 201 notice_issue_update_conflict: "La demande a été mise à jour par un autre utilisateur pendant que vous la modifiez."
202 202 notice_account_deleted: "Votre compte a été définitivement supprimé."
203 203 notice_user_successful_create: "Utilisateur %{id} créé."
204 204 notice_new_password_must_be_different: Votre nouveau mot de passe doit être différent de votre mot de passe actuel
205 205
206 206 error_can_t_load_default_data: "Une erreur s'est produite lors du chargement du paramétrage : %{value}"
207 207 error_scm_not_found: "L'entrée et/ou la révision demandée n'existe pas dans le dépôt."
208 208 error_scm_command_failed: "Une erreur s'est produite lors de l'accès au dépôt : %{value}"
209 209 error_scm_annotate: "L'entrée n'existe pas ou ne peut pas être annotée."
210 210 error_scm_annotate_big_text_file: Cette entrée ne peut pas être annotée car elle excède la taille maximale.
211 211 error_issue_not_found_in_project: "La demande n'existe pas ou n'appartient pas à ce projet"
212 212 error_no_tracker_in_project: "Aucun tracker n'est associé à ce projet. Vérifier la configuration du projet."
213 213 error_no_default_issue_status: "Aucun statut de demande n'est défini par défaut. Vérifier votre configuration (Administration -> Statuts de demandes)."
214 214 error_can_not_delete_custom_field: Impossible de supprimer le champ personnalisé
215 215 error_can_not_delete_tracker: Ce tracker contient des demandes et ne peut pas être supprimé.
216 216 error_can_not_remove_role: Ce rôle est utilisé et ne peut pas être supprimé.
217 217 error_can_not_reopen_issue_on_closed_version: 'Une demande assignée à une version fermée ne peut pas être réouverte'
218 218 error_can_not_archive_project: "Ce projet ne peut pas être archivé"
219 219 error_issue_done_ratios_not_updated: L'avancement des demandes n'a pas pu être mis à jour.
220 220 error_workflow_copy_source: 'Veuillez sélectionner un tracker et/ou un rôle source'
221 221 error_workflow_copy_target: 'Veuillez sélectionner les trackers et rôles cibles'
222 222 error_unable_delete_issue_status: Impossible de supprimer le statut de demande
223 223 error_unable_to_connect: Connexion impossible (%{value})
224 224 error_attachment_too_big: Ce fichier ne peut pas être attaché car il excède la taille maximale autorisée (%{max_size})
225 225 error_session_expired: "Votre session a expiré. Veuillez vous reconnecter."
226 226 warning_attachments_not_saved: "%{count} fichier(s) n'ont pas pu être sauvegardés."
227 227
228 228 mail_subject_lost_password: "Votre mot de passe %{value}"
229 229 mail_body_lost_password: 'Pour changer votre mot de passe, cliquez sur le lien suivant :'
230 230 mail_subject_register: "Activation de votre compte %{value}"
231 231 mail_body_register: 'Pour activer votre compte, cliquez sur le lien suivant :'
232 232 mail_body_account_information_external: "Vous pouvez utiliser votre compte %{value} pour vous connecter."
233 233 mail_body_account_information: Paramètres de connexion de votre compte
234 234 mail_subject_account_activation_request: "Demande d'activation d'un compte %{value}"
235 235 mail_body_account_activation_request: "Un nouvel utilisateur (%{value}) s'est inscrit. Son compte nécessite votre approbation :"
236 236 mail_subject_reminder: "%{count} demande(s) arrivent à échéance (%{days})"
237 237 mail_body_reminder: "%{count} demande(s) qui vous sont assignées arrivent à échéance dans les %{days} prochains jours :"
238 238 mail_subject_wiki_content_added: "Page wiki '%{id}' ajoutée"
239 239 mail_body_wiki_content_added: "La page wiki '%{id}' a été ajoutée par %{author}."
240 240 mail_subject_wiki_content_updated: "Page wiki '%{id}' mise à jour"
241 241 mail_body_wiki_content_updated: "La page wiki '%{id}' a été mise à jour par %{author}."
242 242
243 243 field_name: Nom
244 244 field_description: Description
245 245 field_summary: Résumé
246 246 field_is_required: Obligatoire
247 247 field_firstname: Prénom
248 248 field_lastname: Nom
249 249 field_mail: Email
250 250 field_filename: Fichier
251 251 field_filesize: Taille
252 252 field_downloads: Téléchargements
253 253 field_author: Auteur
254 254 field_created_on: Créé
255 255 field_updated_on: Mis-à-jour
256 256 field_closed_on: Fermé
257 257 field_field_format: Format
258 258 field_is_for_all: Pour tous les projets
259 259 field_possible_values: Valeurs possibles
260 260 field_regexp: Expression régulière
261 261 field_min_length: Longueur minimum
262 262 field_max_length: Longueur maximum
263 263 field_value: Valeur
264 264 field_category: Catégorie
265 265 field_title: Titre
266 266 field_project: Projet
267 267 field_issue: Demande
268 268 field_status: Statut
269 269 field_notes: Notes
270 270 field_is_closed: Demande fermée
271 271 field_is_default: Valeur par défaut
272 272 field_tracker: Tracker
273 273 field_subject: Sujet
274 274 field_due_date: Echéance
275 275 field_assigned_to: Assigné à
276 276 field_priority: Priorité
277 277 field_fixed_version: Version cible
278 278 field_user: Utilisateur
279 279 field_principal: Principal
280 280 field_role: Rôle
281 281 field_homepage: Site web
282 282 field_is_public: Public
283 283 field_parent: Sous-projet de
284 284 field_is_in_roadmap: Demandes affichées dans la roadmap
285 285 field_login: Identifiant
286 286 field_mail_notification: Notifications par mail
287 287 field_admin: Administrateur
288 288 field_last_login_on: Dernière connexion
289 289 field_language: Langue
290 290 field_effective_date: Date
291 291 field_password: Mot de passe
292 292 field_new_password: Nouveau mot de passe
293 293 field_password_confirmation: Confirmation
294 294 field_version: Version
295 295 field_type: Type
296 296 field_host: Hôte
297 297 field_port: Port
298 298 field_account: Compte
299 299 field_base_dn: Base DN
300 300 field_attr_login: Attribut Identifiant
301 301 field_attr_firstname: Attribut Prénom
302 302 field_attr_lastname: Attribut Nom
303 303 field_attr_mail: Attribut Email
304 304 field_onthefly: Création des utilisateurs à la volée
305 305 field_start_date: Début
306 306 field_done_ratio: "% réalisé"
307 307 field_auth_source: Mode d'authentification
308 308 field_hide_mail: Cacher mon adresse mail
309 309 field_comments: Commentaire
310 310 field_url: URL
311 311 field_start_page: Page de démarrage
312 312 field_subproject: Sous-projet
313 313 field_hours: Heures
314 314 field_activity: Activité
315 315 field_spent_on: Date
316 316 field_identifier: Identifiant
317 317 field_is_filter: Utilisé comme filtre
318 318 field_issue_to: Demande liée
319 319 field_delay: Retard
320 320 field_assignable: Demandes assignables à ce rôle
321 321 field_redirect_existing_links: Rediriger les liens existants
322 322 field_estimated_hours: Temps estimé
323 323 field_column_names: Colonnes
324 324 field_time_entries: Temps passé
325 325 field_time_zone: Fuseau horaire
326 326 field_searchable: Utilisé pour les recherches
327 327 field_default_value: Valeur par défaut
328 328 field_comments_sorting: Afficher les commentaires
329 329 field_parent_title: Page parent
330 330 field_editable: Modifiable
331 331 field_watcher: Observateur
332 332 field_identity_url: URL OpenID
333 333 field_content: Contenu
334 334 field_group_by: Grouper par
335 335 field_sharing: Partage
336 336 field_parent_issue: Tâche parente
337 337 field_member_of_group: Groupe de l'assigné
338 338 field_assigned_to_role: Rôle de l'assigné
339 339 field_text: Champ texte
340 340 field_visible: Visible
341 341 field_warn_on_leaving_unsaved: "M'avertir lorsque je quitte une page contenant du texte non sauvegardé"
342 342 field_issues_visibility: Visibilité des demandes
343 343 field_is_private: Privée
344 344 field_commit_logs_encoding: Encodage des messages de commit
345 345 field_scm_path_encoding: Encodage des chemins
346 346 field_path_to_repository: Chemin du dépôt
347 347 field_root_directory: Répertoire racine
348 348 field_cvsroot: CVSROOT
349 349 field_cvs_module: Module
350 350 field_repository_is_default: Dépôt principal
351 351 field_multiple: Valeurs multiples
352 352 field_auth_source_ldap_filter: Filtre LDAP
353 353 field_core_fields: Champs standards
354 354 field_timeout: "Timeout (en secondes)"
355 355 field_board_parent: Forum parent
356 356 field_private_notes: Notes privées
357 357 field_inherit_members: Hériter les membres
358 358 field_generate_password: Générer un mot de passe
359 359 field_must_change_passwd: Doit changer de mot de passe à la prochaine connexion
360 field_default_status: Statut par défaut
360 361
361 362 setting_app_title: Titre de l'application
362 363 setting_app_subtitle: Sous-titre de l'application
363 364 setting_welcome_text: Texte d'accueil
364 365 setting_default_language: Langue par défaut
365 366 setting_login_required: Authentification obligatoire
366 367 setting_self_registration: Inscription des nouveaux utilisateurs
367 368 setting_attachment_max_size: Taille maximale des fichiers
368 369 setting_issues_export_limit: Limite d'exportation des demandes
369 370 setting_mail_from: Adresse d'émission
370 371 setting_bcc_recipients: Destinataires en copie cachée (cci)
371 372 setting_plain_text_mail: Mail en texte brut (non HTML)
372 373 setting_host_name: Nom d'hôte et chemin
373 374 setting_text_formatting: Formatage du texte
374 375 setting_wiki_compression: Compression de l'historique des pages wiki
375 376 setting_feeds_limit: Nombre maximal d'éléments dans les flux Atom
376 377 setting_default_projects_public: Définir les nouveaux projets comme publics par défaut
377 378 setting_autofetch_changesets: Récupération automatique des commits
378 379 setting_sys_api_enabled: Activer les WS pour la gestion des dépôts
379 380 setting_commit_ref_keywords: Mots-clés de référencement
380 381 setting_commit_fix_keywords: Mots-clés de résolution
381 382 setting_autologin: Durée maximale de connexion automatique
382 383 setting_date_format: Format de date
383 384 setting_time_format: Format d'heure
384 385 setting_cross_project_issue_relations: Autoriser les relations entre demandes de différents projets
385 386 setting_cross_project_subtasks: Autoriser les sous-tâches dans des projets différents
386 387 setting_issue_list_default_columns: Colonnes affichées par défaut sur la liste des demandes
387 388 setting_repositories_encodings: Encodages des fichiers et des dépôts
388 389 setting_emails_header: En-tête des emails
389 390 setting_emails_footer: Pied-de-page des emails
390 391 setting_protocol: Protocole
391 392 setting_per_page_options: Options d'objets affichés par page
392 393 setting_user_format: Format d'affichage des utilisateurs
393 394 setting_activity_days_default: Nombre de jours affichés sur l'activité des projets
394 395 setting_display_subprojects_issues: Afficher par défaut les demandes des sous-projets sur les projets principaux
395 396 setting_enabled_scm: SCM activés
396 397 setting_mail_handler_body_delimiters: "Tronquer les emails après l'une de ces lignes"
397 398 setting_mail_handler_api_enabled: "Activer le WS pour la réception d'emails"
398 399 setting_mail_handler_api_key: Clé de protection de l'API
399 400 setting_sequential_project_identifiers: Générer des identifiants de projet séquentiels
400 401 setting_gravatar_enabled: Afficher les Gravatar des utilisateurs
401 402 setting_gravatar_default: Image Gravatar par défaut
402 403 setting_diff_max_lines_displayed: Nombre maximum de lignes de diff affichées
403 404 setting_file_max_size_displayed: Taille maximum des fichiers texte affichés en ligne
404 405 setting_repository_log_display_limit: "Nombre maximum de révisions affichées sur l'historique d'un fichier"
405 406 setting_openid: "Autoriser l'authentification et l'enregistrement OpenID"
406 407 setting_password_min_length: Longueur minimum des mots de passe
407 408 setting_new_project_user_role_id: Rôle donné à un utilisateur non-administrateur qui crée un projet
408 409 setting_default_projects_modules: Modules activés par défaut pour les nouveaux projets
409 410 setting_issue_done_ratio: Calcul de l'avancement des demandes
410 411 setting_issue_done_ratio_issue_field: 'Utiliser le champ % effectué'
411 412 setting_issue_done_ratio_issue_status: Utiliser le statut
412 413 setting_start_of_week: Jour de début des calendriers
413 414 setting_rest_api_enabled: Activer l'API REST
414 415 setting_cache_formatted_text: Mettre en cache le texte formaté
415 416 setting_default_notification_option: Option de notification par défaut
416 417 setting_commit_logtime_enabled: Permettre la saisie de temps
417 418 setting_commit_logtime_activity_id: Activité pour le temps saisi
418 419 setting_gantt_items_limit: Nombre maximum d'éléments affichés sur le gantt
419 420 setting_issue_group_assignment: Permettre l'assignement des demandes aux groupes
420 421 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
421 422 setting_commit_cross_project_ref: Permettre le référencement et la résolution des demandes de tous les autres projets
422 423 setting_unsubscribe: Permettre aux utilisateurs de supprimer leur propre compte
423 424 setting_session_lifetime: Durée de vie maximale des sessions
424 425 setting_session_timeout: Durée maximale d'inactivité
425 426 setting_thumbnails_enabled: Afficher les vignettes des images
426 427 setting_thumbnails_size: Taille des vignettes (en pixels)
427 428 setting_non_working_week_days: Jours non travaillés
428 429 setting_jsonp_enabled: Activer le support JSONP
429 430 setting_default_projects_tracker_ids: Trackers par défaut pour les nouveaux projets
430 431 setting_mail_handler_excluded_filenames: Exclure les fichiers attachés par leur nom
431 432 setting_force_default_language_for_anonymous: Forcer la langue par défault pour les utilisateurs anonymes
432 433 setting_force_default_language_for_loggedin: Forcer la langue par défault pour les utilisateurs identifiés
433 434
434 435 permission_add_project: Créer un projet
435 436 permission_add_subprojects: Créer des sous-projets
436 437 permission_edit_project: Modifier le projet
437 438 permission_close_project: Fermer / réouvrir le projet
438 439 permission_select_project_modules: Choisir les modules
439 440 permission_manage_members: Gérer les membres
440 441 permission_manage_project_activities: Gérer les activités
441 442 permission_manage_versions: Gérer les versions
442 443 permission_manage_categories: Gérer les catégories de demandes
443 444 permission_view_issues: Voir les demandes
444 445 permission_add_issues: Créer des demandes
445 446 permission_edit_issues: Modifier les demandes
446 447 permission_manage_issue_relations: Gérer les relations
447 448 permission_set_issues_private: Rendre les demandes publiques ou privées
448 449 permission_set_own_issues_private: Rendre ses propres demandes publiques ou privées
449 450 permission_add_issue_notes: Ajouter des notes
450 451 permission_edit_issue_notes: Modifier les notes
451 452 permission_edit_own_issue_notes: Modifier ses propres notes
452 453 permission_view_private_notes: Voir les notes privées
453 454 permission_set_notes_private: Rendre les notes privées
454 455 permission_move_issues: Déplacer les demandes
455 456 permission_delete_issues: Supprimer les demandes
456 457 permission_manage_public_queries: Gérer les requêtes publiques
457 458 permission_save_queries: Sauvegarder les requêtes
458 459 permission_view_gantt: Voir le gantt
459 460 permission_view_calendar: Voir le calendrier
460 461 permission_view_issue_watchers: Voir la liste des observateurs
461 462 permission_add_issue_watchers: Ajouter des observateurs
462 463 permission_delete_issue_watchers: Supprimer des observateurs
463 464 permission_log_time: Saisir le temps passé
464 465 permission_view_time_entries: Voir le temps passé
465 466 permission_edit_time_entries: Modifier les temps passés
466 467 permission_edit_own_time_entries: Modifier son propre temps passé
467 468 permission_manage_news: Gérer les annonces
468 469 permission_comment_news: Commenter les annonces
469 470 permission_view_documents: Voir les documents
470 471 permission_add_documents: Ajouter des documents
471 472 permission_edit_documents: Modifier les documents
472 473 permission_delete_documents: Supprimer les documents
473 474 permission_manage_files: Gérer les fichiers
474 475 permission_view_files: Voir les fichiers
475 476 permission_manage_wiki: Gérer le wiki
476 477 permission_rename_wiki_pages: Renommer les pages
477 478 permission_delete_wiki_pages: Supprimer les pages
478 479 permission_view_wiki_pages: Voir le wiki
479 480 permission_view_wiki_edits: "Voir l'historique des modifications"
480 481 permission_edit_wiki_pages: Modifier les pages
481 482 permission_delete_wiki_pages_attachments: Supprimer les fichiers joints
482 483 permission_protect_wiki_pages: Protéger les pages
483 484 permission_manage_repository: Gérer le dépôt de sources
484 485 permission_browse_repository: Parcourir les sources
485 486 permission_view_changesets: Voir les révisions
486 487 permission_commit_access: Droit de commit
487 488 permission_manage_boards: Gérer les forums
488 489 permission_view_messages: Voir les messages
489 490 permission_add_messages: Poster un message
490 491 permission_edit_messages: Modifier les messages
491 492 permission_edit_own_messages: Modifier ses propres messages
492 493 permission_delete_messages: Supprimer les messages
493 494 permission_delete_own_messages: Supprimer ses propres messages
494 495 permission_export_wiki_pages: Exporter les pages
495 496 permission_manage_subtasks: Gérer les sous-tâches
496 497 permission_manage_related_issues: Gérer les demandes associées
497 498
498 499 project_module_issue_tracking: Suivi des demandes
499 500 project_module_time_tracking: Suivi du temps passé
500 501 project_module_news: Publication d'annonces
501 502 project_module_documents: Publication de documents
502 503 project_module_files: Publication de fichiers
503 504 project_module_wiki: Wiki
504 505 project_module_repository: Dépôt de sources
505 506 project_module_boards: Forums de discussion
506 507 project_module_calendar: Calendrier
507 508 project_module_gantt: Gantt
508 509
509 510 label_user: Utilisateur
510 511 label_user_plural: Utilisateurs
511 512 label_user_new: Nouvel utilisateur
512 513 label_user_anonymous: Anonyme
513 514 label_project: Projet
514 515 label_project_new: Nouveau projet
515 516 label_project_plural: Projets
516 517 label_x_projects:
517 518 zero: aucun projet
518 519 one: un projet
519 520 other: "%{count} projets"
520 521 label_project_all: Tous les projets
521 522 label_project_latest: Derniers projets
522 523 label_issue: Demande
523 524 label_issue_new: Nouvelle demande
524 525 label_issue_plural: Demandes
525 526 label_issue_view_all: Voir toutes les demandes
526 527 label_issues_by: "Demandes par %{value}"
527 528 label_issue_added: Demande ajoutée
528 529 label_issue_updated: Demande mise à jour
529 530 label_issue_note_added: Note ajoutée
530 531 label_issue_status_updated: Statut changé
531 532 label_issue_assigned_to_updated: Assigné changé
532 533 label_issue_priority_updated: Priorité changée
533 534 label_document: Document
534 535 label_document_new: Nouveau document
535 536 label_document_plural: Documents
536 537 label_document_added: Document ajouté
537 538 label_role: Rôle
538 539 label_role_plural: Rôles
539 540 label_role_new: Nouveau rôle
540 541 label_role_and_permissions: Rôles et permissions
541 542 label_role_anonymous: Anonyme
542 543 label_role_non_member: Non membre
543 544 label_member: Membre
544 545 label_member_new: Nouveau membre
545 546 label_member_plural: Membres
546 547 label_tracker: Tracker
547 548 label_tracker_plural: Trackers
548 549 label_tracker_new: Nouveau tracker
549 550 label_workflow: Workflow
550 551 label_issue_status: Statut de demandes
551 552 label_issue_status_plural: Statuts de demandes
552 553 label_issue_status_new: Nouveau statut
553 554 label_issue_category: Catégorie de demandes
554 555 label_issue_category_plural: Catégories de demandes
555 556 label_issue_category_new: Nouvelle catégorie
556 557 label_custom_field: Champ personnalisé
557 558 label_custom_field_plural: Champs personnalisés
558 559 label_custom_field_new: Nouveau champ personnalisé
559 560 label_enumerations: Listes de valeurs
560 561 label_enumeration_new: Nouvelle valeur
561 562 label_information: Information
562 563 label_information_plural: Informations
563 564 label_please_login: Identification
564 565 label_register: S'enregistrer
565 566 label_login_with_open_id_option: S'authentifier avec OpenID
566 567 label_password_lost: Mot de passe perdu
567 568 label_home: Accueil
568 569 label_my_page: Ma page
569 570 label_my_account: Mon compte
570 571 label_my_projects: Mes projets
571 572 label_my_page_block: Blocs disponibles
572 573 label_administration: Administration
573 574 label_login: Connexion
574 575 label_logout: Déconnexion
575 576 label_help: Aide
576 577 label_reported_issues: Demandes soumises
577 578 label_assigned_to_me_issues: Demandes qui me sont assignées
578 579 label_last_login: Dernière connexion
579 580 label_registered_on: Inscrit le
580 581 label_activity: Activité
581 582 label_overall_activity: Activité globale
582 583 label_user_activity: "Activité de %{value}"
583 584 label_new: Nouveau
584 585 label_logged_as: Connecté en tant que
585 586 label_environment: Environnement
586 587 label_authentication: Authentification
587 588 label_auth_source: Mode d'authentification
588 589 label_auth_source_new: Nouveau mode d'authentification
589 590 label_auth_source_plural: Modes d'authentification
590 591 label_subproject_plural: Sous-projets
591 592 label_subproject_new: Nouveau sous-projet
592 593 label_and_its_subprojects: "%{value} et ses sous-projets"
593 594 label_min_max_length: Longueurs mini - maxi
594 595 label_list: Liste
595 596 label_date: Date
596 597 label_integer: Entier
597 598 label_float: Nombre décimal
598 599 label_boolean: Booléen
599 600 label_string: Texte
600 601 label_text: Texte long
601 602 label_attribute: Attribut
602 603 label_attribute_plural: Attributs
603 604 label_no_data: Aucune donnée à afficher
604 605 label_change_status: Changer le statut
605 606 label_history: Historique
606 607 label_attachment: Fichier
607 608 label_attachment_new: Nouveau fichier
608 609 label_attachment_delete: Supprimer le fichier
609 610 label_attachment_plural: Fichiers
610 611 label_file_added: Fichier ajouté
611 612 label_report: Rapport
612 613 label_report_plural: Rapports
613 614 label_news: Annonce
614 615 label_news_new: Nouvelle annonce
615 616 label_news_plural: Annonces
616 617 label_news_latest: Dernières annonces
617 618 label_news_view_all: Voir toutes les annonces
618 619 label_news_added: Annonce ajoutée
619 620 label_news_comment_added: Commentaire ajouté à une annonce
620 621 label_settings: Configuration
621 622 label_overview: Aperçu
622 623 label_version: Version
623 624 label_version_new: Nouvelle version
624 625 label_version_plural: Versions
625 626 label_close_versions: Fermer les versions terminées
626 627 label_confirmation: Confirmation
627 628 label_export_to: 'Formats disponibles :'
628 629 label_read: Lire...
629 630 label_public_projects: Projets publics
630 631 label_open_issues: ouvert
631 632 label_open_issues_plural: ouverts
632 633 label_closed_issues: fermé
633 634 label_closed_issues_plural: fermés
634 635 label_x_open_issues_abbr_on_total:
635 636 zero: 0 ouverte sur %{total}
636 637 one: 1 ouverte sur %{total}
637 638 other: "%{count} ouvertes sur %{total}"
638 639 label_x_open_issues_abbr:
639 640 zero: 0 ouverte
640 641 one: 1 ouverte
641 642 other: "%{count} ouvertes"
642 643 label_x_closed_issues_abbr:
643 644 zero: 0 fermée
644 645 one: 1 fermée
645 646 other: "%{count} fermées"
646 647 label_x_issues:
647 648 zero: 0 demande
648 649 one: 1 demande
649 650 other: "%{count} demandes"
650 651 label_total: Total
651 652 label_total_time: Temps total
652 653 label_permissions: Permissions
653 654 label_current_status: Statut actuel
654 655 label_new_statuses_allowed: Nouveaux statuts autorisés
655 656 label_all: tous
656 657 label_any: tous
657 658 label_none: aucun
658 659 label_nobody: personne
659 660 label_next: Suivant
660 661 label_previous: Précédent
661 662 label_used_by: Utilisé par
662 663 label_details: Détails
663 664 label_add_note: Ajouter une note
664 665 label_per_page: Par page
665 666 label_calendar: Calendrier
666 667 label_months_from: mois depuis
667 668 label_gantt: Gantt
668 669 label_internal: Interne
669 670 label_last_changes: "%{count} derniers changements"
670 671 label_change_view_all: Voir tous les changements
671 672 label_personalize_page: Personnaliser cette page
672 673 label_comment: Commentaire
673 674 label_comment_plural: Commentaires
674 675 label_x_comments:
675 676 zero: aucun commentaire
676 677 one: un commentaire
677 678 other: "%{count} commentaires"
678 679 label_comment_add: Ajouter un commentaire
679 680 label_comment_added: Commentaire ajouté
680 681 label_comment_delete: Supprimer les commentaires
681 682 label_query: Rapport personnalisé
682 683 label_query_plural: Rapports personnalisés
683 684 label_query_new: Nouveau rapport
684 685 label_my_queries: Mes rapports personnalisés
685 686 label_filter_add: Ajouter le filtre
686 687 label_filter_plural: Filtres
687 688 label_equals: égal
688 689 label_not_equals: différent
689 690 label_in_less_than: dans moins de
690 691 label_in_more_than: dans plus de
691 692 label_in_the_next_days: dans les prochains jours
692 693 label_in_the_past_days: dans les derniers jours
693 694 label_greater_or_equal: '>='
694 695 label_less_or_equal: '<='
695 696 label_between: entre
696 697 label_in: dans
697 698 label_today: aujourd'hui
698 699 label_all_time: toute la période
699 700 label_yesterday: hier
700 701 label_this_week: cette semaine
701 702 label_last_week: la semaine dernière
702 703 label_last_n_weeks: "les %{count} dernières semaines"
703 704 label_last_n_days: "les %{count} derniers jours"
704 705 label_this_month: ce mois-ci
705 706 label_last_month: le mois dernier
706 707 label_this_year: cette année
707 708 label_date_range: Période
708 709 label_less_than_ago: il y a moins de
709 710 label_more_than_ago: il y a plus de
710 711 label_ago: il y a
711 712 label_contains: contient
712 713 label_not_contains: ne contient pas
713 714 label_any_issues_in_project: une demande du projet
714 715 label_any_issues_not_in_project: une demande hors du projet
715 716 label_no_issues_in_project: aucune demande du projet
716 717 label_day_plural: jours
717 718 label_repository: Dépôt
718 719 label_repository_new: Nouveau dépôt
719 720 label_repository_plural: Dépôts
720 721 label_browse: Parcourir
721 722 label_branch: Branche
722 723 label_tag: Tag
723 724 label_revision: Révision
724 725 label_revision_plural: Révisions
725 726 label_revision_id: "Révision %{value}"
726 727 label_associated_revisions: Révisions associées
727 728 label_added: ajouté
728 729 label_modified: modifié
729 730 label_copied: copié
730 731 label_renamed: renommé
731 732 label_deleted: supprimé
732 733 label_latest_revision: Dernière révision
733 734 label_latest_revision_plural: Dernières révisions
734 735 label_view_revisions: Voir les révisions
735 736 label_view_all_revisions: Voir toutes les révisions
736 737 label_max_size: Taille maximale
737 738 label_sort_highest: Remonter en premier
738 739 label_sort_higher: Remonter
739 740 label_sort_lower: Descendre
740 741 label_sort_lowest: Descendre en dernier
741 742 label_roadmap: Roadmap
742 743 label_roadmap_due_in: "Échéance dans %{value}"
743 744 label_roadmap_overdue: "En retard de %{value}"
744 745 label_roadmap_no_issues: Aucune demande pour cette version
745 746 label_search: Recherche
746 747 label_result_plural: Résultats
747 748 label_all_words: Tous les mots
748 749 label_wiki: Wiki
749 750 label_wiki_edit: Révision wiki
750 751 label_wiki_edit_plural: Révisions wiki
751 752 label_wiki_page: Page wiki
752 753 label_wiki_page_plural: Pages wiki
753 754 label_index_by_title: Index par titre
754 755 label_index_by_date: Index par date
755 756 label_current_version: Version actuelle
756 757 label_preview: Prévisualisation
757 758 label_feed_plural: Flux Atom
758 759 label_changes_details: Détails de tous les changements
759 760 label_issue_tracking: Suivi des demandes
760 761 label_spent_time: Temps passé
761 762 label_overall_spent_time: Temps passé global
762 763 label_f_hour: "%{value} heure"
763 764 label_f_hour_plural: "%{value} heures"
764 765 label_time_tracking: Suivi du temps
765 766 label_change_plural: Changements
766 767 label_statistics: Statistiques
767 768 label_commits_per_month: Commits par mois
768 769 label_commits_per_author: Commits par auteur
769 770 label_diff: diff
770 771 label_view_diff: Voir les différences
771 772 label_diff_inline: en ligne
772 773 label_diff_side_by_side: côte à côte
773 774 label_options: Options
774 775 label_copy_workflow_from: Copier le workflow de
775 776 label_permissions_report: Synthèse des permissions
776 777 label_watched_issues: Demandes surveillées
777 778 label_related_issues: Demandes liées
778 779 label_applied_status: Statut appliqué
779 780 label_loading: Chargement...
780 781 label_relation_new: Nouvelle relation
781 782 label_relation_delete: Supprimer la relation
782 783 label_relates_to: Lié à
783 784 label_duplicates: Duplique
784 785 label_duplicated_by: Dupliqué par
785 786 label_blocks: Bloque
786 787 label_blocked_by: Bloqué par
787 788 label_precedes: Précède
788 789 label_follows: Suit
789 790 label_copied_to: Copié vers
790 791 label_copied_from: Copié depuis
791 792 label_end_to_start: fin à début
792 793 label_end_to_end: fin à fin
793 794 label_start_to_start: début à début
794 795 label_start_to_end: début à fin
795 796 label_stay_logged_in: Rester connecté
796 797 label_disabled: désactivé
797 798 label_show_completed_versions: Voir les versions passées
798 799 label_me: moi
799 800 label_board: Forum
800 801 label_board_new: Nouveau forum
801 802 label_board_plural: Forums
802 803 label_board_locked: Verrouillé
803 804 label_board_sticky: Sticky
804 805 label_topic_plural: Discussions
805 806 label_message_plural: Messages
806 807 label_message_last: Dernier message
807 808 label_message_new: Nouveau message
808 809 label_message_posted: Message ajouté
809 810 label_reply_plural: Réponses
810 811 label_send_information: Envoyer les informations à l'utilisateur
811 812 label_year: Année
812 813 label_month: Mois
813 814 label_week: Semaine
814 815 label_date_from: Du
815 816 label_date_to: Au
816 817 label_language_based: Basé sur la langue de l'utilisateur
817 818 label_sort_by: "Trier par %{value}"
818 819 label_send_test_email: Envoyer un email de test
819 820 label_feeds_access_key: Clé d'accès Atom
820 821 label_missing_feeds_access_key: Clé d'accès Atom manquante
821 822 label_feeds_access_key_created_on: "Clé d'accès Atom créée il y a %{value}"
822 823 label_module_plural: Modules
823 824 label_added_time_by: "Ajouté par %{author} il y a %{age}"
824 825 label_updated_time_by: "Mis à jour par %{author} il y a %{age}"
825 826 label_updated_time: "Mis à jour il y a %{value}"
826 827 label_jump_to_a_project: Aller à un projet...
827 828 label_file_plural: Fichiers
828 829 label_changeset_plural: Révisions
829 830 label_default_columns: Colonnes par défaut
830 831 label_no_change_option: (Pas de changement)
831 832 label_bulk_edit_selected_issues: Modifier les demandes sélectionnées
832 833 label_bulk_edit_selected_time_entries: Modifier les temps passés sélectionnés
833 834 label_theme: Thème
834 835 label_default: Défaut
835 836 label_search_titles_only: Uniquement dans les titres
836 837 label_user_mail_option_all: "Pour tous les événements de tous mes projets"
837 838 label_user_mail_option_selected: "Pour tous les événements des projets sélectionnés..."
838 839 label_user_mail_option_none: Aucune notification
839 840 label_user_mail_option_only_my_events: Seulement pour ce que je surveille
840 841 label_user_mail_option_only_assigned: Seulement pour ce qui m'est assigné
841 842 label_user_mail_option_only_owner: Seulement pour ce que j'ai créé
842 843 label_user_mail_no_self_notified: "Je ne veux pas être notifié des changements que j'effectue"
843 844 label_registration_activation_by_email: activation du compte par email
844 845 label_registration_manual_activation: activation manuelle du compte
845 846 label_registration_automatic_activation: activation automatique du compte
846 847 label_display_per_page: "Par page : %{value}"
847 848 label_age: Âge
848 849 label_change_properties: Changer les propriétés
849 850 label_general: Général
850 851 label_more: Plus
851 852 label_scm: SCM
852 853 label_plugins: Plugins
853 854 label_ldap_authentication: Authentification LDAP
854 855 label_downloads_abbr: D/L
855 856 label_optional_description: Description facultative
856 857 label_add_another_file: Ajouter un autre fichier
857 858 label_preferences: Préférences
858 859 label_chronological_order: Dans l'ordre chronologique
859 860 label_reverse_chronological_order: Dans l'ordre chronologique inverse
860 861 label_planning: Planning
861 862 label_incoming_emails: Emails entrants
862 863 label_generate_key: Générer une clé
863 864 label_issue_watchers: Observateurs
864 865 label_example: Exemple
865 866 label_display: Affichage
866 867 label_sort: Tri
867 868 label_ascending: Croissant
868 869 label_descending: Décroissant
869 870 label_date_from_to: Du %{start} au %{end}
870 871 label_wiki_content_added: Page wiki ajoutée
871 872 label_wiki_content_updated: Page wiki mise à jour
872 873 label_group: Groupe
873 874 label_group_plural: Groupes
874 875 label_group_new: Nouveau groupe
875 876 label_group_anonymous: Utilisateurs anonymes
876 877 label_group_non_member: Utilisateurs non membres
877 878 label_time_entry_plural: Temps passé
878 879 label_version_sharing_none: Non partagé
879 880 label_version_sharing_descendants: Avec les sous-projets
880 881 label_version_sharing_hierarchy: Avec toute la hiérarchie
881 882 label_version_sharing_tree: Avec tout l'arbre
882 883 label_version_sharing_system: Avec tous les projets
883 884 label_update_issue_done_ratios: Mettre à jour l'avancement des demandes
884 885 label_copy_source: Source
885 886 label_copy_target: Cible
886 887 label_copy_same_as_target: Comme la cible
887 888 label_display_used_statuses_only: N'afficher que les statuts utilisés dans ce tracker
888 889 label_api_access_key: Clé d'accès API
889 890 label_missing_api_access_key: Clé d'accès API manquante
890 891 label_api_access_key_created_on: Clé d'accès API créée il y a %{value}
891 892 label_profile: Profil
892 893 label_subtask_plural: Sous-tâches
893 894 label_project_copy_notifications: Envoyer les notifications durant la copie du projet
894 895 label_principal_search: "Rechercher un utilisateur ou un groupe :"
895 896 label_user_search: "Rechercher un utilisateur :"
896 897 label_additional_workflow_transitions_for_author: Autorisations supplémentaires lorsque l'utilisateur a créé la demande
897 898 label_additional_workflow_transitions_for_assignee: Autorisations supplémentaires lorsque la demande est assignée à l'utilisateur
898 899 label_issues_visibility_all: Toutes les demandes
899 900 label_issues_visibility_public: Toutes les demandes non privées
900 901 label_issues_visibility_own: Demandes créées par ou assignées à l'utilisateur
901 902 label_git_report_last_commit: Afficher le dernier commit des fichiers et répertoires
902 903 label_parent_revision: Parent
903 904 label_child_revision: Enfant
904 905 label_export_options: Options d'exportation %{export_format}
905 906 label_copy_attachments: Copier les fichiers
906 907 label_copy_subtasks: Copier les sous-tâches
907 908 label_item_position: "%{position} sur %{count}"
908 909 label_completed_versions: Versions passées
909 910 label_search_for_watchers: Rechercher des observateurs
910 911 label_session_expiration: Expiration des sessions
911 912 label_show_closed_projects: Voir les projets fermés
912 913 label_status_transitions: Changements de statut
913 914 label_fields_permissions: Permissions sur les champs
914 915 label_readonly: Lecture
915 916 label_required: Obligatoire
916 917 label_hidden: Caché
917 918 label_attribute_of_project: "%{name} du projet"
918 919 label_attribute_of_issue: "%{name} de la demande"
919 920 label_attribute_of_author: "%{name} de l'auteur"
920 921 label_attribute_of_assigned_to: "%{name} de l'assigné"
921 922 label_attribute_of_user: "%{name} de l'utilisateur"
922 923 label_attribute_of_fixed_version: "%{name} de la version cible"
923 924 label_cross_project_descendants: Avec les sous-projets
924 925 label_cross_project_tree: Avec tout l'arbre
925 926 label_cross_project_hierarchy: Avec toute la hiérarchie
926 927 label_cross_project_system: Avec tous les projets
927 928 label_gantt_progress_line: Ligne de progression
928 929 label_visibility_private: par moi uniquement
929 930 label_visibility_roles: par ces rôles uniquement
930 931 label_visibility_public: par tout le monde
931 932 label_link: Lien
932 933 label_only: seulement
933 934 label_drop_down_list: liste déroulante
934 935 label_checkboxes: cases à cocher
935 936 label_radio_buttons: boutons radio
936 937 label_link_values_to: Lier les valeurs vers l'URL
937 938 label_custom_field_select_type: Selectionner le type d'objet auquel attacher le champ personnalisé
938 939 label_check_for_updates: Vérifier les mises à jour
939 940 label_latest_compatible_version: Dernière version compatible
940 941 label_unknown_plugin: Plugin inconnu
941 942 label_add_projects: Ajouter des projets
942 943
943 944 button_login: Connexion
944 945 button_submit: Soumettre
945 946 button_save: Sauvegarder
946 947 button_check_all: Tout cocher
947 948 button_uncheck_all: Tout décocher
948 949 button_collapse_all: Plier tout
949 950 button_expand_all: Déplier tout
950 951 button_delete: Supprimer
951 952 button_create: Créer
952 953 button_create_and_continue: Créer et continuer
953 954 button_test: Tester
954 955 button_edit: Modifier
955 956 button_edit_associated_wikipage: "Modifier la page wiki associée: %{page_title}"
956 957 button_add: Ajouter
957 958 button_change: Changer
958 959 button_apply: Appliquer
959 960 button_clear: Effacer
960 961 button_lock: Verrouiller
961 962 button_unlock: Déverrouiller
962 963 button_download: Télécharger
963 964 button_list: Lister
964 965 button_view: Voir
965 966 button_move: Déplacer
966 967 button_move_and_follow: Déplacer et suivre
967 968 button_back: Retour
968 969 button_cancel: Annuler
969 970 button_activate: Activer
970 971 button_sort: Trier
971 972 button_log_time: Saisir temps
972 973 button_rollback: Revenir à cette version
973 974 button_watch: Surveiller
974 975 button_unwatch: Ne plus surveiller
975 976 button_reply: Répondre
976 977 button_archive: Archiver
977 978 button_unarchive: Désarchiver
978 979 button_reset: Réinitialiser
979 980 button_rename: Renommer
980 981 button_change_password: Changer de mot de passe
981 982 button_copy: Copier
982 983 button_copy_and_follow: Copier et suivre
983 984 button_annotate: Annoter
984 985 button_update: Mettre à jour
985 986 button_configure: Configurer
986 987 button_quote: Citer
987 988 button_duplicate: Dupliquer
988 989 button_show: Afficher
989 990 button_hide: Cacher
990 991 button_edit_section: Modifier cette section
991 992 button_export: Exporter
992 993 button_delete_my_account: Supprimer mon compte
993 994 button_close: Fermer
994 995 button_reopen: Réouvrir
995 996
996 997 status_active: actif
997 998 status_registered: enregistré
998 999 status_locked: verrouillé
999 1000
1000 1001 project_status_active: actif
1001 1002 project_status_closed: fermé
1002 1003 project_status_archived: archivé
1003 1004
1004 1005 version_status_open: ouvert
1005 1006 version_status_locked: verrouillé
1006 1007 version_status_closed: fermé
1007 1008
1008 1009 field_active: Actif
1009 1010
1010 1011 text_select_mail_notifications: Actions pour lesquelles une notification par e-mail est envoyée
1011 1012 text_regexp_info: ex. ^[A-Z0-9]+$
1012 1013 text_min_max_length_info: 0 pour aucune restriction
1013 1014 text_project_destroy_confirmation: Êtes-vous sûr de vouloir supprimer ce projet et toutes ses données ?
1014 1015 text_subprojects_destroy_warning: "Ses sous-projets : %{value} seront également supprimés."
1015 1016 text_workflow_edit: Sélectionner un tracker et un rôle pour éditer le workflow
1016 1017 text_are_you_sure: Êtes-vous sûr ?
1017 1018 text_journal_changed: "%{label} changé de %{old} à %{new}"
1018 1019 text_journal_changed_no_detail: "%{label} mis à jour"
1019 1020 text_journal_set_to: "%{label} mis à %{value}"
1020 1021 text_journal_deleted: "%{label} %{old} supprimé"
1021 1022 text_journal_added: "%{label} %{value} ajouté"
1022 1023 text_tip_issue_begin_day: tâche commençant ce jour
1023 1024 text_tip_issue_end_day: tâche finissant ce jour
1024 1025 text_tip_issue_begin_end_day: tâche commençant et finissant ce jour
1025 1026 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é.'
1026 1027 text_caracters_maximum: "%{count} caractères maximum."
1027 1028 text_caracters_minimum: "%{count} caractères minimum."
1028 1029 text_length_between: "Longueur comprise entre %{min} et %{max} caractères."
1029 1030 text_tracker_no_workflow: Aucun worflow n'est défini pour ce tracker
1030 1031 text_unallowed_characters: Caractères non autorisés
1031 1032 text_comma_separated: Plusieurs valeurs possibles (séparées par des virgules).
1032 1033 text_line_separated: Plusieurs valeurs possibles (une valeur par ligne).
1033 1034 text_issues_ref_in_commit_messages: Référencement et résolution des demandes dans les commentaires de commits
1034 1035 text_issue_added: "La demande %{id} a été soumise par %{author}."
1035 1036 text_issue_updated: "La demande %{id} a été mise à jour par %{author}."
1036 1037 text_wiki_destroy_confirmation: Etes-vous sûr de vouloir supprimer ce wiki et tout son contenu ?
1037 1038 text_issue_category_destroy_question: "%{count} demandes sont affectées à cette catégorie. Que voulez-vous faire ?"
1038 1039 text_issue_category_destroy_assignments: N'affecter les demandes à aucune autre catégorie
1039 1040 text_issue_category_reassign_to: Réaffecter les demandes à cette catégorie
1040 1041 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)."
1041 1042 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é."
1042 1043 text_load_default_configuration: Charger le paramétrage par défaut
1043 1044 text_status_changed_by_changeset: "Appliqué par commit %{value}."
1044 1045 text_time_logged_by_changeset: "Appliqué par commit %{value}"
1045 1046 text_issues_destroy_confirmation: 'Êtes-vous sûr de vouloir supprimer la ou les demandes(s) selectionnée(s) ?'
1046 1047 text_issues_destroy_descendants_confirmation: "Cela entrainera également la suppression de %{count} sous-tâche(s)."
1047 1048 text_time_entries_destroy_confirmation: "Etes-vous sûr de vouloir supprimer les temps passés sélectionnés ?"
1048 1049 text_select_project_modules: 'Sélectionner les modules à activer pour ce projet :'
1049 1050 text_default_administrator_account_changed: Compte administrateur par défaut changé
1050 1051 text_file_repository_writable: Répertoire de stockage des fichiers accessible en écriture
1051 1052 text_plugin_assets_writable: Répertoire public des plugins accessible en écriture
1052 1053 text_rmagick_available: Bibliothèque RMagick présente (optionnelle)
1053 1054 text_convert_available: Binaire convert de ImageMagick présent (optionel)
1054 1055 text_destroy_time_entries_question: "%{hours} heures ont été enregistrées sur les demandes à supprimer. Que voulez-vous faire ?"
1055 1056 text_destroy_time_entries: Supprimer les heures
1056 1057 text_assign_time_entries_to_project: Reporter les heures sur le projet
1057 1058 text_reassign_time_entries: 'Reporter les heures sur cette demande:'
1058 1059 text_user_wrote: "%{value} a écrit :"
1059 1060 text_enumeration_destroy_question: "Cette valeur est affectée à %{count} objets."
1060 1061 text_enumeration_category_reassign_to: 'Réaffecter les objets à cette valeur:'
1061 1062 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."
1062 1063 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."
1063 1064 text_diff_truncated: '... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.'
1064 1065 text_custom_field_possible_values_info: 'Une ligne par valeur'
1065 1066 text_wiki_page_destroy_question: "Cette page possède %{descendants} sous-page(s) et descendante(s). Que voulez-vous faire ?"
1066 1067 text_wiki_page_nullify_children: "Conserver les sous-pages en tant que pages racines"
1067 1068 text_wiki_page_destroy_children: "Supprimer les sous-pages et toutes leurs descedantes"
1068 1069 text_wiki_page_reassign_children: "Réaffecter les sous-pages à cette page"
1069 1070 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 ?"
1070 1071 text_zoom_in: Zoom avant
1071 1072 text_zoom_out: Zoom arrière
1072 1073 text_warn_on_leaving_unsaved: "Cette page contient du texte non sauvegardé qui sera perdu si vous quittez la page."
1073 1074 text_scm_path_encoding_note: "Défaut : UTF-8"
1074 1075 text_git_repository_note: "Le dépôt est vide et local (exemples : /gitrepo, c:\\gitrepo)"
1075 1076 text_mercurial_repository_note: "Dépôt local (exemples : /hgrepo, c:\\hgrepo)"
1076 1077 text_scm_command: Commande
1077 1078 text_scm_command_version: Version
1078 1079 text_scm_config: Vous pouvez configurer les commandes des SCM dans config/configuration.yml. Redémarrer l'application après modification.
1079 1080 text_scm_command_not_available: Ce SCM n'est pas disponible. Vérifier les paramètres dans la section administration.
1080 1081 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)"
1081 1082 text_issue_conflict_resolution_add_notes: "Ajouter mes notes et ignorer mes autres changements"
1082 1083 text_issue_conflict_resolution_cancel: "Annuler ma mise à jour et réafficher %{link}"
1083 1084 text_account_destroy_confirmation: "Êtes-vous sûr de vouloir continuer ?\nVotre compte sera définitivement supprimé, sans aucune possibilité de le réactiver."
1084 1085 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."
1085 1086 text_project_closed: Ce projet est fermé et accessible en lecture seule.
1086 1087 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."
1087 1088
1088 1089 default_role_manager: Manager
1089 1090 default_role_developer: Développeur
1090 1091 default_role_reporter: Rapporteur
1091 1092 default_tracker_bug: Anomalie
1092 1093 default_tracker_feature: Evolution
1093 1094 default_tracker_support: Assistance
1094 1095 default_issue_status_new: Nouveau
1095 1096 default_issue_status_in_progress: En cours
1096 1097 default_issue_status_resolved: Résolu
1097 1098 default_issue_status_feedback: Commentaire
1098 1099 default_issue_status_closed: Fermé
1099 1100 default_issue_status_rejected: Rejeté
1100 1101 default_doc_category_user: Documentation utilisateur
1101 1102 default_doc_category_tech: Documentation technique
1102 1103 default_priority_low: Bas
1103 1104 default_priority_normal: Normal
1104 1105 default_priority_high: Haut
1105 1106 default_priority_urgent: Urgent
1106 1107 default_priority_immediate: Immédiat
1107 1108 default_activity_design: Conception
1108 1109 default_activity_development: Développement
1109 1110
1110 1111 enumeration_issue_priorities: Priorités des demandes
1111 1112 enumeration_doc_categories: Catégories des documents
1112 1113 enumeration_activities: Activités (suivi du temps)
1113 1114 enumeration_system_activity: Activité système
1114 1115 description_filter: Filtre
1115 1116 description_search: Champ de recherche
1116 1117 description_choose_project: Projets
1117 1118 description_project_scope: Périmètre de recherche
1118 1119 description_notes: Notes
1119 1120 description_message_content: Contenu du message
1120 1121 description_query_sort_criteria_attribute: Critère de tri
1121 1122 description_query_sort_criteria_direction: Ordre de tri
1122 1123 description_user_mail_notification: Option de notification
1123 1124 description_available_columns: Colonnes disponibles
1124 1125 description_selected_columns: Colonnes sélectionnées
1125 1126 description_all_columns: Toutes les colonnes
1126 1127 description_issue_category_reassign: Choisir une catégorie
1127 1128 description_wiki_subpages_reassign: Choisir une nouvelle page parent
1128 1129 description_date_range_list: Choisir une période prédéfinie
1129 1130 description_date_range_interval: Choisir une période
1130 1131 description_date_from: Date de début
1131 1132 description_date_to: Date de fin
1132 1133 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é.'
@@ -1,185 +1,185
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 module Redmine
19 19 module DefaultData
20 20 class DataAlreadyLoaded < Exception; end
21 21
22 22 module Loader
23 23 include Redmine::I18n
24 24
25 25 class << self
26 26 # Returns true if no data is already loaded in the database
27 27 # otherwise false
28 28 def no_data?
29 29 !Role.where(:builtin => 0).exists? &&
30 30 !Tracker.exists? &&
31 31 !IssueStatus.exists? &&
32 32 !Enumeration.exists?
33 33 end
34 34
35 35 # Loads the default data
36 36 # Raises a RecordNotSaved exception if something goes wrong
37 37 def load(lang=nil)
38 38 raise DataAlreadyLoaded.new("Some configuration data is already loaded.") unless no_data?
39 39 set_language_if_valid(lang)
40 40
41 41 Role.transaction do
42 42 # Roles
43 43 manager = Role.create! :name => l(:default_role_manager),
44 44 :issues_visibility => 'all',
45 45 :position => 1
46 46 manager.permissions = manager.setable_permissions.collect {|p| p.name}
47 47 manager.save!
48 48
49 49 developer = Role.create! :name => l(:default_role_developer),
50 50 :position => 2,
51 51 :permissions => [:manage_versions,
52 52 :manage_categories,
53 53 :view_issues,
54 54 :add_issues,
55 55 :edit_issues,
56 56 :view_private_notes,
57 57 :set_notes_private,
58 58 :manage_issue_relations,
59 59 :manage_subtasks,
60 60 :add_issue_notes,
61 61 :save_queries,
62 62 :view_gantt,
63 63 :view_calendar,
64 64 :log_time,
65 65 :view_time_entries,
66 66 :comment_news,
67 67 :view_documents,
68 68 :view_wiki_pages,
69 69 :view_wiki_edits,
70 70 :edit_wiki_pages,
71 71 :delete_wiki_pages,
72 72 :add_messages,
73 73 :edit_own_messages,
74 74 :view_files,
75 75 :manage_files,
76 76 :browse_repository,
77 77 :view_changesets,
78 78 :commit_access,
79 79 :manage_related_issues]
80 80
81 81 reporter = Role.create! :name => l(:default_role_reporter),
82 82 :position => 3,
83 83 :permissions => [:view_issues,
84 84 :add_issues,
85 85 :add_issue_notes,
86 86 :save_queries,
87 87 :view_gantt,
88 88 :view_calendar,
89 89 :log_time,
90 90 :view_time_entries,
91 91 :comment_news,
92 92 :view_documents,
93 93 :view_wiki_pages,
94 94 :view_wiki_edits,
95 95 :add_messages,
96 96 :edit_own_messages,
97 97 :view_files,
98 98 :browse_repository,
99 99 :view_changesets]
100 100
101 101 Role.non_member.update_attribute :permissions, [:view_issues,
102 102 :add_issues,
103 103 :add_issue_notes,
104 104 :save_queries,
105 105 :view_gantt,
106 106 :view_calendar,
107 107 :view_time_entries,
108 108 :comment_news,
109 109 :view_documents,
110 110 :view_wiki_pages,
111 111 :view_wiki_edits,
112 112 :add_messages,
113 113 :view_files,
114 114 :browse_repository,
115 115 :view_changesets]
116 116
117 117 Role.anonymous.update_attribute :permissions, [:view_issues,
118 118 :view_gantt,
119 119 :view_calendar,
120 120 :view_time_entries,
121 121 :view_documents,
122 122 :view_wiki_pages,
123 123 :view_wiki_edits,
124 124 :view_files,
125 125 :browse_repository,
126 126 :view_changesets]
127 127
128 # Trackers
129 Tracker.create!(:name => l(:default_tracker_bug), :is_in_chlog => true, :is_in_roadmap => false, :position => 1)
130 Tracker.create!(:name => l(:default_tracker_feature), :is_in_chlog => true, :is_in_roadmap => true, :position => 2)
131 Tracker.create!(:name => l(:default_tracker_support), :is_in_chlog => false, :is_in_roadmap => false, :position => 3)
132
133 128 # Issue statuses
134 new = IssueStatus.create!(:name => l(:default_issue_status_new), :is_closed => false, :is_default => true, :position => 1)
135 in_progress = IssueStatus.create!(:name => l(:default_issue_status_in_progress), :is_closed => false, :is_default => false, :position => 2)
136 resolved = IssueStatus.create!(:name => l(:default_issue_status_resolved), :is_closed => false, :is_default => false, :position => 3)
137 feedback = IssueStatus.create!(:name => l(:default_issue_status_feedback), :is_closed => false, :is_default => false, :position => 4)
138 closed = IssueStatus.create!(:name => l(:default_issue_status_closed), :is_closed => true, :is_default => false, :position => 5)
139 rejected = IssueStatus.create!(:name => l(:default_issue_status_rejected), :is_closed => true, :is_default => false, :position => 6)
129 new = IssueStatus.create!(:name => l(:default_issue_status_new), :is_closed => false, :position => 1)
130 in_progress = IssueStatus.create!(:name => l(:default_issue_status_in_progress), :is_closed => false, :position => 2)
131 resolved = IssueStatus.create!(:name => l(:default_issue_status_resolved), :is_closed => false, :position => 3)
132 feedback = IssueStatus.create!(:name => l(:default_issue_status_feedback), :is_closed => false, :position => 4)
133 closed = IssueStatus.create!(:name => l(:default_issue_status_closed), :is_closed => true, :position => 5)
134 rejected = IssueStatus.create!(:name => l(:default_issue_status_rejected), :is_closed => true, :position => 6)
135
136 # Trackers
137 Tracker.create!(:name => l(:default_tracker_bug), :default_status_id => new.id, :is_in_chlog => true, :is_in_roadmap => false, :position => 1)
138 Tracker.create!(:name => l(:default_tracker_feature), :default_status_id => new.id, :is_in_chlog => true, :is_in_roadmap => true, :position => 2)
139 Tracker.create!(:name => l(:default_tracker_support), :default_status_id => new.id, :is_in_chlog => false, :is_in_roadmap => false, :position => 3)
140 140
141 141 # Workflow
142 142 Tracker.all.each { |t|
143 143 IssueStatus.all.each { |os|
144 144 IssueStatus.all.each { |ns|
145 145 WorkflowTransition.create!(:tracker_id => t.id, :role_id => manager.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
146 146 }
147 147 }
148 148 }
149 149
150 150 Tracker.all.each { |t|
151 151 [new, in_progress, resolved, feedback].each { |os|
152 152 [in_progress, resolved, feedback, closed].each { |ns|
153 153 WorkflowTransition.create!(:tracker_id => t.id, :role_id => developer.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
154 154 }
155 155 }
156 156 }
157 157
158 158 Tracker.all.each { |t|
159 159 [new, in_progress, resolved, feedback].each { |os|
160 160 [closed].each { |ns|
161 161 WorkflowTransition.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
162 162 }
163 163 }
164 164 WorkflowTransition.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => resolved.id, :new_status_id => feedback.id)
165 165 }
166 166
167 167 # Enumerations
168 168 IssuePriority.create!(:name => l(:default_priority_low), :position => 1)
169 169 IssuePriority.create!(:name => l(:default_priority_normal), :position => 2, :is_default => true)
170 170 IssuePriority.create!(:name => l(:default_priority_high), :position => 3)
171 171 IssuePriority.create!(:name => l(:default_priority_urgent), :position => 4)
172 172 IssuePriority.create!(:name => l(:default_priority_immediate), :position => 5)
173 173
174 174 DocumentCategory.create!(:name => l(:default_doc_category_user), :position => 1)
175 175 DocumentCategory.create!(:name => l(:default_doc_category_tech), :position => 2)
176 176
177 177 TimeEntryActivity.create!(:name => l(:default_activity_design), :position => 1)
178 178 TimeEntryActivity.create!(:name => l(:default_activity_development), :position => 2)
179 179 end
180 180 true
181 181 end
182 182 end
183 183 end
184 184 end
185 185 end
@@ -1,516 +1,516
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 desc 'Mantis migration script'
19 19
20 20 require 'active_record'
21 21 require 'pp'
22 22
23 23 namespace :redmine do
24 24 task :migrate_from_mantis => :environment do
25 25
26 26 module MantisMigrate
27 27
28 DEFAULT_STATUS = IssueStatus.default
28 new_status = IssueStatus.find_by_position(1)
29 29 assigned_status = IssueStatus.find_by_position(2)
30 30 resolved_status = IssueStatus.find_by_position(3)
31 31 feedback_status = IssueStatus.find_by_position(4)
32 32 closed_status = IssueStatus.where(:is_closed => true).first
33 STATUS_MAPPING = {10 => DEFAULT_STATUS, # new
33 STATUS_MAPPING = {10 => new_status, # new
34 34 20 => feedback_status, # feedback
35 30 => DEFAULT_STATUS, # acknowledged
36 40 => DEFAULT_STATUS, # confirmed
35 30 => new_status, # acknowledged
36 40 => new_status, # confirmed
37 37 50 => assigned_status, # assigned
38 38 80 => resolved_status, # resolved
39 39 90 => closed_status # closed
40 40 }
41 41
42 42 priorities = IssuePriority.all
43 43 DEFAULT_PRIORITY = priorities[2]
44 44 PRIORITY_MAPPING = {10 => priorities[1], # none
45 45 20 => priorities[1], # low
46 46 30 => priorities[2], # normal
47 47 40 => priorities[3], # high
48 48 50 => priorities[4], # urgent
49 49 60 => priorities[5] # immediate
50 50 }
51 51
52 52 TRACKER_BUG = Tracker.find_by_position(1)
53 53 TRACKER_FEATURE = Tracker.find_by_position(2)
54 54
55 55 roles = Role.where(:builtin => 0).order('position ASC').all
56 56 manager_role = roles[0]
57 57 developer_role = roles[1]
58 58 DEFAULT_ROLE = roles.last
59 59 ROLE_MAPPING = {10 => DEFAULT_ROLE, # viewer
60 60 25 => DEFAULT_ROLE, # reporter
61 61 40 => DEFAULT_ROLE, # updater
62 62 55 => developer_role, # developer
63 63 70 => manager_role, # manager
64 64 90 => manager_role # administrator
65 65 }
66 66
67 67 CUSTOM_FIELD_TYPE_MAPPING = {0 => 'string', # String
68 68 1 => 'int', # Numeric
69 69 2 => 'int', # Float
70 70 3 => 'list', # Enumeration
71 71 4 => 'string', # Email
72 72 5 => 'bool', # Checkbox
73 73 6 => 'list', # List
74 74 7 => 'list', # Multiselection list
75 75 8 => 'date', # Date
76 76 }
77 77
78 78 RELATION_TYPE_MAPPING = {1 => IssueRelation::TYPE_RELATES, # related to
79 79 2 => IssueRelation::TYPE_RELATES, # parent of
80 80 3 => IssueRelation::TYPE_RELATES, # child of
81 81 0 => IssueRelation::TYPE_DUPLICATES, # duplicate of
82 82 4 => IssueRelation::TYPE_DUPLICATES # has duplicate
83 83 }
84 84
85 85 class MantisUser < ActiveRecord::Base
86 86 self.table_name = :mantis_user_table
87 87
88 88 def firstname
89 89 @firstname = realname.blank? ? username : realname.split.first[0..29]
90 90 @firstname
91 91 end
92 92
93 93 def lastname
94 94 @lastname = realname.blank? ? '-' : realname.split[1..-1].join(' ')[0..29]
95 95 @lastname = '-' if @lastname.blank?
96 96 @lastname
97 97 end
98 98
99 99 def email
100 100 if read_attribute(:email).match(/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i) &&
101 101 !User.find_by_mail(read_attribute(:email))
102 102 @email = read_attribute(:email)
103 103 else
104 104 @email = "#{username}@foo.bar"
105 105 end
106 106 end
107 107
108 108 def username
109 109 read_attribute(:username)[0..29].gsub(/[^a-zA-Z0-9_\-@\.]/, '-')
110 110 end
111 111 end
112 112
113 113 class MantisProject < ActiveRecord::Base
114 114 self.table_name = :mantis_project_table
115 115 has_many :versions, :class_name => "MantisVersion", :foreign_key => :project_id
116 116 has_many :categories, :class_name => "MantisCategory", :foreign_key => :project_id
117 117 has_many :news, :class_name => "MantisNews", :foreign_key => :project_id
118 118 has_many :members, :class_name => "MantisProjectUser", :foreign_key => :project_id
119 119
120 120 def identifier
121 121 read_attribute(:name).downcase.gsub(/[^a-z0-9\-]+/, '-').slice(0, Project::IDENTIFIER_MAX_LENGTH)
122 122 end
123 123 end
124 124
125 125 class MantisVersion < ActiveRecord::Base
126 126 self.table_name = :mantis_project_version_table
127 127
128 128 def version
129 129 read_attribute(:version)[0..29]
130 130 end
131 131
132 132 def description
133 133 read_attribute(:description)[0..254]
134 134 end
135 135 end
136 136
137 137 class MantisCategory < ActiveRecord::Base
138 138 self.table_name = :mantis_project_category_table
139 139 end
140 140
141 141 class MantisProjectUser < ActiveRecord::Base
142 142 self.table_name = :mantis_project_user_list_table
143 143 end
144 144
145 145 class MantisBug < ActiveRecord::Base
146 146 self.table_name = :mantis_bug_table
147 147 belongs_to :bug_text, :class_name => "MantisBugText", :foreign_key => :bug_text_id
148 148 has_many :bug_notes, :class_name => "MantisBugNote", :foreign_key => :bug_id
149 149 has_many :bug_files, :class_name => "MantisBugFile", :foreign_key => :bug_id
150 150 has_many :bug_monitors, :class_name => "MantisBugMonitor", :foreign_key => :bug_id
151 151 end
152 152
153 153 class MantisBugText < ActiveRecord::Base
154 154 self.table_name = :mantis_bug_text_table
155 155
156 156 # Adds Mantis steps_to_reproduce and additional_information fields
157 157 # to description if any
158 158 def full_description
159 159 full_description = description
160 160 full_description += "\n\n*Steps to reproduce:*\n\n#{steps_to_reproduce}" unless steps_to_reproduce.blank?
161 161 full_description += "\n\n*Additional information:*\n\n#{additional_information}" unless additional_information.blank?
162 162 full_description
163 163 end
164 164 end
165 165
166 166 class MantisBugNote < ActiveRecord::Base
167 167 self.table_name = :mantis_bugnote_table
168 168 belongs_to :bug, :class_name => "MantisBug", :foreign_key => :bug_id
169 169 belongs_to :bug_note_text, :class_name => "MantisBugNoteText", :foreign_key => :bugnote_text_id
170 170 end
171 171
172 172 class MantisBugNoteText < ActiveRecord::Base
173 173 self.table_name = :mantis_bugnote_text_table
174 174 end
175 175
176 176 class MantisBugFile < ActiveRecord::Base
177 177 self.table_name = :mantis_bug_file_table
178 178
179 179 def size
180 180 filesize
181 181 end
182 182
183 183 def original_filename
184 184 MantisMigrate.encode(filename)
185 185 end
186 186
187 187 def content_type
188 188 file_type
189 189 end
190 190
191 191 def read(*args)
192 192 if @read_finished
193 193 nil
194 194 else
195 195 @read_finished = true
196 196 content
197 197 end
198 198 end
199 199 end
200 200
201 201 class MantisBugRelationship < ActiveRecord::Base
202 202 self.table_name = :mantis_bug_relationship_table
203 203 end
204 204
205 205 class MantisBugMonitor < ActiveRecord::Base
206 206 self.table_name = :mantis_bug_monitor_table
207 207 end
208 208
209 209 class MantisNews < ActiveRecord::Base
210 210 self.table_name = :mantis_news_table
211 211 end
212 212
213 213 class MantisCustomField < ActiveRecord::Base
214 214 self.table_name = :mantis_custom_field_table
215 215 set_inheritance_column :none
216 216 has_many :values, :class_name => "MantisCustomFieldString", :foreign_key => :field_id
217 217 has_many :projects, :class_name => "MantisCustomFieldProject", :foreign_key => :field_id
218 218
219 219 def format
220 220 read_attribute :type
221 221 end
222 222
223 223 def name
224 224 read_attribute(:name)[0..29]
225 225 end
226 226 end
227 227
228 228 class MantisCustomFieldProject < ActiveRecord::Base
229 229 self.table_name = :mantis_custom_field_project_table
230 230 end
231 231
232 232 class MantisCustomFieldString < ActiveRecord::Base
233 233 self.table_name = :mantis_custom_field_string_table
234 234 end
235 235
236 236 def self.migrate
237 237
238 238 # Users
239 239 print "Migrating users"
240 240 User.delete_all "login <> 'admin'"
241 241 users_map = {}
242 242 users_migrated = 0
243 243 MantisUser.all.each do |user|
244 244 u = User.new :firstname => encode(user.firstname),
245 245 :lastname => encode(user.lastname),
246 246 :mail => user.email,
247 247 :last_login_on => user.last_visit
248 248 u.login = user.username
249 249 u.password = 'mantis'
250 250 u.status = User::STATUS_LOCKED if user.enabled != 1
251 251 u.admin = true if user.access_level == 90
252 252 next unless u.save!
253 253 users_migrated += 1
254 254 users_map[user.id] = u.id
255 255 print '.'
256 256 end
257 257 puts
258 258
259 259 # Projects
260 260 print "Migrating projects"
261 261 Project.destroy_all
262 262 projects_map = {}
263 263 versions_map = {}
264 264 categories_map = {}
265 265 MantisProject.all.each do |project|
266 266 p = Project.new :name => encode(project.name),
267 267 :description => encode(project.description)
268 268 p.identifier = project.identifier
269 269 next unless p.save
270 270 projects_map[project.id] = p.id
271 271 p.enabled_module_names = ['issue_tracking', 'news', 'wiki']
272 272 p.trackers << TRACKER_BUG unless p.trackers.include?(TRACKER_BUG)
273 273 p.trackers << TRACKER_FEATURE unless p.trackers.include?(TRACKER_FEATURE)
274 274 print '.'
275 275
276 276 # Project members
277 277 project.members.each do |member|
278 278 m = Member.new :user => User.find_by_id(users_map[member.user_id]),
279 279 :roles => [ROLE_MAPPING[member.access_level] || DEFAULT_ROLE]
280 280 m.project = p
281 281 m.save
282 282 end
283 283
284 284 # Project versions
285 285 project.versions.each do |version|
286 286 v = Version.new :name => encode(version.version),
287 287 :description => encode(version.description),
288 288 :effective_date => (version.date_order ? version.date_order.to_date : nil)
289 289 v.project = p
290 290 v.save
291 291 versions_map[version.id] = v.id
292 292 end
293 293
294 294 # Project categories
295 295 project.categories.each do |category|
296 296 g = IssueCategory.new :name => category.category[0,30]
297 297 g.project = p
298 298 g.save
299 299 categories_map[category.category] = g.id
300 300 end
301 301 end
302 302 puts
303 303
304 304 # Bugs
305 305 print "Migrating bugs"
306 306 Issue.destroy_all
307 307 issues_map = {}
308 308 keep_bug_ids = (Issue.count == 0)
309 309 MantisBug.find_each(:batch_size => 200) do |bug|
310 310 next unless projects_map[bug.project_id] && users_map[bug.reporter_id]
311 311 i = Issue.new :project_id => projects_map[bug.project_id],
312 312 :subject => encode(bug.summary),
313 313 :description => encode(bug.bug_text.full_description),
314 314 :priority => PRIORITY_MAPPING[bug.priority] || DEFAULT_PRIORITY,
315 315 :created_on => bug.date_submitted,
316 316 :updated_on => bug.last_updated
317 317 i.author = User.find_by_id(users_map[bug.reporter_id])
318 318 i.category = IssueCategory.find_by_project_id_and_name(i.project_id, bug.category[0,30]) unless bug.category.blank?
319 319 i.fixed_version = Version.find_by_project_id_and_name(i.project_id, bug.fixed_in_version) unless bug.fixed_in_version.blank?
320 i.status = STATUS_MAPPING[bug.status] || DEFAULT_STATUS
321 320 i.tracker = (bug.severity == 10 ? TRACKER_FEATURE : TRACKER_BUG)
321 i.status = STATUS_MAPPING[bug.status] || i.status
322 322 i.id = bug.id if keep_bug_ids
323 323 next unless i.save
324 324 issues_map[bug.id] = i.id
325 325 print '.'
326 326 STDOUT.flush
327 327
328 328 # Assignee
329 329 # Redmine checks that the assignee is a project member
330 330 if (bug.handler_id && users_map[bug.handler_id])
331 331 i.assigned_to = User.find_by_id(users_map[bug.handler_id])
332 332 i.save(:validate => false)
333 333 end
334 334
335 335 # Bug notes
336 336 bug.bug_notes.each do |note|
337 337 next unless users_map[note.reporter_id]
338 338 n = Journal.new :notes => encode(note.bug_note_text.note),
339 339 :created_on => note.date_submitted
340 340 n.user = User.find_by_id(users_map[note.reporter_id])
341 341 n.journalized = i
342 342 n.save
343 343 end
344 344
345 345 # Bug files
346 346 bug.bug_files.each do |file|
347 347 a = Attachment.new :created_on => file.date_added
348 348 a.file = file
349 349 a.author = User.first
350 350 a.container = i
351 351 a.save
352 352 end
353 353
354 354 # Bug monitors
355 355 bug.bug_monitors.each do |monitor|
356 356 next unless users_map[monitor.user_id]
357 357 i.add_watcher(User.find_by_id(users_map[monitor.user_id]))
358 358 end
359 359 end
360 360
361 361 # update issue id sequence if needed (postgresql)
362 362 Issue.connection.reset_pk_sequence!(Issue.table_name) if Issue.connection.respond_to?('reset_pk_sequence!')
363 363 puts
364 364
365 365 # Bug relationships
366 366 print "Migrating bug relations"
367 367 MantisBugRelationship.all.each do |relation|
368 368 next unless issues_map[relation.source_bug_id] && issues_map[relation.destination_bug_id]
369 369 r = IssueRelation.new :relation_type => RELATION_TYPE_MAPPING[relation.relationship_type]
370 370 r.issue_from = Issue.find_by_id(issues_map[relation.source_bug_id])
371 371 r.issue_to = Issue.find_by_id(issues_map[relation.destination_bug_id])
372 372 pp r unless r.save
373 373 print '.'
374 374 STDOUT.flush
375 375 end
376 376 puts
377 377
378 378 # News
379 379 print "Migrating news"
380 380 News.destroy_all
381 381 MantisNews.where('project_id > 0').all.each do |news|
382 382 next unless projects_map[news.project_id]
383 383 n = News.new :project_id => projects_map[news.project_id],
384 384 :title => encode(news.headline[0..59]),
385 385 :description => encode(news.body),
386 386 :created_on => news.date_posted
387 387 n.author = User.find_by_id(users_map[news.poster_id])
388 388 n.save
389 389 print '.'
390 390 STDOUT.flush
391 391 end
392 392 puts
393 393
394 394 # Custom fields
395 395 print "Migrating custom fields"
396 396 IssueCustomField.destroy_all
397 397 MantisCustomField.all.each do |field|
398 398 f = IssueCustomField.new :name => field.name[0..29],
399 399 :field_format => CUSTOM_FIELD_TYPE_MAPPING[field.format],
400 400 :min_length => field.length_min,
401 401 :max_length => field.length_max,
402 402 :regexp => field.valid_regexp,
403 403 :possible_values => field.possible_values.split('|'),
404 404 :is_required => field.require_report?
405 405 next unless f.save
406 406 print '.'
407 407 STDOUT.flush
408 408 # Trackers association
409 409 f.trackers = Tracker.all
410 410
411 411 # Projects association
412 412 field.projects.each do |project|
413 413 f.projects << Project.find_by_id(projects_map[project.project_id]) if projects_map[project.project_id]
414 414 end
415 415
416 416 # Values
417 417 field.values.each do |value|
418 418 v = CustomValue.new :custom_field_id => f.id,
419 419 :value => value.value
420 420 v.customized = Issue.find_by_id(issues_map[value.bug_id]) if issues_map[value.bug_id]
421 421 v.save
422 422 end unless f.new_record?
423 423 end
424 424 puts
425 425
426 426 puts
427 427 puts "Users: #{users_migrated}/#{MantisUser.count}"
428 428 puts "Projects: #{Project.count}/#{MantisProject.count}"
429 429 puts "Memberships: #{Member.count}/#{MantisProjectUser.count}"
430 430 puts "Versions: #{Version.count}/#{MantisVersion.count}"
431 431 puts "Categories: #{IssueCategory.count}/#{MantisCategory.count}"
432 432 puts "Bugs: #{Issue.count}/#{MantisBug.count}"
433 433 puts "Bug notes: #{Journal.count}/#{MantisBugNote.count}"
434 434 puts "Bug files: #{Attachment.count}/#{MantisBugFile.count}"
435 435 puts "Bug relations: #{IssueRelation.count}/#{MantisBugRelationship.count}"
436 436 puts "Bug monitors: #{Watcher.count}/#{MantisBugMonitor.count}"
437 437 puts "News: #{News.count}/#{MantisNews.count}"
438 438 puts "Custom fields: #{IssueCustomField.count}/#{MantisCustomField.count}"
439 439 end
440 440
441 441 def self.encoding(charset)
442 442 @charset = charset
443 443 end
444 444
445 445 def self.establish_connection(params)
446 446 constants.each do |const|
447 447 klass = const_get(const)
448 448 next unless klass.respond_to? 'establish_connection'
449 449 klass.establish_connection params
450 450 end
451 451 end
452 452
453 453 def self.encode(text)
454 454 text.to_s.force_encoding(@charset).encode('UTF-8')
455 455 end
456 456 end
457 457
458 458 puts
459 459 if Redmine::DefaultData::Loader.no_data?
460 460 puts "Redmine configuration need to be loaded before importing data."
461 461 puts "Please, run this first:"
462 462 puts
463 463 puts " rake redmine:load_default_data RAILS_ENV=\"#{ENV['RAILS_ENV']}\""
464 464 exit
465 465 end
466 466
467 467 puts "WARNING: Your Redmine data will be deleted during this process."
468 468 print "Are you sure you want to continue ? [y/N] "
469 469 STDOUT.flush
470 470 break unless STDIN.gets.match(/^y$/i)
471 471
472 472 # Default Mantis database settings
473 473 db_params = {:adapter => 'mysql2',
474 474 :database => 'bugtracker',
475 475 :host => 'localhost',
476 476 :username => 'root',
477 477 :password => '' }
478 478
479 479 puts
480 480 puts "Please enter settings for your Mantis database"
481 481 [:adapter, :host, :database, :username, :password].each do |param|
482 482 print "#{param} [#{db_params[param]}]: "
483 483 value = STDIN.gets.chomp!
484 484 db_params[param] = value unless value.blank?
485 485 end
486 486
487 487 while true
488 488 print "encoding [UTF-8]: "
489 489 STDOUT.flush
490 490 encoding = STDIN.gets.chomp!
491 491 encoding = 'UTF-8' if encoding.blank?
492 492 break if MantisMigrate.encoding encoding
493 493 puts "Invalid encoding!"
494 494 end
495 495 puts
496 496
497 497 # Make sure bugs can refer bugs in other projects
498 498 Setting.cross_project_issue_relations = 1 if Setting.respond_to? 'cross_project_issue_relations'
499 499
500 500 old_notified_events = Setting.notified_events
501 501 old_password_min_length = Setting.password_min_length
502 502 begin
503 503 # Turn off email notifications temporarily
504 504 Setting.notified_events = []
505 505 Setting.password_min_length = 4
506 506 # Run the migration
507 507 MantisMigrate.establish_connection db_params
508 508 MantisMigrate.migrate
509 509 ensure
510 510 # Restore previous settings
511 511 Setting.notified_events = old_notified_events
512 512 Setting.password_min_length = old_password_min_length
513 513 end
514 514
515 515 end
516 516 end
@@ -1,777 +1,777
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require 'active_record'
19 19 require 'pp'
20 20
21 21 namespace :redmine do
22 22 desc 'Trac migration script'
23 23 task :migrate_from_trac => :environment do
24 24
25 25 module TracMigrate
26 26 TICKET_MAP = []
27 27
28 DEFAULT_STATUS = IssueStatus.default
28 new_status = IssueStatus.find_by_position(1)
29 29 assigned_status = IssueStatus.find_by_position(2)
30 30 resolved_status = IssueStatus.find_by_position(3)
31 31 feedback_status = IssueStatus.find_by_position(4)
32 32 closed_status = IssueStatus.where(:is_closed => true).first
33 STATUS_MAPPING = {'new' => DEFAULT_STATUS,
33 STATUS_MAPPING = {'new' => new_status,
34 34 'reopened' => feedback_status,
35 35 'assigned' => assigned_status,
36 36 'closed' => closed_status
37 37 }
38 38
39 39 priorities = IssuePriority.all
40 40 DEFAULT_PRIORITY = priorities[0]
41 41 PRIORITY_MAPPING = {'lowest' => priorities[0],
42 42 'low' => priorities[0],
43 43 'normal' => priorities[1],
44 44 'high' => priorities[2],
45 45 'highest' => priorities[3],
46 46 # ---
47 47 'trivial' => priorities[0],
48 48 'minor' => priorities[1],
49 49 'major' => priorities[2],
50 50 'critical' => priorities[3],
51 51 'blocker' => priorities[4]
52 52 }
53 53
54 54 TRACKER_BUG = Tracker.find_by_position(1)
55 55 TRACKER_FEATURE = Tracker.find_by_position(2)
56 56 DEFAULT_TRACKER = TRACKER_BUG
57 57 TRACKER_MAPPING = {'defect' => TRACKER_BUG,
58 58 'enhancement' => TRACKER_FEATURE,
59 59 'task' => TRACKER_FEATURE,
60 60 'patch' =>TRACKER_FEATURE
61 61 }
62 62
63 63 roles = Role.where(:builtin => 0).order('position ASC').all
64 64 manager_role = roles[0]
65 65 developer_role = roles[1]
66 66 DEFAULT_ROLE = roles.last
67 67 ROLE_MAPPING = {'admin' => manager_role,
68 68 'developer' => developer_role
69 69 }
70 70
71 71 class ::Time
72 72 class << self
73 73 alias :real_now :now
74 74 def now
75 75 real_now - @fake_diff.to_i
76 76 end
77 77 def fake(time)
78 78 @fake_diff = real_now - time
79 79 res = yield
80 80 @fake_diff = 0
81 81 res
82 82 end
83 83 end
84 84 end
85 85
86 86 class TracComponent < ActiveRecord::Base
87 87 self.table_name = :component
88 88 end
89 89
90 90 class TracMilestone < ActiveRecord::Base
91 91 self.table_name = :milestone
92 92 # If this attribute is set a milestone has a defined target timepoint
93 93 def due
94 94 if read_attribute(:due) && read_attribute(:due) > 0
95 95 Time.at(read_attribute(:due)).to_date
96 96 else
97 97 nil
98 98 end
99 99 end
100 100 # This is the real timepoint at which the milestone has finished.
101 101 def completed
102 102 if read_attribute(:completed) && read_attribute(:completed) > 0
103 103 Time.at(read_attribute(:completed)).to_date
104 104 else
105 105 nil
106 106 end
107 107 end
108 108
109 109 def description
110 110 # Attribute is named descr in Trac v0.8.x
111 111 has_attribute?(:descr) ? read_attribute(:descr) : read_attribute(:description)
112 112 end
113 113 end
114 114
115 115 class TracTicketCustom < ActiveRecord::Base
116 116 self.table_name = :ticket_custom
117 117 end
118 118
119 119 class TracAttachment < ActiveRecord::Base
120 120 self.table_name = :attachment
121 121 set_inheritance_column :none
122 122
123 123 def time; Time.at(read_attribute(:time)) end
124 124
125 125 def original_filename
126 126 filename
127 127 end
128 128
129 129 def content_type
130 130 ''
131 131 end
132 132
133 133 def exist?
134 134 File.file? trac_fullpath
135 135 end
136 136
137 137 def open
138 138 File.open("#{trac_fullpath}", 'rb') {|f|
139 139 @file = f
140 140 yield self
141 141 }
142 142 end
143 143
144 144 def read(*args)
145 145 @file.read(*args)
146 146 end
147 147
148 148 def description
149 149 read_attribute(:description).to_s.slice(0,255)
150 150 end
151 151
152 152 private
153 153 def trac_fullpath
154 154 attachment_type = read_attribute(:type)
155 155 #replace exotic characters with their hex representation to avoid invalid filenames
156 156 trac_file = filename.gsub( /[^a-zA-Z0-9\-_\.!~*']/n ) do |x|
157 157 codepoint = x.codepoints.to_a[0]
158 158 sprintf('%%%02x', codepoint)
159 159 end
160 160 "#{TracMigrate.trac_attachments_directory}/#{attachment_type}/#{id}/#{trac_file}"
161 161 end
162 162 end
163 163
164 164 class TracTicket < ActiveRecord::Base
165 165 self.table_name = :ticket
166 166 set_inheritance_column :none
167 167
168 168 # ticket changes: only migrate status changes and comments
169 169 has_many :ticket_changes, :class_name => "TracTicketChange", :foreign_key => :ticket
170 170 has_many :customs, :class_name => "TracTicketCustom", :foreign_key => :ticket
171 171
172 172 def attachments
173 173 TracMigrate::TracAttachment.all(:conditions => ["type = 'ticket' AND id = ?", self.id.to_s])
174 174 end
175 175
176 176 def ticket_type
177 177 read_attribute(:type)
178 178 end
179 179
180 180 def summary
181 181 read_attribute(:summary).blank? ? "(no subject)" : read_attribute(:summary)
182 182 end
183 183
184 184 def description
185 185 read_attribute(:description).blank? ? summary : read_attribute(:description)
186 186 end
187 187
188 188 def time; Time.at(read_attribute(:time)) end
189 189 def changetime; Time.at(read_attribute(:changetime)) end
190 190 end
191 191
192 192 class TracTicketChange < ActiveRecord::Base
193 193 self.table_name = :ticket_change
194 194
195 195 def self.columns
196 196 # Hides Trac field 'field' to prevent clash with AR field_changed? method (Rails 3.0)
197 197 super.select {|column| column.name.to_s != 'field'}
198 198 end
199 199
200 200 def time; Time.at(read_attribute(:time)) end
201 201 end
202 202
203 203 TRAC_WIKI_PAGES = %w(InterMapTxt InterTrac InterWiki RecentChanges SandBox TracAccessibility TracAdmin TracBackup TracBrowser TracCgi TracChangeset \
204 204 TracEnvironment TracFastCgi TracGuide TracImport TracIni TracInstall TracInterfaceCustomization \
205 205 TracLinks TracLogging TracModPython TracNotification TracPermissions TracPlugins TracQuery \
206 206 TracReports TracRevisionLog TracRoadmap TracRss TracSearch TracStandalone TracSupport TracSyntaxColoring TracTickets \
207 207 TracTicketsCustomFields TracTimeline TracUnicode TracUpgrade TracWiki WikiDeletePage WikiFormatting \
208 208 WikiHtml WikiMacros WikiNewPage WikiPageNames WikiProcessors WikiRestructuredText WikiRestructuredTextLinks \
209 209 CamelCase TitleIndex)
210 210
211 211 class TracWikiPage < ActiveRecord::Base
212 212 self.table_name = :wiki
213 213 set_primary_key :name
214 214
215 215 def self.columns
216 216 # Hides readonly Trac field to prevent clash with AR readonly? method (Rails 2.0)
217 217 super.select {|column| column.name.to_s != 'readonly'}
218 218 end
219 219
220 220 def attachments
221 221 TracMigrate::TracAttachment.all(:conditions => ["type = 'wiki' AND id = ?", self.id.to_s])
222 222 end
223 223
224 224 def time; Time.at(read_attribute(:time)) end
225 225 end
226 226
227 227 class TracPermission < ActiveRecord::Base
228 228 self.table_name = :permission
229 229 end
230 230
231 231 class TracSessionAttribute < ActiveRecord::Base
232 232 self.table_name = :session_attribute
233 233 end
234 234
235 235 def self.find_or_create_user(username, project_member = false)
236 236 return User.anonymous if username.blank?
237 237
238 238 u = User.find_by_login(username)
239 239 if !u
240 240 # Create a new user if not found
241 241 mail = username[0, User::MAIL_LENGTH_LIMIT]
242 242 if mail_attr = TracSessionAttribute.find_by_sid_and_name(username, 'email')
243 243 mail = mail_attr.value
244 244 end
245 245 mail = "#{mail}@foo.bar" unless mail.include?("@")
246 246
247 247 name = username
248 248 if name_attr = TracSessionAttribute.find_by_sid_and_name(username, 'name')
249 249 name = name_attr.value
250 250 end
251 251 name =~ (/(\w+)(\s+\w+)?/)
252 252 fn = ($1 || "-").strip
253 253 ln = ($2 || '-').strip
254 254
255 255 u = User.new :mail => mail.gsub(/[^-@a-z0-9\.]/i, '-'),
256 256 :firstname => fn[0, limit_for(User, 'firstname')],
257 257 :lastname => ln[0, limit_for(User, 'lastname')]
258 258
259 259 u.login = username[0, User::LOGIN_LENGTH_LIMIT].gsub(/[^a-z0-9_\-@\.]/i, '-')
260 260 u.password = 'trac'
261 261 u.admin = true if TracPermission.find_by_username_and_action(username, 'admin')
262 262 # finally, a default user is used if the new user is not valid
263 263 u = User.first unless u.save
264 264 end
265 265 # Make sure user is a member of the project
266 266 if project_member && !u.member_of?(@target_project)
267 267 role = DEFAULT_ROLE
268 268 if u.admin
269 269 role = ROLE_MAPPING['admin']
270 270 elsif TracPermission.find_by_username_and_action(username, 'developer')
271 271 role = ROLE_MAPPING['developer']
272 272 end
273 273 Member.create(:user => u, :project => @target_project, :roles => [role])
274 274 u.reload
275 275 end
276 276 u
277 277 end
278 278
279 279 # Basic wiki syntax conversion
280 280 def self.convert_wiki_text(text)
281 281 # Titles
282 282 text = text.gsub(/^(\=+)\s(.+)\s(\=+)/) {|s| "\nh#{$1.length}. #{$2}\n"}
283 283 # External Links
284 284 text = text.gsub(/\[(http[^\s]+)\s+([^\]]+)\]/) {|s| "\"#{$2}\":#{$1}"}
285 285 # Ticket links:
286 286 # [ticket:234 Text],[ticket:234 This is a test]
287 287 text = text.gsub(/\[ticket\:([^\ ]+)\ (.+?)\]/, '"\2":/issues/show/\1')
288 288 # ticket:1234
289 289 # #1 is working cause Redmine uses the same syntax.
290 290 text = text.gsub(/ticket\:([^\ ]+)/, '#\1')
291 291 # Milestone links:
292 292 # [milestone:"0.1.0 Mercury" Milestone 0.1.0 (Mercury)]
293 293 # The text "Milestone 0.1.0 (Mercury)" is not converted,
294 294 # cause Redmine's wiki does not support this.
295 295 text = text.gsub(/\[milestone\:\"([^\"]+)\"\ (.+?)\]/, 'version:"\1"')
296 296 # [milestone:"0.1.0 Mercury"]
297 297 text = text.gsub(/\[milestone\:\"([^\"]+)\"\]/, 'version:"\1"')
298 298 text = text.gsub(/milestone\:\"([^\"]+)\"/, 'version:"\1"')
299 299 # milestone:0.1.0
300 300 text = text.gsub(/\[milestone\:([^\ ]+)\]/, 'version:\1')
301 301 text = text.gsub(/milestone\:([^\ ]+)/, 'version:\1')
302 302 # Internal Links
303 303 text = text.gsub(/\[\[BR\]\]/, "\n") # This has to go before the rules below
304 304 text = text.gsub(/\[\"(.+)\".*\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
305 305 text = text.gsub(/\[wiki:\"(.+)\".*\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
306 306 text = text.gsub(/\[wiki:\"(.+)\".*\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
307 307 text = text.gsub(/\[wiki:([^\s\]]+)\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
308 308 text = text.gsub(/\[wiki:([^\s\]]+)\s(.*)\]/) {|s| "[[#{$1.delete(',./?;|:')}|#{$2.delete(',./?;|:')}]]"}
309 309
310 310 # Links to pages UsingJustWikiCaps
311 311 text = text.gsub(/([^!]|^)(^| )([A-Z][a-z]+[A-Z][a-zA-Z]+)/, '\\1\\2[[\3]]')
312 312 # Normalize things that were supposed to not be links
313 313 # like !NotALink
314 314 text = text.gsub(/(^| )!([A-Z][A-Za-z]+)/, '\1\2')
315 315 # Revisions links
316 316 text = text.gsub(/\[(\d+)\]/, 'r\1')
317 317 # Ticket number re-writing
318 318 text = text.gsub(/#(\d+)/) do |s|
319 319 if $1.length < 10
320 320 # TICKET_MAP[$1.to_i] ||= $1
321 321 "\##{TICKET_MAP[$1.to_i] || $1}"
322 322 else
323 323 s
324 324 end
325 325 end
326 326 # We would like to convert the Code highlighting too
327 327 # This will go into the next line.
328 328 shebang_line = false
329 329 # Regular expression for start of code
330 330 pre_re = /\{\{\{/
331 331 # Code highlighting...
332 332 shebang_re = /^\#\!([a-z]+)/
333 333 # Regular expression for end of code
334 334 pre_end_re = /\}\}\}/
335 335
336 336 # Go through the whole text..extract it line by line
337 337 text = text.gsub(/^(.*)$/) do |line|
338 338 m_pre = pre_re.match(line)
339 339 if m_pre
340 340 line = '<pre>'
341 341 else
342 342 m_sl = shebang_re.match(line)
343 343 if m_sl
344 344 shebang_line = true
345 345 line = '<code class="' + m_sl[1] + '">'
346 346 end
347 347 m_pre_end = pre_end_re.match(line)
348 348 if m_pre_end
349 349 line = '</pre>'
350 350 if shebang_line
351 351 line = '</code>' + line
352 352 end
353 353 end
354 354 end
355 355 line
356 356 end
357 357
358 358 # Highlighting
359 359 text = text.gsub(/'''''([^\s])/, '_*\1')
360 360 text = text.gsub(/([^\s])'''''/, '\1*_')
361 361 text = text.gsub(/'''/, '*')
362 362 text = text.gsub(/''/, '_')
363 363 text = text.gsub(/__/, '+')
364 364 text = text.gsub(/~~/, '-')
365 365 text = text.gsub(/`/, '@')
366 366 text = text.gsub(/,,/, '~')
367 367 # Lists
368 368 text = text.gsub(/^([ ]+)\* /) {|s| '*' * $1.length + " "}
369 369
370 370 text
371 371 end
372 372
373 373 def self.migrate
374 374 establish_connection
375 375
376 376 # Quick database test
377 377 TracComponent.count
378 378
379 379 migrated_components = 0
380 380 migrated_milestones = 0
381 381 migrated_tickets = 0
382 382 migrated_custom_values = 0
383 383 migrated_ticket_attachments = 0
384 384 migrated_wiki_edits = 0
385 385 migrated_wiki_attachments = 0
386 386
387 387 #Wiki system initializing...
388 388 @target_project.wiki.destroy if @target_project.wiki
389 389 @target_project.reload
390 390 wiki = Wiki.new(:project => @target_project, :start_page => 'WikiStart')
391 391 wiki_edit_count = 0
392 392
393 393 # Components
394 394 print "Migrating components"
395 395 issues_category_map = {}
396 396 TracComponent.all.each do |component|
397 397 print '.'
398 398 STDOUT.flush
399 399 c = IssueCategory.new :project => @target_project,
400 400 :name => encode(component.name[0, limit_for(IssueCategory, 'name')])
401 401 next unless c.save
402 402 issues_category_map[component.name] = c
403 403 migrated_components += 1
404 404 end
405 405 puts
406 406
407 407 # Milestones
408 408 print "Migrating milestones"
409 409 version_map = {}
410 410 TracMilestone.all.each do |milestone|
411 411 print '.'
412 412 STDOUT.flush
413 413 # First we try to find the wiki page...
414 414 p = wiki.find_or_new_page(milestone.name.to_s)
415 415 p.content = WikiContent.new(:page => p) if p.new_record?
416 416 p.content.text = milestone.description.to_s
417 417 p.content.author = find_or_create_user('trac')
418 418 p.content.comments = 'Milestone'
419 419 p.save
420 420
421 421 v = Version.new :project => @target_project,
422 422 :name => encode(milestone.name[0, limit_for(Version, 'name')]),
423 423 :description => nil,
424 424 :wiki_page_title => milestone.name.to_s,
425 425 :effective_date => milestone.completed
426 426
427 427 next unless v.save
428 428 version_map[milestone.name] = v
429 429 migrated_milestones += 1
430 430 end
431 431 puts
432 432
433 433 # Custom fields
434 434 # TODO: read trac.ini instead
435 435 print "Migrating custom fields"
436 436 custom_field_map = {}
437 437 TracTicketCustom.find_by_sql("SELECT DISTINCT name FROM #{TracTicketCustom.table_name}").each do |field|
438 438 print '.'
439 439 STDOUT.flush
440 440 # Redmine custom field name
441 441 field_name = encode(field.name[0, limit_for(IssueCustomField, 'name')]).humanize
442 442 # Find if the custom already exists in Redmine
443 443 f = IssueCustomField.find_by_name(field_name)
444 444 # Or create a new one
445 445 f ||= IssueCustomField.create(:name => encode(field.name[0, limit_for(IssueCustomField, 'name')]).humanize,
446 446 :field_format => 'string')
447 447
448 448 next if f.new_record?
449 449 f.trackers = Tracker.all
450 450 f.projects << @target_project
451 451 custom_field_map[field.name] = f
452 452 end
453 453 puts
454 454
455 455 # Trac 'resolution' field as a Redmine custom field
456 456 r = IssueCustomField.where(:name => "Resolution").first
457 457 r = IssueCustomField.new(:name => 'Resolution',
458 458 :field_format => 'list',
459 459 :is_filter => true) if r.nil?
460 460 r.trackers = Tracker.all
461 461 r.projects << @target_project
462 462 r.possible_values = (r.possible_values + %w(fixed invalid wontfix duplicate worksforme)).flatten.compact.uniq
463 463 r.save!
464 464 custom_field_map['resolution'] = r
465 465
466 466 # Tickets
467 467 print "Migrating tickets"
468 468 TracTicket.find_each(:batch_size => 200) do |ticket|
469 469 print '.'
470 470 STDOUT.flush
471 471 i = Issue.new :project => @target_project,
472 472 :subject => encode(ticket.summary[0, limit_for(Issue, 'subject')]),
473 473 :description => convert_wiki_text(encode(ticket.description)),
474 474 :priority => PRIORITY_MAPPING[ticket.priority] || DEFAULT_PRIORITY,
475 475 :created_on => ticket.time
476 476 i.author = find_or_create_user(ticket.reporter)
477 477 i.category = issues_category_map[ticket.component] unless ticket.component.blank?
478 478 i.fixed_version = version_map[ticket.milestone] unless ticket.milestone.blank?
479 i.status = STATUS_MAPPING[ticket.status] || DEFAULT_STATUS
480 479 i.tracker = TRACKER_MAPPING[ticket.ticket_type] || DEFAULT_TRACKER
480 i.status = STATUS_MAPPING[ticket.status] || i.default_status
481 481 i.id = ticket.id unless Issue.exists?(ticket.id)
482 482 next unless Time.fake(ticket.changetime) { i.save }
483 483 TICKET_MAP[ticket.id] = i.id
484 484 migrated_tickets += 1
485 485
486 486 # Owner
487 487 unless ticket.owner.blank?
488 488 i.assigned_to = find_or_create_user(ticket.owner, true)
489 489 Time.fake(ticket.changetime) { i.save }
490 490 end
491 491
492 492 # Comments and status/resolution changes
493 493 ticket.ticket_changes.group_by(&:time).each do |time, changeset|
494 494 status_change = changeset.select {|change| change.field == 'status'}.first
495 495 resolution_change = changeset.select {|change| change.field == 'resolution'}.first
496 496 comment_change = changeset.select {|change| change.field == 'comment'}.first
497 497
498 498 n = Journal.new :notes => (comment_change ? convert_wiki_text(encode(comment_change.newvalue)) : ''),
499 499 :created_on => time
500 500 n.user = find_or_create_user(changeset.first.author)
501 501 n.journalized = i
502 502 if status_change &&
503 503 STATUS_MAPPING[status_change.oldvalue] &&
504 504 STATUS_MAPPING[status_change.newvalue] &&
505 505 (STATUS_MAPPING[status_change.oldvalue] != STATUS_MAPPING[status_change.newvalue])
506 506 n.details << JournalDetail.new(:property => 'attr',
507 507 :prop_key => 'status_id',
508 508 :old_value => STATUS_MAPPING[status_change.oldvalue].id,
509 509 :value => STATUS_MAPPING[status_change.newvalue].id)
510 510 end
511 511 if resolution_change
512 512 n.details << JournalDetail.new(:property => 'cf',
513 513 :prop_key => custom_field_map['resolution'].id,
514 514 :old_value => resolution_change.oldvalue,
515 515 :value => resolution_change.newvalue)
516 516 end
517 517 n.save unless n.details.empty? && n.notes.blank?
518 518 end
519 519
520 520 # Attachments
521 521 ticket.attachments.each do |attachment|
522 522 next unless attachment.exist?
523 523 attachment.open {
524 524 a = Attachment.new :created_on => attachment.time
525 525 a.file = attachment
526 526 a.author = find_or_create_user(attachment.author)
527 527 a.container = i
528 528 a.description = attachment.description
529 529 migrated_ticket_attachments += 1 if a.save
530 530 }
531 531 end
532 532
533 533 # Custom fields
534 534 custom_values = ticket.customs.inject({}) do |h, custom|
535 535 if custom_field = custom_field_map[custom.name]
536 536 h[custom_field.id] = custom.value
537 537 migrated_custom_values += 1
538 538 end
539 539 h
540 540 end
541 541 if custom_field_map['resolution'] && !ticket.resolution.blank?
542 542 custom_values[custom_field_map['resolution'].id] = ticket.resolution
543 543 end
544 544 i.custom_field_values = custom_values
545 545 i.save_custom_field_values
546 546 end
547 547
548 548 # update issue id sequence if needed (postgresql)
549 549 Issue.connection.reset_pk_sequence!(Issue.table_name) if Issue.connection.respond_to?('reset_pk_sequence!')
550 550 puts
551 551
552 552 # Wiki
553 553 print "Migrating wiki"
554 554 if wiki.save
555 555 TracWikiPage.order('name, version').all.each do |page|
556 556 # Do not migrate Trac manual wiki pages
557 557 next if TRAC_WIKI_PAGES.include?(page.name)
558 558 wiki_edit_count += 1
559 559 print '.'
560 560 STDOUT.flush
561 561 p = wiki.find_or_new_page(page.name)
562 562 p.content = WikiContent.new(:page => p) if p.new_record?
563 563 p.content.text = page.text
564 564 p.content.author = find_or_create_user(page.author) unless page.author.blank? || page.author == 'trac'
565 565 p.content.comments = page.comment
566 566 Time.fake(page.time) { p.new_record? ? p.save : p.content.save }
567 567
568 568 next if p.content.new_record?
569 569 migrated_wiki_edits += 1
570 570
571 571 # Attachments
572 572 page.attachments.each do |attachment|
573 573 next unless attachment.exist?
574 574 next if p.attachments.find_by_filename(attachment.filename.gsub(/^.*(\\|\/)/, '').gsub(/[^\w\.\-]/,'_')) #add only once per page
575 575 attachment.open {
576 576 a = Attachment.new :created_on => attachment.time
577 577 a.file = attachment
578 578 a.author = find_or_create_user(attachment.author)
579 579 a.description = attachment.description
580 580 a.container = p
581 581 migrated_wiki_attachments += 1 if a.save
582 582 }
583 583 end
584 584 end
585 585
586 586 wiki.reload
587 587 wiki.pages.each do |page|
588 588 page.content.text = convert_wiki_text(page.content.text)
589 589 Time.fake(page.content.updated_on) { page.content.save }
590 590 end
591 591 end
592 592 puts
593 593
594 594 puts
595 595 puts "Components: #{migrated_components}/#{TracComponent.count}"
596 596 puts "Milestones: #{migrated_milestones}/#{TracMilestone.count}"
597 597 puts "Tickets: #{migrated_tickets}/#{TracTicket.count}"
598 598 puts "Ticket files: #{migrated_ticket_attachments}/" + TracAttachment.count(:conditions => {:type => 'ticket'}).to_s
599 599 puts "Custom values: #{migrated_custom_values}/#{TracTicketCustom.count}"
600 600 puts "Wiki edits: #{migrated_wiki_edits}/#{wiki_edit_count}"
601 601 puts "Wiki files: #{migrated_wiki_attachments}/" + TracAttachment.count(:conditions => {:type => 'wiki'}).to_s
602 602 end
603 603
604 604 def self.limit_for(klass, attribute)
605 605 klass.columns_hash[attribute.to_s].limit
606 606 end
607 607
608 608 def self.encoding(charset)
609 609 @charset = charset
610 610 end
611 611
612 612 def self.set_trac_directory(path)
613 613 @@trac_directory = path
614 614 raise "This directory doesn't exist!" unless File.directory?(path)
615 615 raise "#{trac_attachments_directory} doesn't exist!" unless File.directory?(trac_attachments_directory)
616 616 @@trac_directory
617 617 rescue Exception => e
618 618 puts e
619 619 return false
620 620 end
621 621
622 622 def self.trac_directory
623 623 @@trac_directory
624 624 end
625 625
626 626 def self.set_trac_adapter(adapter)
627 627 return false if adapter.blank?
628 628 raise "Unknown adapter: #{adapter}!" unless %w(sqlite3 mysql postgresql).include?(adapter)
629 629 # If adapter is sqlite or sqlite3, make sure that trac.db exists
630 630 raise "#{trac_db_path} doesn't exist!" if %w(sqlite3).include?(adapter) && !File.exist?(trac_db_path)
631 631 @@trac_adapter = adapter
632 632 rescue Exception => e
633 633 puts e
634 634 return false
635 635 end
636 636
637 637 def self.set_trac_db_host(host)
638 638 return nil if host.blank?
639 639 @@trac_db_host = host
640 640 end
641 641
642 642 def self.set_trac_db_port(port)
643 643 return nil if port.to_i == 0
644 644 @@trac_db_port = port.to_i
645 645 end
646 646
647 647 def self.set_trac_db_name(name)
648 648 return nil if name.blank?
649 649 @@trac_db_name = name
650 650 end
651 651
652 652 def self.set_trac_db_username(username)
653 653 @@trac_db_username = username
654 654 end
655 655
656 656 def self.set_trac_db_password(password)
657 657 @@trac_db_password = password
658 658 end
659 659
660 660 def self.set_trac_db_schema(schema)
661 661 @@trac_db_schema = schema
662 662 end
663 663
664 664 mattr_reader :trac_directory, :trac_adapter, :trac_db_host, :trac_db_port, :trac_db_name, :trac_db_schema, :trac_db_username, :trac_db_password
665 665
666 666 def self.trac_db_path; "#{trac_directory}/db/trac.db" end
667 667 def self.trac_attachments_directory; "#{trac_directory}/attachments" end
668 668
669 669 def self.target_project_identifier(identifier)
670 670 project = Project.find_by_identifier(identifier)
671 671 if !project
672 672 # create the target project
673 673 project = Project.new :name => identifier.humanize,
674 674 :description => ''
675 675 project.identifier = identifier
676 676 puts "Unable to create a project with identifier '#{identifier}'!" unless project.save
677 677 # enable issues and wiki for the created project
678 678 project.enabled_module_names = ['issue_tracking', 'wiki']
679 679 else
680 680 puts
681 681 puts "This project already exists in your Redmine database."
682 682 print "Are you sure you want to append data to this project ? [Y/n] "
683 683 STDOUT.flush
684 684 exit if STDIN.gets.match(/^n$/i)
685 685 end
686 686 project.trackers << TRACKER_BUG unless project.trackers.include?(TRACKER_BUG)
687 687 project.trackers << TRACKER_FEATURE unless project.trackers.include?(TRACKER_FEATURE)
688 688 @target_project = project.new_record? ? nil : project
689 689 @target_project.reload
690 690 end
691 691
692 692 def self.connection_params
693 693 if trac_adapter == 'sqlite3'
694 694 {:adapter => 'sqlite3',
695 695 :database => trac_db_path}
696 696 else
697 697 {:adapter => trac_adapter,
698 698 :database => trac_db_name,
699 699 :host => trac_db_host,
700 700 :port => trac_db_port,
701 701 :username => trac_db_username,
702 702 :password => trac_db_password,
703 703 :schema_search_path => trac_db_schema
704 704 }
705 705 end
706 706 end
707 707
708 708 def self.establish_connection
709 709 constants.each do |const|
710 710 klass = const_get(const)
711 711 next unless klass.respond_to? 'establish_connection'
712 712 klass.establish_connection connection_params
713 713 end
714 714 end
715 715
716 716 def self.encode(text)
717 717 text.to_s.force_encoding(@charset).encode('UTF-8')
718 718 end
719 719 end
720 720
721 721 puts
722 722 if Redmine::DefaultData::Loader.no_data?
723 723 puts "Redmine configuration need to be loaded before importing data."
724 724 puts "Please, run this first:"
725 725 puts
726 726 puts " rake redmine:load_default_data RAILS_ENV=\"#{ENV['RAILS_ENV']}\""
727 727 exit
728 728 end
729 729
730 730 puts "WARNING: a new project will be added to Redmine during this process."
731 731 print "Are you sure you want to continue ? [y/N] "
732 732 STDOUT.flush
733 733 break unless STDIN.gets.match(/^y$/i)
734 734 puts
735 735
736 736 def prompt(text, options = {}, &block)
737 737 default = options[:default] || ''
738 738 while true
739 739 print "#{text} [#{default}]: "
740 740 STDOUT.flush
741 741 value = STDIN.gets.chomp!
742 742 value = default if value.blank?
743 743 break if yield value
744 744 end
745 745 end
746 746
747 747 DEFAULT_PORTS = {'mysql' => 3306, 'postgresql' => 5432}
748 748
749 749 prompt('Trac directory') {|directory| TracMigrate.set_trac_directory directory.strip}
750 750 prompt('Trac database adapter (sqlite3, mysql2, postgresql)', :default => 'sqlite3') {|adapter| TracMigrate.set_trac_adapter adapter}
751 751 unless %w(sqlite3).include?(TracMigrate.trac_adapter)
752 752 prompt('Trac database host', :default => 'localhost') {|host| TracMigrate.set_trac_db_host host}
753 753 prompt('Trac database port', :default => DEFAULT_PORTS[TracMigrate.trac_adapter]) {|port| TracMigrate.set_trac_db_port port}
754 754 prompt('Trac database name') {|name| TracMigrate.set_trac_db_name name}
755 755 prompt('Trac database schema', :default => 'public') {|schema| TracMigrate.set_trac_db_schema schema}
756 756 prompt('Trac database username') {|username| TracMigrate.set_trac_db_username username}
757 757 prompt('Trac database password') {|password| TracMigrate.set_trac_db_password password}
758 758 end
759 759 prompt('Trac database encoding', :default => 'UTF-8') {|encoding| TracMigrate.encoding encoding}
760 760 prompt('Target project identifier') {|identifier| TracMigrate.target_project_identifier identifier}
761 761 puts
762 762
763 763 old_notified_events = Setting.notified_events
764 764 old_password_min_length = Setting.password_min_length
765 765 begin
766 766 # Turn off email notifications temporarily
767 767 Setting.notified_events = []
768 768 Setting.password_min_length = 4
769 769 # Run the migration
770 770 TracMigrate.migrate
771 771 ensure
772 772 # Restore previous settings
773 773 Setting.notified_events = old_notified_events
774 774 Setting.password_min_length = old_password_min_length
775 775 end
776 776 end
777 777 end
@@ -1,37 +1,31
1 1 ---
2 2 issue_statuses_001:
3 3 id: 1
4 4 name: New
5 is_default: true
6 5 is_closed: false
7 6 position: 1
8 7 issue_statuses_002:
9 8 id: 2
10 9 name: Assigned
11 is_default: false
12 10 is_closed: false
13 11 position: 2
14 12 issue_statuses_003:
15 13 id: 3
16 14 name: Resolved
17 is_default: false
18 15 is_closed: false
19 16 position: 3
20 17 issue_statuses_004:
21 18 name: Feedback
22 19 id: 4
23 is_default: false
24 20 is_closed: false
25 21 position: 4
26 22 issue_statuses_005:
27 23 id: 5
28 24 name: Closed
29 is_default: false
30 25 is_closed: true
31 26 position: 5
32 27 issue_statuses_006:
33 28 id: 6
34 29 name: Rejected
35 is_default: false
36 30 is_closed: true
37 31 position: 6
@@ -1,16 +1,19
1 1 ---
2 2 trackers_001:
3 3 name: Bug
4 4 id: 1
5 5 is_in_chlog: true
6 default_status_id: 1
6 7 position: 1
7 8 trackers_002:
8 9 name: Feature request
9 10 id: 2
10 11 is_in_chlog: true
12 default_status_id: 1
11 13 position: 2
12 14 trackers_003:
13 15 name: Support request
14 16 id: 3
15 17 is_in_chlog: false
18 default_status_id: 1
16 19 position: 3
@@ -1,123 +1,136
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class IssueStatusesControllerTest < ActionController::TestCase
21 21 fixtures :issue_statuses, :issues, :users
22 22
23 23 def setup
24 24 User.current = nil
25 25 @request.session[:user_id] = 1 # admin
26 26 end
27 27
28 28 def test_index
29 29 get :index
30 30 assert_response :success
31 31 assert_template 'index'
32 32 end
33 33
34 34 def test_index_by_anonymous_should_redirect_to_login_form
35 35 @request.session[:user_id] = nil
36 36 get :index
37 37 assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fissue_statuses'
38 38 end
39 39
40 40 def test_index_by_user_should_respond_with_406
41 41 @request.session[:user_id] = 2
42 42 get :index
43 43 assert_response 406
44 44 end
45 45
46 46 def test_new
47 47 get :new
48 48 assert_response :success
49 49 assert_template 'new'
50 50 end
51 51
52 52 def test_create
53 53 assert_difference 'IssueStatus.count' do
54 54 post :create, :issue_status => {:name => 'New status'}
55 55 end
56 56 assert_redirected_to :action => 'index'
57 57 status = IssueStatus.order('id DESC').first
58 58 assert_equal 'New status', status.name
59 59 end
60 60
61 61 def test_create_with_failure
62 62 post :create, :issue_status => {:name => ''}
63 63 assert_response :success
64 64 assert_template 'new'
65 65 assert_error_tag :content => /name #{ESCAPED_CANT} be blank/i
66 66 end
67 67
68 68 def test_edit
69 69 get :edit, :id => '3'
70 70 assert_response :success
71 71 assert_template 'edit'
72 72 end
73 73
74 74 def test_update
75 75 put :update, :id => '3', :issue_status => {:name => 'Renamed status'}
76 76 assert_redirected_to :action => 'index'
77 77 status = IssueStatus.find(3)
78 78 assert_equal 'Renamed status', status.name
79 79 end
80 80
81 81 def test_update_with_failure
82 82 put :update, :id => '3', :issue_status => {:name => ''}
83 83 assert_response :success
84 84 assert_template 'edit'
85 85 assert_error_tag :content => /name #{ESCAPED_CANT} be blank/i
86 86 end
87 87
88 88 def test_destroy
89 Issue.delete_all("status_id = 1")
89 Issue.where(:status_id => 1).delete_all
90 Tracker.where(:default_status_id => 1).delete_all
90 91
91 92 assert_difference 'IssueStatus.count', -1 do
92 93 delete :destroy, :id => '1'
93 94 end
94 95 assert_redirected_to :action => 'index'
95 96 assert_nil IssueStatus.find_by_id(1)
96 97 end
97 98
98 99 def test_destroy_should_block_if_status_in_use
99 assert_not_nil Issue.find_by_status_id(1)
100 assert Issue.where(:status_id => 1).any?
101 Tracker.where(:default_status_id => 1).delete_all
102
103 assert_no_difference 'IssueStatus.count' do
104 delete :destroy, :id => '1'
105 end
106 assert_redirected_to :action => 'index'
107 assert_not_nil IssueStatus.find_by_id(1)
108 end
109
110 def test_destroy_should_block_if_status_in_use
111 Issue.where(:status_id => 1).delete_all
112 assert Tracker.where(:default_status_id => 1).any?
100 113
101 114 assert_no_difference 'IssueStatus.count' do
102 115 delete :destroy, :id => '1'
103 116 end
104 117 assert_redirected_to :action => 'index'
105 118 assert_not_nil IssueStatus.find_by_id(1)
106 119 end
107 120
108 121 def test_update_issue_done_ratio_with_issue_done_ratio_set_to_issue_field
109 122 with_settings :issue_done_ratio => 'issue_field' do
110 123 post :update_issue_done_ratio
111 124 assert_match /not updated/, flash[:error].to_s
112 125 assert_redirected_to '/issue_statuses'
113 126 end
114 127 end
115 128
116 129 def test_update_issue_done_ratio_with_issue_done_ratio_set_to_issue_status
117 130 with_settings :issue_done_ratio => 'issue_status' do
118 131 post :update_issue_done_ratio
119 132 assert_match /Issue done ratios updated/, flash[:notice].to_s
120 133 assert_redirected_to '/issue_statuses'
121 134 end
122 135 end
123 136 end
1 NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -1,212 +1,212
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class TrackersControllerTest < ActionController::TestCase
21 fixtures :trackers, :projects, :projects_trackers, :users, :issues, :custom_fields
21 fixtures :trackers, :projects, :projects_trackers, :users, :issues, :custom_fields, :issue_statuses
22 22
23 23 def setup
24 24 User.current = nil
25 25 @request.session[:user_id] = 1 # admin
26 26 end
27 27
28 28 def test_index
29 29 get :index
30 30 assert_response :success
31 31 assert_template 'index'
32 32 end
33 33
34 34 def test_index_by_anonymous_should_redirect_to_login_form
35 35 @request.session[:user_id] = nil
36 36 get :index
37 37 assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Ftrackers'
38 38 end
39 39
40 40 def test_index_by_user_should_respond_with_406
41 41 @request.session[:user_id] = 2
42 42 get :index
43 43 assert_response 406
44 44 end
45 45
46 46 def test_new
47 47 get :new
48 48 assert_response :success
49 49 assert_template 'new'
50 50 end
51 51
52 52 def test_create
53 53 assert_difference 'Tracker.count' do
54 post :create, :tracker => { :name => 'New tracker', :project_ids => ['1', '', ''], :custom_field_ids => ['1', '6', ''] }
54 post :create, :tracker => { :name => 'New tracker', :default_status_id => 1, :project_ids => ['1', '', ''], :custom_field_ids => ['1', '6', ''] }
55 55 end
56 56 assert_redirected_to :action => 'index'
57 57 tracker = Tracker.order('id DESC').first
58 58 assert_equal 'New tracker', tracker.name
59 59 assert_equal [1], tracker.project_ids.sort
60 60 assert_equal Tracker::CORE_FIELDS, tracker.core_fields
61 61 assert_equal [1, 6], tracker.custom_field_ids.sort
62 62 assert_equal 0, tracker.workflow_rules.count
63 63 end
64 64
65 def create_with_disabled_core_fields
65 def test_create_with_disabled_core_fields
66 66 assert_difference 'Tracker.count' do
67 post :create, :tracker => { :name => 'New tracker', :core_fields => ['assigned_to_id', 'fixed_version_id', ''] }
67 post :create, :tracker => { :name => 'New tracker', :default_status_id => 1, :core_fields => ['assigned_to_id', 'fixed_version_id', ''] }
68 68 end
69 69 assert_redirected_to :action => 'index'
70 70 tracker = Tracker.order('id DESC').first
71 71 assert_equal 'New tracker', tracker.name
72 72 assert_equal %w(assigned_to_id fixed_version_id), tracker.core_fields
73 73 end
74 74
75 75 def test_create_new_with_workflow_copy
76 76 assert_difference 'Tracker.count' do
77 post :create, :tracker => { :name => 'New tracker' }, :copy_workflow_from => 1
77 post :create, :tracker => { :name => 'New tracker', :default_status_id => 1 }, :copy_workflow_from => 1
78 78 end
79 79 assert_redirected_to :action => 'index'
80 80 tracker = Tracker.find_by_name('New tracker')
81 81 assert_equal 0, tracker.projects.count
82 82 assert_equal Tracker.find(1).workflow_rules.count, tracker.workflow_rules.count
83 83 end
84 84
85 85 def test_create_with_failure
86 86 assert_no_difference 'Tracker.count' do
87 87 post :create, :tracker => { :name => '', :project_ids => ['1', '', ''],
88 88 :custom_field_ids => ['1', '6', ''] }
89 89 end
90 90 assert_response :success
91 91 assert_template 'new'
92 92 assert_error_tag :content => /name #{ESCAPED_CANT} be blank/i
93 93 end
94 94
95 95 def test_edit
96 96 Tracker.find(1).project_ids = [1, 3]
97 97
98 98 get :edit, :id => 1
99 99 assert_response :success
100 100 assert_template 'edit'
101 101
102 102 assert_tag :input, :attributes => { :name => 'tracker[project_ids][]',
103 103 :value => '1',
104 104 :checked => 'checked' }
105 105
106 106 assert_tag :input, :attributes => { :name => 'tracker[project_ids][]',
107 107 :value => '2',
108 108 :checked => nil }
109 109
110 110 assert_tag :input, :attributes => { :name => 'tracker[project_ids][]',
111 111 :value => '',
112 112 :type => 'hidden'}
113 113 end
114 114
115 115 def test_edit_should_check_core_fields
116 116 tracker = Tracker.find(1)
117 117 tracker.core_fields = %w(assigned_to_id fixed_version_id)
118 118 tracker.save!
119 119
120 120 get :edit, :id => 1
121 121 assert_response :success
122 122 assert_template 'edit'
123 123
124 124 assert_select 'input[name=?][value=assigned_to_id][checked=checked]', 'tracker[core_fields][]'
125 125 assert_select 'input[name=?][value=fixed_version_id][checked=checked]', 'tracker[core_fields][]'
126 126
127 127 assert_select 'input[name=?][value=category_id]', 'tracker[core_fields][]'
128 128 assert_select 'input[name=?][value=category_id][checked=checked]', 'tracker[core_fields][]', 0
129 129
130 130 assert_select 'input[name=?][value=][type=hidden]', 'tracker[core_fields][]'
131 131 end
132 132
133 133 def test_update
134 134 put :update, :id => 1, :tracker => { :name => 'Renamed',
135 135 :project_ids => ['1', '2', ''] }
136 136 assert_redirected_to :action => 'index'
137 137 assert_equal [1, 2], Tracker.find(1).project_ids.sort
138 138 end
139 139
140 140 def test_update_without_projects
141 141 put :update, :id => 1, :tracker => { :name => 'Renamed',
142 142 :project_ids => [''] }
143 143 assert_redirected_to :action => 'index'
144 144 assert Tracker.find(1).project_ids.empty?
145 145 end
146 146
147 147 def test_update_without_core_fields
148 148 put :update, :id => 1, :tracker => { :name => 'Renamed', :core_fields => [''] }
149 149 assert_redirected_to :action => 'index'
150 150 assert Tracker.find(1).core_fields.empty?
151 151 end
152 152
153 153 def test_update_with_failure
154 154 put :update, :id => 1, :tracker => { :name => '' }
155 155 assert_response :success
156 156 assert_template 'edit'
157 157 assert_error_tag :content => /name #{ESCAPED_CANT} be blank/i
158 158 end
159 159
160 160 def test_move_lower
161 161 tracker = Tracker.find_by_position(1)
162 162 put :update, :id => 1, :tracker => { :move_to => 'lower' }
163 163 assert_equal 2, tracker.reload.position
164 164 end
165 165
166 166 def test_destroy
167 tracker = Tracker.create!(:name => 'Destroyable')
167 tracker = Tracker.generate!(:name => 'Destroyable')
168 168 assert_difference 'Tracker.count', -1 do
169 169 delete :destroy, :id => tracker.id
170 170 end
171 171 assert_redirected_to :action => 'index'
172 172 assert_nil flash[:error]
173 173 end
174 174
175 175 def test_destroy_tracker_in_use
176 176 assert_no_difference 'Tracker.count' do
177 177 delete :destroy, :id => 1
178 178 end
179 179 assert_redirected_to :action => 'index'
180 180 assert_not_nil flash[:error]
181 181 end
182 182
183 183 def test_get_fields
184 184 get :fields
185 185 assert_response :success
186 186 assert_template 'fields'
187 187
188 188 assert_select 'form' do
189 189 assert_select 'input[type=checkbox][name=?][value=assigned_to_id]', 'trackers[1][core_fields][]'
190 190 assert_select 'input[type=checkbox][name=?][value=2]', 'trackers[1][custom_field_ids][]'
191 191
192 192 assert_select 'input[type=hidden][name=?][value=]', 'trackers[1][core_fields][]'
193 193 assert_select 'input[type=hidden][name=?][value=]', 'trackers[1][custom_field_ids][]'
194 194 end
195 195 end
196 196
197 197 def test_post_fields
198 198 post :fields, :trackers => {
199 199 '1' => {'core_fields' => ['assigned_to_id', 'due_date', ''], 'custom_field_ids' => ['1', '2']},
200 200 '2' => {'core_fields' => [''], 'custom_field_ids' => ['']}
201 201 }
202 202 assert_redirected_to '/trackers/fields'
203 203
204 204 tracker = Tracker.find(1)
205 205 assert_equal %w(assigned_to_id due_date), tracker.core_fields
206 206 assert_equal [1, 2], tracker.custom_field_ids.sort
207 207
208 208 tracker = Tracker.find(2)
209 209 assert_equal [], tracker.core_fields
210 210 assert_equal [], tracker.custom_field_ids.sort
211 211 end
212 212 end
@@ -1,202 +1,233
1 1 module ObjectHelpers
2 2 def User.generate!(attributes={})
3 3 @generated_user_login ||= 'user0'
4 4 @generated_user_login.succ!
5 5 user = User.new(attributes)
6 6 user.login = @generated_user_login.dup if user.login.blank?
7 7 user.mail = "#{@generated_user_login}@example.com" if user.mail.blank?
8 8 user.firstname = "Bob" if user.firstname.blank?
9 9 user.lastname = "Doe" if user.lastname.blank?
10 10 yield user if block_given?
11 11 user.save!
12 12 user
13 13 end
14 14
15 15 def User.add_to_project(user, project, roles=nil)
16 16 roles = Role.find(1) if roles.nil?
17 17 roles = [roles] if roles.is_a?(Role)
18 18 Member.create!(:principal => user, :project => project, :roles => roles)
19 19 end
20 20
21 21 def Group.generate!(attributes={})
22 22 @generated_group_name ||= 'Group 0'
23 23 @generated_group_name.succ!
24 24 group = Group.new(attributes)
25 25 group.name = @generated_group_name.dup if group.name.blank?
26 26 yield group if block_given?
27 27 group.save!
28 28 group
29 29 end
30 30
31 31 def Project.generate!(attributes={})
32 32 @generated_project_identifier ||= 'project-0000'
33 33 @generated_project_identifier.succ!
34 34 project = Project.new(attributes)
35 35 project.name = @generated_project_identifier.dup if project.name.blank?
36 36 project.identifier = @generated_project_identifier.dup if project.identifier.blank?
37 37 yield project if block_given?
38 38 project.save!
39 39 project
40 40 end
41 41
42 42 def Project.generate_with_parent!(parent, attributes={})
43 43 project = Project.generate!(attributes)
44 44 project.set_parent!(parent)
45 45 project
46 46 end
47 47
48 def IssueStatus.generate!(attributes={})
49 @generated_status_name ||= 'Status 0'
50 @generated_status_name.succ!
51 status = IssueStatus.new(attributes)
52 status.name = @generated_status_name.dup if status.name.blank?
53 yield status if block_given?
54 status.save!
55 status
56 end
57
48 58 def Tracker.generate!(attributes={})
49 59 @generated_tracker_name ||= 'Tracker 0'
50 60 @generated_tracker_name.succ!
51 61 tracker = Tracker.new(attributes)
52 62 tracker.name = @generated_tracker_name.dup if tracker.name.blank?
63 tracker.default_status ||= IssueStatus.order('position').first || IssueStatus.generate!
53 64 yield tracker if block_given?
54 65 tracker.save!
55 66 tracker
56 67 end
57 68
58 69 def Role.generate!(attributes={})
59 70 @generated_role_name ||= 'Role 0'
60 71 @generated_role_name.succ!
61 72 role = Role.new(attributes)
62 73 role.name = @generated_role_name.dup if role.name.blank?
63 74 yield role if block_given?
64 75 role.save!
65 76 role
66 77 end
67 78
68 79 # Generates an unsaved Issue
69 80 def Issue.generate(attributes={})
70 81 issue = Issue.new(attributes)
71 82 issue.project ||= Project.find(1)
72 83 issue.tracker ||= issue.project.trackers.first
73 84 issue.subject = 'Generated' if issue.subject.blank?
74 85 issue.author ||= User.find(2)
75 86 yield issue if block_given?
76 87 issue
77 88 end
78 89
79 90 # Generates a saved Issue
80 91 def Issue.generate!(attributes={}, &block)
81 92 issue = Issue.generate(attributes, &block)
82 93 issue.save!
83 94 issue
84 95 end
85 96
86 97 # Generates an issue with 2 children and a grandchild
87 98 def Issue.generate_with_descendants!(attributes={})
88 99 issue = Issue.generate!(attributes)
89 100 child = Issue.generate!(:project => issue.project, :subject => 'Child1', :parent_issue_id => issue.id)
90 101 Issue.generate!(:project => issue.project, :subject => 'Child2', :parent_issue_id => issue.id)
91 102 Issue.generate!(:project => issue.project, :subject => 'Child11', :parent_issue_id => child.id)
92 103 issue.reload
93 104 end
94 105
95 106 def Journal.generate!(attributes={})
96 107 journal = Journal.new(attributes)
97 108 journal.user ||= User.first
98 109 journal.journalized ||= Issue.first
99 110 yield journal if block_given?
100 111 journal.save!
101 112 journal
102 113 end
103 114
104 115 def Version.generate!(attributes={})
105 116 @generated_version_name ||= 'Version 0'
106 117 @generated_version_name.succ!
107 118 version = Version.new(attributes)
108 119 version.name = @generated_version_name.dup if version.name.blank?
109 120 yield version if block_given?
110 121 version.save!
111 122 version
112 123 end
113 124
114 125 def TimeEntry.generate!(attributes={})
115 126 entry = TimeEntry.new(attributes)
116 127 entry.user ||= User.find(2)
117 128 entry.issue ||= Issue.find(1) unless entry.project
118 129 entry.project ||= entry.issue.project
119 130 entry.activity ||= TimeEntryActivity.first
120 131 entry.spent_on ||= Date.today
121 132 entry.hours ||= 1.0
122 133 entry.save!
123 134 entry
124 135 end
125 136
126 137 def AuthSource.generate!(attributes={})
127 138 @generated_auth_source_name ||= 'Auth 0'
128 139 @generated_auth_source_name.succ!
129 140 source = AuthSource.new(attributes)
130 141 source.name = @generated_auth_source_name.dup if source.name.blank?
131 142 yield source if block_given?
132 143 source.save!
133 144 source
134 145 end
135 146
136 147 def Board.generate!(attributes={})
137 148 @generated_board_name ||= 'Forum 0'
138 149 @generated_board_name.succ!
139 150 board = Board.new(attributes)
140 151 board.name = @generated_board_name.dup if board.name.blank?
141 152 board.description = @generated_board_name.dup if board.description.blank?
142 153 yield board if block_given?
143 154 board.save!
144 155 board
145 156 end
146 157
147 158 def Attachment.generate!(attributes={})
148 159 @generated_filename ||= 'testfile0'
149 160 @generated_filename.succ!
150 161 attributes = attributes.dup
151 162 attachment = Attachment.new(attributes)
152 163 attachment.container ||= Issue.find(1)
153 164 attachment.author ||= User.find(2)
154 165 attachment.filename = @generated_filename.dup if attachment.filename.blank?
155 166 attachment.save!
156 167 attachment
157 168 end
158 169
159 170 def CustomField.generate!(attributes={})
160 171 @generated_custom_field_name ||= 'Custom field 0'
161 172 @generated_custom_field_name.succ!
162 173 field = new(attributes)
163 174 field.name = @generated_custom_field_name.dup if field.name.blank?
164 175 field.field_format = 'string' if field.field_format.blank?
165 176 yield field if block_given?
166 177 field.save!
167 178 field
168 179 end
169 180
170 181 def Changeset.generate!(attributes={})
171 182 @generated_changeset_rev ||= '123456'
172 183 @generated_changeset_rev.succ!
173 184 changeset = new(attributes)
174 185 changeset.repository ||= Project.find(1).repository
175 186 changeset.revision ||= @generated_changeset_rev
176 187 changeset.committed_on ||= Time.now
177 188 yield changeset if block_given?
178 189 changeset.save!
179 190 changeset
180 191 end
181 192
182 193 def Query.generate!(attributes={})
183 194 query = new(attributes)
184 195 query.name = "Generated query" if query.name.blank?
185 196 query.user ||= User.find(1)
186 197 query.save!
187 198 query
188 199 end
189 200 end
190 201
202 module TrackerObjectHelpers
203 def generate_transitions!(*args)
204 options = args.last.is_a?(Hash) ? args.pop : {}
205 if args.size == 1
206 args << args.first
207 end
208 if options[:clear]
209 WorkflowTransition.where(:tracker_id => id).delete_all
210 end
211 args.each_cons(2) do |old_status_id, new_status_id|
212 WorkflowTransition.create!(
213 :tracker => self,
214 :role_id => (options[:role_id] || 1),
215 :old_status_id => old_status_id,
216 :new_status_id => new_status_id
217 )
218 end
219 end
220 end
221 Tracker.send :include, TrackerObjectHelpers
222
191 223 module IssueObjectHelpers
192 224 def close!
193 225 self.status = IssueStatus.where(:is_closed => true).first
194 226 save!
195 227 end
196 228
197 229 def generate_child!(attributes={})
198 230 Issue.generate!(attributes.merge(:parent_issue_id => self.id))
199 231 end
200 232 end
201
202 233 Issue.send :include, IssueObjectHelpers
@@ -1,123 +1,99
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class IssueStatusTest < ActiveSupport::TestCase
21 21 fixtures :issue_statuses, :issues, :roles, :trackers
22 22
23 23 def test_create
24 24 status = IssueStatus.new :name => "Assigned"
25 25 assert !status.save
26 26 # status name uniqueness
27 27 assert_equal 1, status.errors.count
28 28
29 29 status.name = "Test Status"
30 30 assert status.save
31 assert !status.is_default
32 31 end
33 32
34 33 def test_destroy
35 34 status = IssueStatus.find(3)
36 35 assert_difference 'IssueStatus.count', -1 do
37 36 assert status.destroy
38 37 end
39 38 assert_nil WorkflowTransition.where(:old_status_id => status.id).first
40 39 assert_nil WorkflowTransition.where(:new_status_id => status.id).first
41 40 end
42 41
43 42 def test_destroy_status_in_use
44 43 # Status assigned to an Issue
45 44 status = Issue.find(1).status
46 45 assert_raise(RuntimeError, "Can't delete status") { status.destroy }
47 46 end
48 47
49 def test_default
50 status = IssueStatus.default
51 assert_kind_of IssueStatus, status
52 end
53
54 def test_change_default
55 status = IssueStatus.find(2)
56 assert !status.is_default
57 status.is_default = true
58 assert status.save
59 status.reload
60
61 assert_equal status, IssueStatus.default
62 assert !IssueStatus.find(1).is_default
63 end
64
65 def test_reorder_should_not_clear_default_status
66 status = IssueStatus.default
67 status.move_to_bottom
68 status.reload
69 assert status.is_default?
70 end
71
72 48 def test_new_statuses_allowed_to
73 49 WorkflowTransition.delete_all
74 50
75 51 WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 2, :author => false, :assignee => false)
76 52 WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 3, :author => true, :assignee => false)
77 53 WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 4, :author => false, :assignee => true)
78 54 WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 5, :author => true, :assignee => true)
79 55 status = IssueStatus.find(1)
80 56 role = Role.find(1)
81 57 tracker = Tracker.find(1)
82 58
83 59 assert_equal [2], status.new_statuses_allowed_to([role], tracker, false, false).map(&:id)
84 60 assert_equal [2], status.find_new_statuses_allowed_to([role], tracker, false, false).map(&:id)
85 61
86 62 assert_equal [2, 3, 5], status.new_statuses_allowed_to([role], tracker, true, false).map(&:id)
87 63 assert_equal [2, 3, 5], status.find_new_statuses_allowed_to([role], tracker, true, false).map(&:id)
88 64
89 65 assert_equal [2, 4, 5], status.new_statuses_allowed_to([role], tracker, false, true).map(&:id)
90 66 assert_equal [2, 4, 5], status.find_new_statuses_allowed_to([role], tracker, false, true).map(&:id)
91 67
92 68 assert_equal [2, 3, 4, 5], status.new_statuses_allowed_to([role], tracker, true, true).map(&:id)
93 69 assert_equal [2, 3, 4, 5], status.find_new_statuses_allowed_to([role], tracker, true, true).map(&:id)
94 70 end
95 71
96 72 def test_update_done_ratios_with_issue_done_ratio_set_to_issue_field_should_change_nothing
97 73 IssueStatus.find(1).update_attribute(:default_done_ratio, 50)
98 74
99 75 with_settings :issue_done_ratio => 'issue_field' do
100 76 IssueStatus.update_issue_done_ratios
101 77 assert_equal 0, Issue.where(:done_ratio => 50).count
102 78 end
103 79 end
104 80
105 81 def test_update_done_ratios_with_issue_done_ratio_set_to_issue_status_should_update_issues
106 82 IssueStatus.find(1).update_attribute(:default_done_ratio, 50)
107 83 with_settings :issue_done_ratio => 'issue_status' do
108 84 IssueStatus.update_issue_done_ratios
109 85 issues = Issue.where(:status_id => 1)
110 86 assert_equal [50], issues.map {|issue| issue.read_attribute(:done_ratio)}.uniq
111 87 end
112 88 end
113 89
114 90 def test_sorted_scope
115 91 assert_equal IssueStatus.all.sort, IssueStatus.sorted.to_a
116 92 end
117 93
118 94 def test_named_scope
119 95 status = IssueStatus.named("resolved").first
120 96 assert_not_nil status
121 97 assert_equal "Resolved", status.name
122 98 end
123 99 end
1 NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
1 NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
1 NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
General Comments 0
You need to be logged in to leave comments. Login now