Fixed #4 - show Ticket::Article changes also in ticket history.
Did improvments to cacheing of models, pls remove local cache storage via "rm -rf tmp/cache/file_store/" after upgrading to this commit.
This commit is contained in:
parent
41f7e1c64b
commit
8da10083ac
7 changed files with 228 additions and 175 deletions
|
@ -34,13 +34,23 @@ class ApplicationModel < ActiveRecord::Base
|
||||||
def cache_delete
|
def cache_delete
|
||||||
key = self.class.to_s + '::' + self.id.to_s
|
key = self.class.to_s + '::' + self.id.to_s
|
||||||
Cache.delete( key.to_s )
|
Cache.delete( key.to_s )
|
||||||
|
key = self.class.to_s + ':f:' + self.id.to_s
|
||||||
|
Cache.delete( key.to_s )
|
||||||
end
|
end
|
||||||
def self.cache_set(data_id, data)
|
def self.cache_set(data_id, data, full = false)
|
||||||
key = self.to_s + '::' + data_id.to_s
|
if !full
|
||||||
|
key = self.to_s + '::' + data_id.to_s
|
||||||
|
else
|
||||||
|
key = self.to_s + ':f:' + data_id.to_s
|
||||||
|
end
|
||||||
Cache.write( key.to_s, data )
|
Cache.write( key.to_s, data )
|
||||||
end
|
end
|
||||||
def self.cache_get(data_id)
|
def self.cache_get(data_id, full = false)
|
||||||
key = self.to_s + '::' + data_id.to_s
|
if !full
|
||||||
|
key = self.to_s + '::' + data_id.to_s
|
||||||
|
else
|
||||||
|
key = self.to_s + ':f:' + data_id.to_s
|
||||||
|
end
|
||||||
Cache.get( key.to_s )
|
Cache.get( key.to_s )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -66,17 +76,37 @@ class ApplicationModel < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
elsif data[:login]
|
||||||
|
cache = self.cache_get( data[:login] )
|
||||||
|
return cache if cache
|
||||||
|
|
||||||
|
records = self.where( :login => data[:login] )
|
||||||
|
records.each {|record|
|
||||||
|
if record.login == data[:login]
|
||||||
|
self.cache_set( data[:login], record )
|
||||||
|
return record
|
||||||
|
end
|
||||||
|
}
|
||||||
|
return
|
||||||
else
|
else
|
||||||
raise "Need name or id for lookup()"
|
raise "Need name, id or login for lookup()"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_if_not_exists(data)
|
def self.create_if_not_exists(data)
|
||||||
if data[:name]
|
if data[:id]
|
||||||
|
record = self.where( :id => data[:id] ).first
|
||||||
|
return record if record
|
||||||
|
elsif data[:name]
|
||||||
records = self.where( :name => data[:name] )
|
records = self.where( :name => data[:name] )
|
||||||
records.each {|record|
|
records.each {|record|
|
||||||
return record if record.name == data[:name]
|
return record if record.name == data[:name]
|
||||||
}
|
}
|
||||||
|
elsif data[:login]
|
||||||
|
records = self.where( :login => data[:login] )
|
||||||
|
records.each {|record|
|
||||||
|
return record if record.login == data[:login]
|
||||||
|
}
|
||||||
elsif data[:locale] && data[:source]
|
elsif data[:locale] && data[:source]
|
||||||
records = self.where( :locale => data[:locale], :source => data[:source] )
|
records = self.where( :locale => data[:locale], :source => data[:source] )
|
||||||
records.each {|record|
|
records.each {|record|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Link < ActiveRecord::Base
|
class Link < ApplicationModel
|
||||||
belongs_to :link_type, :class_name => 'Link::Type'
|
belongs_to :link_type, :class_name => 'Link::Type'
|
||||||
belongs_to :link_object, :class_name => 'Link::Object'
|
belongs_to :link_object, :class_name => 'Link::Object'
|
||||||
|
|
||||||
|
@ -172,10 +172,10 @@ class Link < ActiveRecord::Base
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class Link::Type < ActiveRecord::Base
|
class Link::Type < ApplicationModel
|
||||||
validates :name, :presence => true
|
validates :name, :presence => true
|
||||||
end
|
end
|
||||||
|
|
||||||
class Link::Object < ActiveRecord::Base
|
class Link::Object < ApplicationModel
|
||||||
validates :name, :presence => true
|
validates :name, :presence => true
|
||||||
end
|
end
|
|
@ -1,31 +1,31 @@
|
||||||
class Network < ActiveRecord::Base
|
class Network < ApplicationModel
|
||||||
# belongs_to :group
|
# belongs_to :group
|
||||||
# belongs_to :ticket_state, :class_name => 'Ticket::State'
|
# belongs_to :ticket_state, :class_name => 'Ticket::State'
|
||||||
# belongs_to :ticket_priority, :class_name => 'Ticket::Priority'
|
# belongs_to :ticket_priority, :class_name => 'Ticket::Priority'
|
||||||
|
|
||||||
class Category < ActiveRecord::Base
|
class Category < ApplicationModel
|
||||||
self.table_name = 'network_categories'
|
self.table_name = 'network_categories'
|
||||||
|
|
||||||
class Type < ActiveRecord::Base
|
class Type < ApplicationModel
|
||||||
end
|
end
|
||||||
|
|
||||||
class Subscription < ActiveRecord::Base
|
class Subscription < ApplicationModel
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Item < ActiveRecord::Base
|
class Item < ApplicationModel
|
||||||
class Comment < ActiveRecord::Base
|
class Comment < ApplicationModel
|
||||||
end
|
end
|
||||||
|
|
||||||
class Plus < ActiveRecord::Base
|
class Plus < ApplicationModel
|
||||||
self.table_name = 'network_item_plus'
|
self.table_name = 'network_item_plus'
|
||||||
end
|
end
|
||||||
|
|
||||||
class Subscription < ActiveRecord::Base
|
class Subscription < ApplicationModel
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Privacy < ActiveRecord::Base
|
class Privacy < ApplicationModel
|
||||||
self.table_name = 'network_privacies'
|
self.table_name = 'network_privacies'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,10 +7,13 @@ class Observer::History < ActiveRecord::Observer
|
||||||
def after_create(record)
|
def after_create(record)
|
||||||
puts "HISTORY OBSERVER, object created #{ record.class.name }.find(#{ record.id })"
|
puts "HISTORY OBSERVER, object created #{ record.class.name }.find(#{ record.id })"
|
||||||
# puts record.inspect
|
# puts record.inspect
|
||||||
related_o_id = nil
|
|
||||||
|
# if Ticket::Article has changed, remember ticket to be able
|
||||||
|
# to show article changes in ticket history
|
||||||
|
related_o_id = nil
|
||||||
related_history_object_id = nil
|
related_history_object_id = nil
|
||||||
if record.class.name == 'Ticket::Article'
|
if record.class.name == 'Ticket::Article'
|
||||||
related_o_id = record.ticket_id
|
related_o_id = record.ticket_id
|
||||||
related_history_object = 'Ticket'
|
related_history_object = 'Ticket'
|
||||||
end
|
end
|
||||||
History.history_create(
|
History.history_create(
|
||||||
|
@ -124,28 +127,33 @@ class Observer::History < ActiveRecord::Observer
|
||||||
if attribute_name.scan(/^(.*)_id$/).first
|
if attribute_name.scan(/^(.*)_id$/).first
|
||||||
attribute_name = attribute_name.scan(/^(.*)_id$/).first.first
|
attribute_name = attribute_name.scan(/^(.*)_id$/).first.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# if Ticket::Article has changed, remember ticket to be able
|
||||||
|
# to show article changes in ticket history
|
||||||
|
related_o_id = nil
|
||||||
|
related_history_object_id = nil
|
||||||
|
if record.class.name == 'Ticket::Article'
|
||||||
|
related_o_id = record.ticket_id
|
||||||
|
related_history_object_id = 'Ticket'
|
||||||
|
end
|
||||||
History.history_create(
|
History.history_create(
|
||||||
:o_id => current.id,
|
:o_id => current.id,
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_object => record.class.name,
|
:history_object => record.class.name,
|
||||||
:history_attribute => attribute_name,
|
:history_attribute => attribute_name,
|
||||||
:value_from => value[0],
|
:related_o_id => related_o_id,
|
||||||
:value_to => value[1],
|
:related_history_object => related_history_object_id,
|
||||||
:id_from => value_ids[0],
|
:value_from => value[0],
|
||||||
:id_to => value_ids[1],
|
:value_to => value[1],
|
||||||
:created_by_id => current_user_id || 1 || self['created_by_id'] || 1
|
:id_from => value_ids[0],
|
||||||
|
:id_to => value_ids[1],
|
||||||
|
:created_by_id => current_user_id || 1 || self['created_by_id'] || 1
|
||||||
)
|
)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# :name => record.class.name,
|
|
||||||
# :type => 'update',
|
|
||||||
# :data => record
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def differences_from?(one, other)
|
def differences_from?(one, other)
|
||||||
# puts '1111'+one.inspect
|
|
||||||
# puts '2222'+other.inspect
|
|
||||||
h = {}
|
h = {}
|
||||||
one.attributes.each_pair do |key, value|
|
one.attributes.each_pair do |key, value|
|
||||||
if one[key] != other[key]
|
if one[key] != other[key]
|
||||||
|
|
|
@ -166,7 +166,7 @@ Your #{config.product_name} Team
|
||||||
|
|
||||||
def self.find_fulldata(user_id)
|
def self.find_fulldata(user_id)
|
||||||
|
|
||||||
cache = self.cache_get(user_id)
|
cache = self.cache_get(user_id, true)
|
||||||
return cache if cache
|
return cache if cache
|
||||||
|
|
||||||
# get user
|
# get user
|
||||||
|
@ -213,7 +213,7 @@ Your #{config.product_name} Team
|
||||||
data['organizations'] = organizations
|
data['organizations'] = organizations
|
||||||
data['organization_ids'] = user.organization_ids
|
data['organization_ids'] = user.organization_ids
|
||||||
|
|
||||||
self.cache_set(user.id, data)
|
self.cache_set(user.id, data, true)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
|
|
210
db/seeds.rb
210
db/seeds.rb
|
@ -6,7 +6,7 @@
|
||||||
#
|
#
|
||||||
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
||||||
# Mayor.create(:name => 'Emanuel', :city => cities.first)
|
# Mayor.create(:name => 'Emanuel', :city => cities.first)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Product Name',
|
:title => 'Product Name',
|
||||||
:name => 'product_name',
|
:name => 'product_name',
|
||||||
:area => 'System::Base',
|
:area => 'System::Base',
|
||||||
|
@ -27,7 +27,7 @@ Setting.create(
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Organization',
|
:title => 'Organization',
|
||||||
:name => 'organization',
|
:name => 'organization',
|
||||||
:area => 'System::Base',
|
:area => 'System::Base',
|
||||||
|
@ -48,7 +48,7 @@ Setting.create(
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'SystemID',
|
:title => 'SystemID',
|
||||||
:name => 'system_id',
|
:name => 'system_id',
|
||||||
:area => 'System::Base',
|
:area => 'System::Base',
|
||||||
|
@ -74,7 +74,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Fully Qualified Domain Name',
|
:title => 'Fully Qualified Domain Name',
|
||||||
:name => 'fqdn',
|
:name => 'fqdn',
|
||||||
:area => 'System::Base',
|
:area => 'System::Base',
|
||||||
|
@ -94,7 +94,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'http type',
|
:title => 'http type',
|
||||||
:name => 'http_type',
|
:name => 'http_type',
|
||||||
:area => 'System::Base',
|
:area => 'System::Base',
|
||||||
|
@ -121,7 +121,7 @@ Setting.create(
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Storage Mechanism',
|
:title => 'Storage Mechanism',
|
||||||
:name => 'storage',
|
:name => 'storage',
|
||||||
:area => 'System::Storage',
|
:area => 'System::Storage',
|
||||||
|
@ -147,7 +147,7 @@ Setting.create(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'New User Accounts',
|
:title => 'New User Accounts',
|
||||||
:name => 'user_create_account',
|
:name => 'user_create_account',
|
||||||
:area => 'Security::Authentication',
|
:area => 'Security::Authentication',
|
||||||
|
@ -171,7 +171,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Lost Password',
|
:title => 'Lost Password',
|
||||||
:name => 'user_lost_password',
|
:name => 'user_lost_password',
|
||||||
:area => 'Security::Authentication',
|
:area => 'Security::Authentication',
|
||||||
|
@ -195,7 +195,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Switch to User',
|
:title => 'Switch to User',
|
||||||
:name => 'switch_to_user',
|
:name => 'switch_to_user',
|
||||||
:area => 'Security::Authentication',
|
:area => 'Security::Authentication',
|
||||||
|
@ -219,7 +219,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Authentication via Database',
|
:title => 'Authentication via Database',
|
||||||
:name => 'auth_db',
|
:name => 'auth_db',
|
||||||
:area => 'Security::Authentication',
|
:area => 'Security::Authentication',
|
||||||
|
@ -243,7 +243,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Authentication via Twitter',
|
:title => 'Authentication via Twitter',
|
||||||
:name => 'auth_twitter',
|
:name => 'auth_twitter',
|
||||||
:area => 'Security::Authentication',
|
:area => 'Security::Authentication',
|
||||||
|
@ -267,7 +267,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Twitter App Credentials',
|
:title => 'Twitter App Credentials',
|
||||||
:name => 'auth_twitter_credentials',
|
:name => 'auth_twitter_credentials',
|
||||||
:area => 'Security::Authentication',
|
:area => 'Security::Authentication',
|
||||||
|
@ -293,7 +293,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Authentication via Facebook',
|
:title => 'Authentication via Facebook',
|
||||||
:name => 'auth_facebook',
|
:name => 'auth_facebook',
|
||||||
:area => 'Security::Authentication',
|
:area => 'Security::Authentication',
|
||||||
|
@ -318,7 +318,7 @@ Setting.create(
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Facebook App Credentials',
|
:title => 'Facebook App Credentials',
|
||||||
:name => 'auth_facebook_credentials',
|
:name => 'auth_facebook_credentials',
|
||||||
:area => 'Security::Authentication',
|
:area => 'Security::Authentication',
|
||||||
|
@ -345,7 +345,7 @@ Setting.create(
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Authentication via Google',
|
:title => 'Authentication via Google',
|
||||||
:name => 'auth_google_oauth2',
|
:name => 'auth_google_oauth2',
|
||||||
:area => 'Security::Authentication',
|
:area => 'Security::Authentication',
|
||||||
|
@ -369,7 +369,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Google App Credentials',
|
:title => 'Google App Credentials',
|
||||||
:name => 'auth_google_oauth2_credentials',
|
:name => 'auth_google_oauth2_credentials',
|
||||||
:area => 'Security::Authentication',
|
:area => 'Security::Authentication',
|
||||||
|
@ -396,7 +396,7 @@ Setting.create(
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Authentication via LinkedIn',
|
:title => 'Authentication via LinkedIn',
|
||||||
:name => 'auth_linkedin',
|
:name => 'auth_linkedin',
|
||||||
:area => 'Security::Authentication',
|
:area => 'Security::Authentication',
|
||||||
|
@ -420,7 +420,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'LinkedIn App Credentials',
|
:title => 'LinkedIn App Credentials',
|
||||||
:name => 'auth_linkedin_credentials',
|
:name => 'auth_linkedin_credentials',
|
||||||
:area => 'Security::Authentication',
|
:area => 'Security::Authentication',
|
||||||
|
@ -447,7 +447,7 @@ Setting.create(
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Minimal size',
|
:title => 'Minimal size',
|
||||||
:name => 'password_min_size',
|
:name => 'password_min_size',
|
||||||
:area => 'Security::Password',
|
:area => 'Security::Password',
|
||||||
|
@ -478,7 +478,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => '2 lower and 2 upper characters',
|
:title => '2 lower and 2 upper characters',
|
||||||
:name => 'password_min_2_lower_2_upper_characters',
|
:name => 'password_min_2_lower_2_upper_characters',
|
||||||
:area => 'Security::Password',
|
:area => 'Security::Password',
|
||||||
|
@ -502,7 +502,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Digit required',
|
:title => 'Digit required',
|
||||||
:name => 'password_need_digit',
|
:name => 'password_need_digit',
|
||||||
:area => 'Security::Password',
|
:area => 'Security::Password',
|
||||||
|
@ -526,7 +526,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Maximal failed logins',
|
:title => 'Maximal failed logins',
|
||||||
:name => 'password_max_login_failed',
|
:name => 'password_max_login_failed',
|
||||||
:area => 'Security::Password',
|
:area => 'Security::Password',
|
||||||
|
@ -558,7 +558,7 @@ Setting.create(
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Ticket Hook',
|
:title => 'Ticket Hook',
|
||||||
:name => 'ticket_hook',
|
:name => 'ticket_hook',
|
||||||
:area => 'Ticket::Base',
|
:area => 'Ticket::Base',
|
||||||
|
@ -578,7 +578,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Ticket Hook Divider',
|
:title => 'Ticket Hook Divider',
|
||||||
:name => 'ticket_hook_divider',
|
:name => 'ticket_hook_divider',
|
||||||
:area => 'Ticket::Base::Shadow',
|
:area => 'Ticket::Base::Shadow',
|
||||||
|
@ -598,7 +598,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Ticket Hook Position',
|
:title => 'Ticket Hook Position',
|
||||||
:name => 'ticket_hook_position',
|
:name => 'ticket_hook_position',
|
||||||
:area => 'Ticket::Base',
|
:area => 'Ticket::Base',
|
||||||
|
@ -623,7 +623,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Ticket Subject Size',
|
:title => 'Ticket Subject Size',
|
||||||
:name => 'ticket_subject_size',
|
:name => 'ticket_subject_size',
|
||||||
:area => 'Ticket::Base',
|
:area => 'Ticket::Base',
|
||||||
|
@ -643,7 +643,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Ticket Subject Reply',
|
:title => 'Ticket Subject Reply',
|
||||||
:name => 'ticket_subject_re',
|
:name => 'ticket_subject_re',
|
||||||
:area => 'Ticket::Base',
|
:area => 'Ticket::Base',
|
||||||
|
@ -674,7 +674,7 @@ Setting.create(
|
||||||
# :frontend => false
|
# :frontend => false
|
||||||
#)
|
#)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Ticket Number Format',
|
:title => 'Ticket Number Format',
|
||||||
:name => 'ticket_number',
|
:name => 'ticket_number',
|
||||||
:area => 'Ticket::Number',
|
:area => 'Ticket::Number',
|
||||||
|
@ -703,7 +703,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Ticket Number Increment',
|
:title => 'Ticket Number Increment',
|
||||||
:name => 'ticket_number_increment',
|
:name => 'ticket_number_increment',
|
||||||
:area => 'Ticket::Number',
|
:area => 'Ticket::Number',
|
||||||
|
@ -758,7 +758,7 @@ Setting.create(
|
||||||
},
|
},
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Ticket Number Increment Date',
|
:title => 'Ticket Number Increment Date',
|
||||||
:name => 'ticket_number_date',
|
:name => 'ticket_number_date',
|
||||||
:area => 'Ticket::Number',
|
:area => 'Ticket::Number',
|
||||||
|
@ -785,7 +785,7 @@ Setting.create(
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Enable Ticket creation',
|
:title => 'Enable Ticket creation',
|
||||||
:name => 'customer_ticket_create',
|
:name => 'customer_ticket_create',
|
||||||
:area => 'CustomerWeb::Base',
|
:area => 'CustomerWeb::Base',
|
||||||
|
@ -810,7 +810,7 @@ Setting.create(
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Enable Ticket View/Update',
|
:title => 'Enable Ticket View/Update',
|
||||||
:name => 'customer_ticket_view',
|
:name => 'customer_ticket_view',
|
||||||
:area => 'CustomerWeb::Base',
|
:area => 'CustomerWeb::Base',
|
||||||
|
@ -835,7 +835,7 @@ Setting.create(
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Sender Format',
|
:title => 'Sender Format',
|
||||||
:name => 'ticket_define_email_from',
|
:name => 'ticket_define_email_from',
|
||||||
:area => 'Email::Base',
|
:area => 'Email::Base',
|
||||||
|
@ -860,7 +860,7 @@ Setting.create(
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Sender Format Seperator',
|
:title => 'Sender Format Seperator',
|
||||||
:name => 'ticket_define_email_from_seperator',
|
:name => 'ticket_define_email_from_seperator',
|
||||||
:area => 'Email::Base',
|
:area => 'Email::Base',
|
||||||
|
@ -881,7 +881,7 @@ Setting.create(
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Max. Email Size',
|
:title => 'Max. Email Size',
|
||||||
:name => 'postmaster_max_size',
|
:name => 'postmaster_max_size',
|
||||||
:area => 'Email::Base',
|
:area => 'Email::Base',
|
||||||
|
@ -924,7 +924,7 @@ Setting.create(
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Additional follow up detection',
|
:title => 'Additional follow up detection',
|
||||||
:name => 'postmaster_follow_up_search_in',
|
:name => 'postmaster_follow_up_search_in',
|
||||||
:area => 'Email::Base',
|
:area => 'Email::Base',
|
||||||
|
@ -951,7 +951,7 @@ Setting.create(
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Notification Sender',
|
:title => 'Notification Sender',
|
||||||
:name => 'notification_sender',
|
:name => 'notification_sender',
|
||||||
:area => 'Email::Base',
|
:area => 'Email::Base',
|
||||||
|
@ -972,7 +972,7 @@ Setting.create(
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Block Notifications',
|
:title => 'Block Notifications',
|
||||||
:name => 'send_no_auto_response_reg_exp',
|
:name => 'send_no_auto_response_reg_exp',
|
||||||
:area => 'Email::Base',
|
:area => 'Email::Base',
|
||||||
|
@ -993,7 +993,7 @@ Setting.create(
|
||||||
:frontend => false
|
:frontend => false
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Enable Chat',
|
:title => 'Enable Chat',
|
||||||
:name => 'chat',
|
:name => 'chat',
|
||||||
:area => 'Chat::Base',
|
:area => 'Chat::Base',
|
||||||
|
@ -1018,7 +1018,7 @@ Setting.create(
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
|
|
||||||
Setting.create(
|
Setting.create_if_not_exists(
|
||||||
:title => 'Import Mode',
|
:title => 'Import Mode',
|
||||||
:name => 'import_mode',
|
:name => 'import_mode',
|
||||||
:area => 'System::Import',
|
:area => 'System::Import',
|
||||||
|
@ -1043,14 +1043,14 @@ Setting.create(
|
||||||
:frontend => true
|
:frontend => true
|
||||||
)
|
)
|
||||||
|
|
||||||
email_address = EmailAddress.create(
|
email_address = EmailAddress.create_if_not_exists(
|
||||||
:id => 1,
|
:id => 1,
|
||||||
:realname => 'Zammad',
|
:realname => 'Zammad',
|
||||||
:email => 'zammad@localhost',
|
:email => 'zammad@localhost',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1
|
:created_by_id => 1
|
||||||
)
|
)
|
||||||
signature = Signature.create(
|
signature = Signature.create_if_not_exists(
|
||||||
:name => 'default',
|
:name => 'default',
|
||||||
:body => '
|
:body => '
|
||||||
#{user.firstname} #{user.lastname}
|
#{user.firstname} #{user.lastname}
|
||||||
|
@ -1064,21 +1064,21 @@ signature = Signature.create(
|
||||||
:created_by_id => 1
|
:created_by_id => 1
|
||||||
)
|
)
|
||||||
|
|
||||||
Role.create(
|
Role.create_if_not_exists(
|
||||||
:id => 1,
|
:id => 1,
|
||||||
:name => 'Admin',
|
:name => 'Admin',
|
||||||
:note => 'To configure your system.',
|
:note => 'To configure your system.',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1
|
:created_by_id => 1
|
||||||
)
|
)
|
||||||
Role.create(
|
Role.create_if_not_exists(
|
||||||
:id => 2,
|
:id => 2,
|
||||||
:name => 'Agent',
|
:name => 'Agent',
|
||||||
:note => 'To work on Tickets.',
|
:note => 'To work on Tickets.',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1
|
:created_by_id => 1
|
||||||
)
|
)
|
||||||
Role.create(
|
Role.create_if_not_exists(
|
||||||
:id => 3,
|
:id => 3,
|
||||||
:name => 'Customer',
|
:name => 'Customer',
|
||||||
:note => 'People who create Tickets ask for help.',
|
:note => 'People who create Tickets ask for help.',
|
||||||
|
@ -1086,7 +1086,7 @@ Role.create(
|
||||||
:created_by_id => 1
|
:created_by_id => 1
|
||||||
)
|
)
|
||||||
|
|
||||||
Group.create(
|
Group.create_if_not_exists(
|
||||||
:id => 1,
|
:id => 1,
|
||||||
:name => 'Users',
|
:name => 'Users',
|
||||||
:email_address_id => email_address.id,
|
:email_address_id => email_address.id,
|
||||||
|
@ -1095,7 +1095,7 @@ Group.create(
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1
|
:created_by_id => 1
|
||||||
)
|
)
|
||||||
Group.create(
|
Group.create_if_not_exists(
|
||||||
:id => 2,
|
:id => 2,
|
||||||
:name => 'Twitter',
|
:name => 'Twitter',
|
||||||
:note => 'All Tweets.',
|
:note => 'All Tweets.',
|
||||||
|
@ -1107,7 +1107,7 @@ roles = Role.where( :name => 'Customer' )
|
||||||
organizations = Organization.find( :all )
|
organizations = Organization.find( :all )
|
||||||
groups = Group.find( :all )
|
groups = Group.find( :all )
|
||||||
|
|
||||||
user = User.create(
|
user = User.create_if_not_exists(
|
||||||
:login => '-',
|
:login => '-',
|
||||||
:firstname => '-',
|
:firstname => '-',
|
||||||
:lastname => '',
|
:lastname => '',
|
||||||
|
@ -1120,7 +1120,7 @@ user = User.create(
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1
|
:created_by_id => 1
|
||||||
)
|
)
|
||||||
user_community = User.create(
|
user_community = User.create_if_not_exists(
|
||||||
:login => 'nicole.braun@zammad.org',
|
:login => 'nicole.braun@zammad.org',
|
||||||
:firstname => 'Nicole',
|
:firstname => 'Nicole',
|
||||||
:lastname => 'Braun',
|
:lastname => 'Braun',
|
||||||
|
@ -1134,46 +1134,46 @@ user_community = User.create(
|
||||||
:created_by_id => 1
|
:created_by_id => 1
|
||||||
)
|
)
|
||||||
|
|
||||||
Link::Type.create( :name => 'normal' )
|
Link::Type.create_if_not_exists( :name => 'normal' )
|
||||||
Link::Object.create( :name => 'Ticket' )
|
Link::Object.create_if_not_exists( :name => 'Ticket' )
|
||||||
Link::Object.create( :name => 'Announcement' )
|
Link::Object.create_if_not_exists( :name => 'Announcement' )
|
||||||
Link::Object.create( :name => 'Question/Answer' )
|
Link::Object.create_if_not_exists( :name => 'Question/Answer' )
|
||||||
Link::Object.create( :name => 'Idea' )
|
Link::Object.create_if_not_exists( :name => 'Idea' )
|
||||||
Link::Object.create( :name => 'Bug' )
|
Link::Object.create_if_not_exists( :name => 'Bug' )
|
||||||
|
|
||||||
Ticket::StateType.create( :name => 'new', :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::StateType.create_if_not_exists( :name => 'new', :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::StateType.create( :name => 'open', :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::StateType.create_if_not_exists( :name => 'open', :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::StateType.create( :name => 'pending reminder', :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::StateType.create_if_not_exists( :name => 'pending reminder', :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::StateType.create( :name => 'pending action', :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::StateType.create_if_not_exists( :name => 'pending action', :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::StateType.create( :name => 'closed', :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::StateType.create_if_not_exists( :name => 'closed', :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::StateType.create( :name => 'merged', :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::StateType.create_if_not_exists( :name => 'merged', :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::StateType.create( :name => 'removed', :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::StateType.create_if_not_exists( :name => 'removed', :updated_by_id => 1, :created_by_id => 1 )
|
||||||
|
|
||||||
Ticket::State.create( :name => 'new', :state_type_id => Ticket::StateType.where(:name => 'new').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::State.create_if_not_exists( :name => 'new', :state_type_id => Ticket::StateType.where(:name => 'new').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::State.create( :name => 'open', :state_type_id => Ticket::StateType.where(:name => 'open').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::State.create_if_not_exists( :name => 'open', :state_type_id => Ticket::StateType.where(:name => 'open').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::State.create( :name => 'pending', :state_type_id => Ticket::StateType.where(:name => 'pending reminder').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::State.create_if_not_exists( :name => 'pending', :state_type_id => Ticket::StateType.where(:name => 'pending reminder').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::State.create( :name => 'closed', :state_type_id => Ticket::StateType.where(:name => 'closed').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::State.create_if_not_exists( :name => 'closed', :state_type_id => Ticket::StateType.where(:name => 'closed').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::State.create( :name => 'merged', :state_type_id => Ticket::StateType.where(:name => 'merged').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::State.create_if_not_exists( :name => 'merged', :state_type_id => Ticket::StateType.where(:name => 'merged').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::State.create( :name => 'removed', :state_type_id => Ticket::StateType.where(:name => 'removed').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::State.create_if_not_exists( :name => 'removed', :state_type_id => Ticket::StateType.where(:name => 'removed').first.id, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
|
|
||||||
Ticket::Priority.create( :name => '1 low', :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Priority.create_if_not_exists( :name => '1 low', :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::Priority.create( :name => '2 normal', :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Priority.create_if_not_exists( :name => '2 normal', :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::Priority.create( :name => '3 high', :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Priority.create_if_not_exists( :name => '3 high', :updated_by_id => 1, :created_by_id => 1 )
|
||||||
|
|
||||||
Ticket::Article::Type.create( :name => 'email', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Article::Type.create_if_not_exists( :name => 'email', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::Article::Type.create( :name => 'sms', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Article::Type.create_if_not_exists( :name => 'sms', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::Article::Type.create( :name => 'chat', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Article::Type.create_if_not_exists( :name => 'chat', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::Article::Type.create( :name => 'fax', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Article::Type.create_if_not_exists( :name => 'fax', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::Article::Type.create( :name => 'phone', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Article::Type.create_if_not_exists( :name => 'phone', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::Article::Type.create( :name => 'twitter status', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Article::Type.create_if_not_exists( :name => 'twitter status', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::Article::Type.create( :name => 'twitter direct-message', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Article::Type.create_if_not_exists( :name => 'twitter direct-message', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::Article::Type.create( :name => 'facebook', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Article::Type.create_if_not_exists( :name => 'facebook', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::Article::Type.create( :name => 'note', :communication => false, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Article::Type.create_if_not_exists( :name => 'note', :communication => false, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::Article::Type.create( :name => 'web', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Article::Type.create_if_not_exists( :name => 'web', :communication => true, :updated_by_id => 1, :created_by_id => 1 )
|
||||||
|
|
||||||
Ticket::Article::Sender.create( :name => 'Agent', :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Article::Sender.create_if_not_exists( :name => 'Agent', :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::Article::Sender.create( :name => 'Customer', :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Article::Sender.create_if_not_exists( :name => 'Customer', :updated_by_id => 1, :created_by_id => 1 )
|
||||||
Ticket::Article::Sender.create( :name => 'System', :updated_by_id => 1, :created_by_id => 1 )
|
Ticket::Article::Sender.create_if_not_exists( :name => 'System', :updated_by_id => 1, :created_by_id => 1 )
|
||||||
|
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
:group_id => Group.where( :name => 'Users' ).first.id,
|
:group_id => Group.where( :name => 'Users' ).first.id,
|
||||||
|
@ -1208,7 +1208,7 @@ The Zammad.org Project
|
||||||
)
|
)
|
||||||
|
|
||||||
overview_role = Role.where( :name => 'Agent' ).first
|
overview_role = Role.where( :name => 'Agent' ).first
|
||||||
Overview.create(
|
Overview.create_if_not_exists(
|
||||||
:name => 'my_assigned',
|
:name => 'my_assigned',
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:condition => {
|
:condition => {
|
||||||
|
@ -1249,7 +1249,7 @@ Overview.create(
|
||||||
:created_by_id => 1
|
:created_by_id => 1
|
||||||
)
|
)
|
||||||
|
|
||||||
Overview.create(
|
Overview.create_if_not_exists(
|
||||||
:name => 'all_unassigned',
|
:name => 'all_unassigned',
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:condition => {
|
:condition => {
|
||||||
|
@ -1290,7 +1290,7 @@ Overview.create(
|
||||||
:created_by_id => 1
|
:created_by_id => 1
|
||||||
)
|
)
|
||||||
|
|
||||||
Overview.create(
|
Overview.create_if_not_exists(
|
||||||
:name => 'all_open',
|
:name => 'all_open',
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:condition => {
|
:condition => {
|
||||||
|
@ -1330,7 +1330,7 @@ Overview.create(
|
||||||
:created_by_id => 1
|
:created_by_id => 1
|
||||||
)
|
)
|
||||||
|
|
||||||
Overview.create(
|
Overview.create_if_not_exists(
|
||||||
:name => 'all_escalated',
|
:name => 'all_escalated',
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:condition => {
|
:condition => {
|
||||||
|
@ -1370,7 +1370,7 @@ Overview.create(
|
||||||
:created_by_id => 1
|
:created_by_id => 1
|
||||||
)
|
)
|
||||||
|
|
||||||
Overview.create(
|
Overview.create_if_not_exists(
|
||||||
:name => 'my_pending_reached',
|
:name => 'my_pending_reached',
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:condition => {
|
:condition => {
|
||||||
|
@ -1411,7 +1411,7 @@ Overview.create(
|
||||||
:created_by_id => 1
|
:created_by_id => 1
|
||||||
)
|
)
|
||||||
|
|
||||||
Overview.create(
|
Overview.create_if_not_exists(
|
||||||
:name => 'all',
|
:name => 'all',
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:condition => {
|
:condition => {
|
||||||
|
@ -1453,7 +1453,7 @@ Overview.create(
|
||||||
)
|
)
|
||||||
|
|
||||||
overview_role = Role.where( :name => 'Customer' ).first
|
overview_role = Role.where( :name => 'Customer' ).first
|
||||||
Overview.create(
|
Overview.create_if_not_exists(
|
||||||
:name => 'my_tickets',
|
:name => 'my_tickets',
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:condition => {
|
:condition => {
|
||||||
|
@ -1493,7 +1493,7 @@ Overview.create(
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1
|
:created_by_id => 1
|
||||||
)
|
)
|
||||||
Overview.create(
|
Overview.create_if_not_exists(
|
||||||
:name => 'my_organization_tickets',
|
:name => 'my_organization_tickets',
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:organization_shared => true,
|
:organization_shared => true,
|
||||||
|
@ -1535,7 +1535,7 @@ Overview.create(
|
||||||
:created_by_id => 1
|
:created_by_id => 1
|
||||||
)
|
)
|
||||||
|
|
||||||
Channel.create(
|
Channel.create_if_not_exists(
|
||||||
:adapter => 'SMTP',
|
:adapter => 'SMTP',
|
||||||
:area => 'Email::Outbound',
|
:area => 'Email::Outbound',
|
||||||
:options => {
|
:options => {
|
||||||
|
@ -1549,7 +1549,7 @@ Channel.create(
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
Channel.create(
|
Channel.create_if_not_exists(
|
||||||
:adapter => 'Sendmail',
|
:adapter => 'Sendmail',
|
||||||
:area => 'Email::Outbound',
|
:area => 'Email::Outbound',
|
||||||
:options => {},
|
:options => {},
|
||||||
|
@ -1558,46 +1558,46 @@ Channel.create(
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
|
|
||||||
network = Network.create(
|
network = Network.create_if_not_exists(
|
||||||
:name => 'base',
|
:name => 'base',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
|
|
||||||
Network::Category::Type.create(
|
Network::Category::Type.create_if_not_exists(
|
||||||
:name => 'Announcement',
|
:name => 'Announcement',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
Network::Category::Type.create(
|
Network::Category::Type.create_if_not_exists(
|
||||||
:name => 'Idea',
|
:name => 'Idea',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
Network::Category::Type.create(
|
Network::Category::Type.create_if_not_exists(
|
||||||
:name => 'Question',
|
:name => 'Question',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
Network::Category::Type.create(
|
Network::Category::Type.create_if_not_exists(
|
||||||
:name => 'Bug Report',
|
:name => 'Bug Report',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
|
|
||||||
Network::Privacy.create(
|
Network::Privacy.create_if_not_exists(
|
||||||
:name => 'logged in',
|
:name => 'logged in',
|
||||||
:key => 'loggedIn',
|
:key => 'loggedIn',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
Network::Privacy.create(
|
Network::Privacy.create_if_not_exists(
|
||||||
:name => 'logged in and moderator',
|
:name => 'logged in and moderator',
|
||||||
:key => 'loggedInModerator',
|
:key => 'loggedInModerator',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
Network::Category.create(
|
Network::Category.create_if_not_exists(
|
||||||
:name => 'Announcements',
|
:name => 'Announcements',
|
||||||
:network_id => network.id,
|
:network_id => network.id,
|
||||||
:allow_comments => true,
|
:allow_comments => true,
|
||||||
|
@ -1607,7 +1607,7 @@ Network::Category.create(
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
Network::Category.create(
|
Network::Category.create_if_not_exists(
|
||||||
:name => 'Questions',
|
:name => 'Questions',
|
||||||
:network_id => network.id,
|
:network_id => network.id,
|
||||||
:allow_comments => true,
|
:allow_comments => true,
|
||||||
|
@ -1617,7 +1617,7 @@ Network::Category.create(
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
Network::Category.create(
|
Network::Category.create_if_not_exists(
|
||||||
:name => 'Ideas',
|
:name => 'Ideas',
|
||||||
:network_id => network.id,
|
:network_id => network.id,
|
||||||
:allow_comments => true,
|
:allow_comments => true,
|
||||||
|
@ -1627,7 +1627,7 @@ Network::Category.create(
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
Network::Category.create(
|
Network::Category.create_if_not_exists(
|
||||||
:name => 'Bug Reports',
|
:name => 'Bug Reports',
|
||||||
:network_id => network.id,
|
:network_id => network.id,
|
||||||
:allow_comments => true,
|
:allow_comments => true,
|
||||||
|
|
|
@ -9,20 +9,20 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
{
|
{
|
||||||
:ticket_create => {
|
:ticket_create => {
|
||||||
:ticket => {
|
:ticket => {
|
||||||
:group_id => Group.where( :name => 'Users' ).first.id,
|
:group_id => Group.lookup( :name => 'Users' ).id,
|
||||||
:customer_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
:customer_id => User.lookup( :login => 'nicole.braun@zammad.org' ).id,
|
||||||
:owner_id => User.where( :login => '-' ).first.id,
|
:owner_id => User.lookup( :login => '-' ).id,
|
||||||
:title => 'Unit Test 1 (äöüß)!',
|
:title => 'Unit Test 1 (äöüß)!',
|
||||||
:ticket_state_id => Ticket::State.where( :name => 'new' ).first.id,
|
:ticket_state_id => Ticket::State.lookup( :name => 'new' ).id,
|
||||||
:ticket_priority_id => Ticket::Priority.where( :name => '2 normal' ).first.id,
|
:ticket_priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id,
|
||||||
:updated_by_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
:updated_by_id => User.lookup( :login => 'nicole.braun@zammad.org' ).id,
|
||||||
:created_by_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
:created_by_id => User.lookup( :login => 'nicole.braun@zammad.org' ).id,
|
||||||
},
|
},
|
||||||
:article => {
|
:article => {
|
||||||
:updated_by_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
:updated_by_id => User.lookup( :login => 'nicole.braun@zammad.org' ).id,
|
||||||
:created_by_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
:created_by_id => User.lookup( :login => 'nicole.braun@zammad.org' ).id,
|
||||||
:ticket_article_type_id => Ticket::Article::Type.where(:name => 'phone' ).first.id,
|
:ticket_article_type_id => Ticket::Article::Type.lookup( :name => 'phone' ).id,
|
||||||
:ticket_article_sender_id => Ticket::Article::Sender.where(:name => 'Customer' ).first.id,
|
:ticket_article_sender_id => Ticket::Article::Sender.lookup( :name => 'Customer' ).id,
|
||||||
:from => 'Unit Test <unittest@example.com>',
|
:from => 'Unit Test <unittest@example.com>',
|
||||||
:body => 'Unit Test 123',
|
:body => 'Unit Test 123',
|
||||||
:internal => false
|
:internal => false
|
||||||
|
@ -31,8 +31,8 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
:ticket_update => {
|
:ticket_update => {
|
||||||
:ticket => {
|
:ticket => {
|
||||||
:title => 'Unit Test 1 (äöüß) - update!',
|
:title => 'Unit Test 1 (äöüß) - update!',
|
||||||
:ticket_state_id => Ticket::State.where( :name => 'open' ).first.id,
|
:ticket_state_id => Ticket::State.lookup( :name => 'open' ).id,
|
||||||
:ticket_priority_id => Ticket::Priority.where( :name => '1 low' ).first.id,
|
:ticket_priority_id => Ticket::Priority.lookup( :name => '1 low' ).id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
:history_check => [
|
:history_check => [
|
||||||
|
@ -53,8 +53,8 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
:history_attribute => 'ticket_state',
|
:history_attribute => 'ticket_state',
|
||||||
:value_from => 'new',
|
:value_from => 'new',
|
||||||
:value_to => 'open',
|
:value_to => 'open',
|
||||||
:id_from => Ticket::State.where( :name => 'new' ).first.id,
|
:id_from => Ticket::State.lookup( :name => 'new' ).id,
|
||||||
:id_to => Ticket::State.where( :name => 'open' ).first.id,
|
:id_to => Ticket::State.lookup( :name => 'open' ).id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:history_object => 'Ticket::Article',
|
:history_object => 'Ticket::Article',
|
||||||
|
@ -67,20 +67,20 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
{
|
{
|
||||||
:ticket_create => {
|
:ticket_create => {
|
||||||
:ticket => {
|
:ticket => {
|
||||||
:group_id => Group.where( :name => 'Users' ).first.id,
|
:group_id => Group.lookup( :name => 'Users' ).id,
|
||||||
:customer_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
:customer_id => User.lookup( :login => 'nicole.braun@zammad.org' ).id,
|
||||||
:owner_id => User.where( :login => '-' ).first.id,
|
:owner_id => User.lookup( :login => '-' ).id,
|
||||||
:title => 'Unit Test 2 (äöüß)!',
|
:title => 'Unit Test 2 (äöüß)!',
|
||||||
:ticket_state_id => Ticket::State.where( :name => 'new' ).first.id,
|
:ticket_state_id => Ticket::State.lookup( :name => 'new' ).id,
|
||||||
:ticket_priority_id => Ticket::Priority.where( :name => '2 normal' ).first.id,
|
:ticket_priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id,
|
||||||
:updated_by_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
:updated_by_id => User.lookup( :login => 'nicole.braun@zammad.org' ).id,
|
||||||
:created_by_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
:created_by_id => User.lookup( :login => 'nicole.braun@zammad.org' ).id,
|
||||||
},
|
},
|
||||||
:article => {
|
:article => {
|
||||||
:created_by_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
:created_by_id => User.lookup( :login => 'nicole.braun@zammad.org' ).id,
|
||||||
:updated_by_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
:updated_by_id => User.lookup( :login => 'nicole.braun@zammad.org' ).id,
|
||||||
:ticket_article_type_id => Ticket::Article::Type.where(:name => 'phone' ).first.id,
|
:ticket_article_type_id => Ticket::Article::Type.lookup(:name => 'phone' ).id,
|
||||||
:ticket_article_sender_id => Ticket::Article::Sender.where(:name => 'Customer' ).first.id,
|
:ticket_article_sender_id => Ticket::Article::Sender.lookup(:name => 'Customer' ).id,
|
||||||
:from => 'Unit Test <unittest@example.com>',
|
:from => 'Unit Test <unittest@example.com>',
|
||||||
:body => 'Unit Test 123',
|
:body => 'Unit Test 123',
|
||||||
:internal => false
|
:internal => false
|
||||||
|
@ -89,8 +89,11 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
:ticket_update => {
|
:ticket_update => {
|
||||||
:ticket => {
|
:ticket => {
|
||||||
:title => 'Unit Test 2 (äöüß) - update!',
|
:title => 'Unit Test 2 (äöüß) - update!',
|
||||||
:ticket_state_id => Ticket::State.where( :name => 'open' ).first.id,
|
:ticket_state_id => Ticket::State.lookup( :name => 'open' ).id,
|
||||||
:owner_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
:owner_id => User.lookup( :login => 'nicole.braun@zammad.org' ).id,
|
||||||
|
},
|
||||||
|
:article => {
|
||||||
|
:from => 'Unit 2 Test 2 <unittest@example.com>',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
:history_check => [
|
:history_check => [
|
||||||
|
@ -111,13 +114,20 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
:history_attribute => 'owner',
|
:history_attribute => 'owner',
|
||||||
:value_from => '-',
|
:value_from => '-',
|
||||||
:value_to => 'Nicole Braun',
|
:value_to => 'Nicole Braun',
|
||||||
:id_from => User.where( :login => '-' ).first.id,
|
:id_from => User.lookup( :login => '-' ).id,
|
||||||
:id_to => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
:id_to => User.lookup( :login => 'nicole.braun@zammad.org' ).id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:history_object => 'Ticket::Article',
|
:history_object => 'Ticket::Article',
|
||||||
:history_type => 'created',
|
:history_type => 'created',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
:history_object => 'Ticket::Article',
|
||||||
|
:history_type => 'updated',
|
||||||
|
:history_attribute => 'from',
|
||||||
|
:value_from => 'Unit Test <unittest@example.com>',
|
||||||
|
:value_to => 'Unit 2 Test 2 <unittest@example.com>',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -135,9 +145,14 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
assert_equal( ticket.class.to_s, 'Ticket' )
|
assert_equal( ticket.class.to_s, 'Ticket' )
|
||||||
assert_equal( article.class.to_s, 'Ticket::Article' )
|
assert_equal( article.class.to_s, 'Ticket::Article' )
|
||||||
|
|
||||||
ticket.update_attributes( test[:ticket_update][:ticket] )
|
|
||||||
|
|
||||||
|
# update ticket
|
||||||
|
if test[:ticket_update][:ticket]
|
||||||
|
ticket.update_attributes( test[:ticket_update][:ticket] )
|
||||||
|
end
|
||||||
|
if test[:ticket_update][:article]
|
||||||
|
article.update_attributes( test[:ticket_update][:article] )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# execute ticket events
|
# execute ticket events
|
||||||
|
@ -180,7 +195,7 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
assert_equal( check_item[:id_to], history_item['id_to'], "check history :id_to #{history_item['id_to']} ok")
|
assert_equal( check_item[:id_to], history_item['id_to'], "check history :id_to #{history_item['id_to']} ok")
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
assert( match, "history check not matched!")
|
assert( match, "history check not matched! #{check_item.inspect}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue