##// END OF EJS Templates
Fixed: default status not showing in new issue...
Jean-Philippe Lang -
r472:c995be94d972
parent child
Show More
@@ -216,7 +216,7 class ProjectsController < ApplicationController
216 default_status = IssueStatus.default
216 default_status = IssueStatus.default
217 @issue = Issue.new(:project => @project, :tracker => @tracker)
217 @issue = Issue.new(:project => @project, :tracker => @tracker)
218 @issue.status = default_status
218 @issue.status = default_status
219 @allowed_statuses = (default_status.find_new_statuses_allowed_to(logged_in_user.role_for_project(@project), @issue.tracker) || [default_status])if logged_in_user
219 @allowed_statuses = ([default_status] + default_status.find_new_statuses_allowed_to(logged_in_user.role_for_project(@project), @issue.tracker))if logged_in_user
220 if request.get?
220 if request.get?
221 @issue.start_date = Date.today
221 @issue.start_date = Date.today
222 @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) }
222 @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) }
@@ -39,7 +39,7 class IssueStatus < ActiveRecord::Base
39 # Uses association cache when called more than one time
39 # Uses association cache when called more than one time
40 def new_statuses_allowed_to(role, tracker)
40 def new_statuses_allowed_to(role, tracker)
41 new_statuses = workflows.select {|w| w.role_id == role.id && w.tracker_id == tracker.id}.collect{|w| w.new_status} if role && tracker
41 new_statuses = workflows.select {|w| w.role_id == role.id && w.tracker_id == tracker.id}.collect{|w| w.new_status} if role && tracker
42 new_statuses.sort{|x, y| x.position <=> y.position } if new_statuses
42 new_statuses ? new_statuses.sort{|x, y| x.position <=> y.position } : []
43 end
43 end
44
44
45 # Same thing as above but uses a database query
45 # Same thing as above but uses a database query
@@ -48,7 +48,7 class IssueStatus < ActiveRecord::Base
48 new_statuses = workflows.find(:all,
48 new_statuses = workflows.find(:all,
49 :include => :new_status,
49 :include => :new_status,
50 :conditions => ["role_id=? and tracker_id=?", role.id, tracker.id]).collect{ |w| w.new_status } if role && tracker
50 :conditions => ["role_id=? and tracker_id=?", role.id, tracker.id]).collect{ |w| w.new_status } if role && tracker
51 new_statuses.sort{|x, y| x.position <=> y.position } if new_statuses
51 new_statuses ? new_statuses.sort{|x, y| x.position <=> y.position } : []
52 end
52 end
53
53
54 private
54 private
General Comments 0
You need to be logged in to leave comments. Login now