Fixed Store/created_by_id handling.
This commit is contained in:
parent
dfe8a89f53
commit
679e260cde
4 changed files with 24 additions and 20 deletions
|
@ -36,11 +36,12 @@ class Observer::Ticket::Article::CommunicateEmail < ActiveRecord::Observer
|
|||
|
||||
# store mail plain
|
||||
Store.add(
|
||||
:object => 'Ticket::Article::Mail',
|
||||
:o_id => record.id,
|
||||
:data => message.to_s,
|
||||
:filename => "ticket-#{ticket.number}-#{record.id}.eml",
|
||||
:preferences => {}
|
||||
:object => 'Ticket::Article::Mail',
|
||||
:o_id => record.id,
|
||||
:data => message.to_s,
|
||||
:filename => "ticket-#{ticket.number}-#{record.id}.eml",
|
||||
:preferences => {},
|
||||
:created_by_id => record.created_by_id,
|
||||
)
|
||||
|
||||
# add history record
|
||||
|
|
|
@ -216,11 +216,12 @@ class Package < ApplicationModel
|
|||
record = Package.create( meta )
|
||||
if !data[:reinstall]
|
||||
Store.add(
|
||||
:object => 'Package',
|
||||
:o_id => record.id,
|
||||
:data => package.to_s,
|
||||
:filename => meta[:name] + '-' + meta[:version] + '.zpm',
|
||||
:preferences => {},
|
||||
:object => 'Package',
|
||||
:o_id => record.id,
|
||||
:data => package.to_s,
|
||||
:filename => meta[:name] + '-' + meta[:version] + '.zpm',
|
||||
:preferences => {},
|
||||
:created_by_id => UserInfo.current_user_id || 1,
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -18,11 +18,12 @@ class Ticket::Article < ApplicationModel
|
|||
article_store = []
|
||||
self.attachments.each do |attachment|
|
||||
article_store.push Store.add(
|
||||
:object => 'Ticket::Article',
|
||||
:o_id => self.id,
|
||||
:data => attachment.store_file.data,
|
||||
:filename => attachment.filename,
|
||||
:preferences => attachment.preferences
|
||||
:object => 'Ticket::Article',
|
||||
:o_id => self.id,
|
||||
:data => attachment.store_file.data,
|
||||
:filename => attachment.filename,
|
||||
:preferences => attachment.preferences,
|
||||
:created_by_id => self.created_by_id,
|
||||
)
|
||||
end
|
||||
self.attachments = article_store
|
||||
|
|
|
@ -25,11 +25,12 @@ class StoreTest < ActiveSupport::TestCase
|
|||
|
||||
# add attachments
|
||||
store = Store.add(
|
||||
:object => 'Test',
|
||||
:o_id => 1,
|
||||
:data => file[:data],
|
||||
:filename => file[:filename],
|
||||
:preferences => {}
|
||||
:object => 'Test',
|
||||
:o_id => 1,
|
||||
:data => file[:data],
|
||||
:filename => file[:filename],
|
||||
:preferences => {},
|
||||
:created_by_id => 1,
|
||||
)
|
||||
assert store
|
||||
|
||||
|
|
Loading…
Reference in a new issue