53 |
53 |
:issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue)
|
54 |
54 |
end
|
55 |
55 |
|
56 |
|
def reminder(user, issues, days)
|
|
56 |
def reminder(user, issues, days, start, sort_key)
|
57 |
57 |
set_language_if_valid user.language
|
58 |
58 |
recipients user.mail
|
59 |
59 |
subject l(:mail_subject_reminder, issues.size)
|
60 |
60 |
body :issues => issues,
|
61 |
61 |
:days => days,
|
62 |
|
:issues_url => url_for(:controller => 'issues', :action => 'index', :set_filter => 1, :assigned_to_id => user.id, :sort_key => 'due_date', :sort_order => 'asc')
|
|
62 |
:issues_url => url_for(:controller => 'issues', :action => 'index', :set_filter => 1, :assigned_to_id => user.id, :sort_key => sort_key, :sort_order => 'asc')
|
63 |
63 |
end
|
64 |
64 |
|
65 |
65 |
def document_added(document)
|
... | ... | |
168 |
168 |
days = options[:days] || 7
|
169 |
169 |
project = options[:project] ? Project.find(options[:project]) : nil
|
170 |
170 |
tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil
|
171 |
|
|
172 |
|
s = ARCondition.new ["#{IssueStatus.table_name}.is_closed = ? AND #{Issue.table_name}.due_date <= ?", false, days.day.from_now.to_date]
|
|
171 |
start = options[:start] || nil
|
|
172 |
if start
|
|
173 |
s = ARCondition.new ["#{IssueStatus.table_name}.is_closed = ? AND #{Issue.table_name}.start_date = ?", false, days.day.from_now.to_date]
|
|
174 |
sort_key = "due_date"
|
|
175 |
else
|
|
176 |
s = ARCondition.new ["#{IssueStatus.table_name}.is_closed = ? AND #{Issue.table_name}.due_date <= ?", false, days.day.from_now.to_date]
|
|
177 |
sort_key = "start_date"
|
|
178 |
end
|
173 |
179 |
s << "#{Issue.table_name}.assigned_to_id IS NOT NULL"
|
174 |
180 |
s << "#{Project.table_name}.status = #{Project::STATUS_ACTIVE}"
|
175 |
181 |
s << "#{Issue.table_name}.project_id = #{project.id}" if project
|
... | ... | |
179 |
185 |
:conditions => s.conditions
|
180 |
186 |
).group_by(&:assigned_to)
|
181 |
187 |
issues_by_assignee.each do |assignee, issues|
|
182 |
|
deliver_reminder(assignee, issues, days) unless assignee.nil?
|
|
188 |
deliver_reminder(assignee, issues, days, start, sort_key) unless assignee.nil?
|
183 |
189 |
end
|
184 |
190 |
end
|
185 |
191 |
|