Patch #16364 » workflow_bugfix-master-2015-06-16.diff
app/models/issue.rb | ||
---|---|---|
259 | 259 |
self.status_id |
260 | 260 |
end |
261 | 261 | |
262 |
# Returns the current status if the workflow allows the status to be unchanged |
|
263 |
# or the first status from the list of allowed new statuses. |
|
264 |
def status_id_or_first_allowed |
|
265 |
user = User.current |
|
266 |
if new_statuses_allowed_to(user).collect(&:id).include?(status_id.to_i) |
|
267 |
status_id |
|
268 |
else |
|
269 |
new_statuses_allowed_to(user).first(&:id).id |
|
270 |
end |
|
271 |
end |
|
272 | ||
262 | 273 |
# Sets the status. |
263 | 274 |
def status=(status) |
264 | 275 |
if status != self.status |
... | ... | |
646 | 657 |
end |
647 | 658 |
end |
648 | 659 |
end |
660 | ||
661 |
unless new_statuses_allowed_to(User.current).collect(&:id).include?(status_id.to_i) |
|
662 |
errors.add :status_id |
|
663 |
end |
|
649 | 664 |
end |
650 | 665 | |
651 | 666 |
# Validates the issue against additional workflow requirements |
... | ... | |
851 | 866 |
assignee_transitions_allowed |
852 | 867 |
) |
853 | 868 |
end |
854 |
statuses << initial_status unless statuses.empty?
|
|
869 |
statuses << initial_status if statuses.empty?
|
|
855 | 870 |
statuses << default_status if include_default |
856 | 871 |
statuses = statuses.compact.uniq.sort |
857 | 872 |
if blocked? |
app/views/issues/_attributes.html.erb | ||
---|---|---|
3 | 3 |
<div class="splitcontent"> |
4 | 4 |
<div class="splitcontentleft"> |
5 | 5 |
<% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %> |
6 |
<p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), {:required => true}, |
|
6 |
<p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), {:required => true, :selected => @issue.status_id_or_first_allowed},
|
|
7 | 7 |
:onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}')" %></p> |
8 | 8 |
<%= hidden_field_tag 'was_default_status', @issue.status_id, :id => nil if @issue.status == @issue.default_status %> |
9 | 9 |
<% else %> |
- « Previous
- 1
- 2
- Next »