diff --git a/lib/hooks/issues_show_hook_listener.rb b/lib/hooks/issues_show_hook_listener.rb index 0495c0c..b1136ab 100644 --- a/lib/hooks/issues_show_hook_listener.rb +++ b/lib/hooks/issues_show_hook_listener.rb @@ -43,7 +43,8 @@ module Hooks locals: { customer: customer, estimate_link: estimate_link, - invoice_link: invoice_link + invoice_link: invoice_link, + issue: issue } }) end diff --git a/lib/patches/pdf_patch.rb b/lib/patches/pdf_patch.rb index 076d068..3298eea 100644 --- a/lib/patches/pdf_patch.rb +++ b/lib/patches/pdf_patch.rb @@ -58,13 +58,20 @@ module Patches #left << [l(:field_category), issue.category] unless issue.disabled_core_fields.include?('category_id') #left << [l(:field_fixed_version), issue.fixed_version] unless issue.disabled_core_fields.include?('fixed_version_id') + logger.debug "Calling :pdf_left hook" + context = Redmine::Hook.call_hook :pdf_left, { array: left, issue: issue } + left << context.first unless context.nil? + right = [] right << [l(:field_start_date), format_date(issue.start_date)] unless issue.disabled_core_fields.include?('start_date') right << [l(:field_due_date), format_date(issue.due_date)] unless issue.disabled_core_fields.include?('due_date') right << [l(:field_done_ratio), "#{issue.done_ratio}%"] unless issue.disabled_core_fields.include?('done_ratio') right << [l(:field_estimated_hours), l_hours(issue.estimated_hours)] unless issue.disabled_core_fields.include?('estimated_hours') right << [l(:label_spent_time), l_hours(issue.total_spent_hours)] if User.current.allowed_to?(:view_time_entries, issue.project) - right << [l(:field_notes), notes] + + logger.debug "Calling :pdf_right hook" + context = Redmine::Hook.call_hook :pdf_right, { array: right, issue: issue } + right << context.first unless context.nil? rows = left.size > right.size ? left.size : right.size while left.size < rows