Feature 9784 Set status when raising issue.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@407 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
6d2ecefca0
commit
a09b2a23b9
|
@ -212,12 +212,20 @@ class ProjectsController < ApplicationController
|
|||
def add_issue
|
||||
@tracker = Tracker.find(params[:tracker_id])
|
||||
@priorities = Enumeration::get_values('IPRI')
|
||||
@issue = Issue.new(:project => @project, :tracker => @tracker)
|
||||
|
||||
default_status = IssueStatus.default
|
||||
@issue = Issue.new(:project => @project, :tracker => @tracker, :status => default_status)
|
||||
@allowed_statuses = [default_status] + default_status.workflows.find(:all, :order => 'position', :include => :new_status, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status }
|
||||
|
||||
if request.get?
|
||||
@issue.start_date = Date.today
|
||||
@custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) }
|
||||
else
|
||||
@issue.attributes = params[:issue]
|
||||
|
||||
requested_status = IssueStatus.find_by_id(params[:issue][:status_id])
|
||||
@issue.status = (@allowed_statuses.include? requested_status) ? requested_status : default_status
|
||||
|
||||
@issue.author_id = self.logged_in_user.id if self.logged_in_user
|
||||
# Multiple file upload
|
||||
@attachments = []
|
||||
|
|
|
@ -38,7 +38,7 @@ class Issue < ActiveRecord::Base
|
|||
|
||||
# set default status for new issues
|
||||
def before_validation
|
||||
self.status = IssueStatus.default if new_record?
|
||||
self.status = IssueStatus.default if status.nil?
|
||||
end
|
||||
|
||||
def validate
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<%= hidden_field_tag 'tracker_id', @tracker.id %>
|
||||
|
||||
<div class="splitcontentleft">
|
||||
<p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), :required => true %></p>
|
||||
<p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p>
|
||||
<p><%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %></p>
|
||||
<p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %></p>
|
||||
|
|
Loading…
Reference in New Issue