Patch #20121 » redmine-reminder_respect_nonworking_days.diff
| app/models/mailer.rb | ||
|---|---|---|
|
# Sends reminders to issue assignees
|
||
|
# Available options:
|
||
|
# * :days => how many days in the future to remind about (defaults to 7)
|
||
|
# * :tracker => id of tracker for filtering issues (defaults to all trackers)
|
||
|
# * :project => id or identifier of project to process (defaults to all projects)
|
||
|
# * :users => array of user/group ids who should be reminded
|
||
|
# * :version => name of target version for filtering issues (defaults to none)
|
||
|
# * :days => how many days in the future to remind about (defaults to 7)
|
||
|
# * :tracker => id of tracker for filtering issues (defaults to all trackers)
|
||
|
# * :project => id or identifier of project to process (defaults to all projects)
|
||
|
# * :users => array of user/group ids who should be reminded
|
||
|
# * :version => name of target version for filtering issues (defaults to none)
|
||
|
# * :respect_nonworking_days => if true the non working days setting will be used to calculate the date difference
|
||
|
def self.reminders(options={})
|
||
|
extend Redmine::Utils::DateCalculation
|
||
|
days = options[:days] || 7
|
||
|
project = options[:project] ? Project.find(options[:project]) : nil
|
||
|
tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil
|
||
| ... | ... | |
|
end
|
||
|
user_ids = options[:users]
|
||
|
if options[:respect_nonworking_days]
|
||
|
working_day_count = working_days(Date.today, days.day.from_now.to_date)
|
||
|
days = days + (days - working_day_count)
|
||
|
end
|
||
|
scope = Issue.open.where("#{Issue.table_name}.assigned_to_id IS NOT NULL" +
|
||
|
" AND #{Project.table_name}.status = #{Project::STATUS_ACTIVE}" +
|
||
|
" AND #{Issue.table_name}.due_date <= ?", days.day.from_now.to_date
|
||
| lib/tasks/reminder.rake | ||
|---|---|---|
|
options[:tracker] = ENV['tracker'].to_i if ENV['tracker']
|
||
|
options[:users] = (ENV['users'] || '').split(',').each(&:strip!)
|
||
|
options[:version] = ENV['version'] if ENV['version']
|
||
|
options[:respect_nonworking_days] = !!ENV['respect_nonworking_days']
|
||
|
Mailer.with_synched_deliveries do
|
||
|
Mailer.reminders(options)
|
||