diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-02-07 07:56:58 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-02-07 07:56:58 +0000 |
commit | e94920a5ff5aff6ef7bb23f8852ee119f8fdca53 (patch) | |
tree | 388cdfc188e7ab492e0212f6675151d2d91b3b6c /app | |
parent | bce16a471cb904f05f8321e35f18cbd56ce9481d (diff) | |
download | redmine-e94920a5ff5aff6ef7bb23f8852ee119f8fdca53.tar.gz redmine-e94920a5ff5aff6ef7bb23f8852ee119f8fdca53.zip |
Allow filtering of Redmine Reminders by Version (#18983).
Patch by Merul Patel.
git-svn-id: http://svn.redmine.org/redmine/trunk@13964 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/mailer.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/mailer.rb b/app/models/mailer.rb index f6312e073..026ff7c18 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -319,10 +319,12 @@ class Mailer < ActionMailer::Base # * :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) def self.reminders(options={}) days = options[:days] || 7 project = options[:project] ? Project.find(options[:project]) : nil tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil + target_versions = options[:version] ? Version.where(name: options[:version]).select(:id).map(&:id) : nil user_ids = options[:users] scope = Issue.open.where("#{Issue.table_name}.assigned_to_id IS NOT NULL" + @@ -331,6 +333,7 @@ class Mailer < ActionMailer::Base ) scope = scope.where(:assigned_to_id => user_ids) if user_ids.present? scope = scope.where(:project_id => project.id) if project + scope = scope.where(:fixed_version_id => target_versions) unless target_versions.blank? scope = scope.where(:tracker_id => tracker.id) if tracker issues_by_assignee = scope.includes(:status, :assigned_to, :project, :tracker). group_by(&:assigned_to) |