|
|
|
@ -7,47 +7,41 @@ module OpenProject::Costs::Patches::WorkPackagesHelperPatch |
|
|
|
|
attributes = [] |
|
|
|
|
|
|
|
|
|
attributes << work_package_show_table_row(:cost_object) do |
|
|
|
|
work_package.cost_object ? |
|
|
|
|
link_to_cost_object(work_package.cost_object) : |
|
|
|
|
"-" |
|
|
|
|
end |
|
|
|
|
work_package.cost_object ? |
|
|
|
|
link_to_cost_object(work_package.cost_object) : |
|
|
|
|
"-" |
|
|
|
|
end |
|
|
|
|
if User.current.allowed_to?(:view_time_entries, @project) || |
|
|
|
|
User.current.allowed_to?(:view_own_time_entries, @project) |
|
|
|
|
User.current.allowed_to?(:view_own_time_entries, @project) |
|
|
|
|
|
|
|
|
|
attributes << work_package_show_table_row(:spent_hours) do |
|
|
|
|
#TODO: put inside controller or model |
|
|
|
|
summed_hours = @time_entries.sum(&:hours) |
|
|
|
|
# TODO: put inside controller or model |
|
|
|
|
summed_hours = @time_entries.sum(&:hours) |
|
|
|
|
|
|
|
|
|
summed_hours > 0 ? |
|
|
|
|
link_to(l_hours(summed_hours), work_package_time_entries_path(work_package)) : |
|
|
|
|
"-" |
|
|
|
|
end |
|
|
|
|
summed_hours > 0 ? |
|
|
|
|
link_to(l_hours(summed_hours), work_package_time_entries_path(work_package)) : |
|
|
|
|
"-" |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
attributes << work_package_show_table_row(:overall_costs) do |
|
|
|
|
@overall_costs.nil? ? |
|
|
|
|
"-" : |
|
|
|
|
number_to_currency(@overall_costs) |
|
|
|
|
end |
|
|
|
|
@overall_costs.nil? ? |
|
|
|
|
"-" : |
|
|
|
|
number_to_currency(@overall_costs) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
if User.current.allowed_to?(:view_cost_entries, @project) || |
|
|
|
|
User.current.allowed_to?(:view_own_cost_entries, @project) |
|
|
|
|
User.current.allowed_to?(:view_own_cost_entries, @project) |
|
|
|
|
|
|
|
|
|
attributes << work_package_show_table_row(:spent_units) do |
|
|
|
|
|
|
|
|
|
summed_costs = summarized_cost_entries(@cost_entries) |
|
|
|
|
|
|
|
|
|
#summed_costs > 0 ? |
|
|
|
|
summed_costs# : |
|
|
|
|
# "-" |
|
|
|
|
end |
|
|
|
|
summarized_cost_entries(@cost_entries, work_package) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
attributes |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def summarized_cost_entries(cost_entries, create_link=true) |
|
|
|
|
def summarized_cost_entries(cost_entries, work_package, create_link=true) |
|
|
|
|
last_cost_type = "" |
|
|
|
|
|
|
|
|
|
return "-" if cost_entries.blank? |
|
|
|
@ -72,10 +66,10 @@ module OpenProject::Costs::Patches::WorkPackagesHelperPatch |
|
|
|
|
# TODO why does this have project_id, work_package_id and cost_type_id params? |
|
|
|
|
str_array << link_to(txt, { :controller => '/costlog', |
|
|
|
|
:action => 'index', |
|
|
|
|
:project_id => @work_package.project, |
|
|
|
|
:work_package_id => @work_package, |
|
|
|
|
:project_id => work_package.project, |
|
|
|
|
:work_package_id => work_package, |
|
|
|
|
:cost_type_id => k }, |
|
|
|
|
{ :title => k.name }) |
|
|
|
|
{ :title => k.name }) |
|
|
|
|
else |
|
|
|
|
str_array << "<span title=\"#{h(k.name)}\">#{txt}</span>" |
|
|
|
|
end |
|
|
|
|