对于设置了完成日期的缺陷,到日期还没解决,给相关人员发一个通知邮件
This commit is contained in:
parent
e7503237f1
commit
c1bbd8a535
|
@ -167,12 +167,6 @@ class Mailer < ActionMailer::Base
|
|||
|
||||
#缺陷到期邮件通知
|
||||
def issue_expire issue
|
||||
#@issues = issues
|
||||
#s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
|
||||
#puts s + "////" + issue.assigned_to.mail
|
||||
#@issues_url = url_for(:controller => 'issues', :action => 'show',:id => issue.id)
|
||||
#mail :to => issue.assigned_to.mail,
|
||||
# :subject => s
|
||||
issue_id = issue.project_index
|
||||
redmine_headers 'Project' => issue.project.identifier,
|
||||
'Issue-Id' => issue_id,
|
||||
|
@ -183,10 +177,32 @@ class Mailer < ActionMailer::Base
|
|||
@issue = issue
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue)
|
||||
recipients = issue.recipients
|
||||
cc = issue.watcher_recipients - recipients
|
||||
s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
|
||||
mail :to => recipients,
|
||||
:cc => cc,
|
||||
:subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
|
||||
:subject => s
|
||||
#########################################################################################################
|
||||
#@issues = issues
|
||||
#s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
|
||||
#puts s + "////" + issue.assigned_to.mail
|
||||
#@issues_url = url_for(:controller => 'issues', :action => 'show',:id => issue.id)
|
||||
#mail :to => issue.assigned_to.mail,
|
||||
# :subject => s
|
||||
#########################################################################################################
|
||||
#issue_id = issue.project_index
|
||||
#redmine_headers 'Project' => issue.project.identifier,
|
||||
# 'Issue-Id' => issue_id,
|
||||
# 'Issue-Author' => issue.author.login
|
||||
#redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
||||
#message_id issue
|
||||
#@author = issue.author
|
||||
#@issue = issue
|
||||
#@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue)
|
||||
#recipients = issue.recipients
|
||||
#cc = issue.watcher_recipients - recipients
|
||||
#mail :to => recipients,
|
||||
# :cc => cc,
|
||||
# :subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
|
||||
######################################################################################################
|
||||
end
|
||||
|
||||
|
||||
|
@ -567,9 +583,10 @@ class Mailer < ActionMailer::Base
|
|||
end
|
||||
|
||||
#缺陷到期后发送邮件提示
|
||||
#只监听已经提交的未到期的缺陷,已过期的缺陷默认已经发过邮件通知,不再提醒。
|
||||
def mail_issue
|
||||
threads = []
|
||||
issues = Issue.where("done_ratio <> 100 && closed_on is null && due_date is not null")
|
||||
issues = Issue.where("done_ratio <> 100 and closed_on is null and due_date is not null and due_date > '#{Time.now.to_date}'")
|
||||
issues.each do |issue|
|
||||
thread = Thread.start do
|
||||
while true
|
||||
|
@ -582,7 +599,7 @@ class Mailer < ActionMailer::Base
|
|||
sleep 3600
|
||||
else
|
||||
#发邮件
|
||||
puts issue.id.to_s
|
||||
#puts issue.id.to_s
|
||||
Mailer.issue_expire(issue).deliver
|
||||
#Mailer.issue_add(issue).deliver
|
||||
break
|
||||
|
@ -591,7 +608,6 @@ class Mailer < ActionMailer::Base
|
|||
end
|
||||
threads << thread
|
||||
end
|
||||
puts threads.count.to_s
|
||||
threads
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div id="admin-index">
|
||||
<h3><%=l(:label_administration)%></h3>
|
||||
<!-- <%= render :partial => 'no_data' if @no_configuration_data %> -->
|
||||
<!-- <%#= render :partial => 'no_data' if @no_configuration_data %> -->
|
||||
<%= render :partial => 'menu' %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#Mailer.mail_issue.each do |t|
|
||||
# t.join
|
||||
#end
|
||||
Mailer.mail_issue.each do |t|
|
||||
t.join
|
||||
end
|
||||
|
||||
|
|
33
db/schema.rb
33
db/schema.rb
|
@ -439,26 +439,6 @@ ActiveRecord::Schema.define(:version => 20140728014933) do
|
|||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "gitlab_projects", :force => true do |t|
|
||||
t.integer "gitlab_project_id"
|
||||
t.integer "project_id"
|
||||
t.string "repository_url"
|
||||
t.string "web_url"
|
||||
t.string "localfile_url"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "gitlab_users", :force => true do |t|
|
||||
t.integer "gitlab_user_id"
|
||||
t.integer "user_id"
|
||||
t.string "email"
|
||||
t.string "password"
|
||||
t.string "login", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "groups_users", :id => false, :force => true do |t|
|
||||
t.integer "group_id", :null => false
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -901,6 +881,19 @@ ActiveRecord::Schema.define(:version => 20140728014933) do
|
|||
|
||||
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
|
||||
|
||||
create_table "rich_rich_files", :force => true do |t|
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "rich_file_file_name"
|
||||
t.string "rich_file_content_type"
|
||||
t.integer "rich_file_file_size"
|
||||
t.datetime "rich_file_updated_at"
|
||||
t.string "owner_type"
|
||||
t.integer "owner_id"
|
||||
t.text "uri_cache"
|
||||
t.string "simplified_type", :default => "file"
|
||||
end
|
||||
|
||||
create_table "roles", :force => true do |t|
|
||||
t.string "name", :limit => 30, :default => "", :null => false
|
||||
t.integer "position", :default => 1
|
||||
|
|
Loading…
Reference in New Issue