Merge branch 'develop' of github.com:martini/zammad into develop

Conflicts:
	test/unit/ticket_sla_test.rb
This commit is contained in:
Martin Edenhofer 2015-04-27 19:44:35 +02:00
commit 7ff5568b37
59 changed files with 361 additions and 358 deletions

View file

@ -267,7 +267,7 @@ class ApplicationController < ActionController::Base
next if t.name =~ /^MST/
next if t.name =~ /^ROC/
next if t.name =~ /^ROK/
diff = t.current_period.utc_total_offset / 60 /60
diff = t.current_period.utc_total_offset / 60 / 60
config['timezones'][ t.name ] = diff
}

View file

@ -76,7 +76,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
# validate url
messages = {}
if !Setting.get('system_online_service')
if !params[:url] ||params[:url] !~ /^(http|https):\/\/.+?$/
if !params[:url] || params[:url] !~ /^(http|https):\/\/.+?$/
messages[:url] = 'A URL looks like http://zammad.example.com'
end
end

View file

@ -6,7 +6,7 @@ class ImportOtrsController < ApplicationController
return if setup_done_response
# validate
if !params[:url] ||params[:url] !~ /^(http|https):\/\/.+?$/
if !params[:url] || params[:url] !~ /^(http|https):\/\/.+?$/
render json: {
result: 'invalid',
message: 'Invalid!',
@ -64,7 +64,7 @@ class ImportOtrsController < ApplicationController
# return result
render json: {
result: 'invalid',
result: 'invalid',
message_human: message_human,
}
end

View file

@ -105,13 +105,13 @@ curl http://localhost/api/v1/online_notifications/mark_all_as_read -v -u #{login
=end
def mark_all_as_read
notifications = OnlineNotification.list(current_user,100)
notifications = OnlineNotification.list(current_user, 100)
notifications.each do |notification|
if !notification['seen']
OnlineNotification.seen( id: notification['id'] )
end
end
render json: {}, status: :ok
render json: {}, status: :ok
end
end

View file

@ -127,7 +127,7 @@ class SessionsController < ApplicationController
request.env['rack.session.options'][:expire_after] = -1.year
request.env['rack.session.options'][:renew] = true
render json: { }
render json: {}
end
def create_omniauth

View file

@ -18,7 +18,7 @@ class TaskbarController < ApplicationController
end
def create
model_create_render(Taskbar,params)
model_create_render(Taskbar, params)
end
def update

View file

@ -283,7 +283,7 @@ class UsersController < ApplicationController
user_all.each { |user|
realname = user.firstname.to_s + ' ' + user.lastname.to_s
if user.email && user.email.to_s != ''
realname = realname + ' <' + user.email.to_s + '>'
realname = realname + ' <' + user.email.to_s + '>'
end
a = { id: user.id, label: realname, value: realname }
users.push a

View file

@ -89,7 +89,7 @@ return all activity entries of an user
=end
def self.list(user,limit)
def self.list(user, limit)
role_ids = user.role_ids
group_ids = user.group_ids

View file

@ -108,7 +108,7 @@ returns
# set relations
self.class.reflect_on_all_associations.map { |assoc|
real_key = assoc.name.to_s[0,assoc.name.to_s.length-1] + '_ids'
real_key = assoc.name.to_s[0, assoc.name.to_s.length - 1] + '_ids'
if params.has_key?( real_key.to_sym )
list_of_items = params[ real_key.to_sym ]
if params[ real_key.to_sym ].class != Array
@ -141,7 +141,7 @@ returns
# set relations
attributes = self.attributes
self.class.reflect_on_all_associations.map { |assoc|
real_key = assoc.name.to_s[0,assoc.name.to_s.length-1] + '_ids'
real_key = assoc.name.to_s[0, assoc.name.to_s.length - 1] + '_ids'
if self.respond_to?( real_key )
attributes[ real_key ] = self.send( real_key )
end
@ -872,13 +872,13 @@ log object update history with all updated attributes, if configured - will be e
# get attribute name
attribute_name = key.to_s
if attribute_name[-3,3] == '_id'
attribute_name = attribute_name[ 0, attribute_name.length-3 ]
if attribute_name[-3, 3] == '_id'
attribute_name = attribute_name[ 0, attribute_name.length - 3 ]
end
value_id = []
value_str = [ value[0], value[1] ]
if key.to_s[-3,3] == '_id'
if key.to_s[-3, 3] == '_id'
value_id[0] = value[0]
value_id[1] = value[1]

View file

@ -112,8 +112,8 @@ returns
# get attribute name
attribute_name_with_id = key.to_s
attribute_name = key.to_s
next if attribute_name[-3,3] != '_id'
attribute_name = attribute_name[ 0, attribute_name.length-3 ]
next if attribute_name[-3, 3] != '_id'
attribute_name = attribute_name[ 0, attribute_name.length - 3 ]
# check if attribute method exists
next if !ref_object.respond_to?( attribute_name )

View file

@ -87,8 +87,8 @@ class Authorization < ApplicationModel
private
def delete_user_cache
self.user.cache_delete
end
def delete_user_cache
self.user.cache_delete
end
end

View file

@ -340,35 +340,35 @@ returns:
private
def self.set_default_items(object_id, o_id, avatar_id)
avatars = Avatar.where(
object_lookup_id: object_id,
o_id: o_id,
).order( 'created_at ASC, id DESC' )
avatars.each do |avatar|
next if avatar.id == avatar_id
avatar.default = false
avatar.save!
end
def self.set_default_items(object_id, o_id, avatar_id)
avatars = Avatar.where(
object_lookup_id: object_id,
o_id: o_id,
).order( 'created_at ASC, id DESC' )
avatars.each do |avatar|
next if avatar.id == avatar_id
avatar.default = false
avatar.save!
end
end
def self.add_init_avatar(object_id, o_id)
def self.add_init_avatar(object_id, o_id)
count = Avatar.where(
object_lookup_id: object_id,
o_id: o_id,
).count
return if count > 0
count = Avatar.where(
object_lookup_id: object_id,
o_id: o_id,
).count
return if count > 0
Avatar.create(
o_id: o_id,
object_lookup_id: object_id,
default: true,
source: 'init',
initial: true,
deletable: false,
updated_by_id: 1,
created_by_id: 1,
)
end
Avatar.create(
o_id: o_id,
object_lookup_id: object_id,
default: true,
source: 'init',
initial: true,
deletable: false,
updated_by_id: 1,
created_by_id: 1,
)
end
end

View file

@ -191,7 +191,7 @@ class Channel::EmailParser
else
# text part only
if !mail.mime_type || mail.mime_type.to_s == '' || mail.mime_type.to_s.downcase == 'text/plain'
if !mail.mime_type || mail.mime_type.to_s == '' || mail.mime_type.to_s.downcase == 'text/plain'
data[:body] = mail.body.decoded
data[:body] = Encode.conv( mail.charset, data[:body] )
@ -526,7 +526,7 @@ class Channel::EmailParser
def set_attributes_by_x_headers( item_object, header_name, mail )
# loop all x-zammad-hedaer-* headers
item_object.attributes.each{|key,value|
item_object.attributes.each{|key, value|
# ignore read only attributes
next if key == 'updated_at'
@ -535,9 +535,9 @@ class Channel::EmailParser
next if key == 'created_by_id'
# check if id exists
key_short = key[ key.length-3 , key.length ]
key_short = key[ key.length - 3, key.length ]
if key_short == '_id'
key_short = key[ 0, key.length-3 ]
key_short = key[ 0, key.length - 3 ]
header = "x-zammad-#{header_name}-#{key_short}"
if mail[ header.to_sym ]
puts "NOTICE: header #{header} found #{mail[ header.to_sym ]}"

View file

@ -65,7 +65,7 @@ class Channel::IMAP < Channel::EmailParser
# check for verify message
if check_type == 'verify'
subject = @imap.fetch(message_id,'ENVELOPE')[0].attr['ENVELOPE'].subject
subject = @imap.fetch(message_id, 'ENVELOPE')[0].attr['ENVELOPE'].subject
if subject && subject =~ /#{verify_string}/
puts " - verify email #{verify_string} found"
@imap.store(message_id, '+FLAGS', [:Deleted])
@ -76,7 +76,7 @@ class Channel::IMAP < Channel::EmailParser
else
# delete email from server after article was created
msg = @imap.fetch(message_id,'RFC822')[0].attr['RFC822']
msg = @imap.fetch(message_id, 'RFC822')[0].attr['RFC822']
if process(channel, msg)
@imap.store(message_id, '+FLAGS', [:Deleted])
end

View file

@ -227,7 +227,7 @@ class Channel::TWITTER2
ticket = Ticket.create(
group_id: group_id,
customer_id: user.id,
title: tweet.text[0,40],
title: tweet.text[0, 40],
state_id: state_id,
priority_id: priority_id,
)

View file

@ -70,7 +70,7 @@ class Observer::Ticket::Notification::BackgroundJob
object: 'Ticket',
o_id: ticket.id,
seen: seen,
created_by_id: ticket.updated_by_id || 1,
created_by_id: ticket.updated_by_id ||  1,
user_id: user.id,
)
@ -134,7 +134,7 @@ class Observer::Ticket::Notification::BackgroundJob
history_type: 'notification',
history_object: 'Ticket',
value_to: recipient_list,
created_by_id: ticket.updated_by_id || 1
created_by_id: ticket.updated_by_id ||  1
)
end
end
@ -165,8 +165,8 @@ class Observer::Ticket::Notification::BackgroundJob
# get attribute name
attribute_name = key.to_s
object_manager_attribute = attribute_list[attribute_name]
if attribute_name[-3,3] == '_id'
attribute_name = attribute_name[ 0, attribute_name.length-3 ].to_s
if attribute_name[-3, 3] == '_id'
attribute_name = attribute_name[ 0, attribute_name.length - 3 ].to_s
end
# add item to changes hash
@ -177,7 +177,7 @@ class Observer::Ticket::Notification::BackgroundJob
# if changed item is an _id field/reference, do an lookup for the realy values
value_id = []
value_str = [ value[0], value[1] ]
if key.to_s[-3,3] == '_id'
if key.to_s[-3, 3] == '_id'
value_id[0] = value[0]
value_id[1] = value[1]
@ -289,7 +289,7 @@ State: i18n(#{ticket.state.name.text2html})<br>
def template_update(user, ticket, article, ticket_changes)
changes = ''
ticket_changes.each {|key,value|
ticket_changes.each {|key, value|
changes += "i18n(#{key.to_s.text2html}): #{value[0].to_s.text2html} -> #{value[1].to_s.text2html}<br>\n"
}
article_content = ''
@ -339,7 +339,7 @@ Changes:<br>
end
body = template_header(user) + body
body += template_footer(user,ticket, article)
body += template_footer(user, ticket, article)
template = {
subject: subject,

View file

@ -85,7 +85,7 @@ return all online notifications of an user
=end
def self.list(user,limit)
def self.list(user, limit)
notifications = OnlineNotification.where(user_id: user.id).
order( 'created_at DESC, id DESC' ).
@ -167,7 +167,7 @@ returns:
=end
def self.list_full(user,limit)
def self.list_full(user, limit)
notifications = OnlineNotification.list(user, limit)
assets = ApplicationModel.assets_of_object_list(notifications)

View file

@ -21,8 +21,8 @@ returns
# get attribute name
attribute_name = key.to_s
next if attribute_name[-3,3] != '_id'
attribute_name = attribute_name[ 0, attribute_name.length-3 ]
next if attribute_name[-3, 3] != '_id'
attribute_name = attribute_name[ 0, attribute_name.length - 3 ]
# check if attribute method exists
next if !ref_object.respond_to?( attribute_name )

View file

@ -207,11 +207,11 @@ class Package < ApplicationModel
end
# uninstall files of old package
self.uninstall({
self.uninstall(
name: package_db.name,
version: package_db.version,
migration_not_down: true,
})
)
end
# store package
@ -391,7 +391,7 @@ class Package < ApplicationModel
# check if directories need to be created
directories = location.split '/'
(0..(directories.length-2) ).each {|position|
(0..(directories.length - 2) ).each {|position|
tmp_path = ''
(1..position).each {|count|
tmp_path = tmp_path + '/' + directories[count].to_s

View file

@ -60,7 +60,7 @@ class Store::Provider::File
end
# write file to fs
def self.write_to_fs(data,sha)
def self.write_to_fs(data, sha)
# install file
permission = '600'

View file

@ -366,7 +366,7 @@ returns
=end
def self.password_reset_via_token(token,password)
def self.password_reset_via_token(token, password)
# check token
user = Token.check( action: 'PasswordReset', name: token )

View file

@ -6,6 +6,6 @@ Zammad::Application.routes.draw do
match api_path + '/networks/:id', to: 'networks#show', via: :get
match api_path + '/networks', to: 'networks#create', via: :post
match api_path + '/networks/:id', to: 'networks#update', via: :put
match api_path + '/networks/:id', to: 'networks#destroy',via: :delete
match api_path + '/networks/:id', to: 'networks#destroy', via: :delete
end

View file

@ -6,6 +6,6 @@ Zammad::Application.routes.draw do
match api_path + '/organizations/:id', to: 'organizations#show', via: :get
match api_path + '/organizations', to: 'organizations#create', via: :post
match api_path + '/organizations/:id', to: 'organizations#update', via: :put
match api_path + '/organizations/history/:id',to: 'organizations#history',via: :get
match api_path + '/organizations/history/:id', to: 'organizations#history', via: :get
end

View file

@ -5,6 +5,6 @@ Zammad::Application.routes.draw do
match api_path + '/taskbar/:id', to: 'taskbar#show', via: :get
match api_path + '/taskbar', to: 'taskbar#create', via: :post
match api_path + '/taskbar/:id', to: 'taskbar#update', via: :put
match api_path + '/taskbar/:id', to: 'taskbar#destroy',via: :delete
match api_path + '/taskbar/:id', to: 'taskbar#destroy', via: :delete
end

View file

@ -33,7 +33,7 @@ class CreateBase < ActiveRecord::Migration
t.column :last_login, :timestamp, null: true
t.column :source, :string, limit: 200, null: true
t.column :login_failed, :integer, null: false, default: 0
t.column :preferences, :string, limit: 8000,null: true
t.column :preferences, :string, limit: 8000, null: true
t.column :updated_by_id, :integer, null: false
t.column :created_by_id, :integer, null: false
t.timestamps

View file

@ -35,10 +35,10 @@ class CreateTicket < ActiveRecord::Migration
t.references :state, null: false
t.references :organization, null: true
t.column :number, :string, limit: 60, null: false
t.column :title, :string, limit: 250,null: false
t.column :title, :string, limit: 250, null: false
t.column :owner_id, :integer, null: false
t.column :customer_id, :integer, null: false
t.column :note, :string, limit: 250,null: true
t.column :note, :string, limit: 250, null: true
t.column :first_response, :timestamp, null: true
t.column :first_response_escal_date, :timestamp, null: true
t.column :first_response_sla_time, :timestamp, null: true

View file

@ -168,7 +168,7 @@ class CreateObjectManager < ActiveRecord::Migration
null: false,
default: 2,
translate: true,
filter: [1,2,3,4,7],
filter: [1, 2, 3, 4, 7],
},
editable: false,
active: true,
@ -182,7 +182,7 @@ class CreateObjectManager < ActiveRecord::Migration
item_class: 'column',
nulloption: false,
null: true,
filter: [1,4],
filter: [1, 4],
default: 1,
},
},
@ -190,12 +190,12 @@ class CreateObjectManager < ActiveRecord::Migration
Agent: {
nulloption: false,
null: false,
filter: [2,3,4,7],
filter: [2, 3, 4, 7],
},
Customer: {
nulloption: false,
null: true,
filter: [2,4],
filter: [2, 4],
default: 2,
},
},
@ -217,10 +217,10 @@ class CreateObjectManager < ActiveRecord::Migration
null: true,
translate: true,
required_if: {
state_id: [3,7]
state_id: [3, 7]
},
shown_if: {
state_id: [3,7]
state_id: [3, 7]
},
},
editable: false,

View file

@ -14,7 +14,7 @@ class UpdateOverviewAndTicketState < ActiveRecord::Migration
condition: {
'tickets.state_id' => [3],
'tickets.owner_id' => 'current_user.id',
'tickets.pending_time' => { 'direction' => 'before', 'count'=> 1, 'area' => 'minute' },
'tickets.pending_time' => { 'direction' => 'before', 'count' => 1, 'area' => 'minute' },
},
order: {
by: 'created_at',
@ -43,7 +43,7 @@ class UpdateOverviewAndTicketState < ActiveRecord::Migration
null: false,
default: 2,
translate: true,
filter: [1,2,3,4,7],
filter: [1, 2, 3, 4, 7],
},
editable: false,
active: true,
@ -57,7 +57,7 @@ class UpdateOverviewAndTicketState < ActiveRecord::Migration
item_class: 'column',
nulloption: false,
null: true,
filter: [1,4],
filter: [1, 4],
default: 1,
},
},
@ -65,12 +65,12 @@ class UpdateOverviewAndTicketState < ActiveRecord::Migration
Agent: {
nulloption: false,
null: false,
filter: [2,3,4,7],
filter: [2, 3, 4, 7],
},
Customer: {
nulloption: false,
null: true,
filter: [2,4],
filter: [2, 4],
default: 2,
},
},
@ -93,10 +93,10 @@ class UpdateOverviewAndTicketState < ActiveRecord::Migration
null: true,
translate: true,
required_if: {
state_id: [3,7]
state_id: [3, 7]
},
shown_if: {
state_id: [3,7]
state_id: [3, 7]
},
},
editable: false,

View file

@ -10,7 +10,7 @@ class UpdateOverview2 < ActiveRecord::Migration
prio: 1000,
role_id: overview_role.id,
condition: {
'tickets.state_id' => [ 1,2,3,7 ],
'tickets.state_id' => [ 1, 2, 3, 7 ],
'tickets.owner_id' => 'current_user.id',
},
order: {

View file

@ -1406,7 +1406,7 @@ Overview.create_if_not_exists(
prio: 1000,
role_id: overview_role.id,
condition: {
'tickets.state_id' => [ 1,2,3,7 ],
'tickets.state_id' => [ 1, 2, 3, 7 ],
'tickets.owner_id' => 'current_user.id',
},
order: {
@ -1429,7 +1429,7 @@ Overview.create_if_not_exists(
condition: {
'tickets.state_id' => [3],
'tickets.owner_id' => 'current_user.id',
'tickets.pending_time' => { 'direction' => 'before', 'count'=> 1, 'area' => 'minute' },
'tickets.pending_time' => { 'direction' => 'before', 'count' => 1, 'area' => 'minute' },
},
order: {
by: 'created_at',
@ -1449,7 +1449,7 @@ Overview.create_if_not_exists(
prio: 1020,
role_id: overview_role.id,
condition: {
'tickets.state_id' => [1,2,3],
'tickets.state_id' => [1, 2, 3],
'tickets.owner_id' => 1,
},
order: {
@ -1470,7 +1470,7 @@ Overview.create_if_not_exists(
prio: 1030,
role_id: overview_role.id,
condition: {
'tickets.state_id' => [1,2,3],
'tickets.state_id' => [1, 2, 3],
},
order: {
by: 'created_at',
@ -1478,7 +1478,7 @@ Overview.create_if_not_exists(
},
view: {
d: [ 'title', 'customer', 'group', 'state', 'owner', 'created_at' ],
s: [ 'title', 'customer', 'group', 'state', 'owner','created_at' ],
s: [ 'title', 'customer', 'group', 'state', 'owner', 'created_at' ],
m: [ 'number', 'title', 'customer', 'group', 'state', 'owner', 'created_at' ],
view_mode_default: 's',
},
@ -1491,7 +1491,7 @@ Overview.create_if_not_exists(
role_id: overview_role.id,
condition: {
'tickets.state_id' => [3],
'tickets.pending_time' => { 'direction' => 'before', 'count'=> 1, 'area' => 'minute' },
'tickets.pending_time' => { 'direction' => 'before', 'count' => 1, 'area' => 'minute' },
},
order: {
by: 'created_at',
@ -1511,7 +1511,7 @@ Overview.create_if_not_exists(
prio: 1040,
role_id: overview_role.id,
condition: {
'tickets.escalation_time' => { 'direction' => 'before', 'count'=> 5, 'area' => 'minute' },
'tickets.escalation_time' => { 'direction' => 'before', 'count' => 5, 'area' => 'minute' },
},
order: {
by: 'escalation_time',
@ -1532,7 +1532,7 @@ Overview.create_if_not_exists(
prio: 1000,
role_id: overview_role.id,
condition: {
'tickets.state_id' => [ 1,2,3,4,6 ],
'tickets.state_id' => [ 1, 2, 3, 4, 6 ],
'tickets.customer_id' => 'current_user.id',
},
order: {
@ -1553,7 +1553,7 @@ Overview.create_if_not_exists(
role_id: overview_role.id,
organization_shared: true,
condition: {
'tickets.state_id' => [ 1,2,3,4,6 ],
'tickets.state_id' => [ 1, 2, 3, 4, 6 ],
'tickets.organization_id' => 'current_user.organization_id',
},
order: {

View file

@ -2,8 +2,8 @@ class Class
def to_app_model_url
camel_cased_word = self.to_s
camel_cased_word.gsub(/::/, '_').
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
gsub(/([a-z\d])([A-Z])/,'\1_\2').
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
gsub(/([a-z\d])([A-Z])/, '\1_\2').
tr('-', '_').
downcase
end

View file

@ -54,7 +54,7 @@ module FillDB
suffix = rand(99_999).to_s
organization = nil
if !organization_pool.empty? && rand(2) == 1
organization = organization_pool[ organization_pool.length-1 ]
organization = organization_pool[ organization_pool.length - 1 ]
end
user = User.create_or_update(
login: "filldb-customer-#{suffix}",
@ -95,15 +95,15 @@ module FillDB
state_pool = Ticket::State.all
if tickets && !tickets.zero?
(1..tickets).each {|count|
customer = customer_pool[ rand(customer_pool.length-1) ]
agent = agent_pool[ rand(agent_pool.length-1) ]
customer = customer_pool[ rand(customer_pool.length - 1) ]
agent = agent_pool[ rand(agent_pool.length - 1) ]
ticket = Ticket.create(
title: 'some title äöüß' + rand(999_999).to_s,
group: group_pool[ rand(group_pool.length-1) ],
group: group_pool[ rand(group_pool.length - 1) ],
customer: customer,
owner: agent,
state: state_pool[ rand(state_pool.length-1) ],
priority: priority_pool[ rand(priority_pool.length-1) ],
state: state_pool[ rand(state_pool.length - 1) ],
priority: priority_pool[ rand(priority_pool.length - 1) ],
updated_by_id: agent.id,
created_by_id: agent.id,
)

View file

@ -37,13 +37,13 @@ returns
=end
def self.reverse_geocode(lat,lng)
def self.reverse_geocode(lat, lng)
# load backend
backend = self.load_adapter_by_setting( 'geo_location_backend' )
return if !backend
# db lookup
backend.reverse_geocode(lat,lng)
backend.reverse_geocode(lat, lng)
end
end

View file

@ -15,10 +15,10 @@ class GeoLocation::Gmaps
lat = result['results'].first['geometry']['location']['lat']
lng = result['results'].first['geometry']['location']['lng']
latlng = [lat,lng]
latlng = [lat, lng]
end
def self.reverse_geocode(lat,lng)
def self.reverse_geocode(lat, lng)
url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=#{lat},#{lng}&sensor=true"
response = UserAgent.get(url)
return if !response.success?

View file

@ -67,7 +67,7 @@ module Import::OTRS
required_group_ro: 'groups_ro',
required_group_rw: 'groups_rw',
}
types.each {|config_key,result_key|
types.each {|config_key, result_key|
if config[config_key]
return false if !result[result_key].has_value?( config[config_key] )
end
@ -82,7 +82,7 @@ module Import::OTRS
group_ro_role_map: 'groups_ro',
group_rw_role_map: 'groups_rw',
}
types.each {|config_key,result_key|
types.each {|config_key, result_key|
next if !config[config_key]
config[config_key].each {|otrs_group, role|
next if !result[result_key].has_value?( otrs_group )
@ -278,7 +278,7 @@ module Import::OTRS
created_by_id: 1,
updated_by_id: 1,
}
map[:Ticket].each { |key,value|
map[:Ticket].each { |key, value|
if record['Ticket'][key.to_s] && record['Ticket'][key.to_s].class == String
ticket_new[value] = Encode.conv( 'utf8', record['Ticket'][key.to_s] )
else
@ -331,7 +331,7 @@ module Import::OTRS
created_by_id: 1,
updated_by_id: 1,
}
map[:Article].each { |key,value|
map[:Article].each { |key, value|
if article[key.to_s]
article_new[value] = Encode.conv( 'utf8', article[key.to_s] )
end
@ -572,7 +572,7 @@ module Import::OTRS
created_by_id: 1,
updated_by_id: 1,
}
map.each { |key,value|
map.each { |key, value|
if state[key.to_s]
state_new[value] = state[key.to_s]
end
@ -623,7 +623,7 @@ module Import::OTRS
created_by_id: 1,
updated_by_id: 1,
}
map.each { |key,value|
map.each { |key, value|
if priority[key.to_s]
priority_new[value] = priority[key.to_s]
end
@ -667,7 +667,7 @@ module Import::OTRS
created_by_id: 1,
updated_by_id: 1,
}
map.each { |key,value|
map.each { |key, value|
if group[key.to_s]
group_new[value] = group[key.to_s]
end
@ -719,7 +719,7 @@ module Import::OTRS
source: 'OTRS Import',
role_ids: [ role.id ],
}
map.each { |key,value|
map.each { |key, value|
if user[key.to_s]
user_new[value] = user[key.to_s]
end
@ -793,7 +793,7 @@ module Import::OTRS
source: 'OTRS Import',
role_ids: [role.id],
}
map.each { |key,value|
map.each { |key, value|
if user[key.to_s]
user_new[value] = user[key.to_s]
end

View file

@ -347,7 +347,7 @@ module Import::OTRS2
run = true
while run
count += steps
records = load('CustomerUser', steps, count-steps)
records = load('CustomerUser', steps, count - steps)
if !records || !records[0]
log 'all customers imported.'
run = false
@ -371,11 +371,11 @@ module Import::OTRS2
while run
count += steps
log "loading... thread# #{thread} ..."
offset = count-steps
offset = count - steps
if offset != 0
offset = count - steps + 1
end
records = load( 'Ticket', steps, count-steps)
records = load( 'Ticket', steps, count - steps)
if !records || !records[0]
log "... thread# #{thread}, no more work."
run = false
@ -450,11 +450,11 @@ module Import::OTRS2
while run
count += steps
log 'loading... diff ...'
offset = count-steps
offset = count - steps
if offset != 0
offset = count - steps + 1
end
records = load( 'Ticket', steps, count-steps, 1 )
records = load( 'Ticket', steps, count - steps, 1 )
if !records || !records[0]
log '... no more work.'
run = false
@ -520,7 +520,7 @@ module Import::OTRS2
created_by_id: 1,
updated_by_id: 1,
}
map[:Ticket].each { |key,value|
map[:Ticket].each { |key, value|
if record[key.to_s] && record[key.to_s].class == String
ticket_new[value] = Encode.conv( 'utf8', record[key.to_s] )
else
@ -571,7 +571,7 @@ module Import::OTRS2
created_by_id: 1,
updated_by_id: 1,
}
map[:Article].each { |key,value|
map[:Article].each { |key, value|
if article[key.to_s]
article_new[value] = Encode.conv( 'utf8', article[key.to_s] )
end
@ -820,7 +820,7 @@ module Import::OTRS2
created_by_id: 1,
updated_by_id: 1,
}
map.each { |key,value|
map.each { |key, value|
if state.has_key?(key.to_s)
state_new[value] = state[key.to_s]
end
@ -869,7 +869,7 @@ module Import::OTRS2
created_by_id: 1,
updated_by_id: 1,
}
map.each { |key,value|
map.each { |key, value|
if priority.has_key?(key.to_s)
priority_new[value] = priority[key.to_s]
end
@ -910,7 +910,7 @@ module Import::OTRS2
created_by_id: 1,
updated_by_id: 1,
}
map.each { |key,value|
map.each { |key, value|
if group.has_key?(key.to_s)
group_new[value] = group[key.to_s]
end
@ -966,7 +966,7 @@ module Import::OTRS2
role_ids: role_ids,
group_ids: group_ids,
}
map.each { |key,value|
map.each { |key, value|
if user.has_key?(key.to_s)
user_new[value] = user[key.to_s]
end
@ -1037,7 +1037,7 @@ module Import::OTRS2
if group_lookup['Name'] == 'admin' && permissions && permissions.include?('rw')
roles.push 'Admin'
end
if group_lookup['Name'] =~ /^(stats|report)/ && permissions && ( permissions.include?('ro') || permissions.include?('rw') )
if group_lookup['Name'] =~ /^(stats|report)/ && permissions && ( permissions.include?('ro') ||  permissions.include?('rw') )
roles.push 'Report'
end
end
@ -1091,7 +1091,7 @@ module Import::OTRS2
organization_id: get_organization_id(user, organizations),
role_ids: [ role_customer.id ],
}
map.each { |key,value|
map.each { |key, value|
if user.has_key?(key.to_s)
user_new[value] = user[key.to_s]
end
@ -1155,7 +1155,7 @@ module Import::OTRS2
created_by_id: 1,
updated_by_id: 1,
}
map.each { |key,value|
map.each { |key, value|
if organization.has_key?(key.to_s)
organization_new[value] = organization[key.to_s]
end

View file

@ -42,10 +42,13 @@ returns
# send update to browser
if session && session['id']
self.send( client_id, {
event: 'ws:login',
data: { success: true },
})
self.send(
client_id,
{
event: 'ws:login',
data: { success: true },
}
)
end
end
@ -269,7 +272,7 @@ returns
while check
if File::exists?( path + filename )
count += 1
filename = filename + '-' + count
filename = filename + '-' + count
else
check = false
end
@ -395,7 +398,7 @@ returns
path = @path + '/spool/'
FileUtils.mkpath path
file = Time.new.to_f.to_s + '-' + rand(99_999).to_s
File.open( path + '/' + file , 'wb' ) { |file|
File.open( path + '/' + file, 'wb' ) { |file|
data = {
msg: msg,
timestamp: Time.now.to_i,

View file

@ -43,7 +43,7 @@ class Sessions::Backend::ActivityStream
data = self.load
return if !data||data.empty?
return if !data || data.empty?
if !@client
return {
@ -54,11 +54,11 @@ class Sessions::Backend::ActivityStream
end
@client.log 'notify', "push activity_stream #{ data.first.class.to_s } for user #{ @user.id }"
@client.send({
@client.send(
event: 'activity_stream_rebuild',
collection: 'activity_stream',
data: data,
})
)
end
end

View file

@ -52,7 +52,7 @@ class Sessions::Backend::Collections::Base
# load current data
items = self.load
return if !items||items.empty?
return if !items || items.empty?
# get relations of data
all = []
@ -74,18 +74,18 @@ class Sessions::Backend::Collections::Base
}
end
@client.log 'notify', "push assets for push_collection #{ items.first.class.to_s } for user #{ @user.id }"
@client.send({
@client.send(
data: assets,
event: [ 'loadAssets' ],
})
)
@client.log 'notify', "push push_collection #{ items.first.class.to_s } for user #{ @user.id }"
@client.send({
@client.send(
event: 'resetCollection',
data: {
items.first.class.to_app_model => all,
},
})
)
end
def self.model_set(model)

View file

@ -43,7 +43,7 @@ class Sessions::Backend::Rss
data = self.load
return if !data||data.empty?
return if !data || data.empty?
if !@client
return {
@ -54,11 +54,11 @@ class Sessions::Backend::Rss
end
@client.log 'notify', "push rss for user #{@user.id}"
@client.send({
@client.send(
event: 'rss_rebuild',
collection: 'dashboard_rss',
data: data,
})
)
end
end

View file

@ -59,10 +59,10 @@ class Sessions::Backend::TicketCreate
end
@client.log 'notify', "push ticket_create for user #{ @user.id }"
@client.send({
@client.send(
collection: 'ticket_create_attributes',
data: data,
})
)
end
end

View file

@ -57,10 +57,10 @@ class Sessions::Backend::TicketOverviewIndex
end
@client.log 'notify', "push overview_index for user #{ @user.id }"
@client.send({
@client.send(
event: ['ticket_overview_index'],
data: data,
})
)
end
end

View file

@ -106,11 +106,11 @@ class Sessions::Backend::TicketOverviewList
@client.log 'notify', "push overview_list for user #{ @user.id }"
# send update to browser
@client.send({
@client.send(
data: assets,
event: [ 'loadAssets' ]
})
@client.send({
)
@client.send(
data: {
view: item[:index].link.to_s,
overview: overview_data[:overview],
@ -122,7 +122,7 @@ class Sessions::Backend::TicketOverviewList
},
},
event: [ 'ticket_overview_rebuild' ],
})
)
end
}
return results if !@client

View file

@ -7,7 +7,7 @@ module StaticAssets
data[:content] = Base64.decode64($2)
return data
end
raise "Unable to parse data url: #{data_url.substr(0,100)}"
raise "Unable to parse data url: #{data_url.substr(0, 100)}"
end
# store image 1:1

View file

@ -197,7 +197,7 @@ put working hours matrix and timezone in function, returns UTC working hours mat
# keep it in current day
if next_hour == 23
start_time += diff-1
start_time += diff - 1
else
start_time += diff
end
@ -334,7 +334,7 @@ put working hours matrix and timezone in function, returns UTC working hours mat
# keep it in current day
if next_hour == 23
start_time += diff-1
start_time += diff - 1
else
start_time += diff
end

View file

@ -45,7 +45,7 @@ returns
http = get_http(uri, options)
# prepare request
request = Net::HTTP::Get.new( uri, {'User-Agent' => 'Zammad User Agent'} )
request = Net::HTTP::Get.new( uri, { 'User-Agent' => 'Zammad User Agent' } )
# http basic auth (if needed)
request = set_basic_auth(request, options)
@ -93,7 +93,7 @@ returns
http = get_http(uri, options)
# prepare request
request = Net::HTTP::Post.new( uri, {'User-Agent' => 'Zammad User Agent'} )
request = Net::HTTP::Post.new( uri, { 'User-Agent' => 'Zammad User Agent' } )
# set params
request = set_params(request, params, options)
@ -141,7 +141,7 @@ returns
http = get_http(uri, options)
# prepare request
request = Net::HTTP::Put.new( uri, {'User-Agent' => 'Zammad User Agent'} )
request = Net::HTTP::Put.new( uri, { 'User-Agent' => 'Zammad User Agent' } )
# set params
request = set_params(request, params, options)
@ -185,7 +185,7 @@ returns
http = get_http(uri, options)
# prepare request
request = Net::HTTP::Delete.new( uri, {'User-Agent' => 'Zammad User Agent'} )
request = Net::HTTP::Delete.new( uri, { 'User-Agent' => 'Zammad User Agent' } )
# http basic auth (if needed)
request = set_basic_auth(request, options)
@ -241,150 +241,150 @@ returns
end
private
def self.get_http(uri, options)
http = Net::HTTP.new(uri.host, uri.port)
def self.get_http(uri, options)
http = Net::HTTP.new(uri.host, uri.port)
http.open_timeout = options[:open_timeout] || 4
http.read_timeout = options[:read_timeout] || 10
http.open_timeout = options[:open_timeout] || 4
http.read_timeout = options[:read_timeout] || 10
if uri.scheme =~ /https/i
http.use_ssl = true
# @TODO verify_mode should be configurable
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
http
if uri.scheme =~ /https/i
http.use_ssl = true
# @TODO verify_mode should be configurable
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
def self.set_basic_auth(request, options)
http
end
# http basic auth (if needed)
if options[:user] && options[:user] != '' && options[:password] && options[:password] != ''
request.basic_auth options[:user], options[:password]
end
request
def self.set_basic_auth(request, options)
# http basic auth (if needed)
if options[:user] && options[:user] != '' && options[:password] && options[:password] != ''
request.basic_auth options[:user], options[:password]
end
request
end
def self.set_params(request, params, options)
if options[:json]
request.add_field('Content-Type', 'application/json')
if !params.empty?
request.body = params.to_json
end
else
if !params.empty?
request.set_form_data( params )
end
def self.set_params(request, params, options)
if options[:json]
request.add_field('Content-Type', 'application/json')
if !params.empty?
request.body = params.to_json
end
else
if !params.empty?
request.set_form_data( params )
end
request
end
request
end
def self.process(response, uri, count, params, options)
if !response
return Result.new(
error: "Can't connect to #{uri.to_s}, got no response!",
success: false,
code: 0,
)
end
case response
when Net::HTTPNotFound
return Result.new(
error: "No such file #{uri.to_s}, 404!",
success: false,
code: response.code,
)
when Net::HTTPClientError
return Result.new(
error: "Client Error: #{response.inspect}!",
success: false,
code: response.code,
)
when Net::HTTPInternalServerError
return Result.new(
error: "Server Error: #{response.inspect}!",
success: false,
code: response.code,
)
when Net::HTTPRedirection
raise 'Too many redirections for the original URL, halting.' if count <= 0
url = response['location']
return get(url, params, options, count - 1)
when Net::HTTPOK
data = nil
if options[:json] && !options[:jsonParseDisable] && response.body
data = JSON.parse( response.body )
end
return Result.new(
data: data,
body: response.body,
content_type: response['Content-Type'],
success: true,
code: response.code,
)
when Net::HTTPCreated
data = nil
if options[:json] && !options[:jsonParseDisable] && response.body
data = JSON.parse( response.body )
end
return Result.new(
data: data,
body: response.body,
content_type: response['Content-Type'],
success: true,
code: response.code,
)
end
raise "Unable to process http call '#{response.inspect}'"
end
def self.ftp(uri,options)
host = uri.host
filename = File.basename(uri.path)
remote_dir = File.dirname(uri.path)
temp_file = Tempfile.new("download-#{filename}")
temp_file.binmode
begin
Net::FTP.open(host) do |ftp|
ftp.passive = true
if options[:user] && options[:password]
ftp.login( options[:user], options[:password] )
else
ftp.login
end
ftp.chdir(remote_dir) unless remote_dir == '.'
begin
ftp.getbinaryfile( filename, temp_file )
rescue => e
return Result.new(
error: e.inspect,
success: false,
code: '550',
)
end
end
rescue => e
return Result.new(
error: e.inspect,
success: false,
code: 0,
)
end
contents = temp_file.read
temp_file.close
Result.new(
body: contents,
success: true,
code: '200',
def self.process(response, uri, count, params, options)
if !response
return Result.new(
error: "Can't connect to #{uri.to_s}, got no response!",
success: false,
code: 0,
)
end
case response
when Net::HTTPNotFound
return Result.new(
error: "No such file #{uri.to_s}, 404!",
success: false,
code: response.code,
)
when Net::HTTPClientError
return Result.new(
error: "Client Error: #{response.inspect}!",
success: false,
code: response.code,
)
when Net::HTTPInternalServerError
return Result.new(
error: "Server Error: #{response.inspect}!",
success: false,
code: response.code,
)
when Net::HTTPRedirection
raise 'Too many redirections for the original URL, halting.' if count <= 0
url = response['location']
return get(url, params, options, count - 1)
when Net::HTTPOK
data = nil
if options[:json] && !options[:jsonParseDisable] && response.body
data = JSON.parse( response.body )
end
return Result.new(
data: data,
body: response.body,
content_type: response['Content-Type'],
success: true,
code: response.code,
)
when Net::HTTPCreated
data = nil
if options[:json] && !options[:jsonParseDisable] && response.body
data = JSON.parse( response.body )
end
return Result.new(
data: data,
body: response.body,
content_type: response['Content-Type'],
success: true,
code: response.code,
)
end
raise "Unable to process http call '#{response.inspect}'"
end
def self.ftp(uri, options)
host = uri.host
filename = File.basename(uri.path)
remote_dir = File.dirname(uri.path)
temp_file = Tempfile.new("download-#{filename}")
temp_file.binmode
begin
Net::FTP.open(host) do |ftp|
ftp.passive = true
if options[:user] && options[:password]
ftp.login( options[:user], options[:password] )
else
ftp.login
end
ftp.chdir(remote_dir) unless remote_dir == '.'
begin
ftp.getbinaryfile( filename, temp_file )
rescue => e
return Result.new(
error: e.inspect,
success: false,
code: '550',
)
end
end
rescue => e
return Result.new(
error: e.inspect,
success: false,
code: 0,
)
end
contents = temp_file.read
temp_file.close
Result.new(
body: contents,
success: true,
code: '200',
)
end
class Result
def initialize(options)
@success = options[:success]

View file

@ -22,7 +22,7 @@ def checkForHeader(fileName)
# detect file type
if allLines[0] =~ /(^# Copyright)/ || allLines[1] =~ /(^# Copyright)/
foundHeader = true
elsif allLines[1] =~/^=begin/ #assume external script
elsif allLines[1] =~ /^=begin/ #assume external script
foundHeader = true
end
if allLines[0] =~ /(^#!\/)/
@ -67,7 +67,7 @@ def checkForHeader(fileName)
end
#folder array
folder = ['app/assets/javascripts/app','app/controllers/', 'app/models/', 'app/helpers/', 'app/mailers/' ]
folder = ['app/assets/javascripts/app', 'app/controllers/', 'app/models/', 'app/helpers/', 'app/mailers/' ]
folder.each do |folder|
puts 'Working on folder' + folder.to_s
rbfiles = File.join("../#{folder}**", '*.{rb,coffee}')

View file

@ -64,19 +64,19 @@ puts "Starting websocket server on #{ @options[:b] }:#{ @options[:p] } (secure:#
if ARGV[0] == 'stop'
# read pid
pid =File.open( @options[:i].to_s ).read
pid = File.open( @options[:i].to_s ).read
pid.gsub!(/\r|\n/, '')
# kill
Process.kill( 9, pid.to_i )
exit
end
if ARGV[0] == 'start' && @options[:d]
if ARGV[0] == 'start' && @options[:d]
Daemons.daemonize
# create pid file
$daemon_pid = File.new( @options[:i].to_s,'w' )
$daemon_pid = File.new( @options[:i].to_s, 'w' )
$daemon_pid.sync = true
$daemon_pid.puts(Process.pid.to_s)
$daemon_pid.close

View file

@ -625,7 +625,7 @@ class TestCase < Test::Unit::TestCase
raise "not matching '#{data[:title]}' in title '#{title}'"
end
end
puts "tv #{params.inspect}"
puts "tv #{params.inspect}"
# verify modified
if data.has_key?(:modified)
exists = instance.find_elements( { css: '.tasks .active .icon' } )[0]

View file

@ -73,7 +73,7 @@ class TwitterTest < ActiveSupport::TestCase
ticket = Ticket.create(
group_id: group.id,
customer_id: user.id,
title: text[0,40],
title: text[0, 40],
state_id: state.id,
priority_id: priority.id,
updated_by_id: 1,

View file

@ -18,7 +18,7 @@ class ExampleTest < Test::Unit::TestCase
def test_first_page
browser.get 'http://portal.znuny.com/'
assert_equal browser.current_url, 'https://portal.znuny.com/#login'
assert_equal browser.current_url, 'https://portal.znuny.com/#login'
end
def test_login_failed

View file

@ -35,7 +35,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
created_by_id: current_user.id,
},
article: {
updated_by_id: current_user.id,
updated_by_id: current_user.id,
created_by_id: current_user.id,
type_id: Ticket::Article::Type.lookup( name: 'phone' ).id,
sender_id: Ticket::Article::Sender.lookup( name: 'Customer' ).id,
@ -58,10 +58,10 @@ class ActivityStreamTest < ActiveSupport::TestCase
},
},
check: [
{
{
result: true,
object: 'Ticket',
type: 'updated',
object: 'Ticket',
type: 'updated',
},
{
result: true,

View file

@ -2153,7 +2153,7 @@ Some Text',
assert( false, "No user '#{user_result[:email]}' found!" )
return
end
user_result.each { |key,value|
user_result.each { |key, value|
if user.respond_to?( key )
assert_equal( value, user.send(key), "user check #{ key }" )
else
@ -2169,7 +2169,7 @@ Some Text',
elsif !file[:success]
if result && result.class == Array && result[1]
puts result.inspect
assert( false, 'ticket should not be created but is created' )
assert( false, 'ticket should not be created but is created' )
else
assert( true, 'ticket not created - nice' )
end

View file

@ -21,7 +21,7 @@ class HistoryTest < ActiveSupport::TestCase
created_by_id: current_user.id,
},
article: {
updated_by_id: current_user.id,
updated_by_id: current_user.id,
created_by_id: current_user.id,
type_id: Ticket::Article::Type.lookup( name: 'phone' ).id,
sender_id: Ticket::Article::Sender.lookup( name: 'Customer' ).id,
@ -88,7 +88,7 @@ class HistoryTest < ActiveSupport::TestCase
created_by_id: current_user.id,
},
article: {
created_by_id: current_user.id,
created_by_id: current_user.id,
updated_by_id: current_user.id,
type_id: Ticket::Article::Type.lookup(name: 'phone' ).id,
sender_id: Ticket::Article::Sender.lookup(name: 'Customer' ).id,

View file

@ -71,16 +71,16 @@ class OnlineNotificationTest < ActiveSupport::TestCase
},
},
check: [
{
{
type: 'create',
object: 'Ticket',
created_by_id: agent_user1.id,
object: 'Ticket',
created_by_id: agent_user1.id,
},
{
type: 'update',
type: 'update',
object: 'Ticket',
created_by_id: customer_user.id,
},
},
],
},
@ -122,16 +122,16 @@ class OnlineNotificationTest < ActiveSupport::TestCase
},
},
check: [
{
{
type: 'create',
object: 'Ticket',
created_by_id: agent_user1.id,
object: 'Ticket',
created_by_id: agent_user1.id,
},
{
type: 'update',
type: 'update',
object: 'Ticket',
created_by_id: customer_user.id,
},
},
],
},
@ -173,16 +173,16 @@ class OnlineNotificationTest < ActiveSupport::TestCase
},
},
check: [
{
{
type: 'create',
object: 'Ticket',
created_by_id: agent_user1.id,
object: 'Ticket',
created_by_id: agent_user1.id,
},
{
type: 'update',
type: 'update',
object: 'Ticket',
created_by_id: customer_user.id,
},
},
],
},
@ -224,16 +224,16 @@ class OnlineNotificationTest < ActiveSupport::TestCase
},
},
check: [
{
{
type: 'create',
object: 'Ticket',
created_by_id: agent_user1.id,
object: 'Ticket',
created_by_id: agent_user1.id,
},
{
type: 'update',
type: 'update',
object: 'Ticket',
created_by_id: customer_user.id,
},
},
],
},
]

View file

@ -3,7 +3,7 @@ require 'test_helper'
class SessionBasicTest < ActiveSupport::TestCase
test 'a cache' do
Sessions::CacheIn.set( 'last_run_test' , true, { expires_in: 2.seconds } )
Sessions::CacheIn.set( 'last_run_test', true, { expires_in: 2.seconds } )
result = Sessions::CacheIn.get( 'last_run_test' )
assert_equal( true, result, 'check 1' )
@ -37,7 +37,7 @@ class SessionBasicTest < ActiveSupport::TestCase
assert_equal( nil, result, 'check 2' )
# check delete cache
Sessions::CacheIn.set( 'last_run_delete' , true, { expires_in: 5.seconds } )
Sessions::CacheIn.set( 'last_run_delete', true, { expires_in: 5.seconds } )
result = Sessions::CacheIn.get( 'last_run_delete' )
assert_equal( true, result, 'check 1' )
Sessions::CacheIn.delete( 'last_run_delete' )

View file

@ -116,7 +116,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase
assert_equal( true, messages[0]['data']['success'], 'messages 1')
# broadcast to all clients
Sessions.broadcast( { msg: 'ooo123123123123123123'} )
Sessions.broadcast( { msg: 'ooo123123123123123123' } )
messages = Sessions.queue(client_id1)
assert_equal( messages.count, 1, 'messages count')
assert_equal( 'ooo123123123123123123', messages[0]['msg'], 'messages broadcast 1')
@ -130,7 +130,7 @@ class SessionEnhancedTest < ActiveSupport::TestCase
assert_equal( 'ooo123123123123123123', messages[0]['msg'], 'messages broadcast 1')
# send dedicated message to user
Sessions.send_to( agent1.id, { msg: 'ooo1231231231231231234'} )
Sessions.send_to( agent1.id, { msg: 'ooo1231231231231231234' } )
messages = Sessions.queue(client_id1)
assert_equal( messages.count, 1, 'messages count')
assert_equal( 'ooo1231231231231231234', messages[0]['msg'], 'messages send 1')

View file

@ -407,7 +407,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
)
# check changed attributes
human_changes = bg.human_changes(agent1,ticket1)
human_changes = bg.human_changes(agent1, ticket1)
assert( human_changes['Priority'], 'Check if attributes translated based on ObjectManager::Attribute' )
assert( human_changes['Pending till'], 'Check if attributes translated based on ObjectManager::Attribute' )
assert_equal( 'i18n(1 low)', human_changes['Priority'][0] )
@ -511,7 +511,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
puts "hc #{human_changes.inspect}"
# check changed attributes
human_changes = bg.human_changes(agent1,ticket1)
human_changes = bg.human_changes(agent1, ticket1)
assert( human_changes['Title'], 'Check if attributes translated based on ObjectManager::Attribute' )
assert( human_changes['Priority'], 'Check if attributes translated based on ObjectManager::Attribute' )
assert_equal( 'i18n(2 normal)', human_changes['Priority'][0] )
@ -522,7 +522,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
assert_not( human_changes['pending_time'] )
assert_not( human_changes['pending_till'] )
human_changes = bg.human_changes(agent2,ticket1)
human_changes = bg.human_changes(agent2, ticket1)
puts "hc2 #{human_changes.inspect}"
template = bg.template_update(agent1, ticket1, article, human_changes)

View file

@ -28,7 +28,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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',
'end_of_workday' => '18:00',
},
@ -49,9 +49,9 @@ class TicketSlaTest < ActiveSupport::TestCase
sla = Sla.create(
name: 'test sla 2',
condition: { 'tickets.priority_id' =>['1', '2', '3'] },
condition: { 'tickets.priority_id' => ['1', '2', '3'] },
data: {
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun',
'Mon' => 'Mon', 'Tue' => 'Tue', 'Wed' => 'Wed', 'Thu' => 'Thu', 'Fri' => 'Fri', 'Sat' => 'Sat', 'Sun' => 'Sun',
'beginning_of_workday' => '8:00',
'end_of_workday' => '18:00',
},
@ -360,7 +360,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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' => '9:00',
'end_of_workday' => '18:00',
},
@ -402,7 +402,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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' => '9:00',
'end_of_workday' => '18:00',
},
@ -445,7 +445,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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' => '9:00',
'end_of_workday' => '18:00',
},
@ -549,7 +549,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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' => '9:00',
'end_of_workday' => '18:00',
},
@ -612,7 +612,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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' => '9:00',
'end_of_workday' => '18:00',
},
@ -706,7 +706,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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' => '9:00',
'end_of_workday' => '18:00',
},
@ -719,14 +719,14 @@ class TicketSlaTest < ActiveSupport::TestCase
)
ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.escalation_time verify 1' )
assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.first_response_escal_date verify 1' )
assert_equal( ticket.first_response_in_min, nil, 'ticket.first_response_in_min verify 3' )
assert_equal( ticket.first_response_diff_in_min, nil, 'ticket.first_response_diff_in_min verify 3' )
assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-06-04 14:30:00 UTC', 'ticket.update_time_escal_date verify 1' )
assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-06-04 15:30:00 UTC', 'ticket.close_time_escal_date verify 1' )
assert_equal( ticket.close_time_in_min, 30, 'ticket.close_time_in_min verify 3' )
assert_equal( ticket.close_time_diff_in_min, 210, 'ticket.close_time_diff_in_min# verify 3' )
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.escalation_time verify 1' )
assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.first_response_escal_date verify 1' )
assert_equal( ticket.first_response_in_min, nil, 'ticket.first_response_in_min verify 3' )
assert_equal( ticket.first_response_diff_in_min, nil, 'ticket.first_response_diff_in_min verify 3' )
assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-06-04 14:30:00 UTC', 'ticket.update_time_escal_date verify 1' )
assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-06-04 15:30:00 UTC', 'ticket.close_time_escal_date verify 1' )
assert_equal( ticket.close_time_in_min, 30, 'ticket.close_time_in_min verify 3' )
assert_equal( ticket.close_time_diff_in_min, 210, 'ticket.close_time_diff_in_min# verify 3' )
delete = sla.destroy
assert( delete, 'sla destroy' )
@ -816,7 +816,7 @@ class TicketSlaTest < ActiveSupport::TestCase
name: 'test sla 1',
condition: {},
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' => '9:00',
'end_of_workday' => '18:00',
},