diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2021-07-27 20:46:18 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2021-07-27 20:46:18 +0000 |
commit | 6bed3457e58c240917e46d141af04ae2125fbacb (patch) | |
tree | e82d6d14b82b0151f4ead5bf71b66feeb2b2afd9 | |
parent | 560e1940472fa4427633a5c4b28ca88af3b5967e (diff) | |
download | redmine-6bed3457e58c240917e46d141af04ae2125fbacb.tar.gz redmine-6bed3457e58c240917e46d141af04ae2125fbacb.zip |
Merged r21085 to 4.1-stable (#35134).
git-svn-id: http://svn.redmine.org/redmine/branches/4.1-stable@21095 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/helpers/issues_helper.rb | 5 | ||||
-rw-r--r-- | test/helpers/issues_helper_test.rb | 22 |
2 files changed, 27 insertions, 0 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 30a2470e9..f2f40654b 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -217,6 +217,11 @@ module IssuesHelper if issue.total_spent_hours == issue.spent_hours link_to(l_hours_short(issue.spent_hours), path) else + # link to global time entries if cross-project subtasks are allowed + # in order to show time entries from not descendents projects + if %w(system tree hierarchy).include?(Setting.cross_project_subtasks) + path = time_entries_path(:issue_id => "~#{issue.id}") + end s = issue.spent_hours > 0 ? l_hours_short(issue.spent_hours) : "" s += " (#{l(:label_total)}: #{link_to l_hours_short(issue.total_spent_hours), path})" s.html_safe diff --git a/test/helpers/issues_helper_test.rb b/test/helpers/issues_helper_test.rb index 89c9de0ef..991e7fe78 100644 --- a/test/helpers/issues_helper_test.rb +++ b/test/helpers/issues_helper_test.rb @@ -360,4 +360,26 @@ class IssuesHelperTest < Redmine::HelperTest assert_equal '06/06/2019', issue_due_date_details(issue) end end + + def test_issue_spent_hours_details_should_link_to_project_time_entries_depending_on_cross_project_setting + %w(descendants).each do |setting| + with_settings :cross_project_subtasks => setting do + TimeEntry.generate!(:issue => Issue.generate!(:parent_issue_id => 1), :hours => 3) + TimeEntry.generate!(:issue => Issue.generate!(:parent_issue_id => 1), :hours => 4) + + assert_match "href=\"/projects/ecookbook/time_entries?issue_id=~1\"", issue_spent_hours_details(Issue.find(1)) + end + end + end + + def test_issue_spent_hours_details_should_link_to_global_time_entries_depending_on_cross_project_setting + %w(system tree hierarchy).each do |setting| + with_settings :cross_project_subtasks => setting do + TimeEntry.generate!(:issue => Issue.generate!(:parent_issue_id => 1), :hours => 3) + TimeEntry.generate!(:issue => Issue.generate!(:parent_issue_id => 1), :hours => 4) + + assert_match "href=\"/time_entries?issue_id=~1\"", issue_spent_hours_details(Issue.find(1)) + end + end + end end |