[#2279] Hooked up the Billable filter to adjust the Timesheet's Activities.

* Hooked into the TimesheetController to modify the Timesheet activities
* Added TimeEntryActivity#find_with_billable_values to find all the TimeEntryActivities
  which have the value in the billable custom field.
This commit is contained in:
Eric Davis
2009-04-22 15:10:29 -07:00
parent c122a291c7
commit 16d793bea6
4 changed files with 90 additions and 0 deletions
+16
View File
@@ -23,6 +23,22 @@ module OverheadTimeEntryActivityPatch
def overhead_configured?
Setting['plugin_redmine_overhead'] && Setting['plugin_redmine_overhead']['custom_field']
end
def find_with_billable_values(values = [])
return [] unless overhead_configured?
billable_field = TimeEntryActivity.billable_custom_field
if billable_field
finder = ARCondition.new
finder.add "#{CustomValue.table_name}.customized_type = '#{TimeEntryActivity.class_name}'"
finder.add ["#{CustomValue.table_name}.custom_field_id = ?", billable_field.id]
finder.add ["#{CustomValue.table_name}.value IN (?)", values]
return TimeEntryActivity.find(:all, :include => :custom_values, :conditions => finder.conditions)
else
return []
end
end
end
module InstanceMethods