Patch #16364 » workflow_bugfix-master-2015-06-16.diff
| app/models/issue.rb | ||
|---|---|---|
|
self.status_id
|
||
|
end
|
||
|
# Returns the current status if the workflow allows the status to be unchanged
|
||
|
# or the first status from the list of allowed new statuses.
|
||
|
def status_id_or_first_allowed
|
||
|
user = User.current
|
||
|
if new_statuses_allowed_to(user).collect(&:id).include?(status_id.to_i)
|
||
|
status_id
|
||
|
else
|
||
|
new_statuses_allowed_to(user).first(&:id).id
|
||
|
end
|
||
|
end
|
||
|
# Sets the status.
|
||
|
def status=(status)
|
||
|
if status != self.status
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
end
|
||
|
unless new_statuses_allowed_to(User.current).collect(&:id).include?(status_id.to_i)
|
||
|
errors.add :status_id
|
||
|
end
|
||
|
end
|
||
|
# Validates the issue against additional workflow requirements
|
||
| ... | ... | |
|
assignee_transitions_allowed
|
||
|
)
|
||
|
end
|
||
|
statuses << initial_status unless statuses.empty?
|
||
|
statuses << initial_status if statuses.empty?
|
||
|
statuses << default_status if include_default
|
||
|
statuses = statuses.compact.uniq.sort
|
||
|
if blocked?
|
||
| app/views/issues/_attributes.html.erb | ||
|---|---|---|
|
<div class="splitcontent">
|
||
|
<div class="splitcontentleft">
|
||
|
<% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %>
|
||
|
<p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), {:required => true},
|
||
|
<p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), {:required => true, :selected => @issue.status_id_or_first_allowed},
|
||
|
:onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}')" %></p>
|
||
|
<%= hidden_field_tag 'was_default_status', @issue.status_id, :id => nil if @issue.status == @issue.default_status %>
|
||
|
<% else %>
|
||
- « Previous
- 1
- 2
- Next »