Patch #20121 » redmine-reminder_respect_nonworking_days-v2.diff
| app/models/mailer.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
def reminder(user, issues, days)
|
||
|
def reminder(user, issues, days, respect_working_days)
|
||
|
set_language_if_valid user.language
|
||
|
@issues = issues
|
||
|
@days = days
|
||
|
@respect_working_days = respect_working_days
|
||
|
@issues_url = url_for(:controller => 'issues', :action => 'index',
|
||
|
:set_filter => 1, :assigned_to_id => user.id,
|
||
|
:sort => 'due_date:asc')
|
||
| ... | ... | |
|
# 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_working_days => if true the 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]
|
||
|
days_requested = days
|
||
|
if options[:respect_working_days]
|
||
|
working_day_count = working_days(Date.today, (days + 7).day.from_now.to_date)
|
||
|
days = days + (days + 7 - 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
|
||
| ... | ... | |
|
end
|
||
|
issues_by_assignee.each do |assignee, issues|
|
||
|
reminder(assignee, issues, days).deliver if assignee.is_a?(User) && assignee.active?
|
||
|
reminder(assignee, issues, days_requested, options[:respect_working_days]).deliver if assignee.is_a?(User) && assignee.active?
|
||
|
end
|
||
|
end
|
||
| app/views/mailer/reminder.html.erb | ||
|---|---|---|
|
<p><%= l(:mail_body_reminder, :count => @issues.size, :days => @days) %></p>
|
||
|
<p><%= l(@respect_working_days ? :mail_body_reminder_working_days : :mail_body_reminder, :count => @issues.size, :days => @days) %></p>
|
||
|
<ul>
|
||
|
<% @issues.each do |issue| -%>
|
||
| app/views/mailer/reminder.text.erb | ||
|---|---|---|
|
<%= l(:mail_body_reminder, :count => @issues.size, :days => @days) %>:
|
||
|
<%= l(@respect_working_days ? :mail_body_reminder_working_days : :mail_body_reminder, :count => @issues.size, :days => @days) %>
|
||
|
<% @issues.each do |issue| -%>
|
||
|
* <%= "#{issue.project} - #{issue.tracker} ##{issue.id}: #{issue.subject}" %>
|
||
| config/locales/de.yml | ||
|---|---|---|
|
mail_body_lost_password: 'Benutzen Sie den folgenden Link, um Ihr Kennwort zu ändern:'
|
||
|
mail_body_register: 'Um Ihr Konto zu aktivieren, benutzen Sie folgenden Link:'
|
||
|
mail_body_reminder: "%{count} Tickets, die Ihnen zugewiesen sind, müssen in den nächsten %{days} Tagen abgegeben werden:"
|
||
|
mail_body_reminder_working_days: "%{count} Tickets, die Ihnen zugewiesen sind, müssen in den nächsten %{days} Arbeitstagen abgegeben werden:"
|
||
|
mail_body_wiki_content_added: "Die Wiki-Seite '%{id}' wurde von %{author} hinzugefügt."
|
||
|
mail_body_wiki_content_updated: "Die Wiki-Seite '%{id}' wurde von %{author} aktualisiert."
|
||
|
mail_subject_account_activation_request: "Antrag auf %{value} Kontoaktivierung"
|
||
| config/locales/en-GB.yml | ||
|---|---|---|
|
mail_body_account_activation_request: "A new user (%{value}) has registered. The account is pending your approval:"
|
||
|
mail_subject_reminder: "%{count} issue(s) due in the next %{days} days"
|
||
|
mail_body_reminder: "%{count} issue(s) that are assigned to you are due in the next %{days} days:"
|
||
|
mail_body_reminder_working_days: "%{count} issue(s) that are assigned to you are due in the next %{days} working days:"
|
||
|
mail_subject_wiki_content_added: "'%{id}' wiki page has been added"
|
||
|
mail_body_wiki_content_added: "The '%{id}' wiki page has been added by %{author}."
|
||
|
mail_subject_wiki_content_updated: "'%{id}' wiki page has been updated"
|
||
| config/locales/en.yml | ||
|---|---|---|
|
mail_body_account_activation_request: "A new user (%{value}) has registered. The account is pending your approval:"
|
||
|
mail_subject_reminder: "%{count} issue(s) due in the next %{days} days"
|
||
|
mail_body_reminder: "%{count} issue(s) that are assigned to you are due in the next %{days} days:"
|
||
|
mail_body_reminder_working_days: "%{count} issue(s) that are assigned to you are due in the next %{days} working days:"
|
||
|
mail_subject_wiki_content_added: "'%{id}' wiki page has been added"
|
||
|
mail_body_wiki_content_added: "The '%{id}' wiki page has been added by %{author}."
|
||
|
mail_subject_wiki_content_updated: "'%{id}' wiki page has been updated"
|
||
| 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_working_days] = !!ENV['respect_working_days']
|
||
|
Mailer.with_synched_deliveries do
|
||
|
Mailer.reminders(options)
|
||
- « Previous
- 1
- 2
- Next »