Show also recipients in ticket history.
This commit is contained in:
parent
0186c8f70d
commit
480abed922
3 changed files with 51 additions and 10 deletions
|
@ -6,22 +6,38 @@
|
||||||
|
|
||||||
<% open = false %>
|
<% open = false %>
|
||||||
<% for object in @objects: %>
|
<% for object in @objects: %>
|
||||||
<% if lasttime isnt object['created_at']: %>
|
<% object['history_object_display'] = object['history_object'] %>
|
||||||
|
<% if object['history_object'] is 'Ticket::Article': %>
|
||||||
|
<% object['history_object_display'] = 'Article' %>
|
||||||
|
<% end %>
|
||||||
|
<% if lasttime isnt object['created_at'] || last_user isnt object['created_by_id']: %>
|
||||||
<% if open: %>
|
<% if open: %>
|
||||||
</ul>
|
</ul>
|
||||||
<hr>
|
<hr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% open = true %>
|
<% open = true %>
|
||||||
|
<% last_user = object['created_by_id'] %>
|
||||||
<% lasttime = object['created_at'] %>
|
<% lasttime = object['created_at'] %>
|
||||||
<span class="user-data" data-id="<%= object['created_by']['id'] %>"><%= object['created_by']['realname'] %></span> - <%= object['created_at'] %> - <%= object['humanTime'] %>
|
<span class="user-data" data-id="<%= object['created_by']['id'] %>"><%= object['created_by']['realname'] %></span> - <%= object['created_at'] %> - <%= object['humanTime'] %>
|
||||||
<ul>
|
<ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
<li><%= object['history_type'] %> <%= object['history_object'] %> <% if object['history_attribute']: %>"<%= object['history_attribute'] %>"<% end %>
|
<li>
|
||||||
<% if object['value_from']: %>
|
<% if ( object['history_type'] is 'notification' || object['history_type'] is 'email' ): %>
|
||||||
<%- T('from') %> "<%= object['value_from'] %>"
|
<%= object['history_type'] %>
|
||||||
<% end %>
|
<% if object['value_from']: %>
|
||||||
<% if object['value_to']: %>
|
"<%= object['value_from'] %>" <%- T('sent to') %>
|
||||||
<%- T('to') %> "<%= object['value_to'] %>"
|
<% end %>
|
||||||
|
<% if object['value_to']: %>
|
||||||
|
"<%= object['value_to'] %>"
|
||||||
|
<% end %>
|
||||||
|
<% else: %>
|
||||||
|
<%= object['history_type'] %> <%= object['history_object_display'] %> <% if object['history_attribute']: %>"<%= object['history_attribute'] %>"<% end %>
|
||||||
|
<% if object['value_from']: %>
|
||||||
|
<%- T('from') %> "<%= object['value_from'] %>"
|
||||||
|
<% end %>
|
||||||
|
<% if object['value_to']: %>
|
||||||
|
<%- T('to') %> "<%= object['value_to'] %>"
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -69,7 +69,7 @@ class History < ActiveRecord::Base
|
||||||
if !related_history_object
|
if !related_history_object
|
||||||
history = History.where( :history_object_id => History::Object.where( :name => requested_object ) ).
|
history = History.where( :history_object_id => History::Object.where( :name => requested_object ) ).
|
||||||
where( :o_id => requested_object_id ).
|
where( :o_id => requested_object_id ).
|
||||||
where( :history_type_id => History::Type.where( :name => ['created', 'updated', 'notification'] ) ).
|
where( :history_type_id => History::Type.where( :name => ['created', 'updated', 'notification', 'email'] ) ).
|
||||||
order('created_at ASC, id ASC')
|
order('created_at ASC, id ASC')
|
||||||
else
|
else
|
||||||
history = History.where(
|
history = History.where(
|
||||||
|
@ -78,7 +78,7 @@ class History < ActiveRecord::Base
|
||||||
requested_object_id,
|
requested_object_id,
|
||||||
History::Object.where( :name => related_history_object ).first.id,
|
History::Object.where( :name => related_history_object ).first.id,
|
||||||
requested_object_id,
|
requested_object_id,
|
||||||
History::Type.where( :name => ['created', 'updated', 'notification'] )
|
History::Type.where( :name => ['created', 'updated', 'notification', 'email'] )
|
||||||
).
|
).
|
||||||
order('created_at ASC, id ASC')
|
order('created_at ASC, id ASC')
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,8 @@ class Ticket::Article < ApplicationModel
|
||||||
|
|
||||||
# if sender is customer, do not change anything
|
# if sender is customer, do not change anything
|
||||||
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 if sender == nil || sender['name'] == 'Customer'
|
return if sender == nil
|
||||||
|
return if sender['name'] == 'Customer'
|
||||||
|
|
||||||
type = Ticket::Article::Type.where( :id => self.ticket_article_type_id ).first
|
type = Ticket::Article::Type.where( :id => self.ticket_article_type_id ).first
|
||||||
ticket = Ticket.find(self.ticket_id)
|
ticket = Ticket.find(self.ticket_id)
|
||||||
|
@ -139,6 +140,30 @@ class Ticket::Article < ApplicationModel
|
||||||
:filename => "ticket-#{ticket.number}-#{self.id}.eml",
|
:filename => "ticket-#{ticket.number}-#{self.id}.eml",
|
||||||
:preferences => {}
|
:preferences => {}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# add history record
|
||||||
|
recipient_list = ''
|
||||||
|
[:to, :cc].each { |key|
|
||||||
|
if self[key] && self[key] != ''
|
||||||
|
if recipient_list != ''
|
||||||
|
recipient_list += ','
|
||||||
|
end
|
||||||
|
recipient_list += self[key]
|
||||||
|
end
|
||||||
|
}
|
||||||
|
if recipient_list != ''
|
||||||
|
History.history_create(
|
||||||
|
:o_id => self.id,
|
||||||
|
:history_type => 'email',
|
||||||
|
:history_object => 'Ticket::Article',
|
||||||
|
:related_o_id => ticket.id,
|
||||||
|
:related_history_object => 'Ticket',
|
||||||
|
:value_from => self.subject,
|
||||||
|
:value_to => recipient_list,
|
||||||
|
:created_by_id => self.created_by_id,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue