Improved error handling.
This commit is contained in:
parent
3aa22ceb10
commit
326c0903f1
1 changed files with 2 additions and 5 deletions
|
@ -34,6 +34,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
|
|||
next if !ticket
|
||||
|
||||
article = ticket.articles[-1]
|
||||
next if !article
|
||||
else
|
||||
raise "unknown object for notification #{event[:name]}"
|
||||
end
|
||||
|
@ -237,17 +238,13 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
|
|||
|
||||
# add history record
|
||||
if recipient_list != ''
|
||||
created_by_id = 1
|
||||
if article && article.created_by_id
|
||||
created_by_id = article.created_by_id
|
||||
end
|
||||
History.add(
|
||||
:o_id => ticket.id,
|
||||
:history_type => 'notification',
|
||||
:history_object => 'Ticket',
|
||||
:value_from => notification_subject,
|
||||
:value_to => recipient_list,
|
||||
:created_by_id => created_by_id
|
||||
:created_by_id => article.created_by_id || 1
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue