diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-09-20 23:17:51 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-09-20 23:17:51 +0000 |
commit | 51359704a0a4a4af49fa8724059bc292649bb1da (patch) | |
tree | e732a512f3d9012c9aba394614066607f97db32a /app/models | |
parent | 55fbf6836be16f4776449e6bcdc8e029d67bcb66 (diff) | |
download | redmine-51359704a0a4a4af49fa8724059bc292649bb1da.tar.gz redmine-51359704a0a4a4af49fa8724059bc292649bb1da.zip |
Added a users options to the reminders email
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4167 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/mailer.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 8f50b1b7b..6db5a997b 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -15,6 +15,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +require 'ar_condition' + class Mailer < ActionMailer::Base layout 'mailer' helper :application @@ -306,13 +308,16 @@ class Mailer < ActionMailer::Base # * :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 ids who should be reminded def self.reminders(options={}) days = options[:days] || 7 project = options[:project] ? Project.find(options[:project]) : nil tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil + user_ids = options[:users] s = ARCondition.new ["#{IssueStatus.table_name}.is_closed = ? AND #{Issue.table_name}.due_date <= ?", false, days.day.from_now.to_date] s << "#{Issue.table_name}.assigned_to_id IS NOT NULL" + s << ["#{Issue.table_name}.assigned_to_id IN (?)", user_ids] if user_ids.present? s << "#{Project.table_name}.status = #{Project::STATUS_ACTIVE}" s << "#{Issue.table_name}.project_id = #{project.id}" if project s << "#{Issue.table_name}.tracker_id = #{tracker.id}" if tracker |