mirror of
https://github.com/meineerde/redmine.git
synced 2026-01-02 05:39:40 +00:00
Add links to Users, Projects and Versions in timelog report (#29042).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@17404 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
438d2f65fd
commit
d32f007319
@ -58,16 +58,12 @@ module TimelogHelper
|
||||
sum
|
||||
end
|
||||
|
||||
def format_criteria_value(criteria_options, value)
|
||||
def format_criteria_value(criteria_options, value, html=true)
|
||||
if value.blank?
|
||||
"[#{l(:label_none)}]"
|
||||
elsif k = criteria_options[:klass]
|
||||
obj = k.find_by_id(value.to_i)
|
||||
if obj.is_a?(Issue)
|
||||
obj.visible? ? "#{obj.tracker} ##{obj.id}: #{obj.subject}" : "##{obj.id}"
|
||||
else
|
||||
obj
|
||||
end
|
||||
format_object(obj, html)
|
||||
elsif cf = criteria_options[:custom_field]
|
||||
format_value(value, cf)
|
||||
else
|
||||
@ -103,7 +99,7 @@ module TimelogHelper
|
||||
hours_for_value = select_hours(hours, criteria[level], value)
|
||||
next if hours_for_value.empty?
|
||||
row = [''] * level
|
||||
row << format_criteria_value(available_criteria[criteria[level]], value).to_s
|
||||
row << format_criteria_value(available_criteria[criteria[level]], value, false).to_s
|
||||
row += [''] * (criteria.length - level - 1)
|
||||
total = 0
|
||||
periods.each do |period|
|
||||
|
||||
@ -71,6 +71,7 @@ class TimelogReportTest < Redmine::ControllerTest
|
||||
get :report, :params => {:columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criteria => ['project']}
|
||||
assert_response :success
|
||||
assert_select 'tr.total td:last', :text => '8.65'
|
||||
assert_select 'tr td.name a[href=?]', '/projects/ecookbook', :text => 'eCookbook'
|
||||
end
|
||||
|
||||
def test_report_all_time
|
||||
@ -98,6 +99,20 @@ class TimelogReportTest < Redmine::ControllerTest
|
||||
assert_select 'tr.total td:last', :text => '162.90'
|
||||
end
|
||||
|
||||
def test_report_should_show_locked_users
|
||||
@request.session[:user_id] = 1
|
||||
|
||||
user = User.find(2)
|
||||
user.status = User::STATUS_LOCKED
|
||||
user.save
|
||||
|
||||
get :report, :params => {:project_id => 1, :columns => 'month', :criteria => ["user", "activity"]}
|
||||
assert_response :success
|
||||
|
||||
assert_select 'td.name a.user.active[href=?]', '/users/1', 1, :text => 'Redmine Admin'
|
||||
assert_select 'td.name a.user.locked[href=?]', '/users/2', 1, :text => 'John Smith'
|
||||
end
|
||||
|
||||
def test_report_custom_field_criteria_with_multiple_values_on_single_value_custom_field_should_not_fail
|
||||
field = TimeEntryCustomField.create!(:name => 'multi', :field_format => 'list', :possible_values => ['value1', 'value2'])
|
||||
entry = TimeEntry.create!(:project => Project.find(1), :hours => 1, :activity_id => 10, :user => User.find(2), :spent_on => Date.today)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user