Renamed tickets.ticket_priority to tickets.priority, tickets.ticket_state to ticket.state, ticket_articles.ticket_article_sender to ticket_articles.sender and ticket_articles.ticket_article_type to ticket_articles.type.

This commit is contained in:
Martin Edenhofer 2014-06-09 00:01:20 +02:00
parent 569d6e0233
commit 065fbb2bba
33 changed files with 613 additions and 600 deletions

View file

@ -145,8 +145,8 @@ class TicketsController < ApplicationController
# open tickets by customer
ticket_list = Ticket.where(
:customer_id => ticket.customer_id,
:ticket_state_id => Ticket::State.by_category( 'open' )
:customer_id => ticket.customer_id,
:state_id => Ticket::State.by_category( 'open' )
)
.where( 'id != ?', [ ticket.id ] )
.order('created_at DESC')

View file

@ -364,16 +364,16 @@ class Channel::EmailParser
# set ticket state to open if not new
if ticket
ticket_state = Ticket::State.find( ticket.ticket_state_id )
ticket_state_type = Ticket::StateType.find( ticket_state.state_type_id )
state = Ticket::State.find( ticket.state_id )
state_type = Ticket::StateType.find( state.state_type_id )
# if tickte is merged, find linked ticket
if ticket_state_type.name == 'merged'
if state_type.name == 'merged'
end
if ticket_state_type.name != 'new'
ticket.ticket_state = Ticket::State.where( :name => 'open' ).first
if state_type.name != 'new'
ticket.state = Ticket::State.where( :name => 'open' ).first
ticket.save
end
end
@ -386,8 +386,8 @@ class Channel::EmailParser
:group_id => channel[:group_id] || 1,
:customer_id => user.id,
:title => mail[:subject] || '',
:ticket_state_id => Ticket::State.where( :name => 'new' ).first.id,
:ticket_priority_id => Ticket::Priority.where( :name => '2 normal' ).first.id,
:state_id => Ticket::State.where( :name => 'new' ).first.id,
:priority_id => Ticket::Priority.where( :name => '2 normal' ).first.id,
)
set_attributes_by_x_headers( ticket, 'ticket', mail )
@ -400,16 +400,16 @@ class Channel::EmailParser
# set attributes
article = Ticket::Article.new(
:ticket_id => ticket.id,
:ticket_article_type_id => Ticket::Article::Type.where( :name => 'email' ).first.id,
:ticket_article_sender_id => Ticket::Article::Sender.where( :name => 'Customer' ).first.id,
:body => mail[:body],
:from => mail[:from],
:to => mail[:to],
:cc => mail[:cc],
:subject => mail[:subject],
:message_id => mail[:message_id],
:internal => false,
:ticket_id => ticket.id,
:type_id => Ticket::Article::Type.where( :name => 'email' ).first.id,
:sender_id => Ticket::Article::Sender.where( :name => 'Customer' ).first.id,
:body => mail[:body],
:from => mail[:from],
:to => mail[:to],
:cc => mail[:cc],
:subject => mail[:subject],
:message_id => mail[:message_id],
:internal => false,
)
# x-headers lookup

View file

@ -195,8 +195,8 @@ class Channel::Twitter2
if @article_type == 'twitter direct-message'
ticket = Ticket.where( :customer_id => user.id ).first
if ticket
ticket_state_type = Ticket::StateType.where( ticket.ticket_state.state_type_id )
if ticket_state_type.name == 'closed' || ticket_state_type.name == 'closed'
state_type = Ticket::StateType.where( ticket.state.state_type_id )
if state_type.name == 'closed' || state_type.name == 'closed'
ticket = nil
end
end
@ -218,11 +218,11 @@ class Channel::Twitter2
priority_id = priority.id
end
ticket = Ticket.create(
:group_id => group_id,
:customer_id => user.id,
:title => tweet.text[0,40],
:ticket_state_id => state_id,
:ticket_priority_id => priority_id,
:group_id => group_id,
:customer_id => user.id,
:title => tweet.text[0,40],
:state_id => state_id,
:priority_id => priority_id,
)
end
@ -236,8 +236,8 @@ class Channel::Twitter2
return article if article
# set ticket state to open if not new
if ticket.ticket_state.name != 'new'
ticket.ticket_state = Ticket::State.where( :name => 'open' ).first
if ticket.state.name != 'new'
ticket.state = Ticket::State.where( :name => 'open' ).first
ticket.save
end
@ -248,14 +248,14 @@ class Channel::Twitter2
end
article = Ticket::Article.create(
:ticket_id => ticket.id,
:ticket_article_type_id => Ticket::Article::Type.where( :name => @article_type ).first.id,
:ticket_article_sender_id => Ticket::Article::Sender.where( :name => 'Customer' ).first.id,
:body => tweet.text,
:from => sender.name,
:to => to,
:message_id => tweet.id,
:internal => false,
:ticket_id => ticket.id,
:type_id => Ticket::Article::Type.where( :name => @article_type ).first.id,
:sender_id => Ticket::Article::Sender.where( :name => 'Customer' ).first.id,
:body => tweet.text,
:from => sender.name,
:to => to,
:message_id => tweet.id,
:internal => false,
)
end

View file

@ -21,7 +21,7 @@ add a new history entry for an object
History.add(
:history_type => 'updated',
:history_object => 'Ticket',
:history_attribute => 'ticket_state',
:history_attribute => 'state',
:o_id => ticket.id,
:id_to => 3,
:id_from => 2,

View file

@ -2,8 +2,8 @@
class Network < ApplicationModel
# belongs_to :group
# belongs_to :ticket_state, :class_name => 'Ticket::State'
# belongs_to :ticket_priority, :class_name => 'Ticket::Priority'
# belongs_to :state, :class_name => 'Ticket::State'
# belongs_to :priority, :class_name => 'Ticket::Priority'
class Category < ApplicationModel
self.table_name = 'network_categories'

View file

@ -9,12 +9,12 @@ class Observer::Ticket::Article::CommunicateEmail < ActiveRecord::Observer
return if Setting.get('import_mode')
# if sender is customer, do not communication
sender = Ticket::Article::Sender.lookup( :id => record.ticket_article_sender_id )
sender = Ticket::Article::Sender.lookup( :id => record.sender_id )
return 1 if sender == nil
return 1 if sender['name'] == 'Customer'
# only apply on emails
type = Ticket::Article::Type.lookup( :id => record.ticket_article_type_id )
type = Ticket::Article::Type.lookup( :id => record.type_id )
return if type['name'] != 'email'
# send background job

View file

@ -9,12 +9,12 @@ class Observer::Ticket::Article::CommunicateFacebook < ActiveRecord::Observer
return if Setting.get('import_mode')
# if sender is customer, do not communication
sender = Ticket::Article::Sender.lookup( :id => record.ticket_article_sender_id )
sender = Ticket::Article::Sender.lookup( :id => record.sender_id )
return 1 if sender == nil
return 1 if sender['name'] == 'Customer'
# only apply on emails
type = Ticket::Article::Type.lookup( :id => record.ticket_article_type_id )
type = Ticket::Article::Type.lookup( :id => record.type_id )
return if type['name'] != 'facebook'
a = Channel::Facebook.new

View file

@ -9,12 +9,12 @@ class Observer::Ticket::Article::CommunicateTwitter < ActiveRecord::Observer
return if Setting.get('import_mode')
# if sender is customer, do not communication
sender = Ticket::Article::Sender.lookup( :id => record.ticket_article_sender_id )
sender = Ticket::Article::Sender.lookup( :id => record.sender_id )
return 1 if sender == nil
return 1 if sender['name'] == 'Customer'
# only apply on tweets
type = Ticket::Article::Type.lookup( :id => record.ticket_article_type_id )
type = Ticket::Article::Type.lookup( :id => record.type_id )
return if type['name'] != 'twitter direct-message' && type['name'] != 'twitter status'
a = Channel::Twitter2.new

View file

@ -9,12 +9,12 @@ class Observer::Ticket::Article::FillupFromEmail < ActiveRecord::Observer
return if Setting.get('import_mode')
# if sender is customer, do not change anything
sender = Ticket::Article::Sender.lookup( :id => record.ticket_article_sender_id )
sender = Ticket::Article::Sender.lookup( :id => record.sender_id )
return if sender == nil
return if sender['name'] == 'Customer'
# set email attributes
type = Ticket::Article::Type.lookup( :id => record.ticket_article_type_id )
type = Ticket::Article::Type.lookup( :id => record.type_id )
return if type['name'] != 'email'
# set subject if empty

View file

@ -9,7 +9,7 @@ class Observer::Ticket::Article::FillupFromGeneral < ActiveRecord::Observer
return if Setting.get('import_mode')
# if sender is customer, do not change anything
sender = Ticket::Article::Sender.lookup( :id => record.ticket_article_sender_id )
sender = Ticket::Article::Sender.lookup( :id => record.sender_id )
return if sender == nil
return if sender['name'] == 'Customer'

View file

@ -9,8 +9,8 @@ class Observer::Ticket::ArticleSenderType < ActiveRecord::Observer
count = Ticket::Article.where( :ticket_id => record.ticket_id ).count
return if count > 1
record.ticket.create_article_type_id = record.ticket_article_type_id
record.ticket.create_article_sender_id = record.ticket_article_sender_id
record.ticket.create_article_type_id = record.type_id
record.ticket.create_article_sender_id = record.sender_id
# save ticket
record.ticket.save

View file

@ -22,9 +22,9 @@ class Observer::Ticket::CloseTime < ActiveRecord::Observer
return true if record.close_time
# check if ticket is closed now
ticket_state = Ticket::State.lookup( :id => record.ticket_state_id )
ticket_state_type = Ticket::StateType.lookup( :id => ticket_state.state_type_id )
return true if ticket_state_type.name != 'closed'
state = Ticket::State.lookup( :id => record.state_id )
state_type = Ticket::StateType.lookup( :id => state.state_type_id )
return true if state_type.name != 'closed'
# set close_time
record.close_time = Time.now

View file

@ -13,8 +13,8 @@ class Observer::Ticket::FirstResponse < ActiveRecord::Observer
return true if record.internal
# if sender is not agent
sender = Ticket::Article::Sender.lookup( :id => record.ticket_article_sender_id )
type = Ticket::Article::Type.lookup( :id => record.ticket_article_type_id )
sender = Ticket::Article::Sender.lookup( :id => record.sender_id )
type = Ticket::Article::Type.lookup( :id => record.type_id )
if sender.name != 'Agent' && type.name !~ /^phone/
return true
end

View file

@ -10,10 +10,10 @@ class Observer::Ticket::LastContact < ActiveRecord::Observer
return true if record.internal
# if article is a message to customer
return true if !Ticket::Article::Type.lookup( :id => record.ticket_article_type_id ).communication
return true if !Ticket::Article::Type.lookup( :id => record.type_id ).communication
# if sender is not customer
sender = Ticket::Article::Sender.lookup( :id => record.ticket_article_sender_id )
sender = Ticket::Article::Sender.lookup( :id => record.sender_id )
if sender.name == 'Customer'
# check if last communication is done by agent, else do not set last_contact_customer

View file

@ -49,11 +49,11 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
:subject => 'New Ticket (#{ticket.title})',
:body => 'Hi #{recipient.firstname},
a new Ticket (#{ticket.title}) via i18n(#{article.ticket_article_type.name}).
a new Ticket (#{ticket.title}) via i18n(#{article.type.name}).
Group: #{ticket.group.name}
Owner: #{ticket.owner.firstname} #{ticket.owner.lastname}
State: i18n(#{ticket.ticket_state.name})
State: i18n(#{ticket.state.name})
From: #{article.from}
<snip>
@ -72,7 +72,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
if event[:name] == 'Ticket' && event[:type] == 'create'
# only for incoming emails
next if article.ticket_article_type.name != 'email'
next if article.type.name != 'email'
puts 'send new ticket notify to customer'
send_notify(
@ -107,7 +107,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
puts 'send new ticket::article notify'
if article.ticket_article_sender.name == 'Customer'
if article.sender.name == 'Customer'
send_notify(
{
:event => event,
@ -115,11 +115,11 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
:subject => 'Follow Up (#{ticket.title})',
:body => 'Hi #{recipient.firstname},
a follow Up (#{ticket.title}) via i18n(#{article.ticket_article_type.name}).
a follow Up (#{ticket.title}) via i18n(#{article.type.name}).
Group: #{ticket.group.name}
Owner: #{ticket.owner.firstname} #{ticket.owner.lastname}
State: i18n(#{ticket.ticket_state.name})
State: i18n(#{ticket.state.name})
From: #{article.from}
<snip>
@ -136,7 +136,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
# send new note notification to owner
# if agent == created.id
if article.ticket_article_sender.name == 'Agent' && article.created_by_id != article.ticket.owner_id
if article.sender.name == 'Agent' && article.created_by_id != article.ticket.owner_id
send_notify(
{
:event => event,
@ -144,11 +144,11 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
:subject => 'Updated (#{ticket.title})',
:body => 'Hi #{recipient.firstname},
updated (#{ticket.title}) via i18n(#{article.ticket_article_type.name}).
updated (#{ticket.title}) via i18n(#{article.type.name}).
Group: #{ticket.group.name}
Owner: #{ticket.owner.firstname} #{ticket.owner.lastname}
State: i18n(#{ticket.ticket_state.name})
State: i18n(#{ticket.state.name})
From: #{article.from}
<snip>

View file

@ -13,21 +13,21 @@ class Observer::Ticket::ResetNewState < ActiveRecord::Observer
return true if record.internal
# if sender is agent
return true if Ticket::Article::Sender.lookup( :id => record.ticket_article_sender_id ).name != 'Agent'
return true if Ticket::Article::Sender.lookup( :id => record.sender_id ).name != 'Agent'
# if article is a message to customer
return true if !Ticket::Article::Type.lookup( :id => record.ticket_article_type_id ).communication
return true if !Ticket::Article::Type.lookup( :id => record.type_id ).communication
# if current ticket state is still new
ticket = Ticket.lookup( :id => record.ticket_id )
return true if ticket.ticket_state.state_type.name != 'new'
return true if ticket.state.state_type.name != 'new'
# TODO: add config option to state managment in UI
state = Ticket::State.lookup( :name => 'open' )
return if !state
# set ticket to open
ticket.ticket_state_id = state.id
ticket.state_id = state.id
# save ticket
ticket.save

View file

@ -14,17 +14,17 @@ class Observer::Ticket::UserTicketCounter < ActiveRecord::Observer
return if !record.customer_id
# open ticket count
ticket_state_open = Ticket::State.by_category( 'open' )
tickets_open = Ticket.where(
:customer_id => record.customer_id,
:ticket_state_id => ticket_state_open,
state_open = Ticket::State.by_category( 'open' )
tickets_open = Ticket.where(
:customer_id => record.customer_id,
:state_id => state_open,
).count()
# closed ticket count
ticket_state_closed = Ticket::State.by_category( 'closed' )
tickets_closed = Ticket.where(
:customer_id => record.customer_id,
:ticket_state_id => ticket_state_closed,
state_closed = Ticket::State.by_category( 'closed' )
tickets_closed = Ticket.where(
:customer_id => record.customer_id,
:state_id => state_closed,
).count()
# check if update is needed

View file

@ -4,13 +4,13 @@ class Ticket < ApplicationModel
include Ticket::Escalation
include Ticket::Subject
include Ticket::Permission
require 'ticket/assets'
load 'ticket/assets.rb'
include Ticket::Assets
require 'ticket/history_log'
load 'ticket/history_log.rb'
include Ticket::HistoryLog
require 'ticket/activity_stream_log'
load 'ticket/activity_stream_log.rb'
include Ticket::ActivityStreamLog
require 'ticket/search_index'
load 'ticket/search_index.rb'
include Ticket::SearchIndex
extend Ticket::Search
@ -48,8 +48,8 @@ class Ticket < ApplicationModel
belongs_to :group
has_many :articles, :class_name => 'Ticket::Article', :after_add => :cache_update, :after_remove => :cache_update
belongs_to :organization
belongs_to :ticket_state, :class_name => 'Ticket::State'
belongs_to :ticket_priority, :class_name => 'Ticket::Priority'
belongs_to :state, :class_name => 'Ticket::State'
belongs_to :priority, :class_name => 'Ticket::Priority'
belongs_to :owner, :class_name => 'User'
belongs_to :customer, :class_name => 'User'
belongs_to :created_by, :class_name => 'User'
@ -99,11 +99,11 @@ returns
# create new merge article
Ticket::Article.create(
:ticket_id => self.id,
:ticket_article_type_id => Ticket::Article::Type.lookup( :name => 'note' ).id,
:ticket_article_sender_id => Ticket::Article::Sender.lookup( :name => 'Agent' ).id,
:body => 'merged',
:internal => false
:ticket_id => self.id,
:type_id => Ticket::Article::Type.lookup( :name => 'note' ).id,
:sender_id => Ticket::Article::Sender.lookup( :name => 'Agent' ).id,
:body => 'merged',
:internal => false
)
# add history to both
@ -118,7 +118,7 @@ returns
)
# set state to 'merged'
self.ticket_state_id = Ticket::State.lookup( :name => 'merged' ).id
self.state_id = Ticket::State.lookup( :name => 'merged' ).id
# rest owner
self.owner_id = User.where( :login => '-' ).first.id

View file

@ -9,21 +9,21 @@ class Ticket::Article < ApplicationModel
include Ticket::Article::ActivityStreamLog
belongs_to :ticket
belongs_to :ticket_article_type, :class_name => 'Ticket::Article::Type'
belongs_to :ticket_article_sender, :class_name => 'Ticket::Article::Sender'
belongs_to :created_by, :class_name => 'User'
belongs_to :type, :class_name => 'Ticket::Article::Type'
belongs_to :sender, :class_name => 'Ticket::Article::Sender'
belongs_to :created_by, :class_name => 'User'
after_create :notify_clients_after_create
after_update :notify_clients_after_update
after_destroy :notify_clients_after_destroy
activity_stream_support :ignore_attributes => {
:ticket_article_type_id => true,
:ticket_article_sender_id => true,
:type_id => true,
:sender_id => true,
}
history_support :ignore_attributes => {
:ticket_article_type_id => true,
:ticket_article_sender_id => true,
:type_id => true,
:sender_id => true,
}
class Flag < ApplicationModel

View file

@ -15,9 +15,9 @@ returns
=end
def self.rebuild_all
ticket_state_list_open = Ticket::State.by_category( 'open' )
state_list_open = Ticket::State.by_category( 'open' )
tickets = Ticket.where( :ticket_state_id => ticket_state_list_open )
tickets = Ticket.where( :state_id => state_list_open )
tickets.each {|ticket|
ticket.escalation_calculation
}
@ -39,8 +39,8 @@ returns
def escalation_calculation
# set escalation off if ticket is already closed
ticket_state = Ticket::State.lookup( :id => self.ticket_state_id )
if ticket_state.ignore_escalation?
state = Ticket::State.lookup( :id => self.state_id )
if state.ignore_escalation?
# nothing to change
return true if !self.escalation_time
@ -186,7 +186,7 @@ returns
elsif sla.condition
hit = false
map = [
[ 'tickets.ticket_priority_id', 'ticket_priority_id' ],
[ 'tickets.priority_id', 'priority_id' ],
[ 'tickets.group_id', 'group_id' ]
]
map.each {|item|
@ -232,7 +232,7 @@ returns
# ignore if it isn't a state change
next if !history_item['attribute']
next if history_item['attribute'] != 'ticket_state'
next if history_item['attribute'] != 'state'
# ignore all newer state before start_time
next if history_item['created_at'] < start_time

View file

@ -45,7 +45,7 @@ returns
{
:type => 'updated',
:object => 'Ticket',
:attribute => 'ticket_priority',
:attribute => 'priority',
:o_id => 1,
:id_to => 3,
:id_from => 2,

View file

@ -32,12 +32,12 @@ list attributes
returns
result = {
:ticket_article_type_id => ticket_article_type_ids,
:ticket_state_id => ticket_state_ids,
:ticket_priority_id => ticket_priority_ids,
:owner_id => owner_ids,
:group_id => group_ids,
:group_id__owner_id => groups_users,
:type_id => type_ids,
:state_id => state_ids,
:priority_id => priority_ids,
:owner_id => owner_ids,
:group_id => group_ids,
:group_id__owner_id => groups_users,
}
=end
@ -51,19 +51,19 @@ returns
end
# get ticket states
ticket_state_ids = []
state_ids = []
if params[:ticket]
ticket_state_type = params[:ticket].ticket_state.state_type
state_type = params[:ticket].state.state_type
end
ticket_state_types = ['open', 'closed', 'pending action', 'pending reminder']
if ticket_state_type && !ticket_state_types.include?(ticket_state_type.name)
ticket_state_ids.push params[:ticket].ticket_state.id
state_types = ['open', 'closed', 'pending action', 'pending reminder']
if state_type && !state_types.include?(state_type.name)
state_ids.push params[:ticket].state.id
end
ticket_state_types.each {|type|
ticket_state_type = Ticket::StateType.where( :name => type ).first
if ticket_state_type
ticket_state_type.states.each {|ticket_state|
ticket_state_ids.push ticket_state.id
state_types.each {|type|
state_type = Ticket::StateType.where( :name => type ).first
if state_type
state_type.states.each {|state|
state_ids.push state.id
}
end
}
@ -97,32 +97,32 @@ returns
}
# get priorities
ticket_priority_ids = []
priority_ids = []
Ticket::Priority.where( :active => true ).each { |priority|
ticket_priority_ids.push priority.id
priority_ids.push priority.id
}
ticket_article_type_ids = []
type_ids = []
if params[:ticket]
ticket_article_types = ['note', 'phone']
types = ['note', 'phone']
if params[:ticket].group.email_address_id
ticket_article_types.push 'email'
types.push 'email'
end
ticket_article_types.each {|ticket_article_type_name|
ticket_article_type = Ticket::Article::Type.lookup( :name => ticket_article_type_name )
if ticket_article_type
ticket_article_type_ids.push ticket_article_type.id
types.each {|type_name|
type = Ticket::Article::Type.lookup( :name => type_name )
if type
type_ids.push type.id
end
}
end
return {
:ticket_article_type_id => ticket_article_type_ids,
:ticket_state_id => ticket_state_ids,
:ticket_priority_id => ticket_priority_ids,
:owner_id => owner_ids,
:group_id => group_ids,
:group_id__owner_id => groups_users,
:type_id => type_ids,
:state_id => state_ids,
:priority_id => priority_ids,
:owner_id => owner_ids,
:group_id => group_ids,
:group_id__owner_id => groups_users,
}
end
@ -147,18 +147,18 @@ returns
def self.list_by_customer(data)
# get closed/open states
ticket_state_list_open = Ticket::State.by_category( 'open' )
ticket_state_list_closed = Ticket::State.by_category( 'closed' )
state_list_open = Ticket::State.by_category( 'open' )
state_list_closed = Ticket::State.by_category( 'closed' )
# get tickets
tickets_open = Ticket.where(
:customer_id => data[:customer_id],
:ticket_state_id => ticket_state_list_open
:state_id => state_list_open
).limit( data[:limit] || 15 ).order('created_at DESC')
tickets_closed = Ticket.where(
:customer_id => data[:customer_id],
:ticket_state_id => ticket_state_list_closed
:state_id => state_list_closed
).limit( data[:limit] || 15 ).order('created_at DESC')
return {

View file

@ -33,9 +33,9 @@ returns:
check if state is ignored for escalation
ticket_state = Ticket::State.lookup( :name => 'state name' )
state = Ticket::State.lookup( :name => 'state name' )
result = ticket_state.ignore_escalation?
result = state.ignore_escalation?
returns:

View file

@ -0,0 +1,12 @@
class UpdateTicketReplace < ActiveRecord::Migration
def up
rename_column :tickets, :ticket_priority_id, :priority_id
rename_column :tickets, :ticket_state_id, :state_id
rename_column :ticket_articles, :ticket_article_type_id, :type_id
rename_column :ticket_articles, :ticket_article_sender_id, :sender_id
end
def down
end
end

View file

@ -16,7 +16,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => false,
:name => 'product_name',
:name => 'product_name',
:tag => 'input',
},
],
@ -35,7 +35,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => false,
:name => 'organization',
:name => 'organization',
:tag => 'input',
},
],
@ -54,7 +54,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'system_id',
:name => 'system_id',
:tag => 'select',
:options => {
'10' => '10',
@ -78,7 +78,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => false,
:name => 'fqdn',
:name => 'fqdn',
:tag => 'input',
},
],
@ -96,7 +96,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'http_type',
:name => 'http_type',
:tag => 'select',
:options => {
'https' => 'https',
@ -121,7 +121,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'storage',
:name => 'storage',
:tag => 'select',
:options => {
'DB' => 'Database',
@ -188,7 +188,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'user_create_account',
:name => 'user_create_account',
:tag => 'boolean',
:options => {
true => 'yes',
@ -210,7 +210,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'user_lost_password',
:name => 'user_lost_password',
:tag => 'boolean',
:options => {
true => 'yes',
@ -232,7 +232,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'switch_to_user',
:name => 'switch_to_user',
:tag => 'boolean',
:options => {
true => 'yes',
@ -300,7 +300,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'auth_twitter',
:name => 'auth_twitter',
:tag => 'boolean',
:options => {
true => 'yes',
@ -322,13 +322,13 @@ Setting.create_if_not_exists(
{
:display => 'Twitter Key',
:null => true,
:name => 'key',
:name => 'key',
:tag => 'input',
},
{
:display => 'Twitter Secret',
:null => true,
:name => 'secret',
:name => 'secret',
:tag => 'input',
},
],
@ -346,7 +346,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'auth_facebook',
:name => 'auth_facebook',
:tag => 'boolean',
:options => {
true => 'yes',
@ -369,13 +369,13 @@ Setting.create_if_not_exists(
{
:display => 'App ID',
:null => true,
:name => 'app_id',
:name => 'app_id',
:tag => 'input',
},
{
:display => 'App Secret',
:null => true,
:name => 'app_secret',
:name => 'app_secret',
:tag => 'input',
},
],
@ -394,7 +394,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'auth_google_oauth2',
:name => 'auth_google_oauth2',
:tag => 'boolean',
:options => {
true => 'yes',
@ -416,13 +416,13 @@ Setting.create_if_not_exists(
{
:display => 'Client ID',
:null => true,
:name => 'client_id',
:name => 'client_id',
:tag => 'input',
},
{
:display => 'Client Secret',
:null => true,
:name => 'client_secret',
:name => 'client_secret',
:tag => 'input',
},
],
@ -441,7 +441,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'auth_linkedin',
:name => 'auth_linkedin',
:tag => 'boolean',
:options => {
true => 'yes',
@ -463,13 +463,13 @@ Setting.create_if_not_exists(
{
:display => 'App ID',
:null => true,
:name => 'app_id',
:name => 'app_id',
:tag => 'input',
},
{
:display => 'App Secret',
:null => true,
:name => 'app_secret',
:name => 'app_secret',
:tag => 'input',
},
],
@ -488,7 +488,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'password_min_size',
:name => 'password_min_size',
:tag => 'select',
:options => {
4 => 4,
@ -517,7 +517,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'password_min_2_lower_2_upper_characters',
:name => 'password_min_2_lower_2_upper_characters',
:tag => 'select',
:options => {
1 => 'yes',
@ -539,7 +539,7 @@ Setting.create_if_not_exists(
{
:display => 'Needed',
:null => true,
:name => 'password_need_digit',
:name => 'password_need_digit',
:tag => 'select',
:options => {
1 => 'yes',
@ -561,7 +561,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'password_max_login_failed',
:name => 'password_max_login_failed',
:tag => 'select',
:options => {
4 => 4,
@ -598,7 +598,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => false,
:name => 'ticket_hook',
:name => 'ticket_hook',
:tag => 'input',
},
],
@ -616,7 +616,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'ticket_hook_divider',
:name => 'ticket_hook_divider',
:tag => 'input',
},
],
@ -634,7 +634,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'ticket_hook_position',
:name => 'ticket_hook_position',
:tag => 'select',
:options => {
'left' => 'Left',
@ -657,7 +657,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => false,
:name => 'ticket_subject_size',
:name => 'ticket_subject_size',
:tag => 'input',
},
],
@ -675,7 +675,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'ticket_subject_re',
:name => 'ticket_subject_re',
:tag => 'input',
},
],
@ -709,7 +709,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'ticket_number',
:name => 'ticket_number',
:tag => 'select',
:options => {
'Ticket::Number::Increment' => 'Increment (SystemID.Counter)',
@ -731,7 +731,7 @@ Setting.create_if_not_exists(
{
:display => 'Checksum',
:null => true,
:name => 'checksum',
:name => 'checksum',
:tag => 'boolean',
:options => {
true => 'yes',
@ -741,7 +741,7 @@ Setting.create_if_not_exists(
{
:display => 'Min. size of number',
:null => true,
:name => 'min_size',
:name => 'min_size',
:tag => 'select',
:options => {
1 => 1,
@ -784,7 +784,7 @@ Setting.create_if_not_exists(
{
:display => 'Checksum',
:null => true,
:name => 'checksum',
:name => 'checksum',
:tag => 'boolean',
:options => {
true => 'yes',
@ -809,7 +809,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'customer_ticket_create',
:name => 'customer_ticket_create',
:tag => 'boolean',
:options => {
true => 'yes',
@ -832,7 +832,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'group_ids',
:name => 'group_ids',
:tag => 'select',
:multiple => true,
:null => false,
@ -856,7 +856,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'customer_ticket_view',
:name => 'customer_ticket_view',
:tag => 'boolean',
:options => {
true => 'yes',
@ -879,7 +879,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'ticket_define_email_from',
:name => 'ticket_define_email_from',
:tag => 'select',
:options => {
:SystemAddressName => 'System Address Display Name',
@ -902,7 +902,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => false,
:name => 'ticket_define_email_from_seperator',
:name => 'ticket_define_email_from_seperator',
:tag => 'input',
},
],
@ -921,7 +921,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'postmaster_max_size',
:name => 'postmaster_max_size',
:tag => 'select',
:options => {
1 => 1,
@ -962,7 +962,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'postmaster_follow_up_search_in',
:name => 'postmaster_follow_up_search_in',
:tag => 'checkbox',
:options => {
'references' => 'References',
@ -987,7 +987,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => false,
:name => 'notification_sender',
:name => 'notification_sender',
:tag => 'input',
},
],
@ -1006,7 +1006,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => false,
:name => 'send_no_auto_response_reg_exp',
:name => 'send_no_auto_response_reg_exp',
:tag => 'input',
},
],
@ -1025,7 +1025,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'chat',
:name => 'chat',
:tag => 'boolean',
:options => {
true => 'yes',
@ -1058,7 +1058,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'import_mode',
:name => 'import_mode',
:tag => 'boolean',
:options => {
true => 'yes',
@ -1080,7 +1080,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'import_ignore_sla',
:name => 'import_ignore_sla',
:tag => 'boolean',
:options => {
true => 'yes',
@ -1097,13 +1097,13 @@ Setting.create_if_not_exists(
:title => 'Import Endpoint',
:name => 'import_otrs_endpoint',
:area => 'Import::OTRS',
:description => 'Defines OTRS endpoint to import users, ticket, ticket_states and articles.',
:description => 'Defines OTRS endpoint to import users, ticket, states and articles.',
:options => {
:form => [
{
:display => '',
:null => false,
:name => 'import_otrs_endpoint',
:name => 'import_otrs_endpoint',
:tag => 'input',
},
],
@ -1121,7 +1121,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => false,
:name => 'import_otrs_endpoint_key',
:name => 'import_otrs_endpoint_key',
:tag => 'input',
},
],
@ -1140,7 +1140,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'import_otrs_user',
:name => 'import_otrs_user',
:tag => 'input',
},
],
@ -1159,7 +1159,7 @@ Setting.create_if_not_exists(
{
:display => '',
:null => true,
:name => 'import_otrs_password',
:name => 'import_otrs_password',
:tag => 'input',
},
],
@ -1302,19 +1302,19 @@ Ticket::Article::Sender.create_if_not_exists( :name => 'System' )
UserInfo.current_user_id = user_community.id
ticket = Ticket.create(
:group_id => Group.where( :name => 'Users' ).first.id,
:customer_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
:owner_id => User.where( :login => '-' ).first.id,
:title => 'Welcome to Zammad!',
:ticket_state_id => Ticket::State.where( :name => 'new' ).first.id,
:ticket_priority_id => Ticket::Priority.where( :name => '2 normal' ).first.id,
:group_id => Group.where( :name => 'Users' ).first.id,
:customer_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
:owner_id => User.where( :login => '-' ).first.id,
:title => 'Welcome to Zammad!',
:state_id => Ticket::State.where( :name => 'new' ).first.id,
:priority_id => Ticket::Priority.where( :name => '2 normal' ).first.id,
)
Ticket::Article.create(
:ticket_id => ticket.id,
:ticket_article_type_id => Ticket::Article::Type.where(:name => 'phone' ).first.id,
:ticket_article_sender_id => Ticket::Article::Sender.where(:name => 'Customer' ).first.id,
:from => 'Zammad Feedback <feedback@zammad.org>',
:body => 'Welcome!
:ticket_id => ticket.id,
:type_id => Ticket::Article::Type.where(:name => 'phone' ).first.id,
:sender_id => Ticket::Article::Sender.where(:name => 'Customer' ).first.id,
:from => 'Zammad Feedback <feedback@zammad.org>',
:body => 'Welcome!
Thank you for installing Zammad.
@ -1337,17 +1337,17 @@ Overview.create_if_not_exists(
:prio => 1000,
:role_id => overview_role.id,
:condition => {
'tickets.ticket_state_id' => [ 1,2,3 ],
'tickets.owner_id' => 'current_user.id',
'tickets.state_id' => [ 1,2,3 ],
'tickets.owner_id' => 'current_user.id',
},
:order => {
:by => 'created_at',
:direction => 'ASC',
},
:view => {
:d => [ 'title', 'customer', 'ticket_state', 'group', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
:m => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:view_mode_default => 's',
},
)
@ -1358,17 +1358,17 @@ Overview.create_if_not_exists(
:prio => 1001,
:role_id => overview_role.id,
:condition => {
'tickets.ticket_state_id' => [1,2,3],
'tickets.owner_id' => 1,
'tickets.state_id' => [1,2,3],
'tickets.owner_id' => 1,
},
:order => {
:by => 'created_at',
:direction => 'ASC',
},
:view => {
:d => [ 'title', 'customer', 'ticket_state', 'group', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
:m => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:view_mode_default => 's',
},
)
@ -1379,16 +1379,16 @@ Overview.create_if_not_exists(
:prio => 1002,
:role_id => overview_role.id,
:condition => {
'tickets.ticket_state_id' => [1,2,3],
'tickets.state_id' => [1,2,3],
},
:order => {
:by => 'created_at',
:direction => 'ASC',
},
:view => {
:d => [ 'title', 'customer', 'ticket_state', 'group', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
:m => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:view_mode_default => 's',
},
)
@ -1406,9 +1406,9 @@ Overview.create_if_not_exists(
:direction => 'ASC',
},
:view => {
:d => [ 'title', 'customer', 'ticket_state', 'group', 'owner', 'escalation_time' ],
:s => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'owner', 'escalation_time' ],
:m => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'owner', 'escalation_time' ],
:d => [ 'title', 'customer', 'state', 'group', 'owner', 'escalation_time' ],
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'owner', 'escalation_time' ],
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'owner', 'escalation_time' ],
:view_mode_default => 's',
},
)
@ -1419,17 +1419,17 @@ Overview.create_if_not_exists(
:prio => 1020,
:role_id => overview_role.id,
:condition => {
'tickets.ticket_state_id' => [3],
'tickets.owner_id' => 'current_user.id',
'tickets.state_id' => [3],
'tickets.owner_id' => 'current_user.id',
},
:order => {
:by => 'created_at',
:direction => 'ASC',
},
:view => {
:d => [ 'title', 'customer', 'ticket_state', 'group', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
:m => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:view_mode_default => 's',
},
)
@ -1440,17 +1440,17 @@ Overview.create_if_not_exists(
:prio => 9003,
:role_id => overview_role.id,
:condition => {
# 'tickets.ticket_state_id' => [3],
# 'tickets.owner_id' => current_user.id,
# 'tickets.state_id' => [3],
# 'tickets.owner_id' => current_user.id,
},
:order => {
:by => 'created_at',
:direction => 'ASC',
},
:view => {
:s => [ 'title', 'customer', 'ticket_state', 'group', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
:m => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
:s => [ 'title', 'customer', 'state', 'group', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
:view_mode_default => 's',
},
)
@ -1462,7 +1462,7 @@ Overview.create_if_not_exists(
:prio => 1000,
:role_id => overview_role.id,
:condition => {
'tickets.ticket_state_id' => [ 1,2,3,4,6 ],
'tickets.state_id' => [ 1,2,3,4,6 ],
'tickets.customer_id' => 'current_user.id',
},
:order => {
@ -1470,9 +1470,9 @@ Overview.create_if_not_exists(
:direction => 'DESC',
},
:view => {
:d => [ 'title', 'customer', 'ticket_state', 'created_at' ],
:s => [ 'number', 'title', 'ticket_state', 'ticket_priority', 'created_at' ],
:m => [ 'number', 'title', 'ticket_state', 'ticket_priority', 'created_at' ],
:d => [ 'title', 'customer', 'state', 'created_at' ],
:s => [ 'number', 'title', 'state', 'priority', 'created_at' ],
:m => [ 'number', 'title', 'state', 'priority', 'created_at' ],
:view_mode_default => 's',
},
)
@ -1483,7 +1483,7 @@ Overview.create_if_not_exists(
:role_id => overview_role.id,
:organization_shared => true,
:condition => {
'tickets.ticket_state_id' => [ 1,2,3,4,6 ],
'tickets.state_id' => [ 1,2,3,4,6 ],
'tickets.organization_id' => 'current_user.organization_id',
},
:order => {
@ -1491,9 +1491,9 @@ Overview.create_if_not_exists(
:direction => 'DESC',
},
:view => {
:d => [ 'title', 'customer', 'ticket_state', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'created_at' ],
:m => [ 'number', 'title', 'ticket_state', 'ticket_priority', 'created_at' ],
:d => [ 'title', 'customer', 'state', 'created_at' ],
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'created_at' ],
:m => [ 'number', 'title', 'state', 'priority', 'created_at' ],
:view_mode_default => 's',
},
)

View file

@ -127,10 +127,10 @@ module Import::OTRS
#self.ticket('156115')
#return
# create states
ticket_state
state
# create priorities
ticket_priority
priority
# create groups
ticket_group
@ -185,10 +185,10 @@ module Import::OTRS
end
# create states
ticket_state
state
# create priorities
ticket_priority
priority
# create groups
ticket_group
@ -233,8 +233,8 @@ module Import::OTRS
:CreateBy => :created_by_id,
:TicketNumber => :number,
:QueueID => :group_id,
:StateID => :ticket_state_id,
:PriorityID => :ticket_priority_id,
:StateID => :state_id,
:PriorityID => :priority_id,
:Owner => :owner,
:CustomerUserID => :customer,
:Title => :title,
@ -249,8 +249,8 @@ module Import::OTRS
# :CloseTimeDiffInMin => :close_time_diff_in_min,
},
:Article => {
:SenderType => :ticket_article_sender,
:ArticleType => :ticket_article_type,
:SenderType => :sender,
:ArticleType => :type,
:TicketID => :ticket_id,
:ArticleID => :id,
:Body => :body,
@ -338,7 +338,7 @@ module Import::OTRS
end
}
# create customer/sender if needed
if article_new[:ticket_article_sender] == 'customer' && article_new[:created_by_id].to_i == 1 && !article_new[:from].empty?
if article_new[:sender] == 'customer' && article_new[:created_by_id].to_i == 1 && !article_new[:from].empty?
# set extra headers
begin
email = Mail::Address.new( article_new[:from] ).address
@ -379,41 +379,41 @@ module Import::OTRS
article_new[:created_by_id] = user.id
end
if article_new[:ticket_article_sender] == 'customer'
article_new[:ticket_article_sender_id] = Ticket::Article::Sender.lookup( :name => 'Customer' ).id
article_new.delete( :ticket_article_sender )
if article_new[:sender] == 'customer'
article_new[:sender_id] = Ticket::Article::Sender.lookup( :name => 'Customer' ).id
article_new.delete( :sender )
end
if article_new[:ticket_article_sender] == 'agent'
article_new[:ticket_article_sender_id] = Ticket::Article::Sender.lookup( :name => 'Agent' ).id
article_new.delete( :ticket_article_sender )
if article_new[:sender] == 'agent'
article_new[:sender_id] = Ticket::Article::Sender.lookup( :name => 'Agent' ).id
article_new.delete( :sender )
end
if article_new[:ticket_article_sender] == 'system'
article_new[:ticket_article_sender_id] = Ticket::Article::Sender.lookup( :name => 'System' ).id
article_new.delete( :ticket_article_sender )
if article_new[:sender] == 'system'
article_new[:sender_id] = Ticket::Article::Sender.lookup( :name => 'System' ).id
article_new.delete( :sender )
end
if article_new[:ticket_article_type] == 'email-external'
article_new[:ticket_article_type_id] = Ticket::Article::Type.lookup( :name => 'email' ).id
if article_new[:type] == 'email-external'
article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'email' ).id
article_new[:internal] = false
elsif article_new[:ticket_article_type] == 'email-internal'
article_new[:ticket_article_type_id] = Ticket::Article::Type.lookup( :name => 'email' ).id
elsif article_new[:type] == 'email-internal'
article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'email' ).id
article_new[:internal] = true
elsif article_new[:ticket_article_type] == 'note-external'
article_new[:ticket_article_type_id] = Ticket::Article::Type.lookup( :name => 'note' ).id
elsif article_new[:type] == 'note-external'
article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'note' ).id
article_new[:internal] = false
elsif article_new[:ticket_article_type] == 'note-internal'
article_new[:ticket_article_type_id] = Ticket::Article::Type.lookup( :name => 'note' ).id
elsif article_new[:type] == 'note-internal'
article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'note' ).id
article_new[:internal] = true
elsif article_new[:ticket_article_type] == 'phone'
article_new[:ticket_article_type_id] = Ticket::Article::Type.lookup( :name => 'phone' ).id
elsif article_new[:type] == 'phone'
article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'phone' ).id
article_new[:internal] = false
elsif article_new[:ticket_article_type] == 'webrequest'
article_new[:ticket_article_type_id] = Ticket::Article::Type.lookup( :name => 'web' ).id
elsif article_new[:type] == 'webrequest'
article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'web' ).id
article_new[:internal] = false
else
article_new[:ticket_article_type_id] = 9
article_new[:type_id] = 9
end
article_new.delete( :ticket_article_type )
article_new.delete( :type )
article_old = Ticket::Article.where( :id => article_new[:id] ).first
#puts 'ARTICLE OLD ' + article_old.inspect
# set state types
@ -466,7 +466,7 @@ module Import::OTRS
:o_id => history['TicketID'],
:history_type => 'updated',
:history_object => 'Ticket',
:history_attribute => 'ticket_state',
:history_attribute => 'state',
:value_from => from,
:id_from => from_id,
:value_to => to,
@ -516,7 +516,7 @@ module Import::OTRS
:o_id => history['TicketID'],
:history_type => 'updated',
:history_object => 'Ticket',
:history_attribute => 'ticket_priority',
:history_attribute => 'priority',
:value_from => from,
:value_to => to,
:id_from => from_id,
@ -542,7 +542,7 @@ module Import::OTRS
}
end
def self.ticket_state
def self.state
response = request( "public.pl?Action=Export;Type=State" )
return if !response
return if !response.success?
@ -587,8 +587,8 @@ module Import::OTRS
if state['TypeName'] == 'pending auto'
state['TypeName'] = 'pending action'
end
ticket_state_type = Ticket::StateType.where( :name => state['TypeName'] ).first
state_new[:state_type_id] = ticket_state_type.id
state_type = Ticket::StateType.where( :name => state['TypeName'] ).first
state_new[:state_type_id] = state_type.id
if state_old
# puts 'TS: ' + state_new.inspect
state_old.update_attributes(state_new)
@ -599,7 +599,7 @@ module Import::OTRS
end
}
end
def self.ticket_priority
def self.priority
response = request( "public.pl?Action=Export;Type=Priority" )
return if !response
return if !response.success?

View file

@ -57,7 +57,7 @@ module NotificationFactory
:from => sender,
:to => data[:recipient][:email],
:subject => data[:subject],
:body => data[:body],
:body => data[:body],
},
true
)

View file

@ -25,30 +25,30 @@ class ActivityStreamTest < ActiveSupport::TestCase
{
:create => {
:ticket => {
:group_id => Group.lookup( :name => 'Users' ).id,
:customer_id => current_user.id,
:owner_id => User.lookup( :login => '-' ).id,
:title => 'Unit Test 1 (äöüß)!',
:ticket_state_id => Ticket::State.lookup( :name => 'new' ).id,
:ticket_priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id,
:updated_by_id => current_user.id,
:created_by_id => current_user.id,
:group_id => Group.lookup( :name => 'Users' ).id,
:customer_id => current_user.id,
:owner_id => User.lookup( :login => '-' ).id,
:title => 'Unit Test 1 (äöüß)!',
:state_id => Ticket::State.lookup( :name => 'new' ).id,
:priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id,
:updated_by_id => current_user.id,
:created_by_id => current_user.id,
},
:article => {
:updated_by_id => current_user.id,
:created_by_id => current_user.id,
:ticket_article_type_id => Ticket::Article::Type.lookup( :name => 'phone' ).id,
:ticket_article_sender_id => Ticket::Article::Sender.lookup( :name => 'Customer' ).id,
:from => 'Unit Test <unittest@example.com>',
:body => 'Unit Test 123',
:internal => false
:updated_by_id => current_user.id,
:created_by_id => current_user.id,
:type_id => Ticket::Article::Type.lookup( :name => 'phone' ).id,
:sender_id => Ticket::Article::Sender.lookup( :name => 'Customer' ).id,
:from => 'Unit Test <unittest@example.com>',
:body => 'Unit Test 123',
:internal => false
},
},
:update => {
:ticket => {
:title => 'Unit Test 1 (äöüß) - update!',
:ticket_state_id => Ticket::State.lookup( :name => 'open' ).id,
:ticket_priority_id => Ticket::Priority.lookup( :name => '1 low' ).id,
:title => 'Unit Test 1 (äöüß) - update!',
:state_id => Ticket::State.lookup( :name => 'open' ).id,
:priority_id => Ticket::Priority.lookup( :name => '1 low' ).id,
},
},
:check => [
@ -286,7 +286,8 @@ class ActivityStreamTest < ActiveSupport::TestCase
:update2 => {
:user => {
:firstname => 'Bob',
:lastname => 'Smith', },
:lastname => 'Smith',
},
},
:check => [
{

View file

@ -23,14 +23,14 @@ Some Textäöü",
:success => true,
:result => {
0 => {
:ticket_priority => '2 normal',
:title => 'äöü some subject',
:priority => '2 normal',
:title => 'äöü some subject',
},
1 => {
:body => 'Some Textäöü',
:ticket_article_sender => 'Customer',
:ticket_article_type => 'email',
:internal => false,
:body => 'Some Textäöü',
:sender => 'Customer',
:type => 'email',
:internal => false,
},
},
},
@ -43,14 +43,14 @@ Some Textäöü".encode("ISO-8859-1"),
:success => true,
:result => {
0 => {
:ticket_priority => '2 normal',
:title => '', # should be äöü some subject, but can not be parsed from mime tools
:priority => '2 normal',
:title => '', # should be äöü some subject, but can not be parsed from mime tools
},
1 => {
:body => 'Some Textäöü',
:ticket_article_sender => 'Customer',
:ticket_article_type => 'email',
:internal => false,
:body => 'Some Textäöü',
:sender => 'Customer',
:type => 'email',
:internal => false,
},
},
},
@ -119,13 +119,13 @@ Some Text",
:success => true,
:result => {
0 => {
:ticket_priority => '2 normal',
:title => '【专业为您注册香港及海外公司(好处多多)】                                                                                                                                                                                                                                     ',
:priority => '2 normal',
:title => '【专业为您注册香港及海外公司(好处多多)】                                                                                                                                                                                                                                     ',
},
1 => {
:body => 'Some Text',
:ticket_article_sender => 'Customer',
:ticket_article_type => 'email',
:body => 'Some Text',
:sender => 'Customer',
:type => 'email',
},
},
},
@ -148,9 +148,9 @@ Some Text',
:data => 'From: me@example.com
To: customer@example.com
Subject: some subject
X-Zammad-Ticket-Ticket_Priority: 3 high
X-Zammad-Article-Ticket_Article_Sender: System
x-Zammad-Article-Ticket_Article_Type: phone
X-Zammad-Ticket-priority: 3 high
X-Zammad-Article-sender: System
x-Zammad-Article-type: phone
x-Zammad-Article-Internal: true
Some Text',
@ -158,13 +158,13 @@ Some Text',
:success => true,
:result => {
0 => {
:ticket_priority => '3 high',
:title => 'some subject',
:priority => '3 high',
:title => 'some subject',
},
1 => {
:ticket_article_sender => 'System',
:ticket_article_type => 'phone',
:internal => true,
:sender => 'System',
:type => 'phone',
:internal => true,
},
},
},
@ -178,9 +178,9 @@ Some Text',
:data => 'From: me@example.com
To: customer@example.com
Subject: some subject
X-Zammad-Ticket-Ticket_Priority: 3 high
X-Zammad-Article-Ticket_Article_Sender: System
x-Zammad-Article-Ticket_Article_Type: phone
X-Zammad-Ticket-Priority: 3 high
X-Zammad-Article-Sender: System
x-Zammad-Article-Type: phone
x-Zammad-Article-Internal: true
Some Text',
@ -188,13 +188,13 @@ Some Text',
:success => true,
:result => {
0 => {
:ticket_priority => '2 normal',
:title => 'some subject',
:priority => '2 normal',
:title => 'some subject',
},
1 => {
:ticket_article_sender => 'Customer',
:ticket_article_type => 'email',
:internal => false,
:sender => 'Customer',
:type => 'email',
:internal => false,
},
},
},
@ -204,7 +204,7 @@ Some Text',
test 'process with postmaster filter' do
group = Group.create_if_not_exists(
:name => 'Test Group',
:name => 'Test Group',
:created_by_id => 1,
:updated_by_id => 1,
)
@ -215,7 +215,7 @@ Some Text',
:from => 'nobody@example.com',
},
:perform => {
'X-Zammad-Ticket-Ticket_Priority' => '3 high',
'X-Zammad-Ticket-priority' => '3 high',
},
:channel => 'email',
:active => true,
@ -261,14 +261,14 @@ Some Text',
:success => true,
:result => {
0 => {
:group => group.name,
:ticket_priority => '2 normal',
:title => 'some subject',
:group => group.name,
:priority => '2 normal',
:title => 'some subject',
},
1 => {
:ticket_article_sender => 'Customer',
:ticket_article_type => 'email',
:internal => true,
:sender => 'Customer',
:type => 'email',
:internal => true,
},
},
},
@ -283,14 +283,14 @@ Some Text',
:success => true,
:result => {
0 => {
:group => 'Twitter',
:ticket_priority => '2 normal',
:title => 'some subject',
:group => 'Twitter',
:priority => '2 normal',
:title => 'some subject',
},
1 => {
:ticket_article_sender => 'Customer',
:ticket_article_type => 'email',
:internal => true,
:sender => 'Customer',
:type => 'email',
:internal => true,
},
},
},

View file

@ -11,30 +11,30 @@ class HistoryTest < ActiveSupport::TestCase
{
:ticket_create => {
:ticket => {
:group_id => Group.lookup( :name => 'Users' ).id,
:customer_id => current_user.id,
:owner_id => User.lookup( :login => '-' ).id,
:title => 'Unit Test 1 (äöüß)!',
:ticket_state_id => Ticket::State.lookup( :name => 'new' ).id,
:ticket_priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id,
:updated_by_id => current_user.id,
:created_by_id => current_user.id,
:group_id => Group.lookup( :name => 'Users' ).id,
:customer_id => current_user.id,
:owner_id => User.lookup( :login => '-' ).id,
:title => 'Unit Test 1 (äöüß)!',
:state_id => Ticket::State.lookup( :name => 'new' ).id,
:priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id,
:updated_by_id => current_user.id,
:created_by_id => current_user.id,
},
:article => {
:updated_by_id => current_user.id,
:created_by_id => current_user.id,
:ticket_article_type_id => Ticket::Article::Type.lookup( :name => 'phone' ).id,
:ticket_article_sender_id => Ticket::Article::Sender.lookup( :name => 'Customer' ).id,
:from => 'Unit Test <unittest@example.com>',
:body => 'Unit Test 123',
:internal => false
:updated_by_id => current_user.id,
:created_by_id => current_user.id,
:type_id => Ticket::Article::Type.lookup( :name => 'phone' ).id,
:sender_id => Ticket::Article::Sender.lookup( :name => 'Customer' ).id,
:from => 'Unit Test <unittest@example.com>',
:body => 'Unit Test 123',
:internal => false
},
},
:ticket_update => {
:ticket => {
:title => 'Unit Test 1 (äöüß) - update!',
:ticket_state_id => Ticket::State.lookup( :name => 'open' ).id,
:ticket_priority_id => Ticket::Priority.lookup( :name => '1 low' ).id,
:title => 'Unit Test 1 (äöüß) - update!',
:state_id => Ticket::State.lookup( :name => 'open' ).id,
:priority_id => Ticket::Priority.lookup( :name => '1 low' ).id,
},
},
:history_check => [
@ -55,7 +55,7 @@ class HistoryTest < ActiveSupport::TestCase
:result => true,
:history_object => 'Ticket',
:history_type => 'updated',
:history_attribute => 'ticket_state',
:history_attribute => 'state',
:value_from => 'new',
:value_to => 'open',
:id_from => Ticket::State.lookup( :name => 'new' ).id,
@ -78,33 +78,33 @@ class HistoryTest < ActiveSupport::TestCase
{
:ticket_create => {
:ticket => {
:group_id => Group.lookup( :name => 'Users' ).id,
:customer_id => current_user.id,
:owner_id => User.lookup( :login => '-' ).id,
:title => 'Unit Test 2 (äöüß)!',
:ticket_state_id => Ticket::State.lookup( :name => 'new' ).id,
:ticket_priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id,
:updated_by_id => current_user.id,
:created_by_id => current_user.id,
:group_id => Group.lookup( :name => 'Users' ).id,
:customer_id => current_user.id,
:owner_id => User.lookup( :login => '-' ).id,
:title => 'Unit Test 2 (äöüß)!',
:state_id => Ticket::State.lookup( :name => 'new' ).id,
:priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id,
:updated_by_id => current_user.id,
:created_by_id => current_user.id,
},
:article => {
:created_by_id => current_user.id,
:updated_by_id => current_user.id,
:ticket_article_type_id => Ticket::Article::Type.lookup(:name => 'phone' ).id,
:ticket_article_sender_id => Ticket::Article::Sender.lookup(:name => 'Customer' ).id,
:from => 'Unit Test <unittest@example.com>',
:body => 'Unit Test 123',
:internal => false
:created_by_id => current_user.id,
:updated_by_id => current_user.id,
:type_id => Ticket::Article::Type.lookup(:name => 'phone' ).id,
:sender_id => Ticket::Article::Sender.lookup(:name => 'Customer' ).id,
:from => 'Unit Test <unittest@example.com>',
:body => 'Unit Test 123',
:internal => false
},
},
:ticket_update => {
:ticket => {
:title => 'Unit Test 2 (äöüß) - update!',
:ticket_state_id => Ticket::State.lookup( :name => 'open' ).id,
:owner_id => current_user.id,
:title => 'Unit Test 2 (äöüß) - update!',
:state_id => Ticket::State.lookup( :name => 'open' ).id,
:owner_id => current_user.id,
},
:article => {
:from => 'Unit 2 Test 2 <unittest@example.com>',
:from => 'Unit 2 Test 2 <unittest@example.com>',
},
},
:history_check => [
@ -132,9 +132,9 @@ class HistoryTest < ActiveSupport::TestCase
:id_to => current_user.id,
},
{
:result => true,
:history_object => 'Ticket::Article',
:history_type => 'created',
:result => true,
:history_object => 'Ticket::Article',
:history_type => 'created',
},
{
:result => true,
@ -302,9 +302,9 @@ class HistoryTest < ActiveSupport::TestCase
},
:history_check => [
{
:result => true,
:history_object => 'Organization',
:history_type => 'created',
:result => true,
:history_object => 'Organization',
:history_type => 'created',
},
{
:result => true,

View file

@ -7,8 +7,8 @@ class NotificationFactoryTest < ActiveSupport::TestCase
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:ticket_state => Ticket::State.lookup( :name => 'new' ),
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
:state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
:updated_by_id => 1,
:created_by_id => 1,
)
@ -41,7 +41,7 @@ class NotificationFactoryTest < ActiveSupport::TestCase
},
{
:locale => 'de',
:string => '\'i18n(#{ticket.ticket_state.name})\' ticket state',
:string => '\'i18n(#{ticket.state.name})\' ticket state',
:result => '\'neu\' ticket state',
},
]

View file

@ -4,33 +4,33 @@ require 'test_helper'
class TicketTest < ActiveSupport::TestCase
test 'ticket create' do
ticket = Ticket.create(
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:ticket_state => Ticket::State.lookup( :name => 'new' ),
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
:updated_by_id => 1,
:created_by_id => 1,
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "ticket created" )
assert_equal( ticket.title, 'some title äöüß', 'ticket.title verify' )
assert_equal( ticket.group.name, 'Users', 'ticket.group verify' )
assert_equal( ticket.ticket_state.name, 'new', 'ticket.state verify' )
assert_equal( ticket.state.name, 'new', 'ticket.state verify' )
# create inbound article
article_inbound = Ticket::Article.create(
:ticket_id => ticket.id,
:from => 'some_sender@example.com',
:to => 'some_recipient@example.com',
:subject => 'some subject',
:message_id => 'some@id',
:body => 'some message article_inbound 😍😍😍',
:internal => false,
:ticket_article_sender => Ticket::Article::Sender.where(:name => 'Customer').first,
:ticket_article_type => Ticket::Article::Type.where(:name => 'email').first,
:updated_by_id => 1,
:created_by_id => 1,
:ticket_id => ticket.id,
:from => 'some_sender@example.com',
:to => 'some_recipient@example.com',
:subject => 'some subject',
:message_id => 'some@id',
:body => 'some message article_inbound 😍😍😍',
:internal => false,
:sender => Ticket::Article::Sender.where(:name => 'Customer').first,
:type => Ticket::Article::Type.where(:name => 'email').first,
:updated_by_id => 1,
:created_by_id => 1,
)
assert_equal( article_inbound.body, 'some message article_inbound 😍😍😍'.utf8_to_3bytesutf8, 'article_inbound.body verify - inbound' )
@ -44,15 +44,15 @@ class TicketTest < ActiveSupport::TestCase
# create note article
article_note = Ticket::Article.create(
:ticket_id => ticket.id,
:from => 'some persion',
:subject => 'some note',
:body => 'some message',
:internal => true,
:ticket_article_sender => Ticket::Article::Sender.where(:name => 'Agent').first,
:ticket_article_type => Ticket::Article::Type.where(:name => 'note').first,
:updated_by_id => 1,
:created_by_id => 1,
:ticket_id => ticket.id,
:from => 'some persion',
:subject => 'some note',
:body => 'some message',
:internal => true,
:sender => Ticket::Article::Sender.where(:name => 'Agent').first,
:type => Ticket::Article::Type.where(:name => 'note').first,
:updated_by_id => 1,
:created_by_id => 1,
)
ticket = Ticket.find(ticket.id)
@ -66,17 +66,17 @@ class TicketTest < ActiveSupport::TestCase
# create outbound article
sleep 10
article_outbound = Ticket::Article.create(
:ticket_id => ticket.id,
:from => 'some_recipient@example.com',
:to => 'some_sender@example.com',
:subject => 'some subject',
:message_id => 'some@id2',
:body => 'some message 2',
:internal => false,
:ticket_article_sender => Ticket::Article::Sender.where(:name => 'Agent').first,
:ticket_article_type => Ticket::Article::Type.where(:name => 'email').first,
:updated_by_id => 1,
:created_by_id => 1,
:ticket_id => ticket.id,
:from => 'some_recipient@example.com',
:to => 'some_sender@example.com',
:subject => 'some subject',
:message_id => 'some@id2',
:body => 'some message 2',
:internal => false,
:sender => Ticket::Article::Sender.where(:name => 'Agent').first,
:type => Ticket::Article::Type.where(:name => 'email').first,
:updated_by_id => 1,
:created_by_id => 1,
)
ticket = Ticket.find(ticket.id)
@ -87,7 +87,7 @@ class TicketTest < ActiveSupport::TestCase
assert_equal( ticket.first_response.to_s, article_outbound.created_at.to_s, 'ticket.first_response verify - outbound' )
assert_equal( ticket.close_time, nil, 'ticket.close_time verify - outbound' )
ticket.ticket_state_id = Ticket::State.where(:name => 'closed').first.id
ticket.state_id = Ticket::State.where(:name => 'closed').first.id
ticket.save
ticket = Ticket.find(ticket.id)
@ -112,15 +112,15 @@ class TicketTest < ActiveSupport::TestCase
assert( delete, "ticket destroy_all" )
ticket = Ticket.create(
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:ticket_state => Ticket::State.lookup( :name => 'new' ),
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-03-21 09:30:00 UTC',
:updated_at => '2013-03-21 09:30:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-03-21 09:30:00 UTC',
:updated_at => '2013-03-21 09:30:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "ticket created" )
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
@ -150,7 +150,7 @@ class TicketTest < ActiveSupport::TestCase
sla = Sla.create(
:name => 'test sla 2',
:condition => { "tickets.ticket_priority_id" =>["1", "2", "3"] },
:condition => { "tickets.priority_id" =>["1", "2", "3"] },
:data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "8:00",
@ -296,7 +296,7 @@ class TicketTest < ActiveSupport::TestCase
# set close time over time
ticket.update_attributes(
:ticket_state => Ticket::State.lookup( :name => 'closed' )
:state => Ticket::State.lookup( :name => 'closed' )
)
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify 9' )
@ -317,37 +317,37 @@ class TicketTest < ActiveSupport::TestCase
assert( delete, "ticket destroy" )
ticket = Ticket.create(
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:ticket_state => Ticket::State.lookup( :name => 'new' ),
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
:updated_by_id => 1,
:created_by_id => 1,
:created_at => '2013-03-28 23:49:00 UTC',
:updated_at => '2013-03-28 23:49:00 UTC',
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
:updated_by_id => 1,
:created_by_id => 1,
:created_at => '2013-03-28 23:49:00 UTC',
:updated_at => '2013-03-28 23:49:00 UTC',
)
assert( ticket, "ticket created" )
assert_equal( ticket.title, 'some title äöüß', 'ticket.title verify' )
assert_equal( ticket.group.name, 'Users', 'ticket.group verify' )
assert_equal( ticket.ticket_state.name, 'new', 'ticket.state verify' )
assert_equal( ticket.state.name, 'new', 'ticket.state verify' )
# create inbound article
article_inbound = Ticket::Article.create(
:ticket_id => ticket.id,
:from => 'some_sender@example.com',
:to => 'some_recipient@example.com',
:subject => 'some subject',
:message_id => 'some@id',
:body => 'some message',
:internal => false,
:ticket_article_sender => Ticket::Article::Sender.where(:name => 'Customer').first,
:ticket_article_type => Ticket::Article::Type.where(:name => 'email').first,
:updated_by_id => 1,
:created_by_id => 1,
:created_at => '2013-03-28 23:49:00 UTC',
:updated_at => '2013-03-28 23:49:00 UTC',
:ticket_id => ticket.id,
:from => 'some_sender@example.com',
:to => 'some_recipient@example.com',
:subject => 'some subject',
:message_id => 'some@id',
:body => 'some message',
:internal => false,
:sender => Ticket::Article::Sender.where(:name => 'Customer').first,
:type => Ticket::Article::Type.where(:name => 'email').first,
:updated_by_id => 1,
:created_by_id => 1,
:created_at => '2013-03-28 23:49:00 UTC',
:updated_at => '2013-03-28 23:49:00 UTC',
)
ticket = Ticket.find(ticket.id)
assert_equal( ticket.article_count, 1, 'ticket.article_count verify - inbound' )
@ -359,19 +359,19 @@ class TicketTest < ActiveSupport::TestCase
# create outbound article
article_outbound = Ticket::Article.create(
:ticket_id => ticket.id,
:from => 'some_recipient@example.com',
:to => 'some_sender@example.com',
:subject => 'some subject',
:message_id => 'some@id2',
:body => 'some message 2',
:internal => false,
:ticket_article_sender => Ticket::Article::Sender.where(:name => 'Agent').first,
:ticket_article_type => Ticket::Article::Type.where(:name => 'email').first,
:updated_by_id => 1,
:created_by_id => 1,
:created_at => '2013-03-29 08:00:03 UTC',
:updated_at => '2013-03-29 08:00:03 UTC',
:ticket_id => ticket.id,
:from => 'some_recipient@example.com',
:to => 'some_sender@example.com',
:subject => 'some subject',
:message_id => 'some@id2',
:body => 'some message 2',
:internal => false,
:sender => Ticket::Article::Sender.where(:name => 'Agent').first,
:type => Ticket::Article::Type.where(:name => 'email').first,
:updated_by_id => 1,
:created_by_id => 1,
:created_at => '2013-03-29 08:00:03 UTC',
:updated_at => '2013-03-29 08:00:03 UTC',
)
ticket = Ticket.find(ticket.id)
@ -389,36 +389,36 @@ class TicketTest < ActiveSupport::TestCase
ticket = Ticket.create(
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:ticket_state => Ticket::State.lookup( :name => 'new' ),
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
:updated_by_id => 1,
:created_by_id => 1,
:created_at => '2013-03-28 23:49:00 UTC',
:updated_at => '2013-03-28 23:49:00 UTC',
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
:updated_by_id => 1,
:created_by_id => 1,
:created_at => '2013-03-28 23:49:00 UTC',
:updated_at => '2013-03-28 23:49:00 UTC',
)
assert( ticket, "ticket created" )
assert_equal( ticket.title, 'some title äöüß', 'ticket.title verify' )
assert_equal( ticket.group.name, 'Users', 'ticket.group verify' )
assert_equal( ticket.ticket_state.name, 'new', 'ticket.state verify' )
assert_equal( ticket.state.name, 'new', 'ticket.state verify' )
# create inbound article
article_inbound = Ticket::Article.create(
:ticket_id => ticket.id,
:from => 'some_sender@example.com',
:subject => 'some subject',
:message_id => 'some@id',
:body => 'some message',
:internal => false,
:ticket_article_sender => Ticket::Article::Sender.where(:name => 'Customer').first,
:ticket_article_type => Ticket::Article::Type.where(:name => 'phone').first,
:updated_by_id => 1,
:created_by_id => 1,
:created_at => '2013-03-28 23:49:00 UTC',
:updated_at => '2013-03-28 23:49:00 UTC',
:ticket_id => ticket.id,
:from => 'some_sender@example.com',
:subject => 'some subject',
:message_id => 'some@id',
:body => 'some message',
:internal => false,
:sender => Ticket::Article::Sender.where(:name => 'Customer').first,
:type => Ticket::Article::Type.where(:name => 'phone').first,
:updated_by_id => 1,
:created_by_id => 1,
:created_at => '2013-03-28 23:49:00 UTC',
:updated_at => '2013-03-28 23:49:00 UTC',
)
ticket = Ticket.find(ticket.id)
assert_equal( ticket.article_count, 1, 'ticket.article_count verify - inbound' )
@ -444,15 +444,15 @@ class TicketTest < ActiveSupport::TestCase
assert( delete, "ticket destroy_all" )
ticket = Ticket.create(
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:ticket_state => Ticket::State.lookup( :name => 'new' ),
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-03-21 09:30:00 UTC',
:updated_at => '2013-03-21 09:30:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-03-21 09:30:00 UTC',
:updated_at => '2013-03-21 09:30:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "ticket created" )
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
@ -486,15 +486,15 @@ class TicketTest < ActiveSupport::TestCase
delete = ticket.destroy
assert( delete, "ticket destroy" )
ticket = Ticket.create(
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:ticket_state => Ticket::State.lookup( :name => 'new' ),
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-10-21 09:30:00 UTC',
:updated_at => '2013-10-21 09:30:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-10-21 09:30:00 UTC',
:updated_at => '2013-10-21 09:30:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "ticket created" )
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
@ -529,15 +529,15 @@ class TicketTest < ActiveSupport::TestCase
assert( delete, "sla destroy" )
ticket = Ticket.create(
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:ticket_state => Ticket::State.lookup( :name => 'new' ),
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-10-21 06:30:00 UTC',
:updated_at => '2013-10-21 06:30:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-10-21 06:30:00 UTC',
:updated_at => '2013-10-21 06:30:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "ticket created" )
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
@ -575,15 +575,15 @@ class TicketTest < ActiveSupport::TestCase
test 'ticket escalation suspend' do
ticket = Ticket.create(
:title => 'some title äöüß3',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:ticket_state => Ticket::State.lookup( :name => 'new' ),
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-06-04 09:00:00 UTC',
:updated_at => '2013-06-04 09:00:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
:title => 'some title äöüß3',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:state => Ticket::State.lookup( :name => 'new' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-06-04 09:00:00 UTC',
:updated_at => '2013-06-04 09:00:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, 'ticket created' )
@ -591,7 +591,7 @@ class TicketTest < ActiveSupport::TestCase
History.add(
:history_type => 'updated',
:history_object => 'Ticket',
:history_attribute => 'ticket_state',
:history_attribute => 'state',
:o_id => ticket.id,
:id_to => 3,
:id_from => 2,
@ -606,7 +606,7 @@ class TicketTest < ActiveSupport::TestCase
History.add(
:history_type => 'updated',
:history_object => 'Ticket',
:history_attribute => 'ticket_state',
:history_attribute => 'state',
:o_id => ticket.id,
:id_to => 2,
:id_from => 3,
@ -631,7 +631,7 @@ class TicketTest < ActiveSupport::TestCase
History.add(
:history_type => 'updated',
:history_object => 'Ticket',
:history_attribute => 'ticket_state',
:history_attribute => 'state',
:o_id => ticket.id,
:id_to => 3,
:id_from => 2,
@ -680,15 +680,15 @@ class TicketTest < ActiveSupport::TestCase
# test Ticket created in state pending and closed without reopen or state change
ticket = Ticket.create(
:title => 'some title äöüß3',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:ticket_state => Ticket::State.lookup( :name => 'pending' ),
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-06-04 09:00:00 UTC',
:updated_at => '2013-06-04 09:00:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
:title => 'some title äöüß3',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:state => Ticket::State.lookup( :name => 'pending' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-06-04 09:00:00 UTC',
:updated_at => '2013-06-04 09:00:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, 'ticket created' )
@ -697,7 +697,7 @@ class TicketTest < ActiveSupport::TestCase
History.add(
:history_type => 'updated',
:history_object => 'Ticket',
:history_attribute => 'ticket_state',
:history_attribute => 'state',
:o_id => ticket.id,
:id_to => 4,
:id_from => 3,
@ -746,15 +746,15 @@ class TicketTest < ActiveSupport::TestCase
# test Ticket created in state pending, changed state to openen, back to pending and closed
ticket = Ticket.create(
:title => 'some title äöüß3',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:ticket_state => Ticket::State.lookup( :name => 'pending' ),
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-06-04 09:00:00 UTC',
:updated_at => '2013-06-04 09:00:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
:title => 'some title äöüß3',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:state => Ticket::State.lookup( :name => 'pending' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-06-04 09:00:00 UTC',
:updated_at => '2013-06-04 09:00:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, 'ticket created' )
@ -762,7 +762,7 @@ class TicketTest < ActiveSupport::TestCase
History.add(
:history_type => 'updated',
:history_object => 'Ticket',
:history_attribute => 'ticket_state',
:history_attribute => 'state',
:o_id => ticket.id,
:id_to => 2,
:id_from => 3,
@ -777,7 +777,7 @@ class TicketTest < ActiveSupport::TestCase
History.add(
:history_type => 'updated',
:history_object => 'Ticket',
:history_attribute => 'ticket_state',
:history_attribute => 'state',
:o_id => ticket.id,
:id_to => 3,
:id_from => 2,
@ -792,7 +792,7 @@ class TicketTest < ActiveSupport::TestCase
History.add(
:history_type => 'updated',
:history_object => 'Ticket',
:history_attribute => 'ticket_state',
:history_attribute => 'state',
:o_id => ticket.id,
:id_to => 4,
:id_from => 3,
@ -841,15 +841,15 @@ class TicketTest < ActiveSupport::TestCase
### Test Ticket created in state pending, changed state to openen, back to pending and back to open then
### close ticket
ticket = Ticket.create(
:title => 'some title äöüß3',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:ticket_state => Ticket::State.lookup( :name => 'pending' ),
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-06-04 09:00:00 UTC',
:updated_at => '2013-06-04 09:00:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
:title => 'some title äöüß3',
:group => Group.lookup( :name => 'Users'),
:customer_id => 2,
:state => Ticket::State.lookup( :name => 'pending' ),
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
:created_at => '2013-06-04 09:00:00 UTC',
:updated_at => '2013-06-04 09:00:00 UTC',
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, 'ticket created' )
@ -857,7 +857,7 @@ class TicketTest < ActiveSupport::TestCase
History.add(
:history_type => 'updated',
:history_object => 'Ticket',
:history_attribute => 'ticket_state',
:history_attribute => 'state',
:o_id => ticket.id,
:id_to => 2,
:id_from => 3,
@ -872,7 +872,7 @@ class TicketTest < ActiveSupport::TestCase
History.add(
:history_type => 'updated',
:history_object => 'Ticket',
:history_attribute => 'ticket_state',
:history_attribute => 'state',
:o_id => ticket.id,
:id_to => 3,
:id_from => 2,
@ -887,7 +887,7 @@ class TicketTest < ActiveSupport::TestCase
History.add(
:history_type => 'updated',
:history_object => 'Ticket',
:history_attribute => 'ticket_state',
:history_attribute => 'state',
:o_id => ticket.id,
:id_to => 2,
:id_from => 3,
@ -902,7 +902,7 @@ class TicketTest < ActiveSupport::TestCase
History.add(
:history_type => 'updated',
:history_object => 'Ticket',
:history_attribute => 'ticket_state',
:history_attribute => 'state',
:o_id => ticket.id,
:id_to => 4,
:id_from => 3,

View file

@ -59,26 +59,26 @@ class TwitterTest < ActiveSupport::TestCase
hash = '#citheo42' + rand(9999).to_s
text = 'Today the weather is really nice... ' + hash
ticket = Ticket.create(
:group_id => group.id,
:customer_id => user.id,
:title => text[0,40],
:ticket_state_id => state.id,
:ticket_priority_id => priority.id,
:updated_by_id => 1,
:created_by_id => 1,
:group_id => group.id,
:customer_id => user.id,
:title => text[0,40],
:state_id => state.id,
:priority_id => priority.id,
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "outbound ticket created" )
article = Ticket::Article.create(
:ticket_id => ticket.id,
:ticket_article_type_id => Ticket::Article::Type.where( :name => 'twitter status' ).first.id,
:ticket_article_sender_id => Ticket::Article::Sender.where( :name => 'Agent' ).first.id,
:body => text,
# :from => sender.name,
# :to => to,
# :message_id => tweet.id,
:internal => false,
:updated_by_id => 1,
:created_by_id => 1,
:ticket_id => ticket.id,
:type_id => Ticket::Article::Type.where( :name => 'twitter status' ).first.id,
:sender_id => Ticket::Article::Sender.where( :name => 'Agent' ).first.id,
:body => text,
# :from => sender.name,
# :to => to,
# :message_id => tweet.id,
:internal => false,
:updated_by_id => 1,
:created_by_id => 1,
)
assert( article, "outbound article created" )
assert_equal( article.ticket.articles.count, 1 )
@ -173,19 +173,19 @@ class TwitterTest < ActiveSupport::TestCase
assert( ticket.articles, "ticket.articles exists" )
article_count = ticket.articles.count
assert( article_count )
# assert_equal( ticket.ticket_state.name, 'new' )
# assert_equal( ticket.state.name, 'new' )
# reply via ticket
outbound_article = Ticket::Article.create(
:ticket_id => ticket.id,
:ticket_article_type_id => Ticket::Article::Type.where( :name => 'twitter direct-message' ).first.id,
:ticket_article_sender_id => Ticket::Article::Sender.where( :name => 'Agent' ).first.id,
:body => text,
# :from => sender.name,
:to => 'me_bauer',
:internal => false,
:updated_by_id => 1,
:created_by_id => 1,
:ticket_id => ticket.id,
:type_id => Ticket::Article::Type.where( :name => 'twitter direct-message' ).first.id,
:sender_id => Ticket::Article::Sender.where( :name => 'Agent' ).first.id,
:body => text,
# :from => sender.name,
:to => 'me_bauer',
:internal => false,
:updated_by_id => 1,
:created_by_id => 1,
)
assert( outbound_article, "outbound article created" )
assert_equal( outbound_article.ticket.articles.count, article_count + 1 )