@@ -8,7 +8,7 | |||
|
8 | 8 | </p> |
|
9 | 9 | <% end %> |
|
10 | 10 | |
|
11 | <% if @issue.safe_attribute?('project_id') && (!@issue.new_record? || @project.nil? || @issue.copy?) %> | |
|
11 | <% if (@issue.safe_attribute?('project_id') || @issue.project_id_changed?) && (!@issue.new_record? || @project.nil? || @issue.copy?) %> | |
|
12 | 12 | <p><%= f.select :project_id, project_tree_options_for_select(@issue.allowed_target_projects, :selected => @issue.project), {:required => true}, |
|
13 | 13 | :onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %></p> |
|
14 | 14 | <% end %> |
@@ -3150,6 +3150,7 class IssuesControllerTest < Redmine::ControllerTest | |||
|
3150 | 3150 | get :edit, :id => 1 |
|
3151 | 3151 | assert_response :success |
|
3152 | 3152 | |
|
3153 | assert_select 'select[name=?]', 'issue[project_id]' | |
|
3153 | 3154 | # Be sure we don't display inactive IssuePriorities |
|
3154 | 3155 | assert ! IssuePriority.find(15).active? |
|
3155 | 3156 | assert_select 'select[name=?]', 'issue[priority_id]' do |
@@ -3157,6 +3158,25 class IssuesControllerTest < Redmine::ControllerTest | |||
|
3157 | 3158 | end |
|
3158 | 3159 | end |
|
3159 | 3160 | |
|
3161 | def test_edit_should_hide_project_if_user_is_not_allowed_to_change_project | |
|
3162 | WorkflowPermission.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :field_name => 'project_id', :rule => 'readonly') | |
|
3163 | ||
|
3164 | @request.session[:user_id] = 2 | |
|
3165 | get :edit, :id => 1 | |
|
3166 | assert_response :success | |
|
3167 | assert_select 'select[name=?]', 'issue[project_id]', 0 | |
|
3168 | end | |
|
3169 | ||
|
3170 | def test_edit_should_not_hide_project_when_user_changes_the_project_even_if_project_is_readonly_on_target_project | |
|
3171 | WorkflowPermission.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :field_name => 'project_id', :rule => 'readonly') | |
|
3172 | issue = Issue.generate!(:project_id => 2) | |
|
3173 | ||
|
3174 | @request.session[:user_id] = 2 | |
|
3175 | get :edit, :id => issue.id, :issue => {:project_id => 1} | |
|
3176 | assert_response :success | |
|
3177 | assert_select 'select[name=?]', 'issue[project_id]' | |
|
3178 | end | |
|
3179 | ||
|
3160 | 3180 | def test_get_edit_should_display_the_time_entry_form_with_log_time_permission |
|
3161 | 3181 | @request.session[:user_id] = 2 |
|
3162 | 3182 | Role.find_by_name('Manager').update_attribute :permissions, [:view_issues, :edit_issues, :log_time] |
General Comments 0
You need to be logged in to leave comments.
Login now