Project

General

Profile

Defect #32959 » 0001-Fix-selected-user-on-timelog-edit.patch

Marius BĂLTEANU, 2020-02-08 21:36

View differences:

app/helpers/timelog_helper.rb
44 44

  
45 45
  def user_collection_for_select_options(time_entry)
46 46
    collection = time_entry.assignable_users
47
    principals_options_for_select(collection, time_entry.user_id)
47
    principals_options_for_select(collection, time_entry.user_id.to_s)
48 48
  end
49 49

  
50 50
  def select_hours(data, criteria, value)
test/functional/timelog_controller_test.rb
1458 1458
    assert_response :success
1459 1459
    assert_select "td.issue_cf_#{field.id}", :text => 'This is a long text'
1460 1460
  end
1461

  
1462
  def test_edit_for_other_user
1463
    Role.find_by_name('Manager').add_permission! :log_time_for_other_users
1464
    @request.session[:user_id] = 2
1465

  
1466
    get :edit, :params => {
1467
      :id => 1
1468
    }
1469

  
1470
    assert_response :success
1471

  
1472
    assert_select 'select[name=?]', 'time_entry[user_id]' do
1473
      assert_select 'option[value="2"][selected=selected]'
1474
    end
1475
  end
1461 1476
end
    (1-1/1)