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,9 +159,16 @@ class Ticket < ActiveRecord::Base
self.message_id = '<' + DateTime.current.to_s(:number) + '.' + self.ticket_id.to_s + '.' + rand(999999).to_s() + '@' + fqdn + '>'
# set 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
def attachment_check
# do nothing if no attachment exists
@ -182,6 +189,7 @@ class Ticket < ActiveRecord::Base
end
def communicate
# if sender is customer, do not communication
sender = Ticket::Article::Sender.where( :id => self.ticket_article_sender_id ).first
return 1 if sender == nil || sender['name'] == 'Customer'