Redmine-Jobs/lib/time_report_helper_patch.rb

26 lines
622 B
Ruby
Raw Normal View History

2024-01-16 13:10:16 +00:00
# frozen_string_literal: true
# Add jobs
module TimeReportHelperPatch
extend ActiveSupport::Concern
included do
include InstanceMethods
alias_method :load_available_criteria_without_jobs, :load_available_criteria
alias_method :load_available_criteria, :load_available_criteria_with_jobs
end
module InstanceMethods
def load_available_criteria_with_jobs
@available_criteria = load_available_criteria_without_jobs
@available_criteria['job'] = {
sql: "#{TimeEntry.table_name}.job_id",
klass: Job,
label: 'Job'
}
@available_criteria
end
end
end