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:
parent
569d6e0233
commit
065fbb2bba
33 changed files with 613 additions and 600 deletions
|
@ -145,8 +145,8 @@ class TicketsController < ApplicationController
|
||||||
|
|
||||||
# open tickets by customer
|
# open tickets by customer
|
||||||
ticket_list = Ticket.where(
|
ticket_list = Ticket.where(
|
||||||
:customer_id => ticket.customer_id,
|
:customer_id => ticket.customer_id,
|
||||||
:ticket_state_id => Ticket::State.by_category( 'open' )
|
:state_id => Ticket::State.by_category( 'open' )
|
||||||
)
|
)
|
||||||
.where( 'id != ?', [ ticket.id ] )
|
.where( 'id != ?', [ ticket.id ] )
|
||||||
.order('created_at DESC')
|
.order('created_at DESC')
|
||||||
|
|
|
@ -364,16 +364,16 @@ class Channel::EmailParser
|
||||||
|
|
||||||
# set ticket state to open if not new
|
# set ticket state to open if not new
|
||||||
if ticket
|
if ticket
|
||||||
ticket_state = Ticket::State.find( ticket.ticket_state_id )
|
state = Ticket::State.find( ticket.state_id )
|
||||||
ticket_state_type = Ticket::StateType.find( ticket_state.state_type_id )
|
state_type = Ticket::StateType.find( state.state_type_id )
|
||||||
|
|
||||||
# if tickte is merged, find linked ticket
|
# if tickte is merged, find linked ticket
|
||||||
if ticket_state_type.name == 'merged'
|
if state_type.name == 'merged'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if ticket_state_type.name != 'new'
|
if state_type.name != 'new'
|
||||||
ticket.ticket_state = Ticket::State.where( :name => 'open' ).first
|
ticket.state = Ticket::State.where( :name => 'open' ).first
|
||||||
ticket.save
|
ticket.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -386,8 +386,8 @@ class Channel::EmailParser
|
||||||
:group_id => channel[:group_id] || 1,
|
:group_id => channel[:group_id] || 1,
|
||||||
:customer_id => user.id,
|
:customer_id => user.id,
|
||||||
:title => mail[:subject] || '',
|
:title => mail[:subject] || '',
|
||||||
:ticket_state_id => Ticket::State.where( :name => 'new' ).first.id,
|
:state_id => Ticket::State.where( :name => 'new' ).first.id,
|
||||||
:ticket_priority_id => Ticket::Priority.where( :name => '2 normal' ).first.id,
|
:priority_id => Ticket::Priority.where( :name => '2 normal' ).first.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
set_attributes_by_x_headers( ticket, 'ticket', mail )
|
set_attributes_by_x_headers( ticket, 'ticket', mail )
|
||||||
|
@ -400,16 +400,16 @@ class Channel::EmailParser
|
||||||
|
|
||||||
# set attributes
|
# set attributes
|
||||||
article = Ticket::Article.new(
|
article = Ticket::Article.new(
|
||||||
:ticket_id => ticket.id,
|
:ticket_id => ticket.id,
|
||||||
:ticket_article_type_id => Ticket::Article::Type.where( :name => 'email' ).first.id,
|
:type_id => Ticket::Article::Type.where( :name => 'email' ).first.id,
|
||||||
:ticket_article_sender_id => Ticket::Article::Sender.where( :name => 'Customer' ).first.id,
|
:sender_id => Ticket::Article::Sender.where( :name => 'Customer' ).first.id,
|
||||||
:body => mail[:body],
|
:body => mail[:body],
|
||||||
:from => mail[:from],
|
:from => mail[:from],
|
||||||
:to => mail[:to],
|
:to => mail[:to],
|
||||||
:cc => mail[:cc],
|
:cc => mail[:cc],
|
||||||
:subject => mail[:subject],
|
:subject => mail[:subject],
|
||||||
:message_id => mail[:message_id],
|
:message_id => mail[:message_id],
|
||||||
:internal => false,
|
:internal => false,
|
||||||
)
|
)
|
||||||
|
|
||||||
# x-headers lookup
|
# x-headers lookup
|
||||||
|
|
|
@ -195,8 +195,8 @@ class Channel::Twitter2
|
||||||
if @article_type == 'twitter direct-message'
|
if @article_type == 'twitter direct-message'
|
||||||
ticket = Ticket.where( :customer_id => user.id ).first
|
ticket = Ticket.where( :customer_id => user.id ).first
|
||||||
if ticket
|
if ticket
|
||||||
ticket_state_type = Ticket::StateType.where( ticket.ticket_state.state_type_id )
|
state_type = Ticket::StateType.where( ticket.state.state_type_id )
|
||||||
if ticket_state_type.name == 'closed' || ticket_state_type.name == 'closed'
|
if state_type.name == 'closed' || state_type.name == 'closed'
|
||||||
ticket = nil
|
ticket = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -218,11 +218,11 @@ class Channel::Twitter2
|
||||||
priority_id = priority.id
|
priority_id = priority.id
|
||||||
end
|
end
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
:group_id => group_id,
|
:group_id => group_id,
|
||||||
:customer_id => user.id,
|
:customer_id => user.id,
|
||||||
:title => tweet.text[0,40],
|
:title => tweet.text[0,40],
|
||||||
:ticket_state_id => state_id,
|
:state_id => state_id,
|
||||||
:ticket_priority_id => priority_id,
|
:priority_id => priority_id,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -236,8 +236,8 @@ class Channel::Twitter2
|
||||||
return article if article
|
return article if article
|
||||||
|
|
||||||
# set ticket state to open if not new
|
# set ticket state to open if not new
|
||||||
if ticket.ticket_state.name != 'new'
|
if ticket.state.name != 'new'
|
||||||
ticket.ticket_state = Ticket::State.where( :name => 'open' ).first
|
ticket.state = Ticket::State.where( :name => 'open' ).first
|
||||||
ticket.save
|
ticket.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -248,14 +248,14 @@ class Channel::Twitter2
|
||||||
end
|
end
|
||||||
|
|
||||||
article = Ticket::Article.create(
|
article = Ticket::Article.create(
|
||||||
:ticket_id => ticket.id,
|
:ticket_id => ticket.id,
|
||||||
:ticket_article_type_id => Ticket::Article::Type.where( :name => @article_type ).first.id,
|
:type_id => Ticket::Article::Type.where( :name => @article_type ).first.id,
|
||||||
:ticket_article_sender_id => Ticket::Article::Sender.where( :name => 'Customer' ).first.id,
|
:sender_id => Ticket::Article::Sender.where( :name => 'Customer' ).first.id,
|
||||||
:body => tweet.text,
|
:body => tweet.text,
|
||||||
:from => sender.name,
|
:from => sender.name,
|
||||||
:to => to,
|
:to => to,
|
||||||
:message_id => tweet.id,
|
:message_id => tweet.id,
|
||||||
:internal => false,
|
:internal => false,
|
||||||
)
|
)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,7 +21,7 @@ add a new history entry for an object
|
||||||
History.add(
|
History.add(
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_object => 'Ticket',
|
:history_object => 'Ticket',
|
||||||
:history_attribute => 'ticket_state',
|
:history_attribute => 'state',
|
||||||
:o_id => ticket.id,
|
:o_id => ticket.id,
|
||||||
:id_to => 3,
|
:id_to => 3,
|
||||||
:id_from => 2,
|
:id_from => 2,
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
class Network < ApplicationModel
|
class Network < ApplicationModel
|
||||||
# belongs_to :group
|
# belongs_to :group
|
||||||
# belongs_to :ticket_state, :class_name => 'Ticket::State'
|
# belongs_to :state, :class_name => 'Ticket::State'
|
||||||
# belongs_to :ticket_priority, :class_name => 'Ticket::Priority'
|
# belongs_to :priority, :class_name => 'Ticket::Priority'
|
||||||
|
|
||||||
class Category < ApplicationModel
|
class Category < ApplicationModel
|
||||||
self.table_name = 'network_categories'
|
self.table_name = 'network_categories'
|
||||||
|
|
|
@ -9,12 +9,12 @@ class Observer::Ticket::Article::CommunicateEmail < ActiveRecord::Observer
|
||||||
return if Setting.get('import_mode')
|
return if Setting.get('import_mode')
|
||||||
|
|
||||||
# if sender is customer, do not communication
|
# 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 == nil
|
||||||
return 1 if sender['name'] == 'Customer'
|
return 1 if sender['name'] == 'Customer'
|
||||||
|
|
||||||
# only apply on emails
|
# 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'
|
return if type['name'] != 'email'
|
||||||
|
|
||||||
# send background job
|
# send background job
|
||||||
|
|
|
@ -9,12 +9,12 @@ class Observer::Ticket::Article::CommunicateFacebook < ActiveRecord::Observer
|
||||||
return if Setting.get('import_mode')
|
return if Setting.get('import_mode')
|
||||||
|
|
||||||
# if sender is customer, do not communication
|
# 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 == nil
|
||||||
return 1 if sender['name'] == 'Customer'
|
return 1 if sender['name'] == 'Customer'
|
||||||
|
|
||||||
# only apply on emails
|
# 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'
|
return if type['name'] != 'facebook'
|
||||||
|
|
||||||
a = Channel::Facebook.new
|
a = Channel::Facebook.new
|
||||||
|
|
|
@ -9,12 +9,12 @@ class Observer::Ticket::Article::CommunicateTwitter < ActiveRecord::Observer
|
||||||
return if Setting.get('import_mode')
|
return if Setting.get('import_mode')
|
||||||
|
|
||||||
# if sender is customer, do not communication
|
# 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 == nil
|
||||||
return 1 if sender['name'] == 'Customer'
|
return 1 if sender['name'] == 'Customer'
|
||||||
|
|
||||||
# only apply on tweets
|
# 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'
|
return if type['name'] != 'twitter direct-message' && type['name'] != 'twitter status'
|
||||||
|
|
||||||
a = Channel::Twitter2.new
|
a = Channel::Twitter2.new
|
||||||
|
|
|
@ -9,12 +9,12 @@ class Observer::Ticket::Article::FillupFromEmail < ActiveRecord::Observer
|
||||||
return if Setting.get('import_mode')
|
return if Setting.get('import_mode')
|
||||||
|
|
||||||
# if sender is customer, do not change anything
|
# 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 == nil
|
||||||
return if sender['name'] == 'Customer'
|
return if sender['name'] == 'Customer'
|
||||||
|
|
||||||
# set email attributes
|
# 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'
|
return if type['name'] != 'email'
|
||||||
|
|
||||||
# set subject if empty
|
# set subject if empty
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Observer::Ticket::Article::FillupFromGeneral < ActiveRecord::Observer
|
||||||
return if Setting.get('import_mode')
|
return if Setting.get('import_mode')
|
||||||
|
|
||||||
# if sender is customer, do not change anything
|
# 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 == nil
|
||||||
return if sender['name'] == 'Customer'
|
return if sender['name'] == 'Customer'
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ class Observer::Ticket::ArticleSenderType < ActiveRecord::Observer
|
||||||
count = Ticket::Article.where( :ticket_id => record.ticket_id ).count
|
count = Ticket::Article.where( :ticket_id => record.ticket_id ).count
|
||||||
return if count > 1
|
return if count > 1
|
||||||
|
|
||||||
record.ticket.create_article_type_id = record.ticket_article_type_id
|
record.ticket.create_article_type_id = record.type_id
|
||||||
record.ticket.create_article_sender_id = record.ticket_article_sender_id
|
record.ticket.create_article_sender_id = record.sender_id
|
||||||
|
|
||||||
# save ticket
|
# save ticket
|
||||||
record.ticket.save
|
record.ticket.save
|
||||||
|
|
|
@ -22,9 +22,9 @@ class Observer::Ticket::CloseTime < ActiveRecord::Observer
|
||||||
return true if record.close_time
|
return true if record.close_time
|
||||||
|
|
||||||
# check if ticket is closed now
|
# check if ticket is closed now
|
||||||
ticket_state = Ticket::State.lookup( :id => record.ticket_state_id )
|
state = Ticket::State.lookup( :id => record.state_id )
|
||||||
ticket_state_type = Ticket::StateType.lookup( :id => ticket_state.state_type_id )
|
state_type = Ticket::StateType.lookup( :id => state.state_type_id )
|
||||||
return true if ticket_state_type.name != 'closed'
|
return true if state_type.name != 'closed'
|
||||||
|
|
||||||
# set close_time
|
# set close_time
|
||||||
record.close_time = Time.now
|
record.close_time = Time.now
|
||||||
|
|
|
@ -13,8 +13,8 @@ class Observer::Ticket::FirstResponse < ActiveRecord::Observer
|
||||||
return true if record.internal
|
return true if record.internal
|
||||||
|
|
||||||
# if sender is not agent
|
# if sender is not agent
|
||||||
sender = Ticket::Article::Sender.lookup( :id => record.ticket_article_sender_id )
|
sender = Ticket::Article::Sender.lookup( :id => record.sender_id )
|
||||||
type = Ticket::Article::Type.lookup( :id => record.ticket_article_type_id )
|
type = Ticket::Article::Type.lookup( :id => record.type_id )
|
||||||
if sender.name != 'Agent' && type.name !~ /^phone/
|
if sender.name != 'Agent' && type.name !~ /^phone/
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,10 +10,10 @@ class Observer::Ticket::LastContact < ActiveRecord::Observer
|
||||||
return true if record.internal
|
return true if record.internal
|
||||||
|
|
||||||
# if article is a message to customer
|
# 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
|
# 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'
|
if sender.name == 'Customer'
|
||||||
|
|
||||||
# check if last communication is done by agent, else do not set last_contact_customer
|
# check if last communication is done by agent, else do not set last_contact_customer
|
||||||
|
|
|
@ -49,11 +49,11 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
|
||||||
:subject => 'New Ticket (#{ticket.title})',
|
:subject => 'New Ticket (#{ticket.title})',
|
||||||
:body => 'Hi #{recipient.firstname},
|
: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}
|
Group: #{ticket.group.name}
|
||||||
Owner: #{ticket.owner.firstname} #{ticket.owner.lastname}
|
Owner: #{ticket.owner.firstname} #{ticket.owner.lastname}
|
||||||
State: i18n(#{ticket.ticket_state.name})
|
State: i18n(#{ticket.state.name})
|
||||||
|
|
||||||
From: #{article.from}
|
From: #{article.from}
|
||||||
<snip>
|
<snip>
|
||||||
|
@ -72,7 +72,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
|
||||||
if event[:name] == 'Ticket' && event[:type] == 'create'
|
if event[:name] == 'Ticket' && event[:type] == 'create'
|
||||||
|
|
||||||
# only for incoming emails
|
# 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'
|
puts 'send new ticket notify to customer'
|
||||||
send_notify(
|
send_notify(
|
||||||
|
@ -107,7 +107,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
|
||||||
|
|
||||||
puts 'send new ticket::article notify'
|
puts 'send new ticket::article notify'
|
||||||
|
|
||||||
if article.ticket_article_sender.name == 'Customer'
|
if article.sender.name == 'Customer'
|
||||||
send_notify(
|
send_notify(
|
||||||
{
|
{
|
||||||
:event => event,
|
:event => event,
|
||||||
|
@ -115,11 +115,11 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
|
||||||
:subject => 'Follow Up (#{ticket.title})',
|
:subject => 'Follow Up (#{ticket.title})',
|
||||||
:body => 'Hi #{recipient.firstname},
|
: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}
|
Group: #{ticket.group.name}
|
||||||
Owner: #{ticket.owner.firstname} #{ticket.owner.lastname}
|
Owner: #{ticket.owner.firstname} #{ticket.owner.lastname}
|
||||||
State: i18n(#{ticket.ticket_state.name})
|
State: i18n(#{ticket.state.name})
|
||||||
|
|
||||||
From: #{article.from}
|
From: #{article.from}
|
||||||
<snip>
|
<snip>
|
||||||
|
@ -136,7 +136,7 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
|
||||||
|
|
||||||
# send new note notification to owner
|
# send new note notification to owner
|
||||||
# if agent == created.id
|
# 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(
|
send_notify(
|
||||||
{
|
{
|
||||||
:event => event,
|
:event => event,
|
||||||
|
@ -144,11 +144,11 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
|
||||||
:subject => 'Updated (#{ticket.title})',
|
:subject => 'Updated (#{ticket.title})',
|
||||||
:body => 'Hi #{recipient.firstname},
|
: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}
|
Group: #{ticket.group.name}
|
||||||
Owner: #{ticket.owner.firstname} #{ticket.owner.lastname}
|
Owner: #{ticket.owner.firstname} #{ticket.owner.lastname}
|
||||||
State: i18n(#{ticket.ticket_state.name})
|
State: i18n(#{ticket.state.name})
|
||||||
|
|
||||||
From: #{article.from}
|
From: #{article.from}
|
||||||
<snip>
|
<snip>
|
||||||
|
|
|
@ -13,21 +13,21 @@ class Observer::Ticket::ResetNewState < ActiveRecord::Observer
|
||||||
return true if record.internal
|
return true if record.internal
|
||||||
|
|
||||||
# if sender is agent
|
# 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
|
# 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
|
# if current ticket state is still new
|
||||||
ticket = Ticket.lookup( :id => record.ticket_id )
|
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
|
# TODO: add config option to state managment in UI
|
||||||
state = Ticket::State.lookup( :name => 'open' )
|
state = Ticket::State.lookup( :name => 'open' )
|
||||||
return if !state
|
return if !state
|
||||||
|
|
||||||
# set ticket to open
|
# set ticket to open
|
||||||
ticket.ticket_state_id = state.id
|
ticket.state_id = state.id
|
||||||
|
|
||||||
# save ticket
|
# save ticket
|
||||||
ticket.save
|
ticket.save
|
||||||
|
|
|
@ -14,17 +14,17 @@ class Observer::Ticket::UserTicketCounter < ActiveRecord::Observer
|
||||||
return if !record.customer_id
|
return if !record.customer_id
|
||||||
|
|
||||||
# open ticket count
|
# open ticket count
|
||||||
ticket_state_open = Ticket::State.by_category( 'open' )
|
state_open = Ticket::State.by_category( 'open' )
|
||||||
tickets_open = Ticket.where(
|
tickets_open = Ticket.where(
|
||||||
:customer_id => record.customer_id,
|
:customer_id => record.customer_id,
|
||||||
:ticket_state_id => ticket_state_open,
|
:state_id => state_open,
|
||||||
).count()
|
).count()
|
||||||
|
|
||||||
# closed ticket count
|
# closed ticket count
|
||||||
ticket_state_closed = Ticket::State.by_category( 'closed' )
|
state_closed = Ticket::State.by_category( 'closed' )
|
||||||
tickets_closed = Ticket.where(
|
tickets_closed = Ticket.where(
|
||||||
:customer_id => record.customer_id,
|
:customer_id => record.customer_id,
|
||||||
:ticket_state_id => ticket_state_closed,
|
:state_id => state_closed,
|
||||||
).count()
|
).count()
|
||||||
|
|
||||||
# check if update is needed
|
# check if update is needed
|
||||||
|
|
|
@ -4,13 +4,13 @@ class Ticket < ApplicationModel
|
||||||
include Ticket::Escalation
|
include Ticket::Escalation
|
||||||
include Ticket::Subject
|
include Ticket::Subject
|
||||||
include Ticket::Permission
|
include Ticket::Permission
|
||||||
require 'ticket/assets'
|
load 'ticket/assets.rb'
|
||||||
include Ticket::Assets
|
include Ticket::Assets
|
||||||
require 'ticket/history_log'
|
load 'ticket/history_log.rb'
|
||||||
include Ticket::HistoryLog
|
include Ticket::HistoryLog
|
||||||
require 'ticket/activity_stream_log'
|
load 'ticket/activity_stream_log.rb'
|
||||||
include Ticket::ActivityStreamLog
|
include Ticket::ActivityStreamLog
|
||||||
require 'ticket/search_index'
|
load 'ticket/search_index.rb'
|
||||||
include Ticket::SearchIndex
|
include Ticket::SearchIndex
|
||||||
extend Ticket::Search
|
extend Ticket::Search
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ class Ticket < ApplicationModel
|
||||||
belongs_to :group
|
belongs_to :group
|
||||||
has_many :articles, :class_name => 'Ticket::Article', :after_add => :cache_update, :after_remove => :cache_update
|
has_many :articles, :class_name => 'Ticket::Article', :after_add => :cache_update, :after_remove => :cache_update
|
||||||
belongs_to :organization
|
belongs_to :organization
|
||||||
belongs_to :ticket_state, :class_name => 'Ticket::State'
|
belongs_to :state, :class_name => 'Ticket::State'
|
||||||
belongs_to :ticket_priority, :class_name => 'Ticket::Priority'
|
belongs_to :priority, :class_name => 'Ticket::Priority'
|
||||||
belongs_to :owner, :class_name => 'User'
|
belongs_to :owner, :class_name => 'User'
|
||||||
belongs_to :customer, :class_name => 'User'
|
belongs_to :customer, :class_name => 'User'
|
||||||
belongs_to :created_by, :class_name => 'User'
|
belongs_to :created_by, :class_name => 'User'
|
||||||
|
@ -99,11 +99,11 @@ returns
|
||||||
|
|
||||||
# create new merge article
|
# create new merge article
|
||||||
Ticket::Article.create(
|
Ticket::Article.create(
|
||||||
:ticket_id => self.id,
|
:ticket_id => self.id,
|
||||||
:ticket_article_type_id => Ticket::Article::Type.lookup( :name => 'note' ).id,
|
:type_id => Ticket::Article::Type.lookup( :name => 'note' ).id,
|
||||||
:ticket_article_sender_id => Ticket::Article::Sender.lookup( :name => 'Agent' ).id,
|
:sender_id => Ticket::Article::Sender.lookup( :name => 'Agent' ).id,
|
||||||
:body => 'merged',
|
:body => 'merged',
|
||||||
:internal => false
|
:internal => false
|
||||||
)
|
)
|
||||||
|
|
||||||
# add history to both
|
# add history to both
|
||||||
|
@ -118,7 +118,7 @@ returns
|
||||||
)
|
)
|
||||||
|
|
||||||
# set state to 'merged'
|
# 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
|
# rest owner
|
||||||
self.owner_id = User.where( :login => '-' ).first.id
|
self.owner_id = User.where( :login => '-' ).first.id
|
||||||
|
|
|
@ -9,21 +9,21 @@ class Ticket::Article < ApplicationModel
|
||||||
include Ticket::Article::ActivityStreamLog
|
include Ticket::Article::ActivityStreamLog
|
||||||
|
|
||||||
belongs_to :ticket
|
belongs_to :ticket
|
||||||
belongs_to :ticket_article_type, :class_name => 'Ticket::Article::Type'
|
belongs_to :type, :class_name => 'Ticket::Article::Type'
|
||||||
belongs_to :ticket_article_sender, :class_name => 'Ticket::Article::Sender'
|
belongs_to :sender, :class_name => 'Ticket::Article::Sender'
|
||||||
belongs_to :created_by, :class_name => 'User'
|
belongs_to :created_by, :class_name => 'User'
|
||||||
after_create :notify_clients_after_create
|
after_create :notify_clients_after_create
|
||||||
after_update :notify_clients_after_update
|
after_update :notify_clients_after_update
|
||||||
after_destroy :notify_clients_after_destroy
|
after_destroy :notify_clients_after_destroy
|
||||||
|
|
||||||
activity_stream_support :ignore_attributes => {
|
activity_stream_support :ignore_attributes => {
|
||||||
:ticket_article_type_id => true,
|
:type_id => true,
|
||||||
:ticket_article_sender_id => true,
|
:sender_id => true,
|
||||||
}
|
}
|
||||||
|
|
||||||
history_support :ignore_attributes => {
|
history_support :ignore_attributes => {
|
||||||
:ticket_article_type_id => true,
|
:type_id => true,
|
||||||
:ticket_article_sender_id => true,
|
:sender_id => true,
|
||||||
}
|
}
|
||||||
|
|
||||||
class Flag < ApplicationModel
|
class Flag < ApplicationModel
|
||||||
|
|
|
@ -15,9 +15,9 @@ returns
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def self.rebuild_all
|
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|
|
tickets.each {|ticket|
|
||||||
ticket.escalation_calculation
|
ticket.escalation_calculation
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,8 @@ returns
|
||||||
def escalation_calculation
|
def escalation_calculation
|
||||||
|
|
||||||
# set escalation off if ticket is already closed
|
# set escalation off if ticket is already closed
|
||||||
ticket_state = Ticket::State.lookup( :id => self.ticket_state_id )
|
state = Ticket::State.lookup( :id => self.state_id )
|
||||||
if ticket_state.ignore_escalation?
|
if state.ignore_escalation?
|
||||||
|
|
||||||
# nothing to change
|
# nothing to change
|
||||||
return true if !self.escalation_time
|
return true if !self.escalation_time
|
||||||
|
@ -186,7 +186,7 @@ returns
|
||||||
elsif sla.condition
|
elsif sla.condition
|
||||||
hit = false
|
hit = false
|
||||||
map = [
|
map = [
|
||||||
[ 'tickets.ticket_priority_id', 'ticket_priority_id' ],
|
[ 'tickets.priority_id', 'priority_id' ],
|
||||||
[ 'tickets.group_id', 'group_id' ]
|
[ 'tickets.group_id', 'group_id' ]
|
||||||
]
|
]
|
||||||
map.each {|item|
|
map.each {|item|
|
||||||
|
@ -232,7 +232,7 @@ returns
|
||||||
|
|
||||||
# ignore if it isn't a state change
|
# ignore if it isn't a state change
|
||||||
next if !history_item['attribute']
|
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
|
# ignore all newer state before start_time
|
||||||
next if history_item['created_at'] < start_time
|
next if history_item['created_at'] < start_time
|
||||||
|
|
|
@ -45,7 +45,7 @@ returns
|
||||||
{
|
{
|
||||||
:type => 'updated',
|
:type => 'updated',
|
||||||
:object => 'Ticket',
|
:object => 'Ticket',
|
||||||
:attribute => 'ticket_priority',
|
:attribute => 'priority',
|
||||||
:o_id => 1,
|
:o_id => 1,
|
||||||
:id_to => 3,
|
:id_to => 3,
|
||||||
:id_from => 2,
|
:id_from => 2,
|
||||||
|
|
|
@ -32,12 +32,12 @@ list attributes
|
||||||
returns
|
returns
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
:ticket_article_type_id => ticket_article_type_ids,
|
:type_id => type_ids,
|
||||||
:ticket_state_id => ticket_state_ids,
|
:state_id => state_ids,
|
||||||
:ticket_priority_id => ticket_priority_ids,
|
:priority_id => priority_ids,
|
||||||
:owner_id => owner_ids,
|
:owner_id => owner_ids,
|
||||||
:group_id => group_ids,
|
:group_id => group_ids,
|
||||||
:group_id__owner_id => groups_users,
|
:group_id__owner_id => groups_users,
|
||||||
}
|
}
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
@ -51,19 +51,19 @@ returns
|
||||||
end
|
end
|
||||||
|
|
||||||
# get ticket states
|
# get ticket states
|
||||||
ticket_state_ids = []
|
state_ids = []
|
||||||
if params[:ticket]
|
if params[:ticket]
|
||||||
ticket_state_type = params[:ticket].ticket_state.state_type
|
state_type = params[:ticket].state.state_type
|
||||||
end
|
end
|
||||||
ticket_state_types = ['open', 'closed', 'pending action', 'pending reminder']
|
state_types = ['open', 'closed', 'pending action', 'pending reminder']
|
||||||
if ticket_state_type && !ticket_state_types.include?(ticket_state_type.name)
|
if state_type && !state_types.include?(state_type.name)
|
||||||
ticket_state_ids.push params[:ticket].ticket_state.id
|
state_ids.push params[:ticket].state.id
|
||||||
end
|
end
|
||||||
ticket_state_types.each {|type|
|
state_types.each {|type|
|
||||||
ticket_state_type = Ticket::StateType.where( :name => type ).first
|
state_type = Ticket::StateType.where( :name => type ).first
|
||||||
if ticket_state_type
|
if state_type
|
||||||
ticket_state_type.states.each {|ticket_state|
|
state_type.states.each {|state|
|
||||||
ticket_state_ids.push ticket_state.id
|
state_ids.push state.id
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -97,32 +97,32 @@ returns
|
||||||
}
|
}
|
||||||
|
|
||||||
# get priorities
|
# get priorities
|
||||||
ticket_priority_ids = []
|
priority_ids = []
|
||||||
Ticket::Priority.where( :active => true ).each { |priority|
|
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]
|
if params[:ticket]
|
||||||
ticket_article_types = ['note', 'phone']
|
types = ['note', 'phone']
|
||||||
if params[:ticket].group.email_address_id
|
if params[:ticket].group.email_address_id
|
||||||
ticket_article_types.push 'email'
|
types.push 'email'
|
||||||
end
|
end
|
||||||
ticket_article_types.each {|ticket_article_type_name|
|
types.each {|type_name|
|
||||||
ticket_article_type = Ticket::Article::Type.lookup( :name => ticket_article_type_name )
|
type = Ticket::Article::Type.lookup( :name => type_name )
|
||||||
if ticket_article_type
|
if type
|
||||||
ticket_article_type_ids.push ticket_article_type.id
|
type_ids.push type.id
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
:ticket_article_type_id => ticket_article_type_ids,
|
:type_id => type_ids,
|
||||||
:ticket_state_id => ticket_state_ids,
|
:state_id => state_ids,
|
||||||
:ticket_priority_id => ticket_priority_ids,
|
:priority_id => priority_ids,
|
||||||
:owner_id => owner_ids,
|
:owner_id => owner_ids,
|
||||||
:group_id => group_ids,
|
:group_id => group_ids,
|
||||||
:group_id__owner_id => groups_users,
|
:group_id__owner_id => groups_users,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -147,18 +147,18 @@ returns
|
||||||
def self.list_by_customer(data)
|
def self.list_by_customer(data)
|
||||||
|
|
||||||
# get closed/open states
|
# get closed/open states
|
||||||
ticket_state_list_open = Ticket::State.by_category( 'open' )
|
state_list_open = Ticket::State.by_category( 'open' )
|
||||||
ticket_state_list_closed = Ticket::State.by_category( 'closed' )
|
state_list_closed = Ticket::State.by_category( 'closed' )
|
||||||
|
|
||||||
# get tickets
|
# get tickets
|
||||||
tickets_open = Ticket.where(
|
tickets_open = Ticket.where(
|
||||||
:customer_id => data[:customer_id],
|
: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')
|
).limit( data[:limit] || 15 ).order('created_at DESC')
|
||||||
|
|
||||||
tickets_closed = Ticket.where(
|
tickets_closed = Ticket.where(
|
||||||
:customer_id => data[:customer_id],
|
: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')
|
).limit( data[:limit] || 15 ).order('created_at DESC')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -33,9 +33,9 @@ returns:
|
||||||
|
|
||||||
check if state is ignored for escalation
|
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:
|
returns:
|
||||||
|
|
||||||
|
|
12
db/migrate/20140608000001_update_ticket_replace.rb
Normal file
12
db/migrate/20140608000001_update_ticket_replace.rb
Normal 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
|
194
db/seeds.rb
194
db/seeds.rb
|
@ -16,7 +16,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => false,
|
:null => false,
|
||||||
:name => 'product_name',
|
:name => 'product_name',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -35,7 +35,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => false,
|
:null => false,
|
||||||
:name => 'organization',
|
:name => 'organization',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -54,7 +54,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'system_id',
|
:name => 'system_id',
|
||||||
:tag => 'select',
|
:tag => 'select',
|
||||||
:options => {
|
:options => {
|
||||||
'10' => '10',
|
'10' => '10',
|
||||||
|
@ -78,7 +78,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => false,
|
:null => false,
|
||||||
:name => 'fqdn',
|
:name => 'fqdn',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -96,7 +96,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'http_type',
|
:name => 'http_type',
|
||||||
:tag => 'select',
|
:tag => 'select',
|
||||||
:options => {
|
:options => {
|
||||||
'https' => 'https',
|
'https' => 'https',
|
||||||
|
@ -121,7 +121,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'storage',
|
:name => 'storage',
|
||||||
:tag => 'select',
|
:tag => 'select',
|
||||||
:options => {
|
:options => {
|
||||||
'DB' => 'Database',
|
'DB' => 'Database',
|
||||||
|
@ -188,7 +188,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'user_create_account',
|
:name => 'user_create_account',
|
||||||
:tag => 'boolean',
|
:tag => 'boolean',
|
||||||
:options => {
|
:options => {
|
||||||
true => 'yes',
|
true => 'yes',
|
||||||
|
@ -210,7 +210,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'user_lost_password',
|
:name => 'user_lost_password',
|
||||||
:tag => 'boolean',
|
:tag => 'boolean',
|
||||||
:options => {
|
:options => {
|
||||||
true => 'yes',
|
true => 'yes',
|
||||||
|
@ -232,7 +232,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'switch_to_user',
|
:name => 'switch_to_user',
|
||||||
:tag => 'boolean',
|
:tag => 'boolean',
|
||||||
:options => {
|
:options => {
|
||||||
true => 'yes',
|
true => 'yes',
|
||||||
|
@ -300,7 +300,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'auth_twitter',
|
:name => 'auth_twitter',
|
||||||
:tag => 'boolean',
|
:tag => 'boolean',
|
||||||
:options => {
|
:options => {
|
||||||
true => 'yes',
|
true => 'yes',
|
||||||
|
@ -322,13 +322,13 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => 'Twitter Key',
|
:display => 'Twitter Key',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'key',
|
:name => 'key',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:display => 'Twitter Secret',
|
:display => 'Twitter Secret',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'secret',
|
:name => 'secret',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -346,7 +346,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'auth_facebook',
|
:name => 'auth_facebook',
|
||||||
:tag => 'boolean',
|
:tag => 'boolean',
|
||||||
:options => {
|
:options => {
|
||||||
true => 'yes',
|
true => 'yes',
|
||||||
|
@ -369,13 +369,13 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => 'App ID',
|
:display => 'App ID',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'app_id',
|
:name => 'app_id',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:display => 'App Secret',
|
:display => 'App Secret',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'app_secret',
|
:name => 'app_secret',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -394,7 +394,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'auth_google_oauth2',
|
:name => 'auth_google_oauth2',
|
||||||
:tag => 'boolean',
|
:tag => 'boolean',
|
||||||
:options => {
|
:options => {
|
||||||
true => 'yes',
|
true => 'yes',
|
||||||
|
@ -416,13 +416,13 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => 'Client ID',
|
:display => 'Client ID',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'client_id',
|
:name => 'client_id',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:display => 'Client Secret',
|
:display => 'Client Secret',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'client_secret',
|
:name => 'client_secret',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -441,7 +441,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'auth_linkedin',
|
:name => 'auth_linkedin',
|
||||||
:tag => 'boolean',
|
:tag => 'boolean',
|
||||||
:options => {
|
:options => {
|
||||||
true => 'yes',
|
true => 'yes',
|
||||||
|
@ -463,13 +463,13 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => 'App ID',
|
:display => 'App ID',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'app_id',
|
:name => 'app_id',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:display => 'App Secret',
|
:display => 'App Secret',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'app_secret',
|
:name => 'app_secret',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -488,7 +488,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'password_min_size',
|
:name => 'password_min_size',
|
||||||
:tag => 'select',
|
:tag => 'select',
|
||||||
:options => {
|
:options => {
|
||||||
4 => 4,
|
4 => 4,
|
||||||
|
@ -517,7 +517,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'password_min_2_lower_2_upper_characters',
|
:name => 'password_min_2_lower_2_upper_characters',
|
||||||
:tag => 'select',
|
:tag => 'select',
|
||||||
:options => {
|
:options => {
|
||||||
1 => 'yes',
|
1 => 'yes',
|
||||||
|
@ -539,7 +539,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => 'Needed',
|
:display => 'Needed',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'password_need_digit',
|
:name => 'password_need_digit',
|
||||||
:tag => 'select',
|
:tag => 'select',
|
||||||
:options => {
|
:options => {
|
||||||
1 => 'yes',
|
1 => 'yes',
|
||||||
|
@ -561,7 +561,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'password_max_login_failed',
|
:name => 'password_max_login_failed',
|
||||||
:tag => 'select',
|
:tag => 'select',
|
||||||
:options => {
|
:options => {
|
||||||
4 => 4,
|
4 => 4,
|
||||||
|
@ -598,7 +598,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => false,
|
:null => false,
|
||||||
:name => 'ticket_hook',
|
:name => 'ticket_hook',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -616,7 +616,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'ticket_hook_divider',
|
:name => 'ticket_hook_divider',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -634,7 +634,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'ticket_hook_position',
|
:name => 'ticket_hook_position',
|
||||||
:tag => 'select',
|
:tag => 'select',
|
||||||
:options => {
|
:options => {
|
||||||
'left' => 'Left',
|
'left' => 'Left',
|
||||||
|
@ -657,7 +657,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => false,
|
:null => false,
|
||||||
:name => 'ticket_subject_size',
|
:name => 'ticket_subject_size',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -675,7 +675,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'ticket_subject_re',
|
:name => 'ticket_subject_re',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -709,7 +709,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'ticket_number',
|
:name => 'ticket_number',
|
||||||
:tag => 'select',
|
:tag => 'select',
|
||||||
:options => {
|
:options => {
|
||||||
'Ticket::Number::Increment' => 'Increment (SystemID.Counter)',
|
'Ticket::Number::Increment' => 'Increment (SystemID.Counter)',
|
||||||
|
@ -731,7 +731,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => 'Checksum',
|
:display => 'Checksum',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'checksum',
|
:name => 'checksum',
|
||||||
:tag => 'boolean',
|
:tag => 'boolean',
|
||||||
:options => {
|
:options => {
|
||||||
true => 'yes',
|
true => 'yes',
|
||||||
|
@ -741,7 +741,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => 'Min. size of number',
|
:display => 'Min. size of number',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'min_size',
|
:name => 'min_size',
|
||||||
:tag => 'select',
|
:tag => 'select',
|
||||||
:options => {
|
:options => {
|
||||||
1 => 1,
|
1 => 1,
|
||||||
|
@ -784,7 +784,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => 'Checksum',
|
:display => 'Checksum',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'checksum',
|
:name => 'checksum',
|
||||||
:tag => 'boolean',
|
:tag => 'boolean',
|
||||||
:options => {
|
:options => {
|
||||||
true => 'yes',
|
true => 'yes',
|
||||||
|
@ -809,7 +809,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'customer_ticket_create',
|
:name => 'customer_ticket_create',
|
||||||
:tag => 'boolean',
|
:tag => 'boolean',
|
||||||
:options => {
|
:options => {
|
||||||
true => 'yes',
|
true => 'yes',
|
||||||
|
@ -832,7 +832,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'group_ids',
|
:name => 'group_ids',
|
||||||
:tag => 'select',
|
:tag => 'select',
|
||||||
:multiple => true,
|
:multiple => true,
|
||||||
:null => false,
|
:null => false,
|
||||||
|
@ -856,7 +856,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'customer_ticket_view',
|
:name => 'customer_ticket_view',
|
||||||
:tag => 'boolean',
|
:tag => 'boolean',
|
||||||
:options => {
|
:options => {
|
||||||
true => 'yes',
|
true => 'yes',
|
||||||
|
@ -879,7 +879,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'ticket_define_email_from',
|
:name => 'ticket_define_email_from',
|
||||||
:tag => 'select',
|
:tag => 'select',
|
||||||
:options => {
|
:options => {
|
||||||
:SystemAddressName => 'System Address Display Name',
|
:SystemAddressName => 'System Address Display Name',
|
||||||
|
@ -902,7 +902,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => false,
|
:null => false,
|
||||||
:name => 'ticket_define_email_from_seperator',
|
:name => 'ticket_define_email_from_seperator',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -921,7 +921,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'postmaster_max_size',
|
:name => 'postmaster_max_size',
|
||||||
:tag => 'select',
|
:tag => 'select',
|
||||||
:options => {
|
:options => {
|
||||||
1 => 1,
|
1 => 1,
|
||||||
|
@ -962,7 +962,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'postmaster_follow_up_search_in',
|
:name => 'postmaster_follow_up_search_in',
|
||||||
:tag => 'checkbox',
|
:tag => 'checkbox',
|
||||||
:options => {
|
:options => {
|
||||||
'references' => 'References',
|
'references' => 'References',
|
||||||
|
@ -987,7 +987,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => false,
|
:null => false,
|
||||||
:name => 'notification_sender',
|
:name => 'notification_sender',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -1006,7 +1006,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => false,
|
:null => false,
|
||||||
:name => 'send_no_auto_response_reg_exp',
|
:name => 'send_no_auto_response_reg_exp',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -1025,7 +1025,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'chat',
|
:name => 'chat',
|
||||||
:tag => 'boolean',
|
:tag => 'boolean',
|
||||||
:options => {
|
:options => {
|
||||||
true => 'yes',
|
true => 'yes',
|
||||||
|
@ -1058,7 +1058,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'import_mode',
|
:name => 'import_mode',
|
||||||
:tag => 'boolean',
|
:tag => 'boolean',
|
||||||
:options => {
|
:options => {
|
||||||
true => 'yes',
|
true => 'yes',
|
||||||
|
@ -1080,7 +1080,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'import_ignore_sla',
|
:name => 'import_ignore_sla',
|
||||||
:tag => 'boolean',
|
:tag => 'boolean',
|
||||||
:options => {
|
:options => {
|
||||||
true => 'yes',
|
true => 'yes',
|
||||||
|
@ -1097,13 +1097,13 @@ Setting.create_if_not_exists(
|
||||||
:title => 'Import Endpoint',
|
:title => 'Import Endpoint',
|
||||||
:name => 'import_otrs_endpoint',
|
:name => 'import_otrs_endpoint',
|
||||||
:area => 'Import::OTRS',
|
: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 => {
|
:options => {
|
||||||
:form => [
|
:form => [
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => false,
|
:null => false,
|
||||||
:name => 'import_otrs_endpoint',
|
:name => 'import_otrs_endpoint',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -1121,7 +1121,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => false,
|
:null => false,
|
||||||
:name => 'import_otrs_endpoint_key',
|
:name => 'import_otrs_endpoint_key',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -1140,7 +1140,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'import_otrs_user',
|
:name => 'import_otrs_user',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -1159,7 +1159,7 @@ Setting.create_if_not_exists(
|
||||||
{
|
{
|
||||||
:display => '',
|
:display => '',
|
||||||
:null => true,
|
:null => true,
|
||||||
:name => 'import_otrs_password',
|
:name => 'import_otrs_password',
|
||||||
:tag => 'input',
|
:tag => 'input',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -1302,19 +1302,19 @@ Ticket::Article::Sender.create_if_not_exists( :name => 'System' )
|
||||||
|
|
||||||
UserInfo.current_user_id = user_community.id
|
UserInfo.current_user_id = user_community.id
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
:group_id => Group.where( :name => 'Users' ).first.id,
|
:group_id => Group.where( :name => 'Users' ).first.id,
|
||||||
:customer_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
:customer_id => User.where( :login => 'nicole.braun@zammad.org' ).first.id,
|
||||||
:owner_id => User.where( :login => '-' ).first.id,
|
:owner_id => User.where( :login => '-' ).first.id,
|
||||||
:title => 'Welcome to Zammad!',
|
:title => 'Welcome to Zammad!',
|
||||||
:ticket_state_id => Ticket::State.where( :name => 'new' ).first.id,
|
:state_id => Ticket::State.where( :name => 'new' ).first.id,
|
||||||
:ticket_priority_id => Ticket::Priority.where( :name => '2 normal' ).first.id,
|
:priority_id => Ticket::Priority.where( :name => '2 normal' ).first.id,
|
||||||
)
|
)
|
||||||
Ticket::Article.create(
|
Ticket::Article.create(
|
||||||
:ticket_id => ticket.id,
|
:ticket_id => ticket.id,
|
||||||
:ticket_article_type_id => Ticket::Article::Type.where(:name => 'phone' ).first.id,
|
:type_id => Ticket::Article::Type.where(:name => 'phone' ).first.id,
|
||||||
:ticket_article_sender_id => Ticket::Article::Sender.where(:name => 'Customer' ).first.id,
|
:sender_id => Ticket::Article::Sender.where(:name => 'Customer' ).first.id,
|
||||||
:from => 'Zammad Feedback <feedback@zammad.org>',
|
:from => 'Zammad Feedback <feedback@zammad.org>',
|
||||||
:body => 'Welcome!
|
:body => 'Welcome!
|
||||||
|
|
||||||
Thank you for installing Zammad.
|
Thank you for installing Zammad.
|
||||||
|
|
||||||
|
@ -1337,17 +1337,17 @@ Overview.create_if_not_exists(
|
||||||
:prio => 1000,
|
:prio => 1000,
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:condition => {
|
:condition => {
|
||||||
'tickets.ticket_state_id' => [ 1,2,3 ],
|
'tickets.state_id' => [ 1,2,3 ],
|
||||||
'tickets.owner_id' => 'current_user.id',
|
'tickets.owner_id' => 'current_user.id',
|
||||||
},
|
},
|
||||||
:order => {
|
:order => {
|
||||||
:by => 'created_at',
|
:by => 'created_at',
|
||||||
:direction => 'ASC',
|
:direction => 'ASC',
|
||||||
},
|
},
|
||||||
:view => {
|
:view => {
|
||||||
:d => [ 'title', 'customer', 'ticket_state', 'group', 'created_at' ],
|
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
|
||||||
:s => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
|
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||||
:m => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
|
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||||
:view_mode_default => 's',
|
:view_mode_default => 's',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -1358,17 +1358,17 @@ Overview.create_if_not_exists(
|
||||||
:prio => 1001,
|
:prio => 1001,
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:condition => {
|
:condition => {
|
||||||
'tickets.ticket_state_id' => [1,2,3],
|
'tickets.state_id' => [1,2,3],
|
||||||
'tickets.owner_id' => 1,
|
'tickets.owner_id' => 1,
|
||||||
},
|
},
|
||||||
:order => {
|
:order => {
|
||||||
:by => 'created_at',
|
:by => 'created_at',
|
||||||
:direction => 'ASC',
|
:direction => 'ASC',
|
||||||
},
|
},
|
||||||
:view => {
|
:view => {
|
||||||
:d => [ 'title', 'customer', 'ticket_state', 'group', 'created_at' ],
|
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
|
||||||
:s => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
|
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||||
:m => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
|
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||||
:view_mode_default => 's',
|
:view_mode_default => 's',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -1379,16 +1379,16 @@ Overview.create_if_not_exists(
|
||||||
:prio => 1002,
|
:prio => 1002,
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:condition => {
|
:condition => {
|
||||||
'tickets.ticket_state_id' => [1,2,3],
|
'tickets.state_id' => [1,2,3],
|
||||||
},
|
},
|
||||||
:order => {
|
:order => {
|
||||||
:by => 'created_at',
|
:by => 'created_at',
|
||||||
:direction => 'ASC',
|
:direction => 'ASC',
|
||||||
},
|
},
|
||||||
:view => {
|
:view => {
|
||||||
:d => [ 'title', 'customer', 'ticket_state', 'group', 'created_at' ],
|
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
|
||||||
:s => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
|
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||||
:m => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
|
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||||
:view_mode_default => 's',
|
:view_mode_default => 's',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -1406,9 +1406,9 @@ Overview.create_if_not_exists(
|
||||||
:direction => 'ASC',
|
:direction => 'ASC',
|
||||||
},
|
},
|
||||||
:view => {
|
:view => {
|
||||||
:d => [ 'title', 'customer', 'ticket_state', 'group', 'owner', 'escalation_time' ],
|
:d => [ 'title', 'customer', 'state', 'group', 'owner', 'escalation_time' ],
|
||||||
:s => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'owner', 'escalation_time' ],
|
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'owner', 'escalation_time' ],
|
||||||
:m => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'owner', 'escalation_time' ],
|
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'owner', 'escalation_time' ],
|
||||||
:view_mode_default => 's',
|
:view_mode_default => 's',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -1419,17 +1419,17 @@ Overview.create_if_not_exists(
|
||||||
:prio => 1020,
|
:prio => 1020,
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:condition => {
|
:condition => {
|
||||||
'tickets.ticket_state_id' => [3],
|
'tickets.state_id' => [3],
|
||||||
'tickets.owner_id' => 'current_user.id',
|
'tickets.owner_id' => 'current_user.id',
|
||||||
},
|
},
|
||||||
:order => {
|
:order => {
|
||||||
:by => 'created_at',
|
:by => 'created_at',
|
||||||
:direction => 'ASC',
|
:direction => 'ASC',
|
||||||
},
|
},
|
||||||
:view => {
|
:view => {
|
||||||
:d => [ 'title', 'customer', 'ticket_state', 'group', 'created_at' ],
|
:d => [ 'title', 'customer', 'state', 'group', 'created_at' ],
|
||||||
:s => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
|
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||||
:m => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
|
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||||
:view_mode_default => 's',
|
:view_mode_default => 's',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -1440,17 +1440,17 @@ Overview.create_if_not_exists(
|
||||||
:prio => 9003,
|
:prio => 9003,
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:condition => {
|
:condition => {
|
||||||
# 'tickets.ticket_state_id' => [3],
|
# 'tickets.state_id' => [3],
|
||||||
# 'tickets.owner_id' => current_user.id,
|
# 'tickets.owner_id' => current_user.id,
|
||||||
},
|
},
|
||||||
:order => {
|
:order => {
|
||||||
:by => 'created_at',
|
:by => 'created_at',
|
||||||
:direction => 'ASC',
|
:direction => 'ASC',
|
||||||
},
|
},
|
||||||
:view => {
|
:view => {
|
||||||
:s => [ 'title', 'customer', 'ticket_state', 'group', 'created_at' ],
|
:s => [ 'title', 'customer', 'state', 'group', 'created_at' ],
|
||||||
:s => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
|
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||||
:m => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'group', 'created_at' ],
|
:m => [ 'number', 'title', 'customer', 'state', 'priority', 'group', 'created_at' ],
|
||||||
:view_mode_default => 's',
|
:view_mode_default => 's',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -1462,7 +1462,7 @@ Overview.create_if_not_exists(
|
||||||
:prio => 1000,
|
:prio => 1000,
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:condition => {
|
:condition => {
|
||||||
'tickets.ticket_state_id' => [ 1,2,3,4,6 ],
|
'tickets.state_id' => [ 1,2,3,4,6 ],
|
||||||
'tickets.customer_id' => 'current_user.id',
|
'tickets.customer_id' => 'current_user.id',
|
||||||
},
|
},
|
||||||
:order => {
|
:order => {
|
||||||
|
@ -1470,9 +1470,9 @@ Overview.create_if_not_exists(
|
||||||
:direction => 'DESC',
|
:direction => 'DESC',
|
||||||
},
|
},
|
||||||
:view => {
|
:view => {
|
||||||
:d => [ 'title', 'customer', 'ticket_state', 'created_at' ],
|
:d => [ 'title', 'customer', 'state', 'created_at' ],
|
||||||
:s => [ 'number', 'title', 'ticket_state', 'ticket_priority', 'created_at' ],
|
:s => [ 'number', 'title', 'state', 'priority', 'created_at' ],
|
||||||
:m => [ 'number', 'title', 'ticket_state', 'ticket_priority', 'created_at' ],
|
:m => [ 'number', 'title', 'state', 'priority', 'created_at' ],
|
||||||
:view_mode_default => 's',
|
:view_mode_default => 's',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -1483,7 +1483,7 @@ Overview.create_if_not_exists(
|
||||||
:role_id => overview_role.id,
|
:role_id => overview_role.id,
|
||||||
:organization_shared => true,
|
:organization_shared => true,
|
||||||
:condition => {
|
: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',
|
'tickets.organization_id' => 'current_user.organization_id',
|
||||||
},
|
},
|
||||||
:order => {
|
:order => {
|
||||||
|
@ -1491,9 +1491,9 @@ Overview.create_if_not_exists(
|
||||||
:direction => 'DESC',
|
:direction => 'DESC',
|
||||||
},
|
},
|
||||||
:view => {
|
:view => {
|
||||||
:d => [ 'title', 'customer', 'ticket_state', 'created_at' ],
|
:d => [ 'title', 'customer', 'state', 'created_at' ],
|
||||||
:s => [ 'number', 'title', 'customer', 'ticket_state', 'ticket_priority', 'created_at' ],
|
:s => [ 'number', 'title', 'customer', 'state', 'priority', 'created_at' ],
|
||||||
:m => [ 'number', 'title', 'ticket_state', 'ticket_priority', 'created_at' ],
|
:m => [ 'number', 'title', 'state', 'priority', 'created_at' ],
|
||||||
:view_mode_default => 's',
|
:view_mode_default => 's',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -127,10 +127,10 @@ module Import::OTRS
|
||||||
#self.ticket('156115')
|
#self.ticket('156115')
|
||||||
#return
|
#return
|
||||||
# create states
|
# create states
|
||||||
ticket_state
|
state
|
||||||
|
|
||||||
# create priorities
|
# create priorities
|
||||||
ticket_priority
|
priority
|
||||||
|
|
||||||
# create groups
|
# create groups
|
||||||
ticket_group
|
ticket_group
|
||||||
|
@ -185,10 +185,10 @@ module Import::OTRS
|
||||||
end
|
end
|
||||||
|
|
||||||
# create states
|
# create states
|
||||||
ticket_state
|
state
|
||||||
|
|
||||||
# create priorities
|
# create priorities
|
||||||
ticket_priority
|
priority
|
||||||
|
|
||||||
# create groups
|
# create groups
|
||||||
ticket_group
|
ticket_group
|
||||||
|
@ -233,8 +233,8 @@ module Import::OTRS
|
||||||
:CreateBy => :created_by_id,
|
:CreateBy => :created_by_id,
|
||||||
:TicketNumber => :number,
|
:TicketNumber => :number,
|
||||||
:QueueID => :group_id,
|
:QueueID => :group_id,
|
||||||
:StateID => :ticket_state_id,
|
:StateID => :state_id,
|
||||||
:PriorityID => :ticket_priority_id,
|
:PriorityID => :priority_id,
|
||||||
:Owner => :owner,
|
:Owner => :owner,
|
||||||
:CustomerUserID => :customer,
|
:CustomerUserID => :customer,
|
||||||
:Title => :title,
|
:Title => :title,
|
||||||
|
@ -249,8 +249,8 @@ module Import::OTRS
|
||||||
# :CloseTimeDiffInMin => :close_time_diff_in_min,
|
# :CloseTimeDiffInMin => :close_time_diff_in_min,
|
||||||
},
|
},
|
||||||
:Article => {
|
:Article => {
|
||||||
:SenderType => :ticket_article_sender,
|
:SenderType => :sender,
|
||||||
:ArticleType => :ticket_article_type,
|
:ArticleType => :type,
|
||||||
:TicketID => :ticket_id,
|
:TicketID => :ticket_id,
|
||||||
:ArticleID => :id,
|
:ArticleID => :id,
|
||||||
:Body => :body,
|
:Body => :body,
|
||||||
|
@ -338,7 +338,7 @@ module Import::OTRS
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
# create customer/sender if needed
|
# 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
|
# set extra headers
|
||||||
begin
|
begin
|
||||||
email = Mail::Address.new( article_new[:from] ).address
|
email = Mail::Address.new( article_new[:from] ).address
|
||||||
|
@ -379,41 +379,41 @@ module Import::OTRS
|
||||||
article_new[:created_by_id] = user.id
|
article_new[:created_by_id] = user.id
|
||||||
end
|
end
|
||||||
|
|
||||||
if article_new[:ticket_article_sender] == 'customer'
|
if article_new[:sender] == 'customer'
|
||||||
article_new[:ticket_article_sender_id] = Ticket::Article::Sender.lookup( :name => 'Customer' ).id
|
article_new[:sender_id] = Ticket::Article::Sender.lookup( :name => 'Customer' ).id
|
||||||
article_new.delete( :ticket_article_sender )
|
article_new.delete( :sender )
|
||||||
end
|
end
|
||||||
if article_new[:ticket_article_sender] == 'agent'
|
if article_new[:sender] == 'agent'
|
||||||
article_new[:ticket_article_sender_id] = Ticket::Article::Sender.lookup( :name => 'Agent' ).id
|
article_new[:sender_id] = Ticket::Article::Sender.lookup( :name => 'Agent' ).id
|
||||||
article_new.delete( :ticket_article_sender )
|
article_new.delete( :sender )
|
||||||
end
|
end
|
||||||
if article_new[:ticket_article_sender] == 'system'
|
if article_new[:sender] == 'system'
|
||||||
article_new[:ticket_article_sender_id] = Ticket::Article::Sender.lookup( :name => 'System' ).id
|
article_new[:sender_id] = Ticket::Article::Sender.lookup( :name => 'System' ).id
|
||||||
article_new.delete( :ticket_article_sender )
|
article_new.delete( :sender )
|
||||||
end
|
end
|
||||||
|
|
||||||
if article_new[:ticket_article_type] == 'email-external'
|
if article_new[:type] == 'email-external'
|
||||||
article_new[:ticket_article_type_id] = Ticket::Article::Type.lookup( :name => 'email' ).id
|
article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'email' ).id
|
||||||
article_new[:internal] = false
|
article_new[:internal] = false
|
||||||
elsif article_new[:ticket_article_type] == 'email-internal'
|
elsif article_new[:type] == 'email-internal'
|
||||||
article_new[:ticket_article_type_id] = Ticket::Article::Type.lookup( :name => 'email' ).id
|
article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'email' ).id
|
||||||
article_new[:internal] = true
|
article_new[:internal] = true
|
||||||
elsif article_new[:ticket_article_type] == 'note-external'
|
elsif article_new[:type] == 'note-external'
|
||||||
article_new[:ticket_article_type_id] = Ticket::Article::Type.lookup( :name => 'note' ).id
|
article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'note' ).id
|
||||||
article_new[:internal] = false
|
article_new[:internal] = false
|
||||||
elsif article_new[:ticket_article_type] == 'note-internal'
|
elsif article_new[:type] == 'note-internal'
|
||||||
article_new[:ticket_article_type_id] = Ticket::Article::Type.lookup( :name => 'note' ).id
|
article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'note' ).id
|
||||||
article_new[:internal] = true
|
article_new[:internal] = true
|
||||||
elsif article_new[:ticket_article_type] == 'phone'
|
elsif article_new[:type] == 'phone'
|
||||||
article_new[:ticket_article_type_id] = Ticket::Article::Type.lookup( :name => 'phone' ).id
|
article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'phone' ).id
|
||||||
article_new[:internal] = false
|
article_new[:internal] = false
|
||||||
elsif article_new[:ticket_article_type] == 'webrequest'
|
elsif article_new[:type] == 'webrequest'
|
||||||
article_new[:ticket_article_type_id] = Ticket::Article::Type.lookup( :name => 'web' ).id
|
article_new[:type_id] = Ticket::Article::Type.lookup( :name => 'web' ).id
|
||||||
article_new[:internal] = false
|
article_new[:internal] = false
|
||||||
else
|
else
|
||||||
article_new[:ticket_article_type_id] = 9
|
article_new[:type_id] = 9
|
||||||
end
|
end
|
||||||
article_new.delete( :ticket_article_type )
|
article_new.delete( :type )
|
||||||
article_old = Ticket::Article.where( :id => article_new[:id] ).first
|
article_old = Ticket::Article.where( :id => article_new[:id] ).first
|
||||||
#puts 'ARTICLE OLD ' + article_old.inspect
|
#puts 'ARTICLE OLD ' + article_old.inspect
|
||||||
# set state types
|
# set state types
|
||||||
|
@ -466,7 +466,7 @@ module Import::OTRS
|
||||||
:o_id => history['TicketID'],
|
:o_id => history['TicketID'],
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_object => 'Ticket',
|
:history_object => 'Ticket',
|
||||||
:history_attribute => 'ticket_state',
|
:history_attribute => 'state',
|
||||||
:value_from => from,
|
:value_from => from,
|
||||||
:id_from => from_id,
|
:id_from => from_id,
|
||||||
:value_to => to,
|
:value_to => to,
|
||||||
|
@ -516,7 +516,7 @@ module Import::OTRS
|
||||||
:o_id => history['TicketID'],
|
:o_id => history['TicketID'],
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_object => 'Ticket',
|
:history_object => 'Ticket',
|
||||||
:history_attribute => 'ticket_priority',
|
:history_attribute => 'priority',
|
||||||
:value_from => from,
|
:value_from => from,
|
||||||
:value_to => to,
|
:value_to => to,
|
||||||
:id_from => from_id,
|
:id_from => from_id,
|
||||||
|
@ -542,7 +542,7 @@ module Import::OTRS
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.ticket_state
|
def self.state
|
||||||
response = request( "public.pl?Action=Export;Type=State" )
|
response = request( "public.pl?Action=Export;Type=State" )
|
||||||
return if !response
|
return if !response
|
||||||
return if !response.success?
|
return if !response.success?
|
||||||
|
@ -587,8 +587,8 @@ module Import::OTRS
|
||||||
if state['TypeName'] == 'pending auto'
|
if state['TypeName'] == 'pending auto'
|
||||||
state['TypeName'] = 'pending action'
|
state['TypeName'] = 'pending action'
|
||||||
end
|
end
|
||||||
ticket_state_type = Ticket::StateType.where( :name => state['TypeName'] ).first
|
state_type = Ticket::StateType.where( :name => state['TypeName'] ).first
|
||||||
state_new[:state_type_id] = ticket_state_type.id
|
state_new[:state_type_id] = state_type.id
|
||||||
if state_old
|
if state_old
|
||||||
# puts 'TS: ' + state_new.inspect
|
# puts 'TS: ' + state_new.inspect
|
||||||
state_old.update_attributes(state_new)
|
state_old.update_attributes(state_new)
|
||||||
|
@ -599,7 +599,7 @@ module Import::OTRS
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
def self.ticket_priority
|
def self.priority
|
||||||
response = request( "public.pl?Action=Export;Type=Priority" )
|
response = request( "public.pl?Action=Export;Type=Priority" )
|
||||||
return if !response
|
return if !response
|
||||||
return if !response.success?
|
return if !response.success?
|
||||||
|
|
|
@ -57,7 +57,7 @@ module NotificationFactory
|
||||||
:from => sender,
|
:from => sender,
|
||||||
:to => data[:recipient][:email],
|
:to => data[:recipient][:email],
|
||||||
:subject => data[:subject],
|
:subject => data[:subject],
|
||||||
:body => data[:body],
|
:body => data[:body],
|
||||||
},
|
},
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,30 +25,30 @@ class ActivityStreamTest < ActiveSupport::TestCase
|
||||||
{
|
{
|
||||||
:create => {
|
:create => {
|
||||||
:ticket => {
|
:ticket => {
|
||||||
:group_id => Group.lookup( :name => 'Users' ).id,
|
:group_id => Group.lookup( :name => 'Users' ).id,
|
||||||
:customer_id => current_user.id,
|
:customer_id => current_user.id,
|
||||||
:owner_id => User.lookup( :login => '-' ).id,
|
:owner_id => User.lookup( :login => '-' ).id,
|
||||||
:title => 'Unit Test 1 (äöüß)!',
|
:title => 'Unit Test 1 (äöüß)!',
|
||||||
:ticket_state_id => Ticket::State.lookup( :name => 'new' ).id,
|
:state_id => Ticket::State.lookup( :name => 'new' ).id,
|
||||||
:ticket_priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id,
|
:priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id,
|
||||||
:updated_by_id => current_user.id,
|
:updated_by_id => current_user.id,
|
||||||
:created_by_id => current_user.id,
|
:created_by_id => current_user.id,
|
||||||
},
|
},
|
||||||
:article => {
|
:article => {
|
||||||
:updated_by_id => current_user.id,
|
:updated_by_id => current_user.id,
|
||||||
:created_by_id => current_user.id,
|
:created_by_id => current_user.id,
|
||||||
:ticket_article_type_id => Ticket::Article::Type.lookup( :name => 'phone' ).id,
|
:type_id => Ticket::Article::Type.lookup( :name => 'phone' ).id,
|
||||||
:ticket_article_sender_id => Ticket::Article::Sender.lookup( :name => 'Customer' ).id,
|
: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
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
:update => {
|
:update => {
|
||||||
:ticket => {
|
:ticket => {
|
||||||
:title => 'Unit Test 1 (äöüß) - update!',
|
:title => 'Unit Test 1 (äöüß) - update!',
|
||||||
:ticket_state_id => Ticket::State.lookup( :name => 'open' ).id,
|
:state_id => Ticket::State.lookup( :name => 'open' ).id,
|
||||||
:ticket_priority_id => Ticket::Priority.lookup( :name => '1 low' ).id,
|
:priority_id => Ticket::Priority.lookup( :name => '1 low' ).id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
:check => [
|
:check => [
|
||||||
|
@ -286,7 +286,8 @@ class ActivityStreamTest < ActiveSupport::TestCase
|
||||||
:update2 => {
|
:update2 => {
|
||||||
:user => {
|
:user => {
|
||||||
:firstname => 'Bob',
|
:firstname => 'Bob',
|
||||||
:lastname => 'Smith', },
|
:lastname => 'Smith',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
:check => [
|
:check => [
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,14 +23,14 @@ Some Textäöü",
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:ticket_priority => '2 normal',
|
:priority => '2 normal',
|
||||||
:title => 'äöü some subject',
|
:title => 'äöü some subject',
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:body => 'Some Textäöü',
|
:body => 'Some Textäöü',
|
||||||
:ticket_article_sender => 'Customer',
|
:sender => 'Customer',
|
||||||
:ticket_article_type => 'email',
|
:type => 'email',
|
||||||
:internal => false,
|
:internal => false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -43,14 +43,14 @@ Some Textäöü".encode("ISO-8859-1"),
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:ticket_priority => '2 normal',
|
:priority => '2 normal',
|
||||||
:title => '', # should be äöü some subject, but can not be parsed from mime tools
|
:title => '', # should be äöü some subject, but can not be parsed from mime tools
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:body => 'Some Textäöü',
|
:body => 'Some Textäöü',
|
||||||
:ticket_article_sender => 'Customer',
|
:sender => 'Customer',
|
||||||
:ticket_article_type => 'email',
|
:type => 'email',
|
||||||
:internal => false,
|
:internal => false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -119,13 +119,13 @@ Some Text",
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:ticket_priority => '2 normal',
|
:priority => '2 normal',
|
||||||
:title => '【专业为您注册香港及海外公司(好处多多)】 ',
|
:title => '【专业为您注册香港及海外公司(好处多多)】 ',
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:body => 'Some Text',
|
:body => 'Some Text',
|
||||||
:ticket_article_sender => 'Customer',
|
:sender => 'Customer',
|
||||||
:ticket_article_type => 'email',
|
:type => 'email',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -148,9 +148,9 @@ Some Text',
|
||||||
:data => 'From: me@example.com
|
:data => 'From: me@example.com
|
||||||
To: customer@example.com
|
To: customer@example.com
|
||||||
Subject: some subject
|
Subject: some subject
|
||||||
X-Zammad-Ticket-Ticket_Priority: 3 high
|
X-Zammad-Ticket-priority: 3 high
|
||||||
X-Zammad-Article-Ticket_Article_Sender: System
|
X-Zammad-Article-sender: System
|
||||||
x-Zammad-Article-Ticket_Article_Type: phone
|
x-Zammad-Article-type: phone
|
||||||
x-Zammad-Article-Internal: true
|
x-Zammad-Article-Internal: true
|
||||||
|
|
||||||
Some Text',
|
Some Text',
|
||||||
|
@ -158,13 +158,13 @@ Some Text',
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:ticket_priority => '3 high',
|
:priority => '3 high',
|
||||||
:title => 'some subject',
|
:title => 'some subject',
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:ticket_article_sender => 'System',
|
:sender => 'System',
|
||||||
:ticket_article_type => 'phone',
|
:type => 'phone',
|
||||||
:internal => true,
|
:internal => true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -178,9 +178,9 @@ Some Text',
|
||||||
:data => 'From: me@example.com
|
:data => 'From: me@example.com
|
||||||
To: customer@example.com
|
To: customer@example.com
|
||||||
Subject: some subject
|
Subject: some subject
|
||||||
X-Zammad-Ticket-Ticket_Priority: 3 high
|
X-Zammad-Ticket-Priority: 3 high
|
||||||
X-Zammad-Article-Ticket_Article_Sender: System
|
X-Zammad-Article-Sender: System
|
||||||
x-Zammad-Article-Ticket_Article_Type: phone
|
x-Zammad-Article-Type: phone
|
||||||
x-Zammad-Article-Internal: true
|
x-Zammad-Article-Internal: true
|
||||||
|
|
||||||
Some Text',
|
Some Text',
|
||||||
|
@ -188,13 +188,13 @@ Some Text',
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:ticket_priority => '2 normal',
|
:priority => '2 normal',
|
||||||
:title => 'some subject',
|
:title => 'some subject',
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:ticket_article_sender => 'Customer',
|
:sender => 'Customer',
|
||||||
:ticket_article_type => 'email',
|
:type => 'email',
|
||||||
:internal => false,
|
:internal => false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -204,7 +204,7 @@ Some Text',
|
||||||
|
|
||||||
test 'process with postmaster filter' do
|
test 'process with postmaster filter' do
|
||||||
group = Group.create_if_not_exists(
|
group = Group.create_if_not_exists(
|
||||||
:name => 'Test Group',
|
:name => 'Test Group',
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
)
|
)
|
||||||
|
@ -215,7 +215,7 @@ Some Text',
|
||||||
:from => 'nobody@example.com',
|
:from => 'nobody@example.com',
|
||||||
},
|
},
|
||||||
:perform => {
|
:perform => {
|
||||||
'X-Zammad-Ticket-Ticket_Priority' => '3 high',
|
'X-Zammad-Ticket-priority' => '3 high',
|
||||||
},
|
},
|
||||||
:channel => 'email',
|
:channel => 'email',
|
||||||
:active => true,
|
:active => true,
|
||||||
|
@ -261,14 +261,14 @@ Some Text',
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:group => group.name,
|
:group => group.name,
|
||||||
:ticket_priority => '2 normal',
|
:priority => '2 normal',
|
||||||
:title => 'some subject',
|
:title => 'some subject',
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:ticket_article_sender => 'Customer',
|
:sender => 'Customer',
|
||||||
:ticket_article_type => 'email',
|
:type => 'email',
|
||||||
:internal => true,
|
:internal => true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -283,14 +283,14 @@ Some Text',
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:group => 'Twitter',
|
:group => 'Twitter',
|
||||||
:ticket_priority => '2 normal',
|
:priority => '2 normal',
|
||||||
:title => 'some subject',
|
:title => 'some subject',
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:ticket_article_sender => 'Customer',
|
:sender => 'Customer',
|
||||||
:ticket_article_type => 'email',
|
:type => 'email',
|
||||||
:internal => true,
|
:internal => true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,30 +11,30 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
{
|
{
|
||||||
:ticket_create => {
|
:ticket_create => {
|
||||||
:ticket => {
|
:ticket => {
|
||||||
:group_id => Group.lookup( :name => 'Users' ).id,
|
:group_id => Group.lookup( :name => 'Users' ).id,
|
||||||
:customer_id => current_user.id,
|
:customer_id => current_user.id,
|
||||||
:owner_id => User.lookup( :login => '-' ).id,
|
:owner_id => User.lookup( :login => '-' ).id,
|
||||||
:title => 'Unit Test 1 (äöüß)!',
|
:title => 'Unit Test 1 (äöüß)!',
|
||||||
:ticket_state_id => Ticket::State.lookup( :name => 'new' ).id,
|
:state_id => Ticket::State.lookup( :name => 'new' ).id,
|
||||||
:ticket_priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id,
|
:priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id,
|
||||||
:updated_by_id => current_user.id,
|
:updated_by_id => current_user.id,
|
||||||
:created_by_id => current_user.id,
|
:created_by_id => current_user.id,
|
||||||
},
|
},
|
||||||
:article => {
|
:article => {
|
||||||
:updated_by_id => current_user.id,
|
:updated_by_id => current_user.id,
|
||||||
:created_by_id => current_user.id,
|
:created_by_id => current_user.id,
|
||||||
:ticket_article_type_id => Ticket::Article::Type.lookup( :name => 'phone' ).id,
|
:type_id => Ticket::Article::Type.lookup( :name => 'phone' ).id,
|
||||||
:ticket_article_sender_id => Ticket::Article::Sender.lookup( :name => 'Customer' ).id,
|
: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
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
:ticket_update => {
|
:ticket_update => {
|
||||||
:ticket => {
|
:ticket => {
|
||||||
:title => 'Unit Test 1 (äöüß) - update!',
|
:title => 'Unit Test 1 (äöüß) - update!',
|
||||||
:ticket_state_id => Ticket::State.lookup( :name => 'open' ).id,
|
:state_id => Ticket::State.lookup( :name => 'open' ).id,
|
||||||
:ticket_priority_id => Ticket::Priority.lookup( :name => '1 low' ).id,
|
:priority_id => Ticket::Priority.lookup( :name => '1 low' ).id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
:history_check => [
|
:history_check => [
|
||||||
|
@ -55,7 +55,7 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
:result => true,
|
:result => true,
|
||||||
:history_object => 'Ticket',
|
:history_object => 'Ticket',
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_attribute => 'ticket_state',
|
:history_attribute => 'state',
|
||||||
:value_from => 'new',
|
:value_from => 'new',
|
||||||
:value_to => 'open',
|
:value_to => 'open',
|
||||||
:id_from => Ticket::State.lookup( :name => 'new' ).id,
|
:id_from => Ticket::State.lookup( :name => 'new' ).id,
|
||||||
|
@ -78,33 +78,33 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
{
|
{
|
||||||
:ticket_create => {
|
:ticket_create => {
|
||||||
:ticket => {
|
:ticket => {
|
||||||
:group_id => Group.lookup( :name => 'Users' ).id,
|
:group_id => Group.lookup( :name => 'Users' ).id,
|
||||||
:customer_id => current_user.id,
|
:customer_id => current_user.id,
|
||||||
:owner_id => User.lookup( :login => '-' ).id,
|
:owner_id => User.lookup( :login => '-' ).id,
|
||||||
:title => 'Unit Test 2 (äöüß)!',
|
:title => 'Unit Test 2 (äöüß)!',
|
||||||
:ticket_state_id => Ticket::State.lookup( :name => 'new' ).id,
|
:state_id => Ticket::State.lookup( :name => 'new' ).id,
|
||||||
:ticket_priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id,
|
:priority_id => Ticket::Priority.lookup( :name => '2 normal' ).id,
|
||||||
:updated_by_id => current_user.id,
|
:updated_by_id => current_user.id,
|
||||||
:created_by_id => current_user.id,
|
:created_by_id => current_user.id,
|
||||||
},
|
},
|
||||||
:article => {
|
:article => {
|
||||||
:created_by_id => current_user.id,
|
:created_by_id => current_user.id,
|
||||||
:updated_by_id => current_user.id,
|
:updated_by_id => current_user.id,
|
||||||
:ticket_article_type_id => Ticket::Article::Type.lookup(:name => 'phone' ).id,
|
:type_id => Ticket::Article::Type.lookup(:name => 'phone' ).id,
|
||||||
:ticket_article_sender_id => Ticket::Article::Sender.lookup(:name => 'Customer' ).id,
|
: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
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
:ticket_update => {
|
:ticket_update => {
|
||||||
:ticket => {
|
:ticket => {
|
||||||
:title => 'Unit Test 2 (äöüß) - update!',
|
:title => 'Unit Test 2 (äöüß) - update!',
|
||||||
:ticket_state_id => Ticket::State.lookup( :name => 'open' ).id,
|
:state_id => Ticket::State.lookup( :name => 'open' ).id,
|
||||||
:owner_id => current_user.id,
|
:owner_id => current_user.id,
|
||||||
},
|
},
|
||||||
:article => {
|
:article => {
|
||||||
:from => 'Unit 2 Test 2 <unittest@example.com>',
|
:from => 'Unit 2 Test 2 <unittest@example.com>',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
:history_check => [
|
:history_check => [
|
||||||
|
@ -132,9 +132,9 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
:id_to => current_user.id,
|
:id_to => current_user.id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:result => true,
|
:result => true,
|
||||||
:history_object => 'Ticket::Article',
|
:history_object => 'Ticket::Article',
|
||||||
:history_type => 'created',
|
:history_type => 'created',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:result => true,
|
:result => true,
|
||||||
|
@ -302,9 +302,9 @@ class HistoryTest < ActiveSupport::TestCase
|
||||||
},
|
},
|
||||||
:history_check => [
|
:history_check => [
|
||||||
{
|
{
|
||||||
:result => true,
|
:result => true,
|
||||||
:history_object => 'Organization',
|
:history_object => 'Organization',
|
||||||
:history_type => 'created',
|
:history_type => 'created',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:result => true,
|
:result => true,
|
||||||
|
|
|
@ -7,8 +7,8 @@ class NotificationFactoryTest < ActiveSupport::TestCase
|
||||||
:title => 'some title äöüß',
|
:title => 'some title äöüß',
|
||||||
:group => Group.lookup( :name => 'Users'),
|
:group => Group.lookup( :name => 'Users'),
|
||||||
:customer_id => 2,
|
:customer_id => 2,
|
||||||
:ticket_state => Ticket::State.lookup( :name => 'new' ),
|
:state => Ticket::State.lookup( :name => 'new' ),
|
||||||
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
|
@ -41,7 +41,7 @@ class NotificationFactoryTest < ActiveSupport::TestCase
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:locale => 'de',
|
:locale => 'de',
|
||||||
:string => '\'i18n(#{ticket.ticket_state.name})\' ticket state',
|
:string => '\'i18n(#{ticket.state.name})\' ticket state',
|
||||||
:result => '\'neu\' ticket state',
|
:result => '\'neu\' ticket state',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,33 +4,33 @@ require 'test_helper'
|
||||||
class TicketTest < ActiveSupport::TestCase
|
class TicketTest < ActiveSupport::TestCase
|
||||||
test 'ticket create' do
|
test 'ticket create' do
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
:title => 'some title äöüß',
|
:title => 'some title äöüß',
|
||||||
:group => Group.lookup( :name => 'Users'),
|
:group => Group.lookup( :name => 'Users'),
|
||||||
:customer_id => 2,
|
:customer_id => 2,
|
||||||
:ticket_state => Ticket::State.lookup( :name => 'new' ),
|
:state => Ticket::State.lookup( :name => 'new' ),
|
||||||
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
assert( ticket, "ticket created" )
|
assert( ticket, "ticket created" )
|
||||||
|
|
||||||
assert_equal( ticket.title, 'some title äöüß', 'ticket.title verify' )
|
assert_equal( ticket.title, 'some title äöüß', 'ticket.title verify' )
|
||||||
assert_equal( ticket.group.name, 'Users', 'ticket.group 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
|
# create inbound article
|
||||||
article_inbound = Ticket::Article.create(
|
article_inbound = Ticket::Article.create(
|
||||||
:ticket_id => ticket.id,
|
:ticket_id => ticket.id,
|
||||||
:from => 'some_sender@example.com',
|
:from => 'some_sender@example.com',
|
||||||
:to => 'some_recipient@example.com',
|
:to => 'some_recipient@example.com',
|
||||||
:subject => 'some subject',
|
:subject => 'some subject',
|
||||||
:message_id => 'some@id',
|
:message_id => 'some@id',
|
||||||
:body => 'some message article_inbound 😍😍😍',
|
:body => 'some message article_inbound 😍😍😍',
|
||||||
:internal => false,
|
:internal => false,
|
||||||
:ticket_article_sender => Ticket::Article::Sender.where(:name => 'Customer').first,
|
:sender => Ticket::Article::Sender.where(:name => 'Customer').first,
|
||||||
:ticket_article_type => Ticket::Article::Type.where(:name => 'email').first,
|
:type => Ticket::Article::Type.where(:name => 'email').first,
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
assert_equal( article_inbound.body, 'some message article_inbound 😍😍😍'.utf8_to_3bytesutf8, 'article_inbound.body verify - inbound' )
|
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
|
# create note article
|
||||||
article_note = Ticket::Article.create(
|
article_note = Ticket::Article.create(
|
||||||
:ticket_id => ticket.id,
|
:ticket_id => ticket.id,
|
||||||
:from => 'some persion',
|
:from => 'some persion',
|
||||||
:subject => 'some note',
|
:subject => 'some note',
|
||||||
:body => 'some message',
|
:body => 'some message',
|
||||||
:internal => true,
|
:internal => true,
|
||||||
:ticket_article_sender => Ticket::Article::Sender.where(:name => 'Agent').first,
|
:sender => Ticket::Article::Sender.where(:name => 'Agent').first,
|
||||||
:ticket_article_type => Ticket::Article::Type.where(:name => 'note').first,
|
:type => Ticket::Article::Type.where(:name => 'note').first,
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
|
|
||||||
ticket = Ticket.find(ticket.id)
|
ticket = Ticket.find(ticket.id)
|
||||||
|
@ -66,17 +66,17 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
# create outbound article
|
# create outbound article
|
||||||
sleep 10
|
sleep 10
|
||||||
article_outbound = Ticket::Article.create(
|
article_outbound = Ticket::Article.create(
|
||||||
:ticket_id => ticket.id,
|
:ticket_id => ticket.id,
|
||||||
:from => 'some_recipient@example.com',
|
:from => 'some_recipient@example.com',
|
||||||
:to => 'some_sender@example.com',
|
:to => 'some_sender@example.com',
|
||||||
:subject => 'some subject',
|
:subject => 'some subject',
|
||||||
:message_id => 'some@id2',
|
:message_id => 'some@id2',
|
||||||
:body => 'some message 2',
|
:body => 'some message 2',
|
||||||
:internal => false,
|
:internal => false,
|
||||||
:ticket_article_sender => Ticket::Article::Sender.where(:name => 'Agent').first,
|
:sender => Ticket::Article::Sender.where(:name => 'Agent').first,
|
||||||
:ticket_article_type => Ticket::Article::Type.where(:name => 'email').first,
|
:type => Ticket::Article::Type.where(:name => 'email').first,
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
|
|
||||||
ticket = Ticket.find(ticket.id)
|
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.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' )
|
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.save
|
||||||
|
|
||||||
ticket = Ticket.find(ticket.id)
|
ticket = Ticket.find(ticket.id)
|
||||||
|
@ -112,15 +112,15 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
assert( delete, "ticket destroy_all" )
|
assert( delete, "ticket destroy_all" )
|
||||||
|
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
:title => 'some title äöüß',
|
:title => 'some title äöüß',
|
||||||
:group => Group.lookup( :name => 'Users'),
|
:group => Group.lookup( :name => 'Users'),
|
||||||
:customer_id => 2,
|
:customer_id => 2,
|
||||||
:ticket_state => Ticket::State.lookup( :name => 'new' ),
|
:state => Ticket::State.lookup( :name => 'new' ),
|
||||||
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
||||||
:created_at => '2013-03-21 09:30:00 UTC',
|
:created_at => '2013-03-21 09:30:00 UTC',
|
||||||
:updated_at => '2013-03-21 09:30:00 UTC',
|
:updated_at => '2013-03-21 09:30:00 UTC',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
assert( ticket, "ticket created" )
|
assert( ticket, "ticket created" )
|
||||||
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
|
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
|
||||||
|
@ -150,7 +150,7 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
sla = Sla.create(
|
sla = Sla.create(
|
||||||
:name => 'test sla 2',
|
:name => 'test sla 2',
|
||||||
:condition => { "tickets.ticket_priority_id" =>["1", "2", "3"] },
|
:condition => { "tickets.priority_id" =>["1", "2", "3"] },
|
||||||
:data => {
|
:data => {
|
||||||
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
|
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
|
||||||
"beginning_of_workday" => "8:00",
|
"beginning_of_workday" => "8:00",
|
||||||
|
@ -296,7 +296,7 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# set close time over time
|
# set close time over time
|
||||||
ticket.update_attributes(
|
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' )
|
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify 9' )
|
||||||
|
|
||||||
|
@ -317,37 +317,37 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
assert( delete, "ticket destroy" )
|
assert( delete, "ticket destroy" )
|
||||||
|
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
:title => 'some title äöüß',
|
:title => 'some title äöüß',
|
||||||
:group => Group.lookup( :name => 'Users'),
|
:group => Group.lookup( :name => 'Users'),
|
||||||
:customer_id => 2,
|
:customer_id => 2,
|
||||||
:ticket_state => Ticket::State.lookup( :name => 'new' ),
|
:state => Ticket::State.lookup( :name => 'new' ),
|
||||||
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
:created_at => '2013-03-28 23:49:00 UTC',
|
:created_at => '2013-03-28 23:49:00 UTC',
|
||||||
:updated_at => '2013-03-28 23:49:00 UTC',
|
:updated_at => '2013-03-28 23:49:00 UTC',
|
||||||
)
|
)
|
||||||
assert( ticket, "ticket created" )
|
assert( ticket, "ticket created" )
|
||||||
|
|
||||||
assert_equal( ticket.title, 'some title äöüß', 'ticket.title verify' )
|
assert_equal( ticket.title, 'some title äöüß', 'ticket.title verify' )
|
||||||
assert_equal( ticket.group.name, 'Users', 'ticket.group 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
|
# create inbound article
|
||||||
article_inbound = Ticket::Article.create(
|
article_inbound = Ticket::Article.create(
|
||||||
:ticket_id => ticket.id,
|
:ticket_id => ticket.id,
|
||||||
:from => 'some_sender@example.com',
|
:from => 'some_sender@example.com',
|
||||||
:to => 'some_recipient@example.com',
|
:to => 'some_recipient@example.com',
|
||||||
:subject => 'some subject',
|
:subject => 'some subject',
|
||||||
:message_id => 'some@id',
|
:message_id => 'some@id',
|
||||||
:body => 'some message',
|
:body => 'some message',
|
||||||
:internal => false,
|
:internal => false,
|
||||||
:ticket_article_sender => Ticket::Article::Sender.where(:name => 'Customer').first,
|
:sender => Ticket::Article::Sender.where(:name => 'Customer').first,
|
||||||
:ticket_article_type => Ticket::Article::Type.where(:name => 'email').first,
|
:type => Ticket::Article::Type.where(:name => 'email').first,
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
:created_at => '2013-03-28 23:49:00 UTC',
|
:created_at => '2013-03-28 23:49:00 UTC',
|
||||||
:updated_at => '2013-03-28 23:49:00 UTC',
|
:updated_at => '2013-03-28 23:49:00 UTC',
|
||||||
)
|
)
|
||||||
ticket = Ticket.find(ticket.id)
|
ticket = Ticket.find(ticket.id)
|
||||||
assert_equal( ticket.article_count, 1, 'ticket.article_count verify - inbound' )
|
assert_equal( ticket.article_count, 1, 'ticket.article_count verify - inbound' )
|
||||||
|
@ -359,19 +359,19 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# create outbound article
|
# create outbound article
|
||||||
article_outbound = Ticket::Article.create(
|
article_outbound = Ticket::Article.create(
|
||||||
:ticket_id => ticket.id,
|
:ticket_id => ticket.id,
|
||||||
:from => 'some_recipient@example.com',
|
:from => 'some_recipient@example.com',
|
||||||
:to => 'some_sender@example.com',
|
:to => 'some_sender@example.com',
|
||||||
:subject => 'some subject',
|
:subject => 'some subject',
|
||||||
:message_id => 'some@id2',
|
:message_id => 'some@id2',
|
||||||
:body => 'some message 2',
|
:body => 'some message 2',
|
||||||
:internal => false,
|
:internal => false,
|
||||||
:ticket_article_sender => Ticket::Article::Sender.where(:name => 'Agent').first,
|
:sender => Ticket::Article::Sender.where(:name => 'Agent').first,
|
||||||
:ticket_article_type => Ticket::Article::Type.where(:name => 'email').first,
|
:type => Ticket::Article::Type.where(:name => 'email').first,
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
:created_at => '2013-03-29 08:00:03 UTC',
|
:created_at => '2013-03-29 08:00:03 UTC',
|
||||||
:updated_at => '2013-03-29 08:00:03 UTC',
|
:updated_at => '2013-03-29 08:00:03 UTC',
|
||||||
)
|
)
|
||||||
|
|
||||||
ticket = Ticket.find(ticket.id)
|
ticket = Ticket.find(ticket.id)
|
||||||
|
@ -389,36 +389,36 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
|
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
:title => 'some title äöüß',
|
:title => 'some title äöüß',
|
||||||
:group => Group.lookup( :name => 'Users'),
|
:group => Group.lookup( :name => 'Users'),
|
||||||
:customer_id => 2,
|
:customer_id => 2,
|
||||||
:ticket_state => Ticket::State.lookup( :name => 'new' ),
|
:state => Ticket::State.lookup( :name => 'new' ),
|
||||||
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
:created_at => '2013-03-28 23:49:00 UTC',
|
:created_at => '2013-03-28 23:49:00 UTC',
|
||||||
:updated_at => '2013-03-28 23:49:00 UTC',
|
:updated_at => '2013-03-28 23:49:00 UTC',
|
||||||
)
|
)
|
||||||
assert( ticket, "ticket created" )
|
assert( ticket, "ticket created" )
|
||||||
|
|
||||||
assert_equal( ticket.title, 'some title äöüß', 'ticket.title verify' )
|
assert_equal( ticket.title, 'some title äöüß', 'ticket.title verify' )
|
||||||
assert_equal( ticket.group.name, 'Users', 'ticket.group 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
|
# create inbound article
|
||||||
article_inbound = Ticket::Article.create(
|
article_inbound = Ticket::Article.create(
|
||||||
:ticket_id => ticket.id,
|
:ticket_id => ticket.id,
|
||||||
:from => 'some_sender@example.com',
|
:from => 'some_sender@example.com',
|
||||||
:subject => 'some subject',
|
:subject => 'some subject',
|
||||||
:message_id => 'some@id',
|
:message_id => 'some@id',
|
||||||
:body => 'some message',
|
:body => 'some message',
|
||||||
:internal => false,
|
:internal => false,
|
||||||
:ticket_article_sender => Ticket::Article::Sender.where(:name => 'Customer').first,
|
:sender => Ticket::Article::Sender.where(:name => 'Customer').first,
|
||||||
:ticket_article_type => Ticket::Article::Type.where(:name => 'phone').first,
|
:type => Ticket::Article::Type.where(:name => 'phone').first,
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
:created_at => '2013-03-28 23:49:00 UTC',
|
:created_at => '2013-03-28 23:49:00 UTC',
|
||||||
:updated_at => '2013-03-28 23:49:00 UTC',
|
:updated_at => '2013-03-28 23:49:00 UTC',
|
||||||
)
|
)
|
||||||
ticket = Ticket.find(ticket.id)
|
ticket = Ticket.find(ticket.id)
|
||||||
assert_equal( ticket.article_count, 1, 'ticket.article_count verify - inbound' )
|
assert_equal( ticket.article_count, 1, 'ticket.article_count verify - inbound' )
|
||||||
|
@ -444,15 +444,15 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
assert( delete, "ticket destroy_all" )
|
assert( delete, "ticket destroy_all" )
|
||||||
|
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
:title => 'some title äöüß',
|
:title => 'some title äöüß',
|
||||||
:group => Group.lookup( :name => 'Users'),
|
:group => Group.lookup( :name => 'Users'),
|
||||||
:customer_id => 2,
|
:customer_id => 2,
|
||||||
:ticket_state => Ticket::State.lookup( :name => 'new' ),
|
:state => Ticket::State.lookup( :name => 'new' ),
|
||||||
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
||||||
:created_at => '2013-03-21 09:30:00 UTC',
|
:created_at => '2013-03-21 09:30:00 UTC',
|
||||||
:updated_at => '2013-03-21 09:30:00 UTC',
|
:updated_at => '2013-03-21 09:30:00 UTC',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
assert( ticket, "ticket created" )
|
assert( ticket, "ticket created" )
|
||||||
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
|
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
|
||||||
|
@ -486,15 +486,15 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
delete = ticket.destroy
|
delete = ticket.destroy
|
||||||
assert( delete, "ticket destroy" )
|
assert( delete, "ticket destroy" )
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
:title => 'some title äöüß',
|
:title => 'some title äöüß',
|
||||||
:group => Group.lookup( :name => 'Users'),
|
:group => Group.lookup( :name => 'Users'),
|
||||||
:customer_id => 2,
|
:customer_id => 2,
|
||||||
:ticket_state => Ticket::State.lookup( :name => 'new' ),
|
:state => Ticket::State.lookup( :name => 'new' ),
|
||||||
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
||||||
:created_at => '2013-10-21 09:30:00 UTC',
|
:created_at => '2013-10-21 09:30:00 UTC',
|
||||||
:updated_at => '2013-10-21 09:30:00 UTC',
|
:updated_at => '2013-10-21 09:30:00 UTC',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
assert( ticket, "ticket created" )
|
assert( ticket, "ticket created" )
|
||||||
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
|
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
|
||||||
|
@ -529,15 +529,15 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
assert( delete, "sla destroy" )
|
assert( delete, "sla destroy" )
|
||||||
|
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
:title => 'some title äöüß',
|
:title => 'some title äöüß',
|
||||||
:group => Group.lookup( :name => 'Users'),
|
:group => Group.lookup( :name => 'Users'),
|
||||||
:customer_id => 2,
|
:customer_id => 2,
|
||||||
:ticket_state => Ticket::State.lookup( :name => 'new' ),
|
:state => Ticket::State.lookup( :name => 'new' ),
|
||||||
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
||||||
:created_at => '2013-10-21 06:30:00 UTC',
|
:created_at => '2013-10-21 06:30:00 UTC',
|
||||||
:updated_at => '2013-10-21 06:30:00 UTC',
|
:updated_at => '2013-10-21 06:30:00 UTC',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
assert( ticket, "ticket created" )
|
assert( ticket, "ticket created" )
|
||||||
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
|
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
|
||||||
|
@ -575,15 +575,15 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
test 'ticket escalation suspend' do
|
test 'ticket escalation suspend' do
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
:title => 'some title äöüß3',
|
:title => 'some title äöüß3',
|
||||||
:group => Group.lookup( :name => 'Users'),
|
:group => Group.lookup( :name => 'Users'),
|
||||||
:customer_id => 2,
|
:customer_id => 2,
|
||||||
:ticket_state => Ticket::State.lookup( :name => 'new' ),
|
:state => Ticket::State.lookup( :name => 'new' ),
|
||||||
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
||||||
:created_at => '2013-06-04 09:00:00 UTC',
|
:created_at => '2013-06-04 09:00:00 UTC',
|
||||||
:updated_at => '2013-06-04 09:00:00 UTC',
|
:updated_at => '2013-06-04 09:00:00 UTC',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
assert( ticket, 'ticket created' )
|
assert( ticket, 'ticket created' )
|
||||||
|
|
||||||
|
@ -591,7 +591,7 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
History.add(
|
History.add(
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_object => 'Ticket',
|
:history_object => 'Ticket',
|
||||||
:history_attribute => 'ticket_state',
|
:history_attribute => 'state',
|
||||||
:o_id => ticket.id,
|
:o_id => ticket.id,
|
||||||
:id_to => 3,
|
:id_to => 3,
|
||||||
:id_from => 2,
|
:id_from => 2,
|
||||||
|
@ -606,7 +606,7 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
History.add(
|
History.add(
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_object => 'Ticket',
|
:history_object => 'Ticket',
|
||||||
:history_attribute => 'ticket_state',
|
:history_attribute => 'state',
|
||||||
:o_id => ticket.id,
|
:o_id => ticket.id,
|
||||||
:id_to => 2,
|
:id_to => 2,
|
||||||
:id_from => 3,
|
:id_from => 3,
|
||||||
|
@ -631,7 +631,7 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
History.add(
|
History.add(
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_object => 'Ticket',
|
:history_object => 'Ticket',
|
||||||
:history_attribute => 'ticket_state',
|
:history_attribute => 'state',
|
||||||
:o_id => ticket.id,
|
:o_id => ticket.id,
|
||||||
:id_to => 3,
|
:id_to => 3,
|
||||||
:id_from => 2,
|
:id_from => 2,
|
||||||
|
@ -680,15 +680,15 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# test Ticket created in state pending and closed without reopen or state change
|
# test Ticket created in state pending and closed without reopen or state change
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
:title => 'some title äöüß3',
|
:title => 'some title äöüß3',
|
||||||
:group => Group.lookup( :name => 'Users'),
|
:group => Group.lookup( :name => 'Users'),
|
||||||
:customer_id => 2,
|
:customer_id => 2,
|
||||||
:ticket_state => Ticket::State.lookup( :name => 'pending' ),
|
:state => Ticket::State.lookup( :name => 'pending' ),
|
||||||
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
||||||
:created_at => '2013-06-04 09:00:00 UTC',
|
:created_at => '2013-06-04 09:00:00 UTC',
|
||||||
:updated_at => '2013-06-04 09:00:00 UTC',
|
:updated_at => '2013-06-04 09:00:00 UTC',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
assert( ticket, 'ticket created' )
|
assert( ticket, 'ticket created' )
|
||||||
|
|
||||||
|
@ -697,7 +697,7 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
History.add(
|
History.add(
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_object => 'Ticket',
|
:history_object => 'Ticket',
|
||||||
:history_attribute => 'ticket_state',
|
:history_attribute => 'state',
|
||||||
:o_id => ticket.id,
|
:o_id => ticket.id,
|
||||||
:id_to => 4,
|
:id_to => 4,
|
||||||
:id_from => 3,
|
: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
|
# test Ticket created in state pending, changed state to openen, back to pending and closed
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
:title => 'some title äöüß3',
|
:title => 'some title äöüß3',
|
||||||
:group => Group.lookup( :name => 'Users'),
|
:group => Group.lookup( :name => 'Users'),
|
||||||
:customer_id => 2,
|
:customer_id => 2,
|
||||||
:ticket_state => Ticket::State.lookup( :name => 'pending' ),
|
:state => Ticket::State.lookup( :name => 'pending' ),
|
||||||
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
||||||
:created_at => '2013-06-04 09:00:00 UTC',
|
:created_at => '2013-06-04 09:00:00 UTC',
|
||||||
:updated_at => '2013-06-04 09:00:00 UTC',
|
:updated_at => '2013-06-04 09:00:00 UTC',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
assert( ticket, 'ticket created' )
|
assert( ticket, 'ticket created' )
|
||||||
|
|
||||||
|
@ -762,7 +762,7 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
History.add(
|
History.add(
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_object => 'Ticket',
|
:history_object => 'Ticket',
|
||||||
:history_attribute => 'ticket_state',
|
:history_attribute => 'state',
|
||||||
:o_id => ticket.id,
|
:o_id => ticket.id,
|
||||||
:id_to => 2,
|
:id_to => 2,
|
||||||
:id_from => 3,
|
:id_from => 3,
|
||||||
|
@ -777,7 +777,7 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
History.add(
|
History.add(
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_object => 'Ticket',
|
:history_object => 'Ticket',
|
||||||
:history_attribute => 'ticket_state',
|
:history_attribute => 'state',
|
||||||
:o_id => ticket.id,
|
:o_id => ticket.id,
|
||||||
:id_to => 3,
|
:id_to => 3,
|
||||||
:id_from => 2,
|
:id_from => 2,
|
||||||
|
@ -792,7 +792,7 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
History.add(
|
History.add(
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_object => 'Ticket',
|
:history_object => 'Ticket',
|
||||||
:history_attribute => 'ticket_state',
|
:history_attribute => 'state',
|
||||||
:o_id => ticket.id,
|
:o_id => ticket.id,
|
||||||
:id_to => 4,
|
:id_to => 4,
|
||||||
:id_from => 3,
|
: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
|
### Test Ticket created in state pending, changed state to openen, back to pending and back to open then
|
||||||
### close ticket
|
### close ticket
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
:title => 'some title äöüß3',
|
:title => 'some title äöüß3',
|
||||||
:group => Group.lookup( :name => 'Users'),
|
:group => Group.lookup( :name => 'Users'),
|
||||||
:customer_id => 2,
|
:customer_id => 2,
|
||||||
:ticket_state => Ticket::State.lookup( :name => 'pending' ),
|
:state => Ticket::State.lookup( :name => 'pending' ),
|
||||||
:ticket_priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
:priority => Ticket::Priority.lookup( :name => '2 normal' ),
|
||||||
:created_at => '2013-06-04 09:00:00 UTC',
|
:created_at => '2013-06-04 09:00:00 UTC',
|
||||||
:updated_at => '2013-06-04 09:00:00 UTC',
|
:updated_at => '2013-06-04 09:00:00 UTC',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
assert( ticket, 'ticket created' )
|
assert( ticket, 'ticket created' )
|
||||||
|
|
||||||
|
@ -857,7 +857,7 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
History.add(
|
History.add(
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_object => 'Ticket',
|
:history_object => 'Ticket',
|
||||||
:history_attribute => 'ticket_state',
|
:history_attribute => 'state',
|
||||||
:o_id => ticket.id,
|
:o_id => ticket.id,
|
||||||
:id_to => 2,
|
:id_to => 2,
|
||||||
:id_from => 3,
|
:id_from => 3,
|
||||||
|
@ -872,7 +872,7 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
History.add(
|
History.add(
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_object => 'Ticket',
|
:history_object => 'Ticket',
|
||||||
:history_attribute => 'ticket_state',
|
:history_attribute => 'state',
|
||||||
:o_id => ticket.id,
|
:o_id => ticket.id,
|
||||||
:id_to => 3,
|
:id_to => 3,
|
||||||
:id_from => 2,
|
:id_from => 2,
|
||||||
|
@ -887,7 +887,7 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
History.add(
|
History.add(
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_object => 'Ticket',
|
:history_object => 'Ticket',
|
||||||
:history_attribute => 'ticket_state',
|
:history_attribute => 'state',
|
||||||
:o_id => ticket.id,
|
:o_id => ticket.id,
|
||||||
:id_to => 2,
|
:id_to => 2,
|
||||||
:id_from => 3,
|
:id_from => 3,
|
||||||
|
@ -902,7 +902,7 @@ class TicketTest < ActiveSupport::TestCase
|
||||||
History.add(
|
History.add(
|
||||||
:history_type => 'updated',
|
:history_type => 'updated',
|
||||||
:history_object => 'Ticket',
|
:history_object => 'Ticket',
|
||||||
:history_attribute => 'ticket_state',
|
:history_attribute => 'state',
|
||||||
:o_id => ticket.id,
|
:o_id => ticket.id,
|
||||||
:id_to => 4,
|
:id_to => 4,
|
||||||
:id_from => 3,
|
:id_from => 3,
|
||||||
|
|
|
@ -59,26 +59,26 @@ class TwitterTest < ActiveSupport::TestCase
|
||||||
hash = '#citheo42' + rand(9999).to_s
|
hash = '#citheo42' + rand(9999).to_s
|
||||||
text = 'Today the weather is really nice... ' + hash
|
text = 'Today the weather is really nice... ' + hash
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
:group_id => group.id,
|
:group_id => group.id,
|
||||||
:customer_id => user.id,
|
:customer_id => user.id,
|
||||||
:title => text[0,40],
|
:title => text[0,40],
|
||||||
:ticket_state_id => state.id,
|
:state_id => state.id,
|
||||||
:ticket_priority_id => priority.id,
|
:priority_id => priority.id,
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
assert( ticket, "outbound ticket created" )
|
assert( ticket, "outbound ticket created" )
|
||||||
article = Ticket::Article.create(
|
article = Ticket::Article.create(
|
||||||
:ticket_id => ticket.id,
|
:ticket_id => ticket.id,
|
||||||
:ticket_article_type_id => Ticket::Article::Type.where( :name => 'twitter status' ).first.id,
|
:type_id => Ticket::Article::Type.where( :name => 'twitter status' ).first.id,
|
||||||
:ticket_article_sender_id => Ticket::Article::Sender.where( :name => 'Agent' ).first.id,
|
:sender_id => Ticket::Article::Sender.where( :name => 'Agent' ).first.id,
|
||||||
:body => text,
|
:body => text,
|
||||||
# :from => sender.name,
|
# :from => sender.name,
|
||||||
# :to => to,
|
# :to => to,
|
||||||
# :message_id => tweet.id,
|
# :message_id => tweet.id,
|
||||||
:internal => false,
|
:internal => false,
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
assert( article, "outbound article created" )
|
assert( article, "outbound article created" )
|
||||||
assert_equal( article.ticket.articles.count, 1 )
|
assert_equal( article.ticket.articles.count, 1 )
|
||||||
|
@ -173,19 +173,19 @@ class TwitterTest < ActiveSupport::TestCase
|
||||||
assert( ticket.articles, "ticket.articles exists" )
|
assert( ticket.articles, "ticket.articles exists" )
|
||||||
article_count = ticket.articles.count
|
article_count = ticket.articles.count
|
||||||
assert( article_count )
|
assert( article_count )
|
||||||
# assert_equal( ticket.ticket_state.name, 'new' )
|
# assert_equal( ticket.state.name, 'new' )
|
||||||
|
|
||||||
# reply via ticket
|
# reply via ticket
|
||||||
outbound_article = Ticket::Article.create(
|
outbound_article = Ticket::Article.create(
|
||||||
:ticket_id => ticket.id,
|
:ticket_id => ticket.id,
|
||||||
:ticket_article_type_id => Ticket::Article::Type.where( :name => 'twitter direct-message' ).first.id,
|
:type_id => Ticket::Article::Type.where( :name => 'twitter direct-message' ).first.id,
|
||||||
:ticket_article_sender_id => Ticket::Article::Sender.where( :name => 'Agent' ).first.id,
|
:sender_id => Ticket::Article::Sender.where( :name => 'Agent' ).first.id,
|
||||||
:body => text,
|
:body => text,
|
||||||
# :from => sender.name,
|
# :from => sender.name,
|
||||||
:to => 'me_bauer',
|
:to => 'me_bauer',
|
||||||
:internal => false,
|
:internal => false,
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
assert( outbound_article, "outbound article created" )
|
assert( outbound_article, "outbound article created" )
|
||||||
assert_equal( outbound_article.ticket.articles.count, article_count + 1 )
|
assert_equal( outbound_article.ticket.articles.count, article_count + 1 )
|
||||||
|
|
Loading…
Reference in a new issue