From 42bbb74bce453a45180eb85b7037b0da0a6dd570 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 2 May 2012 11:44:49 +0200 Subject: [PATCH] Added support of sender format. --- app/models/ticket.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/models/ticket.rb b/app/models/ticket.rb index f9bd77767..0dddfc542 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -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 + '>' # 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 def attachment_check @@ -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'