We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Description: This is a Redmine plugin to generate timesheets from timelogs.
Homepage: https://projects.littlestreamsoftware.com/projects/show/redmine-timesheet
Clone URL: git://github.com/edavis10/redmine-timesheet-plugin.git
Added hooks to allow other plugins to modify the Timesheet object

* Added :plugin_timesheet_controller_report_pre_fetch_time_entries to 
allow
  a plugin to modifiy @timesheet
* Added :plugin_timesheet_model_timesheet_conditions to allow a plugin to
  modify the conditions used to find time entries in 
  Timesheet.fetch_time_entries
edavis10 (author)
Fri Oct 31 15:40:49 -0700 2008
commit  fcbc40a249c4ada97515e28a96cee9f97ea0c0a8
tree    d64c47d71cfac211b1f5328a8636e0793e1c0b9e
parent  110ed9ef8c4778e1c0dd3f1b5182ffea7d29e756
...
8
9
10
 
11
12
13
...
43
44
45
 
 
46
47
48
...
8
9
10
11
12
13
14
...
44
45
46
47
48
49
50
51
0
@@ -8,6 +8,7 @@ class TimesheetController < ApplicationController
0
   helper :sort
0
   include SortHelper
0
   helper :issues
0
+ include ApplicationHelper
0
 
0
   def index
0
     @from = Date.today.to_s
0
@@ -43,6 +44,8 @@ class TimesheetController < ApplicationController
0
       @timesheet.projects = @timesheet.allowed_projects
0
     end
0
 
0
+ call_hook(:plugin_timesheet_controller_report_pre_fetch_time_entries, { :timesheet => @timesheet, :params => params })
0
+
0
     @timesheet.fetch_time_entries
0
 
0
     # Sums
...
64
65
66
 
 
 
 
 
 
 
 
 
 
67
68
69
70
71
72
73
 
74
75
76
77
78
79
80
81
 
82
83
84
 
85
...
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
 
 
82
83
84
85
86
87
88
 
 
89
90
91
92
93
94
0
@@ -64,22 +64,31 @@ class Timesheet
0
     end
0
   end
0
   
0
+ protected
0
+
0
+ def conditions(users)
0
+ conditions = ['spent_on >= (?) AND spent_on <= (?) AND activity_id IN (?) AND user_id IN (?)',
0
+ self.date_from, self.date_to, self.activities, users ]
0
+
0
+ Redmine::Hook.call_hook(:plugin_timesheet_model_timesheet_conditions, { :timesheet => self, :conditions => conditions})
0
+ return conditions
0
+ end
0
+
0
   private
0
 
0
   
0
   def time_entries_for_all_users(project)
0
     return project.time_entries.find(:all,
0
- :conditions => ['spent_on >= (?) AND spent_on <= (?) AND activity_id IN (?) AND user_id IN (?)',
0
- self.date_from, self.date_to, self.activities, self.users ],
0
+ :conditions => self.conditions(self.users),
0
                                      :include => [:activity, :user, {:issue => [:tracker, :assigned_to, :priority]}],
0
                                      :order => "spent_on ASC")
0
   end
0
   
0
   def time_entries_for_current_user(project)
0
     return project.time_entries.find(:all,
0
- :conditions => ['spent_on >= (?) AND spent_on <= (?) AND activity_id IN (?) AND user_id = (?)',
0
- self.date_from, self.date_to, self.activities, User.current.id ],
0
+ :conditions => self.conditions(User.current.id),
0
                                      :include => [:activity, :user, {:issue => [:tracker, :assigned_to, :priority]}],
0
                                      :order => "spent_on ASC")
0
   end
0
+
0
 end

Comments

    No one has commented yet.