From 51359704a0a4a4af49fa8724059bc292649bb1da Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Mon, 20 Sep 2010 23:17:51 +0000 Subject: 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 --- app/models/mailer.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/models/mailer.rb') 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 -- cgit v1.2.3