1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-31 19:47:14 +00:00

Link total spent time to global time entries page when cross_project_issue_relations are allowed in order to include time entries from other projects (#35134).

git-svn-id: http://svn.redmine.org/redmine/trunk@21082 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu 2021-07-26 20:28:21 +00:00
parent 3ebe6a8b0a
commit 158d21b75c
2 changed files with 27 additions and 0 deletions

View File

@ -264,6 +264,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

View File

@ -375,4 +375,26 @@ class IssuesHelperTest < Redmine::HelperTest
assert_equal new_project_issue_path(issue.project, params),
url_for_new_subtask(issue)
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