Added support of sender format.

This commit is contained in:
Martin Edenhofer 2012-05-02 11:44:49 +02:00
parent 21654d677c
commit 42bbb74bce

View file

@ -159,7 +159,14 @@ class Ticket < ActiveRecord::Base
self.message_id = '<' + DateTime.current.to_s(:number) + '.' + self.ticket_id.to_s + '.' + rand(999999).to_s() + '@' + fqdn + '>' self.message_id = '<' + DateTime.current.to_s(:number) + '.' + self.ticket_id.to_s + '.' + rand(999999).to_s() + '@' + fqdn + '>'
# set sender # set sender
self.from = Setting.get('system_sender') if Setting.get('ticket_define_email_from') == 'AgentNameSystemAddressName'
seperator = Setting.get('ticket_define_email_from_seperator')
sender = User.find(self.created_by_id)
system_sender = Setting.get('system_sender')
self.from = "#{sender.firstname} #{sender.lastname} #{seperator} #{system_sender}"
else
self.from = Setting.get('system_sender')
end
end end
end end
def attachment_check def attachment_check
@ -182,6 +189,7 @@ class Ticket < ActiveRecord::Base
end end
def communicate def communicate
# if sender is customer, do not communication # if sender is customer, do not communication
sender = Ticket::Article::Sender.where( :id => self.ticket_article_sender_id ).first sender = Ticket::Article::Sender.where( :id => self.ticket_article_sender_id ).first
return 1 if sender == nil || sender['name'] == 'Customer' return 1 if sender == nil || sender['name'] == 'Customer'