Feature #3035 » redminder-start-date.patch
| app/models/mailer.rb (working copy) | ||
|---|---|---|
|
:issue_url => url_for(:controller => 'issues', :action => 'show', :id => issue)
|
||
|
end
|
||
|
def reminder(user, issues, days)
|
||
|
def reminder(user, issues, days, start, sort_key)
|
||
|
set_language_if_valid user.language
|
||
|
recipients user.mail
|
||
|
subject l(:mail_subject_reminder, issues.size)
|
||
|
body :issues => issues,
|
||
|
:days => days,
|
||
|
:issues_url => url_for(:controller => 'issues', :action => 'index', :set_filter => 1, :assigned_to_id => user.id, :sort_key => 'due_date', :sort_order => 'asc')
|
||
|
:issues_url => url_for(:controller => 'issues', :action => 'index', :set_filter => 1, :assigned_to_id => user.id, :sort_key => sort_key, :sort_order => 'asc')
|
||
|
end
|
||
|
def document_added(document)
|
||
| ... | ... | |
|
days = options[:days] || 7
|
||
|
project = options[:project] ? Project.find(options[:project]) : nil
|
||
|
tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil
|
||
|
s = ARCondition.new ["#{IssueStatus.table_name}.is_closed = ? AND #{Issue.table_name}.due_date <= ?", false, days.day.from_now.to_date]
|
||
|
start = options[:start] || nil
|
||
|
if start
|
||
|
s = ARCondition.new ["#{IssueStatus.table_name}.is_closed = ? AND #{Issue.table_name}.start_date = ?", false, days.day.from_now.to_date]
|
||
|
sort_key = "due_date"
|
||
|
else
|
||
|
s = ARCondition.new ["#{IssueStatus.table_name}.is_closed = ? AND #{Issue.table_name}.due_date <= ?", false, days.day.from_now.to_date]
|
||
|
sort_key = "start_date"
|
||
|
end
|
||
|
s << "#{Issue.table_name}.assigned_to_id IS NOT NULL"
|
||
|
s << "#{Project.table_name}.status = #{Project::STATUS_ACTIVE}"
|
||
|
s << "#{Issue.table_name}.project_id = #{project.id}" if project
|
||
| ... | ... | |
|
:conditions => s.conditions
|
||
|
).group_by(&:assigned_to)
|
||
|
issues_by_assignee.each do |assignee, issues|
|
||
|
deliver_reminder(assignee, issues, days) unless assignee.nil?
|
||
|
deliver_reminder(assignee, issues, days, start, sort_key) unless assignee.nil?
|
||
|
end
|
||
|
end
|
||
| lib/tasks/reminder.rake (working copy) | ||
|---|---|---|
|
* days => number of days to remind about (defaults to 7)
|
||
|
* tracker => id of tracker (defaults to all trackers)
|
||
|
* project => id or identifier of project (defaults to all projects)
|
||
|
* start => remind at for start-date instead of due-date
|
||
|
Example:
|
||
|
rake redmine:send_reminders days=7 RAILS_ENV="production"
|
||
| ... | ... | |
|
options[:days] = ENV['days'].to_i if ENV['days']
|
||
|
options[:project] = ENV['project'] if ENV['project']
|
||
|
options[:tracker] = ENV['tracker'].to_i if ENV['tracker']
|
||
|
options[:start] = ENV['start'].to_i if ENV['start']
|
||
|
|
||
|
Mailer.reminders(options)
|
||
|
end
|
||