parent
bf2a207429
commit
472d2b0479
1
init.rb
1
init.rb
|
@ -16,6 +16,7 @@ Redmine::Plugin.register :jobs do
|
||||||
TimeEntryQuery.send(:include, TimeEntryQueryPatch)
|
TimeEntryQuery.send(:include, TimeEntryQueryPatch)
|
||||||
TimeEntry.send(:include, TimeEntryPatch)
|
TimeEntry.send(:include, TimeEntryPatch)
|
||||||
Project.send(:include, ProjectPatch)
|
Project.send(:include, ProjectPatch)
|
||||||
|
Redmine::Helpers::TimeReport.send(:include, TimeReportHelperPatch)
|
||||||
end
|
end
|
||||||
|
|
||||||
project_module :jobs do
|
project_module :jobs do
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
# 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
|
Loading…
Reference in New Issue