Updated rubocop - applied custom Layout/AlignHash style.
This commit is contained in:
parent
1be60c91db
commit
e8a57517f4
533 changed files with 22170 additions and 22161 deletions
|
@ -93,6 +93,15 @@ Style/MethodDefParentheses:
|
||||||
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Layout/AlignHash:
|
||||||
|
Description: >-
|
||||||
|
Align the elements of a hash literal if they span more than
|
||||||
|
one line.
|
||||||
|
Enabled: true
|
||||||
|
EnforcedHashRocketStyle: table
|
||||||
|
EnforcedColonStyle: table
|
||||||
|
EnforcedLastArgumentHashStyle: always_inspect
|
||||||
|
|
||||||
Layout/EmptyLinesAroundClassBody:
|
Layout/EmptyLinesAroundClassBody:
|
||||||
Description: "Keeps track of empty lines around class bodies."
|
Description: "Keeps track of empty lines around class bodies."
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
|
@ -317,7 +317,7 @@ GEM
|
||||||
omniauth (~> 1.5)
|
omniauth (~> 1.5)
|
||||||
omniauth-oauth2 (>= 1.4.0)
|
omniauth-oauth2 (>= 1.4.0)
|
||||||
parallel (1.12.1)
|
parallel (1.12.1)
|
||||||
parser (2.5.1.2)
|
parser (2.5.3.0)
|
||||||
ast (~> 2.4.0)
|
ast (~> 2.4.0)
|
||||||
pg (0.21.0)
|
pg (0.21.0)
|
||||||
pluginator (1.5.0)
|
pluginator (1.5.0)
|
||||||
|
@ -401,14 +401,14 @@ GEM
|
||||||
rspec-mocks (~> 3.8.0)
|
rspec-mocks (~> 3.8.0)
|
||||||
rspec-support (~> 3.8.0)
|
rspec-support (~> 3.8.0)
|
||||||
rspec-support (3.8.0)
|
rspec-support (3.8.0)
|
||||||
rubocop (0.59.2)
|
rubocop (0.61.1)
|
||||||
jaro_winkler (~> 1.5.1)
|
jaro_winkler (~> 1.5.1)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 2.5, != 2.5.1.1)
|
parser (>= 2.5, != 2.5.1.1)
|
||||||
powerpack (~> 0.1)
|
powerpack (~> 0.1)
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (~> 1.0, >= 1.0.1)
|
unicode-display_width (~> 1.4.0)
|
||||||
ruby-progressbar (1.10.0)
|
ruby-progressbar (1.10.0)
|
||||||
ruby_dep (1.5.0)
|
ruby_dep (1.5.0)
|
||||||
rubyzip (1.2.2)
|
rubyzip (1.2.2)
|
||||||
|
|
|
@ -25,7 +25,7 @@ class ActivityStreamController < ApplicationController
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
record_ids: item_ids,
|
record_ids: item_ids,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}, status: :ok
|
}, status: :ok
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,8 +10,8 @@ module ApplicationController::Authenticates
|
||||||
def permission_check(key)
|
def permission_check(key)
|
||||||
if @_token_auth
|
if @_token_auth
|
||||||
user = Token.check(
|
user = Token.check(
|
||||||
action: 'api',
|
action: 'api',
|
||||||
name: @_token_auth,
|
name: @_token_auth,
|
||||||
permission: key,
|
permission: key,
|
||||||
)
|
)
|
||||||
return false if user
|
return false if user
|
||||||
|
@ -84,15 +84,15 @@ module ApplicationController::Authenticates
|
||||||
end
|
end
|
||||||
|
|
||||||
user = Token.check(
|
user = Token.check(
|
||||||
action: 'api',
|
action: 'api',
|
||||||
name: token_string,
|
name: token_string,
|
||||||
inactive_user: true,
|
inactive_user: true,
|
||||||
)
|
)
|
||||||
if user && auth_param[:permission]
|
if user && auth_param[:permission]
|
||||||
user = Token.check(
|
user = Token.check(
|
||||||
action: 'api',
|
action: 'api',
|
||||||
name: token_string,
|
name: token_string,
|
||||||
permission: auth_param[:permission],
|
permission: auth_param[:permission],
|
||||||
inactive_user: true,
|
inactive_user: true,
|
||||||
)
|
)
|
||||||
raise Exceptions::NotAuthorized, 'Not authorized (token)!' if !user
|
raise Exceptions::NotAuthorized, 'Not authorized (token)!' if !user
|
||||||
|
|
|
@ -17,10 +17,10 @@ module ApplicationController::LogsHttpAccess
|
||||||
|
|
||||||
# request
|
# request
|
||||||
request_data = {
|
request_data = {
|
||||||
content: '',
|
content: '',
|
||||||
content_type: request.headers['Content-Type'],
|
content_type: request.headers['Content-Type'],
|
||||||
content_encoding: request.headers['Content-Encoding'],
|
content_encoding: request.headers['Content-Encoding'],
|
||||||
source: request.headers['User-Agent'] || request.headers['Server'],
|
source: request.headers['User-Agent'] || request.headers['Server'],
|
||||||
}
|
}
|
||||||
request.headers.each do |key, value|
|
request.headers.each do |key, value|
|
||||||
next if key[0, 5] != 'HTTP_'
|
next if key[0, 5] != 'HTTP_'
|
||||||
|
@ -39,11 +39,11 @@ module ApplicationController::LogsHttpAccess
|
||||||
|
|
||||||
# response
|
# response
|
||||||
response_data = {
|
response_data = {
|
||||||
code: response.status = response.code,
|
code: response.status = response.code,
|
||||||
content: '',
|
content: '',
|
||||||
content_type: nil,
|
content_type: nil,
|
||||||
content_encoding: nil,
|
content_encoding: nil,
|
||||||
source: nil,
|
source: nil,
|
||||||
}
|
}
|
||||||
response.headers.each do |key, value|
|
response.headers.each do |key, value|
|
||||||
response_data[:content] += "#{key}: #{value}\n"
|
response_data[:content] += "#{key}: #{value}\n"
|
||||||
|
@ -55,13 +55,13 @@ module ApplicationController::LogsHttpAccess
|
||||||
response_data[:content] = response_data[:content].slice(0, 8000)
|
response_data[:content] = response_data[:content].slice(0, 8000)
|
||||||
record = {
|
record = {
|
||||||
direction: 'in',
|
direction: 'in',
|
||||||
facility: @http_log_support[:facility],
|
facility: @http_log_support[:facility],
|
||||||
url: url_for(only_path: false, overwrite_params: {}),
|
url: url_for(only_path: false, overwrite_params: {}),
|
||||||
status: response.status,
|
status: response.status,
|
||||||
ip: request.remote_ip,
|
ip: request.remote_ip,
|
||||||
request: request_data,
|
request: request_data,
|
||||||
response: response_data,
|
response: response_data,
|
||||||
method: request.method,
|
method: request.method,
|
||||||
}
|
}
|
||||||
HttpLog.create(record)
|
HttpLog.create(record)
|
||||||
end
|
end
|
||||||
|
|
|
@ -136,7 +136,7 @@ module ApplicationController::RendersModels
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
record_ids: item_ids,
|
record_ids: item_ids,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}, status: :ok
|
}, status: :ok
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@ class ApplicationsController < ApplicationController
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
record_ids: item_ids,
|
record_ids: item_ids,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}, status: :ok
|
}, status: :ok
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,8 +14,8 @@ class CalendarSubscriptionsController < ApplicationController
|
||||||
|
|
||||||
send_data(
|
send_data(
|
||||||
ical,
|
ical,
|
||||||
filename: 'zammad.ical',
|
filename: 'zammad.ical',
|
||||||
type: 'text/plain',
|
type: 'text/plain',
|
||||||
disposition: 'inline'
|
disposition: 'inline'
|
||||||
)
|
)
|
||||||
rescue => e
|
rescue => e
|
||||||
|
@ -36,8 +36,8 @@ class CalendarSubscriptionsController < ApplicationController
|
||||||
|
|
||||||
send_data(
|
send_data(
|
||||||
ical,
|
ical,
|
||||||
filename: 'zammad.ical',
|
filename: 'zammad.ical',
|
||||||
type: 'text/plain',
|
type: 'text/plain',
|
||||||
disposition: 'inline'
|
disposition: 'inline'
|
||||||
)
|
)
|
||||||
rescue => e
|
rescue => e
|
||||||
|
|
|
@ -16,8 +16,8 @@ class CalendarsController < ApplicationController
|
||||||
render json: {
|
render json: {
|
||||||
record_ids: record_ids,
|
record_ids: record_ids,
|
||||||
ical_feeds: ical_feeds,
|
ical_feeds: ical_feeds,
|
||||||
timezones: timezones,
|
timezones: timezones,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}, status: :ok
|
}, status: :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -37,16 +37,16 @@ class ChannelsEmailController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
accounts_fixed: accounts_fixed,
|
accounts_fixed: accounts_fixed,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
account_channel_ids: account_channel_ids,
|
account_channel_ids: account_channel_ids,
|
||||||
notification_channel_ids: notification_channel_ids,
|
notification_channel_ids: notification_channel_ids,
|
||||||
email_address_ids: email_address_ids,
|
email_address_ids: email_address_ids,
|
||||||
not_used_email_address_ids: not_used_email_address_ids,
|
not_used_email_address_ids: not_used_email_address_ids,
|
||||||
channel_driver: {
|
channel_driver: {
|
||||||
email: EmailHelper.available_driver,
|
email: EmailHelper.available_driver,
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
notification_sender: Setting.get('notification_sender'),
|
notification_sender: Setting.get('notification_sender'),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,9 +56,9 @@ class ChannelsEmailController < ApplicationController
|
||||||
|
|
||||||
# probe settings based on email and password
|
# probe settings based on email and password
|
||||||
result = EmailHelper::Probe.full(
|
result = EmailHelper::Probe.full(
|
||||||
email: params[:email],
|
email: params[:email],
|
||||||
password: params[:password],
|
password: params[:password],
|
||||||
folder: params[:folder],
|
folder: params[:folder],
|
||||||
)
|
)
|
||||||
|
|
||||||
# verify if user+host already exists
|
# verify if user+host already exists
|
||||||
|
@ -107,9 +107,9 @@ class ChannelsEmailController < ApplicationController
|
||||||
# check delivery for 30 sek.
|
# check delivery for 30 sek.
|
||||||
result = EmailHelper::Verify.email(
|
result = EmailHelper::Verify.email(
|
||||||
outbound: params[:outbound].to_h,
|
outbound: params[:outbound].to_h,
|
||||||
inbound: params[:inbound].to_h,
|
inbound: params[:inbound].to_h,
|
||||||
sender: email,
|
sender: email,
|
||||||
subject: params[:subject],
|
subject: params[:subject],
|
||||||
)
|
)
|
||||||
|
|
||||||
if result[:result] != 'ok'
|
if result[:result] != 'ok'
|
||||||
|
@ -126,15 +126,15 @@ class ChannelsEmailController < ApplicationController
|
||||||
if channel_id
|
if channel_id
|
||||||
channel = Channel.find(channel_id)
|
channel = Channel.find(channel_id)
|
||||||
channel.update!(
|
channel.update!(
|
||||||
options: {
|
options: {
|
||||||
inbound: params[:inbound].to_h,
|
inbound: params[:inbound].to_h,
|
||||||
outbound: params[:outbound].to_h,
|
outbound: params[:outbound].to_h,
|
||||||
},
|
},
|
||||||
group_id: params[:group_id],
|
group_id: params[:group_id],
|
||||||
last_log_in: nil,
|
last_log_in: nil,
|
||||||
last_log_out: nil,
|
last_log_out: nil,
|
||||||
status_in: 'ok',
|
status_in: 'ok',
|
||||||
status_out: 'ok',
|
status_out: 'ok',
|
||||||
)
|
)
|
||||||
render json: result
|
render json: result
|
||||||
return
|
return
|
||||||
|
@ -142,17 +142,17 @@ class ChannelsEmailController < ApplicationController
|
||||||
|
|
||||||
# create new account
|
# create new account
|
||||||
channel = Channel.create(
|
channel = Channel.create(
|
||||||
area: 'Email::Account',
|
area: 'Email::Account',
|
||||||
options: {
|
options: {
|
||||||
inbound: params[:inbound].to_h,
|
inbound: params[:inbound].to_h,
|
||||||
outbound: params[:outbound].to_h,
|
outbound: params[:outbound].to_h,
|
||||||
},
|
},
|
||||||
group_id: params[:group_id],
|
group_id: params[:group_id],
|
||||||
last_log_in: nil,
|
last_log_in: nil,
|
||||||
last_log_out: nil,
|
last_log_out: nil,
|
||||||
status_in: 'ok',
|
status_in: 'ok',
|
||||||
status_out: 'ok',
|
status_out: 'ok',
|
||||||
active: true,
|
active: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
# remember address && set channel for email address
|
# remember address && set channel for email address
|
||||||
|
@ -165,16 +165,16 @@ class ChannelsEmailController < ApplicationController
|
||||||
|
|
||||||
if address
|
if address
|
||||||
address.update!(
|
address.update!(
|
||||||
realname: params[:meta][:realname],
|
realname: params[:meta][:realname],
|
||||||
email: email,
|
email: email,
|
||||||
active: true,
|
active: true,
|
||||||
channel_id: channel.id,
|
channel_id: channel.id,
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
address = EmailAddress.create(
|
address = EmailAddress.create(
|
||||||
realname: params[:meta][:realname],
|
realname: params[:meta][:realname],
|
||||||
email: email,
|
email: email,
|
||||||
active: true,
|
active: true,
|
||||||
channel_id: channel.id,
|
channel_id: channel.id,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -259,7 +259,7 @@ class ChannelsEmailController < ApplicationController
|
||||||
next if channel.id.to_s == channel_id.to_s
|
next if channel.id.to_s == channel_id.to_s
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
result: 'duplicate',
|
result: 'duplicate',
|
||||||
message: 'Account already exists!',
|
message: 'Account already exists!',
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -14,8 +14,8 @@ class ChannelsFacebookController < ApplicationController
|
||||||
channel_ids.push channel.id
|
channel_ids.push channel.id
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
assets: assets,
|
assets: assets,
|
||||||
channel_ids: channel_ids,
|
channel_ids: channel_ids,
|
||||||
callback_url: ExternalCredential.callback_url('facebook'),
|
callback_url: ExternalCredential.callback_url('facebook'),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,10 +8,10 @@ class ChannelsSmsController < ApplicationChannelController
|
||||||
def index
|
def index
|
||||||
assets = {}
|
assets = {}
|
||||||
render json: {
|
render json: {
|
||||||
account_channel_ids: channels_data('Sms::Account', assets),
|
account_channel_ids: channels_data('Sms::Account', assets),
|
||||||
notification_channel_ids: channels_data('Sms::Notification', assets),
|
notification_channel_ids: channels_data('Sms::Notification', assets),
|
||||||
config: channels_config,
|
config: channels_config,
|
||||||
assets: assets
|
assets: assets
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class ChannelsSmsController < ApplicationChannelController
|
||||||
end
|
end
|
||||||
if !channel
|
if !channel
|
||||||
render(
|
render(
|
||||||
json: { message: 'channel not found' },
|
json: { message: 'channel not found' },
|
||||||
status: :not_found
|
status: :not_found
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
|
@ -12,7 +12,7 @@ class ChannelsTelegramController < ApplicationController
|
||||||
channel_ids.push channel.id
|
channel_ids.push channel.id
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
assets: assets,
|
assets: assets,
|
||||||
channel_ids: channel_ids
|
channel_ids: channel_ids
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -74,10 +74,10 @@ class ChannelsTwitterController < ApplicationController
|
||||||
channel_ids.push channel.id
|
channel_ids.push channel.id
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
assets: assets,
|
assets: assets,
|
||||||
channel_ids: channel_ids,
|
channel_ids: channel_ids,
|
||||||
external_credential_ids: external_credential_ids,
|
external_credential_ids: external_credential_ids,
|
||||||
callback_url: ExternalCredential.callback_url('twitter'),
|
callback_url: ExternalCredential.callback_url('twitter'),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class ChatsController < ApplicationController
|
||||||
assets = setting.assets(assets)
|
assets = setting.assets(assets)
|
||||||
render json: {
|
render json: {
|
||||||
chat_ids: chat_ids,
|
chat_ids: chat_ids,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ module ClonesTicketArticleAttachments
|
||||||
|
|
||||||
existing_attachments = Store.list(
|
existing_attachments = Store.list(
|
||||||
object: 'UploadCache',
|
object: 'UploadCache',
|
||||||
o_id: params[:form_id],
|
o_id: params[:form_id],
|
||||||
)
|
)
|
||||||
attachments = []
|
attachments = []
|
||||||
article.attachments.each do |new_attachment|
|
article.attachments.each do |new_attachment|
|
||||||
|
@ -31,10 +31,10 @@ module ClonesTicketArticleAttachments
|
||||||
next if already_added == true
|
next if already_added == true
|
||||||
|
|
||||||
file = Store.add(
|
file = Store.add(
|
||||||
object: 'UploadCache',
|
object: 'UploadCache',
|
||||||
o_id: params[:form_id],
|
o_id: params[:form_id],
|
||||||
data: new_attachment.content,
|
data: new_attachment.content,
|
||||||
filename: new_attachment.filename,
|
filename: new_attachment.filename,
|
||||||
preferences: new_attachment.preferences,
|
preferences: new_attachment.preferences,
|
||||||
)
|
)
|
||||||
attachments.push file
|
attachments.push file
|
||||||
|
|
|
@ -57,7 +57,7 @@ module CreatesTicketArticles
|
||||||
if form_id
|
if form_id
|
||||||
article.attachments = Store.list(
|
article.attachments = Store.list(
|
||||||
object: 'UploadCache',
|
object: 'UploadCache',
|
||||||
o_id: form_id,
|
o_id: form_id,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,10 +69,10 @@ module CreatesTicketArticles
|
||||||
# store inline attachments
|
# store inline attachments
|
||||||
attachments_inline.each do |attachment|
|
attachments_inline.each do |attachment|
|
||||||
Store.add(
|
Store.add(
|
||||||
object: 'Ticket::Article',
|
object: 'Ticket::Article',
|
||||||
o_id: article.id,
|
o_id: article.id,
|
||||||
data: attachment[:data],
|
data: attachment[:data],
|
||||||
filename: attachment[:filename],
|
filename: attachment[:filename],
|
||||||
preferences: attachment[:preferences],
|
preferences: attachment[:preferences],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -104,10 +104,10 @@ module CreatesTicketArticles
|
||||||
end
|
end
|
||||||
|
|
||||||
Store.add(
|
Store.add(
|
||||||
object: 'Ticket::Article',
|
object: 'Ticket::Article',
|
||||||
o_id: article.id,
|
o_id: article.id,
|
||||||
data: attachment_data,
|
data: attachment_data,
|
||||||
filename: attachment[:filename],
|
filename: attachment[:filename],
|
||||||
preferences: preferences,
|
preferences: preferences,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -116,9 +116,9 @@ module CreatesTicketArticles
|
||||||
# account time
|
# account time
|
||||||
if time_unit.present?
|
if time_unit.present?
|
||||||
Ticket::TimeAccounting.create!(
|
Ticket::TimeAccounting.create!(
|
||||||
ticket_id: article.ticket_id,
|
ticket_id: article.ticket_id,
|
||||||
ticket_article_id: article.id,
|
ticket_article_id: article.id,
|
||||||
time_unit: time_unit
|
time_unit: time_unit
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ module CreatesTicketArticles
|
||||||
# remove attachments from upload cache
|
# remove attachments from upload cache
|
||||||
Store.remove(
|
Store.remove(
|
||||||
object: 'UploadCache',
|
object: 'UploadCache',
|
||||||
o_id: form_id,
|
o_id: form_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
article
|
article
|
||||||
|
|
|
@ -5,11 +5,11 @@ module TicketStats
|
||||||
|
|
||||||
def ticket_ids_and_assets(condition, current_user, limit, assets)
|
def ticket_ids_and_assets(condition, current_user, limit, assets)
|
||||||
tickets = Ticket.search(
|
tickets = Ticket.search(
|
||||||
limit: limit,
|
limit: limit,
|
||||||
condition: condition,
|
condition: condition,
|
||||||
current_user: current_user,
|
current_user: current_user,
|
||||||
sort_by: 'created_at',
|
sort_by: 'created_at',
|
||||||
order_by: 'desc',
|
order_by: 'desc',
|
||||||
)
|
)
|
||||||
assets_of_tickets(tickets, assets)
|
assets_of_tickets(tickets, assets)
|
||||||
end
|
end
|
||||||
|
@ -36,11 +36,11 @@ module TicketStats
|
||||||
.count
|
.count
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
month: date_to_check.month,
|
month: date_to_check.month,
|
||||||
year: date_to_check.year,
|
year: date_to_check.year,
|
||||||
text: Date::MONTHNAMES[date_to_check.month],
|
text: Date::MONTHNAMES[date_to_check.month],
|
||||||
created: created,
|
created: created,
|
||||||
closed: closed,
|
closed: closed,
|
||||||
}
|
}
|
||||||
volume_by_year.push data
|
volume_by_year.push data
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,19 +7,19 @@ class CtiController < ApplicationController
|
||||||
def index
|
def index
|
||||||
backends = [
|
backends = [
|
||||||
{
|
{
|
||||||
name: 'CTI (generic)',
|
name: 'CTI (generic)',
|
||||||
enabled: Setting.get('cti_integration'),
|
enabled: Setting.get('cti_integration'),
|
||||||
url: '#system/integration/cti',
|
url: '#system/integration/cti',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'sipgate.io',
|
name: 'sipgate.io',
|
||||||
enabled: Setting.get('sipgate_integration'),
|
enabled: Setting.get('sipgate_integration'),
|
||||||
url: '#system/integration/sipgate',
|
url: '#system/integration/sipgate',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Placetel',
|
name: 'Placetel',
|
||||||
enabled: Setting.get('placetel_integration'),
|
enabled: Setting.get('placetel_integration'),
|
||||||
url: '#system/integration/placetel',
|
url: '#system/integration/placetel',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -48,54 +48,54 @@ class FirstStepsController < ApplicationController
|
||||||
|
|
||||||
result = [
|
result = [
|
||||||
{
|
{
|
||||||
name: 'Configuration',
|
name: 'Configuration',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
name: 'Branding',
|
name: 'Branding',
|
||||||
checked: true,
|
checked: true,
|
||||||
location: '#settings/branding',
|
location: '#settings/branding',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Your Email Configuration',
|
name: 'Your Email Configuration',
|
||||||
checked: email_active,
|
checked: email_active,
|
||||||
location: '#channels/email',
|
location: '#channels/email',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Invite agents/colleagues to help working on tickets',
|
name: 'Invite agents/colleagues to help working on tickets',
|
||||||
checked: invite_agents,
|
checked: invite_agents,
|
||||||
location: '#',
|
location: '#',
|
||||||
class: 'js-inviteAgent',
|
class: 'js-inviteAgent',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Invite customers to create issues in Zammad',
|
name: 'Invite customers to create issues in Zammad',
|
||||||
checked: invite_customers,
|
checked: invite_customers,
|
||||||
location: '#',
|
location: '#',
|
||||||
class: 'js-inviteCustomer',
|
class: 'js-inviteCustomer',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'How to use it',
|
name: 'How to use it',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
name: 'Intro',
|
name: 'Intro',
|
||||||
checked: true,
|
checked: true,
|
||||||
location: '#clues',
|
location: '#clues',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Create a Test Ticket',
|
name: 'Create a Test Ticket',
|
||||||
checked: false,
|
checked: false,
|
||||||
location: '#',
|
location: '#',
|
||||||
class: 'js-testTicket',
|
class: 'js-testTicket',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Create Text Modules',
|
name: 'Create Text Modules',
|
||||||
checked: text_module_active,
|
checked: text_module_active,
|
||||||
location: '#manage/text_modules',
|
location: '#manage/text_modules',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Create Macros',
|
name: 'Create Macros',
|
||||||
checked: macro_active,
|
checked: macro_active,
|
||||||
location: '#manage/macros',
|
location: '#manage/macros',
|
||||||
},
|
},
|
||||||
#{
|
#{
|
||||||
|
@ -106,26 +106,26 @@ class FirstStepsController < ApplicationController
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Additional Channels',
|
name: 'Additional Channels',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
name: 'Twitter',
|
name: 'Twitter',
|
||||||
checked: twitter_active,
|
checked: twitter_active,
|
||||||
location: '#channels/twitter',
|
location: '#channels/twitter',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Facebook',
|
name: 'Facebook',
|
||||||
checked: facebook_active,
|
checked: facebook_active,
|
||||||
location: '#channels/facebook',
|
location: '#channels/facebook',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Chat',
|
name: 'Chat',
|
||||||
checked: chat_active,
|
checked: chat_active,
|
||||||
location: '#channels/chat',
|
location: '#channels/chat',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Online Forms',
|
name: 'Online Forms',
|
||||||
checked: from_active,
|
checked: from_active,
|
||||||
location: '#channels/form',
|
location: '#channels/form',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -140,24 +140,24 @@ class FirstStepsController < ApplicationController
|
||||||
|
|
||||||
result = [
|
result = [
|
||||||
{
|
{
|
||||||
name: 'How to use it',
|
name: 'How to use it',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
name: 'Intro',
|
name: 'Intro',
|
||||||
checked: true,
|
checked: true,
|
||||||
location: '#clues',
|
location: '#clues',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Create a Test Ticket',
|
name: 'Create a Test Ticket',
|
||||||
checked: false,
|
checked: false,
|
||||||
location: '#',
|
location: '#',
|
||||||
class: 'js-testTicket',
|
class: 'js-testTicket',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Invite customers to create issues in Zammad',
|
name: 'Invite customers to create issues in Zammad',
|
||||||
checked: invite_customers,
|
checked: invite_customers,
|
||||||
location: '#',
|
location: '#',
|
||||||
class: 'js-inviteCustomer',
|
class: 'js-inviteCustomer',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -177,27 +177,27 @@ class FirstStepsController < ApplicationController
|
||||||
original_user_id = UserInfo.current_user_id
|
original_user_id = UserInfo.current_user_id
|
||||||
result = NotificationFactory::Mailer.template(
|
result = NotificationFactory::Mailer.template(
|
||||||
template: 'test_ticket',
|
template: 'test_ticket',
|
||||||
locale: agent.preferences[:locale] || Setting.get('locale_default') || 'en-us',
|
locale: agent.preferences[:locale] || Setting.get('locale_default') || 'en-us',
|
||||||
objects: {
|
objects: {
|
||||||
agent: agent,
|
agent: agent,
|
||||||
customer: customer,
|
customer: customer,
|
||||||
},
|
},
|
||||||
raw: true,
|
raw: true,
|
||||||
)
|
)
|
||||||
UserInfo.current_user_id = customer.id
|
UserInfo.current_user_id = customer.id
|
||||||
ticket = Ticket.create!(
|
ticket = Ticket.create!(
|
||||||
group_id: Group.find_by(active: true, name: 'Users').id,
|
group_id: Group.find_by(active: true, name: 'Users').id,
|
||||||
customer_id: customer.id,
|
customer_id: customer.id,
|
||||||
title: result[:subject],
|
title: result[:subject],
|
||||||
)
|
)
|
||||||
article = Ticket::Article.create!(
|
article = Ticket::Article.create!(
|
||||||
ticket_id: ticket.id,
|
ticket_id: ticket.id,
|
||||||
type_id: Ticket::Article::Type.find_by(name: 'phone').id,
|
type_id: Ticket::Article::Type.find_by(name: 'phone').id,
|
||||||
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
|
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
|
||||||
from: from,
|
from: from,
|
||||||
body: result[:body],
|
body: result[:body],
|
||||||
content_type: 'text/html',
|
content_type: 'text/html',
|
||||||
internal: false,
|
internal: false,
|
||||||
)
|
)
|
||||||
UserInfo.current_user_id = original_user_id
|
UserInfo.current_user_id = original_user_id
|
||||||
overview = test_overview
|
overview = test_overview
|
||||||
|
@ -206,8 +206,8 @@ class FirstStepsController < ApplicationController
|
||||||
assets = overview.assets(assets)
|
assets = overview.assets(assets)
|
||||||
render json: {
|
render json: {
|
||||||
overview_id: overview.id,
|
overview_id: overview.id,
|
||||||
ticket_id: ticket.id,
|
ticket_id: ticket.id,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -85,11 +85,11 @@ class FormController < ApplicationController
|
||||||
if !customer
|
if !customer
|
||||||
role_ids = Role.signup_role_ids
|
role_ids = Role.signup_role_ids
|
||||||
customer = User.create(
|
customer = User.create(
|
||||||
firstname: name,
|
firstname: name,
|
||||||
lastname: '',
|
lastname: '',
|
||||||
email: email,
|
email: email,
|
||||||
active: true,
|
active: true,
|
||||||
role_ids: role_ids,
|
role_ids: role_ids,
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
|
@ -106,31 +106,31 @@ class FormController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
ticket = Ticket.create!(
|
ticket = Ticket.create!(
|
||||||
group_id: group.id,
|
group_id: group.id,
|
||||||
customer_id: customer.id,
|
customer_id: customer.id,
|
||||||
title: params[:title],
|
title: params[:title],
|
||||||
preferences: {
|
preferences: {
|
||||||
form: {
|
form: {
|
||||||
remote_ip: request.remote_ip,
|
remote_ip: request.remote_ip,
|
||||||
fingerprint_md5: Digest::MD5.hexdigest(params[:fingerprint]),
|
fingerprint_md5: Digest::MD5.hexdigest(params[:fingerprint]),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
article = Ticket::Article.create!(
|
article = Ticket::Article.create!(
|
||||||
ticket_id: ticket.id,
|
ticket_id: ticket.id,
|
||||||
type_id: Ticket::Article::Type.find_by(name: 'web').id,
|
type_id: Ticket::Article::Type.find_by(name: 'web').id,
|
||||||
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
|
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
|
||||||
body: params[:body],
|
body: params[:body],
|
||||||
subject: params[:title],
|
subject: params[:title],
|
||||||
internal: false,
|
internal: false,
|
||||||
)
|
)
|
||||||
|
|
||||||
params[:file]&.each do |file|
|
params[:file]&.each do |file|
|
||||||
Store.add(
|
Store.add(
|
||||||
object: 'Ticket::Article',
|
object: 'Ticket::Article',
|
||||||
o_id: article.id,
|
o_id: article.id,
|
||||||
data: file.read,
|
data: file.read,
|
||||||
filename: file.original_filename,
|
filename: file.original_filename,
|
||||||
preferences: {
|
preferences: {
|
||||||
'Mime-Type' => file.content_type,
|
'Mime-Type' => file.content_type,
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ class FormController < ApplicationController
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
ticket: {
|
ticket: {
|
||||||
id: ticket.id,
|
id: ticket.id,
|
||||||
number: ticket.number
|
number: ticket.number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,9 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
render json: {
|
render json: {
|
||||||
setup_done: setup_done,
|
setup_done: setup_done,
|
||||||
import_mode: Setting.get('import_mode'),
|
import_mode: Setting.get('import_mode'),
|
||||||
import_backend: Setting.get('import_backend'),
|
import_backend: Setting.get('import_backend'),
|
||||||
system_online_service: Setting.get('system_online_service'),
|
system_online_service: Setting.get('system_online_service'),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -65,9 +65,9 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
||||||
auto_wizard_data = AutoWizard.data
|
auto_wizard_data = AutoWizard.data
|
||||||
if auto_wizard_data.blank?
|
if auto_wizard_data.blank?
|
||||||
render json: {
|
render json: {
|
||||||
auto_wizard: true,
|
auto_wizard: true,
|
||||||
auto_wizard_success: false,
|
auto_wizard_success: false,
|
||||||
message: 'Invalid auto wizard file.',
|
message: 'Invalid auto wizard file.',
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -75,7 +75,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
||||||
# verify auto wizard token
|
# verify auto wizard token
|
||||||
if auto_wizard_data['Token'] && auto_wizard_data['Token'] != params[:token]
|
if auto_wizard_data['Token'] && auto_wizard_data['Token'] != params[:token]
|
||||||
render json: {
|
render json: {
|
||||||
auto_wizard: true,
|
auto_wizard: true,
|
||||||
auto_wizard_success: false,
|
auto_wizard_success: false,
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -85,9 +85,9 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
||||||
auto_wizard_admin = AutoWizard.setup
|
auto_wizard_admin = AutoWizard.setup
|
||||||
if !auto_wizard_admin
|
if !auto_wizard_admin
|
||||||
render json: {
|
render json: {
|
||||||
auto_wizard: true,
|
auto_wizard: true,
|
||||||
auto_wizard_success: false,
|
auto_wizard_success: false,
|
||||||
message: 'Error during execution of auto wizard.',
|
message: 'Error during execution of auto wizard.',
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -99,7 +99,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
||||||
Setting.set('system_init_done', true)
|
Setting.set('system_init_done', true)
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
auto_wizard: true,
|
auto_wizard: true,
|
||||||
auto_wizard_success: true,
|
auto_wizard_success: true,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -150,7 +150,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
||||||
|
|
||||||
if messages.present?
|
if messages.present?
|
||||||
render json: {
|
render json: {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
messages: messages,
|
messages: messages,
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -181,7 +181,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
||||||
end
|
end
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
result: 'ok',
|
result: 'ok',
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -214,14 +214,14 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
||||||
addresses = EmailAddress.where(active: true)
|
addresses = EmailAddress.where(active: true)
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
setup_done: true,
|
setup_done: true,
|
||||||
import_mode: Setting.get('import_mode'),
|
import_mode: Setting.get('import_mode'),
|
||||||
import_backend: Setting.get('import_backend'),
|
import_backend: Setting.get('import_backend'),
|
||||||
system_online_service: Setting.get('system_online_service'),
|
system_online_service: Setting.get('system_online_service'),
|
||||||
addresses: addresses,
|
addresses: addresses,
|
||||||
groups: groups,
|
groups: groups,
|
||||||
config: config_to_update,
|
config: config_to_update,
|
||||||
channel_driver: {
|
channel_driver: {
|
||||||
email: EmailHelper.available_driver,
|
email: EmailHelper.available_driver,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ class ImportOtrsController < ApplicationController
|
||||||
# validate
|
# validate
|
||||||
if !params[:url] || params[:url] !~ %r{^(http|https)://.+?$}
|
if !params[:url] || params[:url] !~ %r{^(http|https)://.+?$}
|
||||||
render json: {
|
render json: {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message: 'Invalid URL!',
|
message: 'Invalid URL!',
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -31,9 +31,9 @@ class ImportOtrsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message_human: message_human,
|
message_human: message_human,
|
||||||
message: response.error.to_s,
|
message: response.error.to_s,
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -59,7 +59,7 @@ class ImportOtrsController < ApplicationController
|
||||||
|
|
||||||
if !key_parts[1]
|
if !key_parts[1]
|
||||||
render json: {
|
render json: {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message_human: 'Unable to get key from URL!'
|
message_human: 'Unable to get key from URL!'
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -78,22 +78,22 @@ class ImportOtrsController < ApplicationController
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
result: 'ok',
|
result: 'ok',
|
||||||
url: params[:url],
|
url: params[:url],
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = {
|
result = {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message_human: migrator_response['Error']
|
message_human: migrator_response['Error']
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
elsif response.body.match?(/(otrs\sag|otrs\.com|otrs\.org)/i)
|
elsif response.body.match?(/(otrs\sag|otrs\.com|otrs\.org)/i)
|
||||||
result = {
|
result = {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message_human: 'Host found, but no OTRS migrator is installed!'
|
message_human: 'Host found, but no OTRS migrator is installed!'
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = {
|
result = {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message_human: 'Host found, but it seems to be no OTRS installation!',
|
message_human: 'Host found, but it seems to be no OTRS installation!',
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -109,7 +109,7 @@ class ImportOtrsController < ApplicationController
|
||||||
if !welcome
|
if !welcome
|
||||||
render json: {
|
render json: {
|
||||||
message: 'Migrator can\'t read OTRS output!',
|
message: 'Migrator can\'t read OTRS output!',
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ class ImportZendeskController < ApplicationController
|
||||||
# validate
|
# validate
|
||||||
if params[:url].blank? || params[:url] !~ %r{^(http|https)://.+?$}
|
if params[:url].blank? || params[:url] !~ %r{^(http|https)://.+?$}
|
||||||
render json: {
|
render json: {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message: 'Invalid URL!',
|
message: 'Invalid URL!',
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -31,9 +31,9 @@ class ImportZendeskController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message_human: message_human,
|
message_human: message_human,
|
||||||
message: response.error.to_s,
|
message: response.error.to_s,
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -41,7 +41,7 @@ class ImportZendeskController < ApplicationController
|
||||||
# since 2016-10-15 a redirect to a marketing page has been implemented
|
# since 2016-10-15 a redirect to a marketing page has been implemented
|
||||||
if !response.body.match?(/#{params[:url]}/)
|
if !response.body.match?(/#{params[:url]}/)
|
||||||
render json: {
|
render json: {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message_human: 'Hostname not found!',
|
message_human: 'Hostname not found!',
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -53,7 +53,7 @@ class ImportZendeskController < ApplicationController
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
result: 'ok',
|
result: 'ok',
|
||||||
url: params[:url],
|
url: params[:url],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class ImportZendeskController < ApplicationController
|
||||||
if !params[:username] || !params[:token]
|
if !params[:username] || !params[:token]
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message_human: 'Incomplete credentials',
|
message_human: 'Incomplete credentials',
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -80,7 +80,7 @@ class ImportZendeskController < ApplicationController
|
||||||
Setting.set('import_zendesk_endpoint_key', nil)
|
Setting.set('import_zendesk_endpoint_key', nil)
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message_human: 'Invalid credentials!',
|
message_human: 'Invalid credentials!',
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
|
@ -57,16 +57,16 @@ UserAgent: #{request.env['HTTP_USER_AGENT']}
|
||||||
|
|
||||||
article = Ticket::Article.create!(
|
article = Ticket::Article.create!(
|
||||||
ticket_id: ticket_id,
|
ticket_id: ticket_id,
|
||||||
type_id: Ticket::Article::Type.find_by(name: 'web').id,
|
type_id: Ticket::Article::Type.find_by(name: 'web').id,
|
||||||
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
|
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
|
||||||
body: body,
|
body: body,
|
||||||
subject: title,
|
subject: title,
|
||||||
internal: false,
|
internal: false,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
if (!auto_close && params[:state].match(/#{state_recovery_match}/i)) || !params[:state].match(/#{state_recovery_match}/i)
|
if (!auto_close && params[:state].match(/#{state_recovery_match}/i)) || !params[:state].match(/#{state_recovery_match}/i)
|
||||||
render json: {
|
render json: {
|
||||||
result: 'ticket already open, added note',
|
result: 'ticket already open, added note',
|
||||||
ticket_ids: ticket_ids_found,
|
ticket_ids: ticket_ids_found,
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -90,35 +90,35 @@ UserAgent: #{request.env['HTTP_USER_AGENT']}
|
||||||
ticket.save!
|
ticket.save!
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
result: "closed tickets with ids #{ticket_ids_found.join(',')}",
|
result: "closed tickets with ids #{ticket_ids_found.join(',')}",
|
||||||
ticket_ids: ticket_ids_found,
|
ticket_ids: ticket_ids_found,
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
ticket = Ticket.create!(
|
ticket = Ticket.create!(
|
||||||
group_id: group_id,
|
group_id: group_id,
|
||||||
customer_id: customer.id,
|
customer_id: customer.id,
|
||||||
title: title,
|
title: title,
|
||||||
preferences: {
|
preferences: {
|
||||||
check_mk: {
|
check_mk: {
|
||||||
host: params[:host],
|
host: params[:host],
|
||||||
service: params[:service],
|
service: params[:service],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
article = Ticket::Article.create!(
|
article = Ticket::Article.create!(
|
||||||
ticket_id: ticket.id,
|
ticket_id: ticket.id,
|
||||||
type_id: Ticket::Article::Type.find_by(name: 'web').id,
|
type_id: Ticket::Article::Type.find_by(name: 'web').id,
|
||||||
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
|
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
|
||||||
body: body,
|
body: body,
|
||||||
subject: title,
|
subject: title,
|
||||||
internal: false,
|
internal: false,
|
||||||
)
|
)
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
result: "new ticket created (ticket id: #{ticket.id})",
|
result: "new ticket created (ticket id: #{ticket.id})",
|
||||||
ticket_id: ticket.id,
|
ticket_id: ticket.id,
|
||||||
ticket_number: ticket.number,
|
ticket_number: ticket.number,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -51,18 +51,18 @@ class Integration::CtiController < ApplicationController
|
||||||
|
|
||||||
from = row[:caller_id]
|
from = row[:caller_id]
|
||||||
data = {
|
data = {
|
||||||
action: 'dial',
|
action: 'dial',
|
||||||
caller_id: from,
|
caller_id: from,
|
||||||
number: params[:to]
|
number: params[:to]
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
if data.blank? && default_caller_id.present?
|
if data.blank? && default_caller_id.present?
|
||||||
from = default_caller_id
|
from = default_caller_id
|
||||||
data = {
|
data = {
|
||||||
action: 'dial',
|
action: 'dial',
|
||||||
caller_id: default_caller_id,
|
caller_id: default_caller_id,
|
||||||
number: params[:to]
|
number: params[:to]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Integration::IdoitController < ApplicationController
|
||||||
def verify
|
def verify
|
||||||
response = ::Idoit.verify(params[:api_token], params[:endpoint], params[:client_id])
|
response = ::Idoit.verify(params[:api_token], params[:endpoint], params[:client_id])
|
||||||
render json: {
|
render json: {
|
||||||
result: 'ok',
|
result: 'ok',
|
||||||
response: response,
|
response: response,
|
||||||
}
|
}
|
||||||
rescue => e
|
rescue => e
|
||||||
|
@ -23,7 +23,7 @@ class Integration::IdoitController < ApplicationController
|
||||||
def query
|
def query
|
||||||
response = ::Idoit.query(params[:method], params[:filter])
|
response = ::Idoit.query(params[:method], params[:filter])
|
||||||
render json: {
|
render json: {
|
||||||
result: 'ok',
|
result: 'ok',
|
||||||
response: response,
|
response: response,
|
||||||
}
|
}
|
||||||
rescue => e
|
rescue => e
|
||||||
|
|
|
@ -42,9 +42,9 @@ class Integration::LdapController < ApplicationController
|
||||||
user_uid: user.uid_attribute,
|
user_uid: user.uid_attribute,
|
||||||
|
|
||||||
# the order of these calls is relevant!
|
# the order of these calls is relevant!
|
||||||
group_filter: group.filter,
|
group_filter: group.filter,
|
||||||
groups: group.list,
|
groups: group.list,
|
||||||
group_uid: group.uid_attribute,
|
group_uid: group.uid_attribute,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -184,12 +184,12 @@ class Integration::PlacetelController < ApplicationController
|
||||||
api_key: config_integration[:api_token],
|
api_key: config_integration[:api_token],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
log: {
|
log: {
|
||||||
facility: 'placetel',
|
facility: 'placetel',
|
||||||
},
|
},
|
||||||
json: true,
|
json: true,
|
||||||
open_timeout: 4,
|
open_timeout: 4,
|
||||||
read_timeout: 6,
|
read_timeout: 6,
|
||||||
total_timeout: 6,
|
total_timeout: 6,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,8 +6,8 @@ class KarmaController < ApplicationController
|
||||||
def index
|
def index
|
||||||
render json: {
|
render json: {
|
||||||
levels: Setting.get('karma_levels'),
|
levels: Setting.get('karma_levels'),
|
||||||
user: Karma::User.by_user(current_user),
|
user: Karma::User.by_user(current_user),
|
||||||
logs: Karma::ActivityLog.latest(current_user, 20),
|
logs: Karma::ActivityLog.latest(current_user, 20),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ class LinksController < ApplicationController
|
||||||
# GET /api/v1/links
|
# GET /api/v1/links
|
||||||
def index
|
def index
|
||||||
links = Link.list(
|
links = Link.list(
|
||||||
link_object: params[:link_object],
|
link_object: params[:link_object],
|
||||||
link_object_value: params[:link_object_value],
|
link_object_value: params[:link_object_value],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class LinksController < ApplicationController
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
render json: {
|
render json: {
|
||||||
links: link_list,
|
links: link_list,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -37,10 +37,10 @@ class LinksController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
link = Link.add(
|
link = Link.add(
|
||||||
link_type: params[:link_type],
|
link_type: params[:link_type],
|
||||||
link_object_target: params[:link_object_target],
|
link_object_target: params[:link_object_target],
|
||||||
link_object_target_value: params[:link_object_target_value],
|
link_object_target_value: params[:link_object_target_value],
|
||||||
link_object_source: params[:link_object_source],
|
link_object_source: params[:link_object_source],
|
||||||
link_object_source_value: object.id,
|
link_object_source_value: object.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -29,12 +29,12 @@ class LongPollingController < ApplicationController
|
||||||
Sessions.create(client_id, session_data, { type: 'ajax' })
|
Sessions.create(client_id, session_data, { type: 'ajax' })
|
||||||
elsif data['event']
|
elsif data['event']
|
||||||
message = Sessions::Event.run(
|
message = Sessions::Event.run(
|
||||||
event: data['event'],
|
event: data['event'],
|
||||||
payload: data,
|
payload: data,
|
||||||
session: session_data,
|
session: session_data,
|
||||||
client_id: client_id,
|
client_id: client_id,
|
||||||
clients: {},
|
clients: {},
|
||||||
options: {},
|
options: {},
|
||||||
)
|
)
|
||||||
if message
|
if message
|
||||||
Sessions.send(client_id, message)
|
Sessions.send(client_id, message)
|
||||||
|
|
|
@ -152,7 +152,7 @@ curl http://localhost/api/v1/monitoring/health_check?token=XXX
|
||||||
result = {
|
result = {
|
||||||
healthy: true,
|
healthy: true,
|
||||||
message: 'success',
|
message: 'success',
|
||||||
token: token,
|
token: token,
|
||||||
}
|
}
|
||||||
render json: result
|
render json: result
|
||||||
return
|
return
|
||||||
|
@ -204,19 +204,19 @@ curl http://localhost/api/v1/monitoring/status?token=XXX
|
||||||
end
|
end
|
||||||
|
|
||||||
status = {
|
status = {
|
||||||
counts: {},
|
counts: {},
|
||||||
last_created_at: {},
|
last_created_at: {},
|
||||||
last_login: last_login,
|
last_login: last_login,
|
||||||
agents: User.with_permissions('ticket.agent').count,
|
agents: User.with_permissions('ticket.agent').count,
|
||||||
}
|
}
|
||||||
|
|
||||||
map = {
|
map = {
|
||||||
users: User,
|
users: User,
|
||||||
groups: Group,
|
groups: Group,
|
||||||
overviews: Overview,
|
overviews: Overview,
|
||||||
tickets: Ticket,
|
tickets: Ticket,
|
||||||
ticket_articles: Ticket::Article,
|
ticket_articles: Ticket::Article,
|
||||||
text_modules: TextModule,
|
text_modules: TextModule,
|
||||||
}
|
}
|
||||||
map.each do |key, class_name|
|
map.each do |key, class_name|
|
||||||
status[:counts][key] = class_name.count
|
status[:counts][key] = class_name.count
|
||||||
|
@ -316,9 +316,9 @@ curl http://localhost/api/v1/monitoring/amount_check?token=XXX&periode=1h
|
||||||
if row[:type] == 'gt'
|
if row[:type] == 'gt'
|
||||||
if count > params[row[:param]].to_i
|
if count > params[row[:param]].to_i
|
||||||
result = {
|
result = {
|
||||||
state: row[:notice],
|
state: row[:notice],
|
||||||
message: "The limit of #{params[row[:param]]} was exceeded with #{count} in the last #{params[:periode]}",
|
message: "The limit of #{params[row[:param]]} was exceeded with #{count} in the last #{params[:periode]}",
|
||||||
count: count,
|
count: count,
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -327,18 +327,18 @@ curl http://localhost/api/v1/monitoring/amount_check?token=XXX&periode=1h
|
||||||
next if count > params[row[:param]].to_i
|
next if count > params[row[:param]].to_i
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
state: row[:notice],
|
state: row[:notice],
|
||||||
message: "The minimum of #{params[row[:param]]} was undercut by #{count} in the last #{params[:periode]}",
|
message: "The minimum of #{params[row[:param]]} was undercut by #{count} in the last #{params[:periode]}",
|
||||||
count: count,
|
count: count,
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
if result.blank?
|
if result.blank?
|
||||||
result = {
|
result = {
|
||||||
state: 'ok',
|
state: 'ok',
|
||||||
message: '',
|
message: '',
|
||||||
count: Ticket.where('created_at >= ?', created_at).count,
|
count: Ticket.where('created_at >= ?', created_at).count,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -25,21 +25,21 @@ class ObjectManagerAttributesController < ApplicationController
|
||||||
# check if attribute already exists
|
# check if attribute already exists
|
||||||
exists = ObjectManager::Attribute.get(
|
exists = ObjectManager::Attribute.get(
|
||||||
object: permitted_params[:object],
|
object: permitted_params[:object],
|
||||||
name: permitted_params[:name],
|
name: permitted_params[:name],
|
||||||
)
|
)
|
||||||
raise Exceptions::UnprocessableEntity, 'already exists' if exists
|
raise Exceptions::UnprocessableEntity, 'already exists' if exists
|
||||||
|
|
||||||
begin
|
begin
|
||||||
object_manager_attribute = ObjectManager::Attribute.add(
|
object_manager_attribute = ObjectManager::Attribute.add(
|
||||||
object: permitted_params[:object],
|
object: permitted_params[:object],
|
||||||
name: permitted_params[:name],
|
name: permitted_params[:name],
|
||||||
display: permitted_params[:display],
|
display: permitted_params[:display],
|
||||||
data_type: permitted_params[:data_type],
|
data_type: permitted_params[:data_type],
|
||||||
data_option: permitted_params[:data_option],
|
data_option: permitted_params[:data_option],
|
||||||
active: permitted_params[:active],
|
active: permitted_params[:active],
|
||||||
screens: permitted_params[:screens],
|
screens: permitted_params[:screens],
|
||||||
position: 1550,
|
position: 1550,
|
||||||
editable: true,
|
editable: true,
|
||||||
)
|
)
|
||||||
render json: object_manager_attribute.attributes_with_association_ids, status: :created
|
render json: object_manager_attribute.attributes_with_association_ids, status: :created
|
||||||
rescue => e
|
rescue => e
|
||||||
|
@ -52,15 +52,15 @@ class ObjectManagerAttributesController < ApplicationController
|
||||||
def update
|
def update
|
||||||
|
|
||||||
object_manager_attribute = ObjectManager::Attribute.add(
|
object_manager_attribute = ObjectManager::Attribute.add(
|
||||||
object: permitted_params[:object],
|
object: permitted_params[:object],
|
||||||
name: permitted_params[:name],
|
name: permitted_params[:name],
|
||||||
display: permitted_params[:display],
|
display: permitted_params[:display],
|
||||||
data_type: permitted_params[:data_type],
|
data_type: permitted_params[:data_type],
|
||||||
data_option: permitted_params[:data_option],
|
data_option: permitted_params[:data_option],
|
||||||
active: permitted_params[:active],
|
active: permitted_params[:active],
|
||||||
screens: permitted_params[:screens],
|
screens: permitted_params[:screens],
|
||||||
position: 1550,
|
position: 1550,
|
||||||
editable: true,
|
editable: true,
|
||||||
)
|
)
|
||||||
render json: object_manager_attribute.attributes_with_association_ids, status: :ok
|
render json: object_manager_attribute.attributes_with_association_ids, status: :ok
|
||||||
rescue => e
|
rescue => e
|
||||||
|
@ -74,7 +74,7 @@ class ObjectManagerAttributesController < ApplicationController
|
||||||
object_manager_attribute = ObjectManager::Attribute.find(params[:id])
|
object_manager_attribute = ObjectManager::Attribute.find(params[:id])
|
||||||
ObjectManager::Attribute.remove(
|
ObjectManager::Attribute.remove(
|
||||||
object_lookup_id: object_manager_attribute.object_lookup_id,
|
object_lookup_id: object_manager_attribute.object_lookup_id,
|
||||||
name: object_manager_attribute.name,
|
name: object_manager_attribute.name,
|
||||||
)
|
)
|
||||||
model_destroy_render_item
|
model_destroy_render_item
|
||||||
rescue => e
|
rescue => e
|
||||||
|
|
|
@ -67,7 +67,7 @@ curl http://localhost/api/v1/online_notifications.json -v -u #{login}:#{password
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
record_ids: item_ids,
|
record_ids: item_ids,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}, status: :ok
|
}, status: :ok
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -87,7 +87,7 @@ curl http://localhost/api/v1/organizations -v -u #{login}:#{password}
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
record_ids: item_ids,
|
record_ids: item_ids,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}, status: :ok
|
}, status: :ok
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -243,11 +243,11 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co
|
||||||
query = query.permit!.to_h
|
query = query.permit!.to_h
|
||||||
end
|
end
|
||||||
query_params = {
|
query_params = {
|
||||||
query: query,
|
query: query,
|
||||||
limit: per_page,
|
limit: per_page,
|
||||||
offset: offset,
|
offset: offset,
|
||||||
sort_by: params[:sort_by],
|
sort_by: params[:sort_by],
|
||||||
order_by: params[:order_by],
|
order_by: params[:order_by],
|
||||||
current_user: current_user,
|
current_user: current_user,
|
||||||
}
|
}
|
||||||
if params[:role_ids].present?
|
if params[:role_ids].present?
|
||||||
|
@ -289,7 +289,7 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
render json: {
|
render json: {
|
||||||
assets: assets,
|
assets: assets,
|
||||||
organization_ids: organization_ids.uniq,
|
organization_ids: organization_ids.uniq,
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -332,8 +332,8 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co
|
||||||
permission_check('admin.organization')
|
permission_check('admin.organization')
|
||||||
send_data(
|
send_data(
|
||||||
Organization.csv_example,
|
Organization.csv_example,
|
||||||
filename: 'organization-example.csv',
|
filename: 'organization-example.csv',
|
||||||
type: 'text/csv',
|
type: 'text/csv',
|
||||||
disposition: 'attachment'
|
disposition: 'attachment'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -356,12 +356,12 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co
|
||||||
raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank?
|
raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank?
|
||||||
|
|
||||||
result = Organization.csv_import(
|
result = Organization.csv_import(
|
||||||
string: string,
|
string: string,
|
||||||
parse_params: {
|
parse_params: {
|
||||||
col_sep: params[:col_sep] || ',',
|
col_sep: params[:col_sep] || ',',
|
||||||
},
|
},
|
||||||
try: params[:try],
|
try: params[:try],
|
||||||
delete: params[:delete],
|
delete: params[:delete],
|
||||||
)
|
)
|
||||||
render json: result, status: :ok
|
render json: result, status: :ok
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,7 @@ class ProxyController < ApplicationController
|
||||||
)
|
)
|
||||||
rescue => e
|
rescue => e
|
||||||
render json: {
|
render json: {
|
||||||
result: 'failed',
|
result: 'failed',
|
||||||
message: e.inspect
|
message: e.inspect
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -29,7 +29,7 @@ class ProxyController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
result: 'failed',
|
result: 'failed',
|
||||||
message: result.body || result.error || result.code
|
message: result.body || result.error || result.code
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -39,7 +39,7 @@ curl http://localhost/api/v1/recent_view -v -u #{login}:#{password} -H "Content-
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
record_ids: item_ids,
|
record_ids: item_ids,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}, status: :ok
|
}, status: :ok
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ class ReportsController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
config: Report.config,
|
config: Report.config,
|
||||||
profiles: Report::Profile.list,
|
profiles: Report::Profile.list,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -102,8 +102,8 @@ class ReportsController < ApplicationController
|
||||||
content = sheet(get_params[:profile], backend[:display], result)
|
content = sheet(get_params[:profile], backend[:display], result)
|
||||||
send_data(
|
send_data(
|
||||||
content,
|
content,
|
||||||
filename: "tickets-#{get_params[:profile].name}-#{backend[:display]}.xls",
|
filename: "tickets-#{get_params[:profile].name}-#{backend[:display]}.xls",
|
||||||
type: 'application/vnd.ms-excel',
|
type: 'application/vnd.ms-excel',
|
||||||
disposition: 'attachment'
|
disposition: 'attachment'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -163,11 +163,11 @@ class ReportsController < ApplicationController
|
||||||
end
|
end
|
||||||
{
|
{
|
||||||
profile: profile,
|
profile: profile,
|
||||||
metric: metric,
|
metric: metric,
|
||||||
config: local_config,
|
config: local_config,
|
||||||
start: start,
|
start: start,
|
||||||
stop: stop,
|
stop: stop,
|
||||||
range: range,
|
range: range,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -217,9 +217,9 @@ class ReportsController < ApplicationController
|
||||||
# ObjectManager attributes
|
# ObjectManager attributes
|
||||||
header_column = 14
|
header_column = 14
|
||||||
# needs to be skipped
|
# needs to be skipped
|
||||||
objects = ObjectManager::Attribute.where(editable: true,
|
objects = ObjectManager::Attribute.where(editable: true,
|
||||||
active: true,
|
active: true,
|
||||||
to_create: false,
|
to_create: false,
|
||||||
object_lookup_id: ObjectLookup.lookup(name: 'Ticket').id)
|
object_lookup_id: ObjectLookup.lookup(name: 'Ticket').id)
|
||||||
.pluck(:name, :display, :data_type, :data_option)
|
.pluck(:name, :display, :data_type, :data_option)
|
||||||
.map { |name, display, data_type, data_option| { name: name, display: display, data_type: data_type, data_option: data_option } }
|
.map { |name, display, data_type, data_option| { name: name, display: display, data_type: data_type, data_option: data_option } }
|
||||||
|
|
|
@ -6,8 +6,8 @@ module ExtraCollection
|
||||||
|
|
||||||
item = StatsStore.search(
|
item = StatsStore.search(
|
||||||
object: 'User',
|
object: 'User',
|
||||||
o_id: user.id,
|
o_id: user.id,
|
||||||
key: 'dashboard',
|
key: 'dashboard',
|
||||||
)
|
)
|
||||||
return [collections, assets] if !item
|
return [collections, assets] if !item
|
||||||
|
|
||||||
|
|
|
@ -51,12 +51,12 @@ class SessionsController < ApplicationController
|
||||||
|
|
||||||
# return new session data
|
# return new session data
|
||||||
render status: :created,
|
render status: :created,
|
||||||
json: {
|
json: {
|
||||||
session: user,
|
session: user,
|
||||||
config: config_frontend,
|
config: config_frontend,
|
||||||
models: models,
|
models: models,
|
||||||
collections: collections,
|
collections: collections,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -74,9 +74,9 @@ class SessionsController < ApplicationController
|
||||||
models = SessionHelper.models()
|
models = SessionHelper.models()
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
error: 'no valid session',
|
error: 'no valid session',
|
||||||
config: config_frontend,
|
config: config_frontend,
|
||||||
models: models,
|
models: models,
|
||||||
collections: {
|
collections: {
|
||||||
Locale.to_app_model => Locale.where(active: true)
|
Locale.to_app_model => Locale.where(active: true)
|
||||||
},
|
},
|
||||||
|
@ -103,11 +103,11 @@ class SessionsController < ApplicationController
|
||||||
|
|
||||||
# return current session
|
# return current session
|
||||||
render json: {
|
render json: {
|
||||||
session: user,
|
session: user,
|
||||||
config: config_frontend,
|
config: config_frontend,
|
||||||
models: models,
|
models: models,
|
||||||
collections: collections,
|
collections: collections,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ class SessionsController < ApplicationController
|
||||||
# check user
|
# check user
|
||||||
if !params[:id]
|
if !params[:id]
|
||||||
render(
|
render(
|
||||||
json: { message: 'no user given' },
|
json: { message: 'no user given' },
|
||||||
status: :not_found
|
status: :not_found
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
|
@ -215,7 +215,7 @@ class SessionsController < ApplicationController
|
||||||
user = User.find(params[:id])
|
user = User.find(params[:id])
|
||||||
if !user
|
if !user
|
||||||
render(
|
render(
|
||||||
json: {},
|
json: {},
|
||||||
status: :not_found
|
status: :not_found
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
|
@ -232,7 +232,7 @@ class SessionsController < ApplicationController
|
||||||
|
|
||||||
render(
|
render(
|
||||||
json: {
|
json: {
|
||||||
success: true,
|
success: true,
|
||||||
location: '',
|
location: '',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -250,7 +250,7 @@ class SessionsController < ApplicationController
|
||||||
user = User.lookup(id: session[:switched_from_user_id])
|
user = User.lookup(id: session[:switched_from_user_id])
|
||||||
if !user
|
if !user
|
||||||
render(
|
render(
|
||||||
json: {},
|
json: {},
|
||||||
status: :not_found
|
status: :not_found
|
||||||
)
|
)
|
||||||
return false
|
return false
|
||||||
|
@ -270,7 +270,7 @@ class SessionsController < ApplicationController
|
||||||
|
|
||||||
render(
|
render(
|
||||||
json: {
|
json: {
|
||||||
success: true,
|
success: true,
|
||||||
location: '',
|
location: '',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -299,7 +299,7 @@ class SessionsController < ApplicationController
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
sessions: sessions_clean,
|
sessions: sessions_clean,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class SettingsController < ApplicationController
|
||||||
|
|
||||||
if !clean_params[:logo]
|
if !clean_params[:logo]
|
||||||
render json: {
|
render json: {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message: 'Need logo param',
|
message: 'Need logo param',
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -48,7 +48,7 @@ class SettingsController < ApplicationController
|
||||||
# validate image
|
# validate image
|
||||||
if !clean_params[:logo].match?(/^data:image/i)
|
if !clean_params[:logo].match?(/^data:image/i)
|
||||||
render json: {
|
render json: {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message: 'Invalid payload, need data:image in logo param',
|
message: 'Invalid payload, need data:image in logo param',
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -58,7 +58,7 @@ class SettingsController < ApplicationController
|
||||||
file = StaticAssets.data_url_attributes(clean_params[:logo])
|
file = StaticAssets.data_url_attributes(clean_params[:logo])
|
||||||
if !file[:content] || !file[:mime_type]
|
if !file[:content] || !file[:mime_type]
|
||||||
render json: {
|
render json: {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
message: 'Unable to process image upload.',
|
message: 'Unable to process image upload.',
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -80,7 +80,7 @@ class SettingsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
result: 'ok',
|
result: 'ok',
|
||||||
settings: [setting],
|
settings: [setting],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -65,7 +65,7 @@ curl http://localhost/api/v1/slas.json -v -u #{login}:#{password}
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
record_ids: sla_ids,
|
record_ids: sla_ids,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}, status: :ok
|
}, status: :ok
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ class TagsController < ApplicationController
|
||||||
results = []
|
results = []
|
||||||
list.each do |item|
|
list.each do |item|
|
||||||
result = {
|
result = {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
value: item.name,
|
value: item.name,
|
||||||
}
|
}
|
||||||
results.push result
|
results.push result
|
||||||
|
@ -21,7 +21,7 @@ class TagsController < ApplicationController
|
||||||
def list
|
def list
|
||||||
list = Tag.tag_list(
|
list = Tag.tag_list(
|
||||||
object: params[:object],
|
object: params[:object],
|
||||||
o_id: params[:o_id],
|
o_id: params[:o_id],
|
||||||
)
|
)
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
|
@ -34,8 +34,8 @@ class TagsController < ApplicationController
|
||||||
def add
|
def add
|
||||||
success = Tag.tag_add(
|
success = Tag.tag_add(
|
||||||
object: params[:object],
|
object: params[:object],
|
||||||
o_id: params[:o_id],
|
o_id: params[:o_id],
|
||||||
item: params[:item],
|
item: params[:item],
|
||||||
)
|
)
|
||||||
if success
|
if success
|
||||||
render json: success, status: :created
|
render json: success, status: :created
|
||||||
|
@ -48,8 +48,8 @@ class TagsController < ApplicationController
|
||||||
def remove
|
def remove
|
||||||
success = Tag.tag_remove(
|
success = Tag.tag_remove(
|
||||||
object: params[:object],
|
object: params[:object],
|
||||||
o_id: params[:o_id],
|
o_id: params[:o_id],
|
||||||
item: params[:item],
|
item: params[:item],
|
||||||
)
|
)
|
||||||
if success
|
if success
|
||||||
render json: success, status: :created
|
render json: success, status: :created
|
||||||
|
@ -65,8 +65,8 @@ class TagsController < ApplicationController
|
||||||
results = []
|
results = []
|
||||||
list.each do |item|
|
list.each do |item|
|
||||||
result = {
|
result = {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
count: Tag.where(tag_item_id: item.id).count
|
count: Tag.where(tag_item_id: item.id).count
|
||||||
}
|
}
|
||||||
results.push result
|
results.push result
|
||||||
|
@ -85,7 +85,7 @@ class TagsController < ApplicationController
|
||||||
def admin_rename
|
def admin_rename
|
||||||
permission_check('admin.tag')
|
permission_check('admin.tag')
|
||||||
Tag::Item.rename(
|
Tag::Item.rename(
|
||||||
id: params[:id],
|
id: params[:id],
|
||||||
name: params[:name],
|
name: params[:name],
|
||||||
)
|
)
|
||||||
render json: {}
|
render json: {}
|
||||||
|
|
|
@ -168,8 +168,8 @@ curl http://localhost/api/v1/text_modules.json -v -u #{login}:#{password} -H "Co
|
||||||
)
|
)
|
||||||
send_data(
|
send_data(
|
||||||
csv_string,
|
csv_string,
|
||||||
filename: 'text_module-example.csv',
|
filename: 'text_module-example.csv',
|
||||||
type: 'text/csv',
|
type: 'text/csv',
|
||||||
disposition: 'attachment'
|
disposition: 'attachment'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -193,12 +193,12 @@ curl http://localhost/api/v1/text_modules.json -v -u #{login}:#{password} -H "Co
|
||||||
raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank?
|
raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank?
|
||||||
|
|
||||||
result = TextModule.csv_import(
|
result = TextModule.csv_import(
|
||||||
string: string,
|
string: string,
|
||||||
parse_params: {
|
parse_params: {
|
||||||
col_sep: params[:col_sep] || ',',
|
col_sep: params[:col_sep] || ',',
|
||||||
},
|
},
|
||||||
try: params[:try],
|
try: params[:try],
|
||||||
delete: params[:delete],
|
delete: params[:delete],
|
||||||
)
|
)
|
||||||
render json: result, status: :ok
|
render json: result, status: :ok
|
||||||
end
|
end
|
||||||
|
|
|
@ -66,7 +66,7 @@ class TicketArticlesController < ApplicationController
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
record_ids: record_ids,
|
record_ids: record_ids,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}, status: :ok
|
}, status: :ok
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -196,20 +196,20 @@ class TicketArticlesController < ApplicationController
|
||||||
'Content-Type' => content_type
|
'Content-Type' => content_type
|
||||||
}
|
}
|
||||||
store = Store.add(
|
store = Store.add(
|
||||||
object: 'UploadCache',
|
object: 'UploadCache',
|
||||||
o_id: params[:form_id],
|
o_id: params[:form_id],
|
||||||
data: file.read,
|
data: file.read,
|
||||||
filename: file.original_filename,
|
filename: file.original_filename,
|
||||||
preferences: headers_store
|
preferences: headers_store
|
||||||
)
|
)
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
render json: {
|
render json: {
|
||||||
success: true,
|
success: true,
|
||||||
data: {
|
data: {
|
||||||
id: store.id,
|
id: store.id,
|
||||||
filename: file.original_filename,
|
filename: file.original_filename,
|
||||||
size: store.size,
|
size: store.size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -257,8 +257,8 @@ class TicketArticlesController < ApplicationController
|
||||||
|
|
||||||
send_data(
|
send_data(
|
||||||
file.content,
|
file.content,
|
||||||
filename: file.filename,
|
filename: file.filename,
|
||||||
type: file.preferences['Content-Type'] || file.preferences['Mime-Type'] || 'application/octet-stream',
|
type: file.preferences['Content-Type'] || file.preferences['Mime-Type'] || 'application/octet-stream',
|
||||||
disposition: disposition
|
disposition: disposition
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -275,8 +275,8 @@ class TicketArticlesController < ApplicationController
|
||||||
|
|
||||||
send_data(
|
send_data(
|
||||||
file.content,
|
file.content,
|
||||||
filename: file.filename,
|
filename: file.filename,
|
||||||
type: 'message/rfc822',
|
type: 'message/rfc822',
|
||||||
disposition: 'inline'
|
disposition: 'inline'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -296,8 +296,8 @@ class TicketArticlesController < ApplicationController
|
||||||
)
|
)
|
||||||
send_data(
|
send_data(
|
||||||
csv_string,
|
csv_string,
|
||||||
filename: 'example.csv',
|
filename: 'example.csv',
|
||||||
type: 'text/csv',
|
type: 'text/csv',
|
||||||
disposition: 'attachment'
|
disposition: 'attachment'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -325,11 +325,11 @@ class TicketArticlesController < ApplicationController
|
||||||
raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank?
|
raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank?
|
||||||
|
|
||||||
result = Ticket::Article.csv_import(
|
result = Ticket::Article.csv_import(
|
||||||
string: string,
|
string: string,
|
||||||
parse_params: {
|
parse_params: {
|
||||||
col_sep: ';',
|
col_sep: ';',
|
||||||
},
|
},
|
||||||
try: params[:try],
|
try: params[:try],
|
||||||
)
|
)
|
||||||
render json: result, status: :ok
|
render json: result, status: :ok
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,9 +13,9 @@ class TicketOverviewsController < ApplicationController
|
||||||
assets = {}
|
assets = {}
|
||||||
overview = Overview.lookup(id: index[:overview][:id])
|
overview = Overview.lookup(id: index[:overview][:id])
|
||||||
meta = {
|
meta = {
|
||||||
name: overview.name,
|
name: overview.name,
|
||||||
prio: overview.prio,
|
prio: overview.prio,
|
||||||
link: overview.link,
|
link: overview.link,
|
||||||
count: index[:count],
|
count: index[:count],
|
||||||
}
|
}
|
||||||
indexes.push meta
|
indexes.push meta
|
||||||
|
@ -42,7 +42,7 @@ class TicketOverviewsController < ApplicationController
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
assets: assets,
|
assets: assets,
|
||||||
index: result,
|
index: result,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ class TicketsController < ApplicationController
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
record_ids: item_ids,
|
record_ids: item_ids,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}, status: :ok
|
}, status: :ok
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -107,11 +107,11 @@ class TicketsController < ApplicationController
|
||||||
role_ids = Role.signup_role_ids
|
role_ids = Role.signup_role_ids
|
||||||
local_customer = User.create(
|
local_customer = User.create(
|
||||||
firstname: '',
|
firstname: '',
|
||||||
lastname: '',
|
lastname: '',
|
||||||
email: email,
|
email: email,
|
||||||
password: '',
|
password: '',
|
||||||
active: true,
|
active: true,
|
||||||
role_ids: role_ids,
|
role_ids: role_ids,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
clean_params[:customer_id] = local_customer.id
|
clean_params[:customer_id] = local_customer.id
|
||||||
|
@ -186,10 +186,10 @@ class TicketsController < ApplicationController
|
||||||
|
|
||||||
object_ids.each do |local_object_id|
|
object_ids.each do |local_object_id|
|
||||||
link = Link.add(
|
link = Link.add(
|
||||||
link_type: link_type,
|
link_type: link_type,
|
||||||
link_object_target: target_object,
|
link_object_target: target_object,
|
||||||
link_object_target_value: local_object_id,
|
link_object_target_value: local_object_id,
|
||||||
link_object_source: 'Ticket',
|
link_object_source: 'Ticket',
|
||||||
link_object_source_value: ticket.id,
|
link_object_source_value: ticket.id,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -281,7 +281,7 @@ class TicketsController < ApplicationController
|
||||||
# return result
|
# return result
|
||||||
result = Ticket::ScreenOptions.list_by_customer(
|
result = Ticket::ScreenOptions.list_by_customer(
|
||||||
customer_id: params[:customer_id],
|
customer_id: params[:customer_id],
|
||||||
limit: 15,
|
limit: 15,
|
||||||
)
|
)
|
||||||
render json: result
|
render json: result
|
||||||
end
|
end
|
||||||
|
@ -312,7 +312,7 @@ class TicketsController < ApplicationController
|
||||||
ticket_lists = Ticket
|
ticket_lists = Ticket
|
||||||
.where(
|
.where(
|
||||||
customer_id: ticket.customer_id,
|
customer_id: ticket.customer_id,
|
||||||
state_id: Ticket::State.by_category(:open)
|
state_id: Ticket::State.by_category(:open)
|
||||||
)
|
)
|
||||||
.where(access_condition)
|
.where(access_condition)
|
||||||
.where('id != ?', [ ticket.id ])
|
.where('id != ?', [ ticket.id ])
|
||||||
|
@ -353,8 +353,8 @@ class TicketsController < ApplicationController
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
render json: {
|
render json: {
|
||||||
assets: assets,
|
assets: assets,
|
||||||
ticket_ids_by_customer: ticket_ids_by_customer,
|
ticket_ids_by_customer: ticket_ids_by_customer,
|
||||||
ticket_ids_recent_viewed: ticket_ids_recent_viewed,
|
ticket_ids_recent_viewed: ticket_ids_recent_viewed,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -366,7 +366,7 @@ class TicketsController < ApplicationController
|
||||||
ticket_master = Ticket.find_by(number: params[:master_ticket_number])
|
ticket_master = Ticket.find_by(number: params[:master_ticket_number])
|
||||||
if !ticket_master
|
if !ticket_master
|
||||||
render json: {
|
render json: {
|
||||||
result: 'failed',
|
result: 'failed',
|
||||||
message: 'No such master ticket number!',
|
message: 'No such master ticket number!',
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -377,7 +377,7 @@ class TicketsController < ApplicationController
|
||||||
ticket_slave = Ticket.find_by(id: params[:slave_ticket_id])
|
ticket_slave = Ticket.find_by(id: params[:slave_ticket_id])
|
||||||
if !ticket_slave
|
if !ticket_slave
|
||||||
render json: {
|
render json: {
|
||||||
result: 'failed',
|
result: 'failed',
|
||||||
message: 'No such slave ticket!',
|
message: 'No such slave ticket!',
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -386,15 +386,15 @@ class TicketsController < ApplicationController
|
||||||
|
|
||||||
# merge ticket
|
# merge ticket
|
||||||
ticket_slave.merge_to(
|
ticket_slave.merge_to(
|
||||||
ticket_id: ticket_master.id,
|
ticket_id: ticket_master.id,
|
||||||
created_by_id: current_user.id,
|
created_by_id: current_user.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
render json: {
|
render json: {
|
||||||
result: 'success',
|
result: 'success',
|
||||||
master_ticket: ticket_master.attributes,
|
master_ticket: ticket_master.attributes,
|
||||||
slave_ticket: ticket_slave.attributes,
|
slave_ticket: ticket_slave.attributes,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ class TicketsController < ApplicationController
|
||||||
assets = article.assets(assets)
|
assets = article.assets(assets)
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
assets: assets,
|
assets: assets,
|
||||||
attachments: article_attachments_clone(article),
|
attachments: article_attachments_clone(article),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -448,12 +448,12 @@ class TicketsController < ApplicationController
|
||||||
|
|
||||||
# build result list
|
# build result list
|
||||||
tickets = Ticket.search(
|
tickets = Ticket.search(
|
||||||
query: query,
|
query: query,
|
||||||
condition: params[:condition].to_h,
|
condition: params[:condition].to_h,
|
||||||
limit: per_page,
|
limit: per_page,
|
||||||
offset: offset,
|
offset: offset,
|
||||||
order_by: params[:order_by],
|
order_by: params[:order_by],
|
||||||
sort_by: params[:sort_by],
|
sort_by: params[:sort_by],
|
||||||
current_user: current_user,
|
current_user: current_user,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -475,9 +475,9 @@ class TicketsController < ApplicationController
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
render json: {
|
render json: {
|
||||||
tickets: ticket_result,
|
tickets: ticket_result,
|
||||||
tickets_count: tickets.count,
|
tickets_count: tickets.count,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -496,9 +496,9 @@ class TicketsController < ApplicationController
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
render json: {
|
render json: {
|
||||||
ticket_ids: ticket_ids,
|
ticket_ids: ticket_ids,
|
||||||
ticket_count: ticket_count || 0,
|
ticket_count: ticket_count || 0,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -523,23 +523,23 @@ class TicketsController < ApplicationController
|
||||||
|
|
||||||
conditions = {
|
conditions = {
|
||||||
closed_ids: {
|
closed_ids: {
|
||||||
'ticket.state_id' => {
|
'ticket.state_id' => {
|
||||||
operator: 'is',
|
operator: 'is',
|
||||||
value: Ticket::State.by_category(:closed).pluck(:id),
|
value: Ticket::State.by_category(:closed).pluck(:id),
|
||||||
},
|
},
|
||||||
'ticket.customer_id' => {
|
'ticket.customer_id' => {
|
||||||
operator: 'is',
|
operator: 'is',
|
||||||
value: user.id,
|
value: user.id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
open_ids: {
|
open_ids: {
|
||||||
'ticket.state_id' => {
|
'ticket.state_id' => {
|
||||||
operator: 'is',
|
operator: 'is',
|
||||||
value: Ticket::State.by_category(:open).pluck(:id),
|
value: Ticket::State.by_category(:open).pluck(:id),
|
||||||
},
|
},
|
||||||
'ticket.customer_id' => {
|
'ticket.customer_id' => {
|
||||||
operator: 'is',
|
operator: 'is',
|
||||||
value: user.id,
|
value: user.id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -565,23 +565,23 @@ class TicketsController < ApplicationController
|
||||||
|
|
||||||
conditions = {
|
conditions = {
|
||||||
closed_ids: {
|
closed_ids: {
|
||||||
'ticket.state_id' => {
|
'ticket.state_id' => {
|
||||||
operator: 'is',
|
operator: 'is',
|
||||||
value: Ticket::State.by_category(:closed).pluck(:id),
|
value: Ticket::State.by_category(:closed).pluck(:id),
|
||||||
},
|
},
|
||||||
'ticket.organization_id' => {
|
'ticket.organization_id' => {
|
||||||
operator: 'is',
|
operator: 'is',
|
||||||
value: organization.id,
|
value: organization.id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
open_ids: {
|
open_ids: {
|
||||||
'ticket.state_id' => {
|
'ticket.state_id' => {
|
||||||
operator: 'is',
|
operator: 'is',
|
||||||
value: Ticket::State.by_category(:open).pluck(:id),
|
value: Ticket::State.by_category(:open).pluck(:id),
|
||||||
},
|
},
|
||||||
'ticket.organization_id' => {
|
'ticket.organization_id' => {
|
||||||
operator: 'is',
|
operator: 'is',
|
||||||
value: organization.id,
|
value: organization.id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -598,9 +598,9 @@ class TicketsController < ApplicationController
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
render json: {
|
render json: {
|
||||||
user: user_tickets,
|
user: user_tickets,
|
||||||
organization: org_tickets,
|
organization: org_tickets,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -619,8 +619,8 @@ class TicketsController < ApplicationController
|
||||||
)
|
)
|
||||||
send_data(
|
send_data(
|
||||||
csv_string,
|
csv_string,
|
||||||
filename: 'example.csv',
|
filename: 'example.csv',
|
||||||
type: 'text/csv',
|
type: 'text/csv',
|
||||||
disposition: 'attachment'
|
disposition: 'attachment'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -648,11 +648,11 @@ class TicketsController < ApplicationController
|
||||||
raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank?
|
raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank?
|
||||||
|
|
||||||
result = Ticket.csv_import(
|
result = Ticket.csv_import(
|
||||||
string: string,
|
string: string,
|
||||||
parse_params: {
|
parse_params: {
|
||||||
col_sep: params[:col_sep] || ',',
|
col_sep: params[:col_sep] || ',',
|
||||||
},
|
},
|
||||||
try: params[:try],
|
try: params[:try],
|
||||||
)
|
)
|
||||||
render json: result, status: :ok
|
render json: result, status: :ok
|
||||||
end
|
end
|
||||||
|
@ -693,7 +693,7 @@ class TicketsController < ApplicationController
|
||||||
|
|
||||||
# get links
|
# get links
|
||||||
links = Link.list(
|
links = Link.list(
|
||||||
link_object: 'Ticket',
|
link_object: 'Ticket',
|
||||||
link_object_value: ticket.id,
|
link_object_value: ticket.id,
|
||||||
)
|
)
|
||||||
link_list = []
|
link_list = []
|
||||||
|
@ -710,12 +710,12 @@ class TicketsController < ApplicationController
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
{
|
{
|
||||||
ticket_id: ticket.id,
|
ticket_id: ticket.id,
|
||||||
ticket_article_ids: article_ids,
|
ticket_article_ids: article_ids,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
links: link_list,
|
links: link_list,
|
||||||
tags: tags,
|
tags: tags,
|
||||||
form_meta: attributes_to_change[:form_meta],
|
form_meta: attributes_to_change[:form_meta],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class TimeAccountingsController < ApplicationController
|
||||||
if !time_unit[record[0]]
|
if !time_unit[record[0]]
|
||||||
time_unit[record[0]] = {
|
time_unit[record[0]] = {
|
||||||
time_unit: 0,
|
time_unit: 0,
|
||||||
agent_id: record[2],
|
agent_id: record[2],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
time_unit[record[0]][:time_unit] += record[1]
|
time_unit[record[0]][:time_unit] += record[1]
|
||||||
|
@ -55,11 +55,11 @@ class TimeAccountingsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
result = {
|
result = {
|
||||||
ticket: ticket.attributes,
|
ticket: ticket.attributes,
|
||||||
time_unit: local_time_unit[:time_unit],
|
time_unit: local_time_unit[:time_unit],
|
||||||
customer: customers[ticket.customer_id],
|
customer: customers[ticket.customer_id],
|
||||||
organization: organizations[ticket.organization_id],
|
organization: organizations[ticket.organization_id],
|
||||||
agent: agents[local_time_unit[:agent_id]],
|
agent: agents[local_time_unit[:agent_id]],
|
||||||
}
|
}
|
||||||
results.push result
|
results.push result
|
||||||
end
|
end
|
||||||
|
@ -67,105 +67,105 @@ class TimeAccountingsController < ApplicationController
|
||||||
if params[:download]
|
if params[:download]
|
||||||
header = [
|
header = [
|
||||||
{
|
{
|
||||||
name: 'Ticket#',
|
name: 'Ticket#',
|
||||||
width: 15,
|
width: 15,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Title',
|
name: 'Title',
|
||||||
width: 30,
|
width: 30,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Customer',
|
name: 'Customer',
|
||||||
width: 20,
|
width: 20,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Organization',
|
name: 'Organization',
|
||||||
width: 20,
|
width: 20,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Agent',
|
name: 'Agent',
|
||||||
width: 20,
|
width: 20,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Time Units',
|
name: 'Time Units',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Time Units Total',
|
name: 'Time Units Total',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Created at',
|
name: 'Created at',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Closed at',
|
name: 'Closed at',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Close Escalation At',
|
name: 'Close Escalation At',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Close In Min',
|
name: 'Close In Min',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Close Diff In Min',
|
name: 'Close Diff In Min',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'First Response At',
|
name: 'First Response At',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'First Response Escalation At',
|
name: 'First Response Escalation At',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'First Response In Min',
|
name: 'First Response In Min',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'First Response Diff In Min',
|
name: 'First Response Diff In Min',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Update Escalation At',
|
name: 'Update Escalation At',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Update In Min',
|
name: 'Update In Min',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Update Diff In Min',
|
name: 'Update Diff In Min',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Last Contact At',
|
name: 'Last Contact At',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Last Contact Agent At',
|
name: 'Last Contact Agent At',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Last Contact Customer At',
|
name: 'Last Contact Customer At',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Article Count',
|
name: 'Article Count',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Escalation At',
|
name: 'Escalation At',
|
||||||
width: 10,
|
width: 10,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
objects = ObjectManager::Attribute.where(editable: true,
|
objects = ObjectManager::Attribute.where(editable: true,
|
||||||
active: true,
|
active: true,
|
||||||
to_create: false,
|
to_create: false,
|
||||||
object_lookup_id: ObjectLookup.lookup(name: 'Ticket').id)
|
object_lookup_id: ObjectLookup.lookup(name: 'Ticket').id)
|
||||||
.pluck(:name, :display, :data_type, :data_option)
|
.pluck(:name, :display, :data_type, :data_option)
|
||||||
.map { |name, display, data_type, data_option| { name: name, display: display, data_type: data_type, data_option: data_option } }
|
.map { |name, display, data_type, data_option| { name: name, display: display, data_type: data_type, data_option: data_option } }
|
||||||
|
@ -233,8 +233,8 @@ class TimeAccountingsController < ApplicationController
|
||||||
content = sheet("By Ticket #{year}-#{month}", header, result)
|
content = sheet("By Ticket #{year}-#{month}", header, result)
|
||||||
send_data(
|
send_data(
|
||||||
content,
|
content,
|
||||||
filename: "by_ticket-#{year}-#{month}.xls",
|
filename: "by_ticket-#{year}-#{month}.xls",
|
||||||
type: 'application/vnd.ms-excel',
|
type: 'application/vnd.ms-excel',
|
||||||
disposition: 'attachment'
|
disposition: 'attachment'
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
@ -256,7 +256,7 @@ class TimeAccountingsController < ApplicationController
|
||||||
if !time_unit[record[0]]
|
if !time_unit[record[0]]
|
||||||
time_unit[record[0]] = {
|
time_unit[record[0]] = {
|
||||||
time_unit: 0,
|
time_unit: 0,
|
||||||
agent_id: record[2],
|
agent_id: record[2],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
time_unit[record[0]][:time_unit] += record[1]
|
time_unit[record[0]][:time_unit] += record[1]
|
||||||
|
@ -273,9 +273,9 @@ class TimeAccountingsController < ApplicationController
|
||||||
organization = Organization.lookup(id: ticket.organization_id).attributes
|
organization = Organization.lookup(id: ticket.organization_id).attributes
|
||||||
end
|
end
|
||||||
customers[ticket.customer_id] = {
|
customers[ticket.customer_id] = {
|
||||||
customer: User.lookup(id: ticket.customer_id).attributes,
|
customer: User.lookup(id: ticket.customer_id).attributes,
|
||||||
organization: organization,
|
organization: organization,
|
||||||
time_unit: local_time_unit[:time_unit],
|
time_unit: local_time_unit[:time_unit],
|
||||||
}
|
}
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
@ -289,15 +289,15 @@ class TimeAccountingsController < ApplicationController
|
||||||
if params[:download]
|
if params[:download]
|
||||||
header = [
|
header = [
|
||||||
{
|
{
|
||||||
name: 'Customer',
|
name: 'Customer',
|
||||||
width: 30,
|
width: 30,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Organization',
|
name: 'Organization',
|
||||||
width: 30,
|
width: 30,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Time Units',
|
name: 'Time Units',
|
||||||
width: 10,
|
width: 10,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -314,8 +314,8 @@ class TimeAccountingsController < ApplicationController
|
||||||
content = sheet("By Customer #{year}-#{month}", header, result)
|
content = sheet("By Customer #{year}-#{month}", header, result)
|
||||||
send_data(
|
send_data(
|
||||||
content,
|
content,
|
||||||
filename: "by_customer-#{year}-#{month}.xls",
|
filename: "by_customer-#{year}-#{month}.xls",
|
||||||
type: 'application/vnd.ms-excel',
|
type: 'application/vnd.ms-excel',
|
||||||
disposition: 'attachment'
|
disposition: 'attachment'
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
@ -337,7 +337,7 @@ class TimeAccountingsController < ApplicationController
|
||||||
if !time_unit[record[0]]
|
if !time_unit[record[0]]
|
||||||
time_unit[record[0]] = {
|
time_unit[record[0]] = {
|
||||||
time_unit: 0,
|
time_unit: 0,
|
||||||
agent_id: record[2],
|
agent_id: record[2],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
time_unit[record[0]][:time_unit] += record[1]
|
time_unit[record[0]][:time_unit] += record[1]
|
||||||
|
@ -352,7 +352,7 @@ class TimeAccountingsController < ApplicationController
|
||||||
if !organizations[ticket.organization_id]
|
if !organizations[ticket.organization_id]
|
||||||
organizations[ticket.organization_id] = {
|
organizations[ticket.organization_id] = {
|
||||||
organization: Organization.lookup(id: ticket.organization_id).attributes,
|
organization: Organization.lookup(id: ticket.organization_id).attributes,
|
||||||
time_unit: local_time_unit[:time_unit],
|
time_unit: local_time_unit[:time_unit],
|
||||||
}
|
}
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
@ -366,11 +366,11 @@ class TimeAccountingsController < ApplicationController
|
||||||
if params[:download]
|
if params[:download]
|
||||||
header = [
|
header = [
|
||||||
{
|
{
|
||||||
name: 'Organization',
|
name: 'Organization',
|
||||||
width: 40,
|
width: 40,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Time Units',
|
name: 'Time Units',
|
||||||
width: 20,
|
width: 20,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -386,8 +386,8 @@ class TimeAccountingsController < ApplicationController
|
||||||
content = sheet("By Organization #{year}-#{month}", header, result)
|
content = sheet("By Organization #{year}-#{month}", header, result)
|
||||||
send_data(
|
send_data(
|
||||||
content,
|
content,
|
||||||
filename: "by_organization-#{year}-#{month}.xls",
|
filename: "by_organization-#{year}-#{month}.xls",
|
||||||
type: 'application/vnd.ms-excel',
|
type: 'application/vnd.ms-excel',
|
||||||
disposition: 'attachment'
|
disposition: 'attachment'
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
|
@ -61,7 +61,7 @@ curl http://localhost/api/v1/user_access_token -v -u #{login}:#{password}
|
||||||
end
|
end
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
tokens: token_list,
|
tokens: token_list,
|
||||||
permissions: permissions,
|
permissions: permissions,
|
||||||
}, status: :ok
|
}, status: :ok
|
||||||
end
|
end
|
||||||
|
|
|
@ -52,7 +52,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
render json: {
|
render json: {
|
||||||
record_ids: item_ids,
|
record_ids: item_ids,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}, status: :ok
|
}, status: :ok
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -211,10 +211,10 @@ class UsersController < ApplicationController
|
||||||
token = Token.create(action: 'PasswordReset', user_id: user.id)
|
token = Token.create(action: 'PasswordReset', user_id: user.id)
|
||||||
NotificationFactory::Mailer.notification(
|
NotificationFactory::Mailer.notification(
|
||||||
template: 'user_invite',
|
template: 'user_invite',
|
||||||
user: user,
|
user: user,
|
||||||
objects: {
|
objects: {
|
||||||
token: token,
|
token: token,
|
||||||
user: user,
|
user: user,
|
||||||
current_user: current_user,
|
current_user: current_user,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -225,8 +225,8 @@ class UsersController < ApplicationController
|
||||||
result = User.signup_new_token(user)
|
result = User.signup_new_token(user)
|
||||||
NotificationFactory::Mailer.notification(
|
NotificationFactory::Mailer.notification(
|
||||||
template: 'signup',
|
template: 'signup',
|
||||||
user: user,
|
user: user,
|
||||||
objects: result,
|
objects: result,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -389,10 +389,10 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# build result list
|
# build result list
|
||||||
tickets = Ticket.search(
|
tickets = Ticket.search(
|
||||||
query: query,
|
query: query,
|
||||||
condition: params[:condition].to_h,
|
condition: params[:condition].to_h,
|
||||||
limit: per_page,
|
limit: per_page,
|
||||||
offset: offset,
|
offset: offset,
|
||||||
current_user: current_user,
|
current_user: current_user,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -402,11 +402,11 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
query_params = {
|
query_params = {
|
||||||
query: query,
|
query: query,
|
||||||
limit: per_page,
|
limit: per_page,
|
||||||
offset: offset,
|
offset: offset,
|
||||||
sort_by: params[:sort_by],
|
sort_by: params[:sort_by],
|
||||||
order_by: params[:order_by],
|
order_by: params[:order_by],
|
||||||
current_user: current_user,
|
current_user: current_user,
|
||||||
}
|
}
|
||||||
%i[role_ids permissions].each do |key|
|
%i[role_ids permissions].each do |key|
|
||||||
|
@ -464,7 +464,7 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# return result
|
# return result
|
||||||
render json: {
|
render json: {
|
||||||
assets: assets,
|
assets: assets,
|
||||||
user_ids: user_ids.uniq,
|
user_ids: user_ids.uniq,
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -577,8 +577,8 @@ curl http://localhost/api/v1/users/email_verify_send -v -u #{login}:#{password}
|
||||||
user = result[:user]
|
user = result[:user]
|
||||||
NotificationFactory::Mailer.notification(
|
NotificationFactory::Mailer.notification(
|
||||||
template: 'signup',
|
template: 'signup',
|
||||||
user: user,
|
user: user,
|
||||||
objects: result
|
objects: result
|
||||||
)
|
)
|
||||||
|
|
||||||
# only if system is in develop mode, send token back to browser for browser tests
|
# only if system is in develop mode, send token back to browser for browser tests
|
||||||
|
@ -628,8 +628,8 @@ curl http://localhost/api/v1/users/password_reset -v -u #{login}:#{password} -H
|
||||||
user = result[:user]
|
user = result[:user]
|
||||||
NotificationFactory::Mailer.notification(
|
NotificationFactory::Mailer.notification(
|
||||||
template: 'password_reset',
|
template: 'password_reset',
|
||||||
user: user,
|
user: user,
|
||||||
objects: result
|
objects: result
|
||||||
)
|
)
|
||||||
|
|
||||||
# only if system is in develop mode, send token back to browser for browser tests
|
# only if system is in develop mode, send token back to browser for browser tests
|
||||||
|
@ -685,9 +685,9 @@ curl http://localhost/api/v1/users/password_reset_verify -v -u #{login}:#{passwo
|
||||||
if user
|
if user
|
||||||
NotificationFactory::Mailer.notification(
|
NotificationFactory::Mailer.notification(
|
||||||
template: 'password_change',
|
template: 'password_change',
|
||||||
user: user,
|
user: user,
|
||||||
objects: {
|
objects: {
|
||||||
user: user,
|
user: user,
|
||||||
current_user: current_user,
|
current_user: current_user,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -754,9 +754,9 @@ curl http://localhost/api/v1/users/password_change -v -u #{login}:#{password} -H
|
||||||
|
|
||||||
NotificationFactory::Mailer.notification(
|
NotificationFactory::Mailer.notification(
|
||||||
template: 'password_change',
|
template: 'password_change',
|
||||||
user: user,
|
user: user,
|
||||||
objects: {
|
objects: {
|
||||||
user: user,
|
user: user,
|
||||||
current_user: current_user,
|
current_user: current_user,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -873,9 +873,9 @@ curl http://localhost/api/v1/users/account -v -u #{login}:#{password} -H "Conten
|
||||||
|
|
||||||
# remove from database
|
# remove from database
|
||||||
record = Authorization.where(
|
record = Authorization.where(
|
||||||
user_id: current_user.id,
|
user_id: current_user.id,
|
||||||
provider: params[:provider],
|
provider: params[:provider],
|
||||||
uid: params[:uid],
|
uid: params[:uid],
|
||||||
)
|
)
|
||||||
raise Exceptions::UnprocessableEntity, 'No record found!' if !record.first
|
raise Exceptions::UnprocessableEntity, 'No record found!' if !record.first
|
||||||
|
|
||||||
|
@ -907,8 +907,8 @@ curl http://localhost/api/v1/users/image/8d6cca1c6bdc226cf2ba131e264ca2c7 -v -u
|
||||||
if file
|
if file
|
||||||
send_data(
|
send_data(
|
||||||
file.content,
|
file.content,
|
||||||
filename: file.filename,
|
filename: file.filename,
|
||||||
type: file.preferences['Content-Type'] || file.preferences['Mime-Type'],
|
type: file.preferences['Content-Type'] || file.preferences['Mime-Type'],
|
||||||
disposition: 'inline'
|
disposition: 'inline'
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
@ -918,8 +918,8 @@ curl http://localhost/api/v1/users/image/8d6cca1c6bdc226cf2ba131e264ca2c7 -v -u
|
||||||
image = 'R0lGODdhMAAwAOMAAMzMzJaWlr6+vqqqqqOjo8XFxbe3t7GxsZycnAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAMAAwAAAEcxDISau9OOvNu/9gKI5kaZ5oqq5s675wLM90bd94ru98TwuAA+KQAQqJK8EAgBAgMEqmkzUgBIeSwWGZtR5XhSqAULACCoGCJGwlm1MGQrq9RqgB8fm4ZTUgDBIEcRR9fz6HiImKi4yNjo+QkZKTlJWWkBEAOw=='
|
image = 'R0lGODdhMAAwAOMAAMzMzJaWlr6+vqqqqqOjo8XFxbe3t7GxsZycnAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAMAAwAAAEcxDISau9OOvNu/9gKI5kaZ5oqq5s675wLM90bd94ru98TwuAA+KQAQqJK8EAgBAgMEqmkzUgBIeSwWGZtR5XhSqAULACCoGCJGwlm1MGQrq9RqgB8fm4ZTUgDBIEcRR9fz6HiImKi4yNjo+QkZKTlJWWkBEAOw=='
|
||||||
send_data(
|
send_data(
|
||||||
Base64.decode64(image),
|
Base64.decode64(image),
|
||||||
filename: 'image.gif',
|
filename: 'image.gif',
|
||||||
type: 'image/gif',
|
type: 'image/gif',
|
||||||
disposition: 'inline'
|
disposition: 'inline'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -952,17 +952,17 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content
|
||||||
file_resize = StaticAssets.data_url_attributes(params[:avatar_resize])
|
file_resize = StaticAssets.data_url_attributes(params[:avatar_resize])
|
||||||
|
|
||||||
avatar = Avatar.add(
|
avatar = Avatar.add(
|
||||||
object: 'User',
|
object: 'User',
|
||||||
o_id: current_user.id,
|
o_id: current_user.id,
|
||||||
full: {
|
full: {
|
||||||
content: file_full[:content],
|
content: file_full[:content],
|
||||||
mime_type: file_full[:mime_type],
|
mime_type: file_full[:mime_type],
|
||||||
},
|
},
|
||||||
resize: {
|
resize: {
|
||||||
content: file_resize[:content],
|
content: file_resize[:content],
|
||||||
mime_type: file_resize[:mime_type],
|
mime_type: file_resize[:mime_type],
|
||||||
},
|
},
|
||||||
source: 'upload ' + Time.zone.now.to_s,
|
source: 'upload ' + Time.zone.now.to_s,
|
||||||
deletable: true,
|
deletable: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1026,8 +1026,8 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content
|
||||||
permission_check('admin.user')
|
permission_check('admin.user')
|
||||||
send_data(
|
send_data(
|
||||||
User.csv_example,
|
User.csv_example,
|
||||||
filename: 'user-example.csv',
|
filename: 'user-example.csv',
|
||||||
type: 'text/csv',
|
type: 'text/csv',
|
||||||
disposition: 'attachment'
|
disposition: 'attachment'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -1050,12 +1050,12 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content
|
||||||
raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank?
|
raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank?
|
||||||
|
|
||||||
result = User.csv_import(
|
result = User.csv_import(
|
||||||
string: string,
|
string: string,
|
||||||
parse_params: {
|
parse_params: {
|
||||||
col_sep: params[:col_sep] || ',',
|
col_sep: params[:col_sep] || ',',
|
||||||
},
|
},
|
||||||
try: params[:try],
|
try: params[:try],
|
||||||
delete: params[:delete],
|
delete: params[:delete],
|
||||||
)
|
)
|
||||||
render json: result, status: :ok
|
render json: result, status: :ok
|
||||||
end
|
end
|
||||||
|
|
|
@ -54,11 +54,11 @@ add a new activity entry for an object
|
||||||
|
|
||||||
# check newest entry - is needed
|
# check newest entry - is needed
|
||||||
result = ActivityStream.where(
|
result = ActivityStream.where(
|
||||||
o_id: data[:o_id],
|
o_id: data[:o_id],
|
||||||
#:activity_stream_type_id => type_id,
|
#:activity_stream_type_id => type_id,
|
||||||
permission_id: permission_id,
|
permission_id: permission_id,
|
||||||
activity_stream_object_id: object_id,
|
activity_stream_object_id: object_id,
|
||||||
created_by_id: data[:created_by_id]
|
created_by_id: data[:created_by_id]
|
||||||
).order('created_at DESC, id DESC').first
|
).order('created_at DESC, id DESC').first
|
||||||
|
|
||||||
# resturn if old entry is really fresh
|
# resturn if old entry is really fresh
|
||||||
|
@ -69,13 +69,13 @@ add a new activity entry for an object
|
||||||
|
|
||||||
# create history
|
# create history
|
||||||
record = {
|
record = {
|
||||||
o_id: data[:o_id],
|
o_id: data[:o_id],
|
||||||
activity_stream_type_id: type_id,
|
activity_stream_type_id: type_id,
|
||||||
activity_stream_object_id: object_id,
|
activity_stream_object_id: object_id,
|
||||||
permission_id: permission_id,
|
permission_id: permission_id,
|
||||||
group_id: data[:group_id],
|
group_id: data[:group_id],
|
||||||
created_at: data[:created_at],
|
created_at: data[:created_at],
|
||||||
created_by_id: data[:created_by_id]
|
created_by_id: data[:created_by_id]
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivityStream.create(record)
|
ActivityStream.create(record)
|
||||||
|
@ -93,7 +93,7 @@ remove whole activity entries of an object
|
||||||
object_id = ObjectLookup.by_name(object_name)
|
object_id = ObjectLookup.by_name(object_name)
|
||||||
ActivityStream.where(
|
ActivityStream.where(
|
||||||
activity_stream_object_id: object_id,
|
activity_stream_object_id: object_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
).destroy_all
|
).destroy_all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ return object and assets
|
||||||
object = find(id)
|
object = find(id)
|
||||||
assets = object.assets({})
|
assets = object.assets({})
|
||||||
{
|
{
|
||||||
id: object.id,
|
id: object.id,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -61,11 +61,11 @@ store attachments for this object
|
||||||
article_store = []
|
article_store = []
|
||||||
attachments_buffer.each do |attachment|
|
attachments_buffer.each do |attachment|
|
||||||
article_store.push Store.add(
|
article_store.push Store.add(
|
||||||
object: self.class.to_s,
|
object: self.class.to_s,
|
||||||
o_id: id,
|
o_id: id,
|
||||||
data: attachment.content,
|
data: attachment.content,
|
||||||
filename: attachment.filename,
|
filename: attachment.filename,
|
||||||
preferences: attachment.preferences,
|
preferences: attachment.preferences,
|
||||||
created_by_id: created_by_id,
|
created_by_id: created_by_id,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Authorization < ApplicationModel
|
||||||
|
|
||||||
# update auth tokens
|
# update auth tokens
|
||||||
auth.update!(
|
auth.update!(
|
||||||
token: hash['credentials']['token'],
|
token: hash['credentials']['token'],
|
||||||
secret: hash['credentials']['secret']
|
secret: hash['credentials']['secret']
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -40,11 +40,11 @@ class Authorization < ApplicationModel
|
||||||
# update image if needed
|
# update image if needed
|
||||||
if hash['info']['image'].present?
|
if hash['info']['image'].present?
|
||||||
avatar = Avatar.add(
|
avatar = Avatar.add(
|
||||||
object: 'User',
|
object: 'User',
|
||||||
o_id: user.id,
|
o_id: user.id,
|
||||||
url: hash['info']['image'],
|
url: hash['info']['image'],
|
||||||
source: hash['provider'],
|
source: hash['provider'],
|
||||||
deletable: true,
|
deletable: true,
|
||||||
updated_by_id: user.id,
|
updated_by_id: user.id,
|
||||||
created_by_id: user.id,
|
created_by_id: user.id,
|
||||||
)
|
)
|
||||||
|
@ -75,11 +75,11 @@ class Authorization < ApplicationModel
|
||||||
# save/update avatar
|
# save/update avatar
|
||||||
if hash['info'].present? && hash['info']['image'].present?
|
if hash['info'].present? && hash['info']['image'].present?
|
||||||
avatar = Avatar.add(
|
avatar = Avatar.add(
|
||||||
object: 'User',
|
object: 'User',
|
||||||
o_id: user.id,
|
o_id: user.id,
|
||||||
url: hash['info']['image'],
|
url: hash['info']['image'],
|
||||||
source: hash['provider'],
|
source: hash['provider'],
|
||||||
deletable: true,
|
deletable: true,
|
||||||
updated_by_id: user.id,
|
updated_by_id: user.id,
|
||||||
created_by_id: user.id,
|
created_by_id: user.id,
|
||||||
)
|
)
|
||||||
|
@ -92,12 +92,12 @@ class Authorization < ApplicationModel
|
||||||
end
|
end
|
||||||
|
|
||||||
Authorization.create!(
|
Authorization.create!(
|
||||||
user: user,
|
user: user,
|
||||||
uid: hash['uid'],
|
uid: hash['uid'],
|
||||||
username: hash['info']['nickname'] || hash['info']['username'] || hash['info']['name'] || hash['info']['email'] || hash['username'],
|
username: hash['info']['nickname'] || hash['info']['username'] || hash['info']['name'] || hash['info']['email'] || hash['username'],
|
||||||
provider: hash['provider'],
|
provider: hash['provider'],
|
||||||
token: hash['credentials']['token'],
|
token: hash['credentials']['token'],
|
||||||
secret: hash['credentials']['secret']
|
secret: hash['credentials']['secret']
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,11 @@ add an avatar based on auto detection (email address)
|
||||||
return if data[:url].blank?
|
return if data[:url].blank?
|
||||||
|
|
||||||
Avatar.add(
|
Avatar.add(
|
||||||
object: data[:object],
|
object: data[:object],
|
||||||
o_id: data[:o_id],
|
o_id: data[:o_id],
|
||||||
url: data[:url],
|
url: data[:url],
|
||||||
source: 'zammad.com',
|
source: 'zammad.com',
|
||||||
deletable: false,
|
deletable: false,
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
|
@ -82,15 +82,15 @@ add avatar by url
|
||||||
_add_init_avatar(object_id, data[:o_id])
|
_add_init_avatar(object_id, data[:o_id])
|
||||||
|
|
||||||
record = {
|
record = {
|
||||||
o_id: data[:o_id],
|
o_id: data[:o_id],
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
default: true,
|
default: true,
|
||||||
deletable: data[:deletable],
|
deletable: data[:deletable],
|
||||||
initial: false,
|
initial: false,
|
||||||
source: data[:source],
|
source: data[:source],
|
||||||
source_url: data[:url],
|
source_url: data[:url],
|
||||||
updated_by_id: data[:updated_by_id],
|
updated_by_id: data[:updated_by_id],
|
||||||
created_by_id: data[:created_by_id],
|
created_by_id: data[:created_by_id],
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if avatar with url already exists
|
# check if avatar with url already exists
|
||||||
|
@ -98,8 +98,8 @@ add avatar by url
|
||||||
if data[:source].present?
|
if data[:source].present?
|
||||||
avatar_already_exists = Avatar.find_by(
|
avatar_already_exists = Avatar.find_by(
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
o_id: data[:o_id],
|
o_id: data[:o_id],
|
||||||
source: data[:source],
|
source: data[:source],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -142,8 +142,8 @@ add avatar by url
|
||||||
url,
|
url,
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
open_timeout: 4,
|
open_timeout: 4,
|
||||||
read_timeout: 6,
|
read_timeout: 6,
|
||||||
total_timeout: 6,
|
total_timeout: 6,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -198,11 +198,11 @@ add avatar by url
|
||||||
object_name = "Avatar::#{data[:object]}"
|
object_name = "Avatar::#{data[:object]}"
|
||||||
if data[:full].present?
|
if data[:full].present?
|
||||||
store_full = Store.add(
|
store_full = Store.add(
|
||||||
object: "#{object_name}::Full",
|
object: "#{object_name}::Full",
|
||||||
o_id: data[:o_id],
|
o_id: data[:o_id],
|
||||||
data: data[:full][:content],
|
data: data[:full][:content],
|
||||||
filename: 'avatar_full',
|
filename: 'avatar_full',
|
||||||
preferences: {
|
preferences: {
|
||||||
'Mime-Type' => data[:full][:mime_type]
|
'Mime-Type' => data[:full][:mime_type]
|
||||||
},
|
},
|
||||||
created_by_id: data[:created_by_id],
|
created_by_id: data[:created_by_id],
|
||||||
|
@ -212,11 +212,11 @@ add avatar by url
|
||||||
end
|
end
|
||||||
if data[:resize].present?
|
if data[:resize].present?
|
||||||
store_resize = Store.add(
|
store_resize = Store.add(
|
||||||
object: "#{object_name}::Resize",
|
object: "#{object_name}::Resize",
|
||||||
o_id: data[:o_id],
|
o_id: data[:o_id],
|
||||||
data: data[:resize][:content],
|
data: data[:resize][:content],
|
||||||
filename: 'avatar',
|
filename: 'avatar',
|
||||||
preferences: {
|
preferences: {
|
||||||
'Mime-Type' => data[:resize][:mime_type]
|
'Mime-Type' => data[:resize][:mime_type]
|
||||||
},
|
},
|
||||||
created_by_id: data[:created_by_id],
|
created_by_id: data[:created_by_id],
|
||||||
|
@ -253,8 +253,8 @@ set avatars as default
|
||||||
object_id = ObjectLookup.by_name(object_name)
|
object_id = ObjectLookup.by_name(object_name)
|
||||||
avatar = Avatar.find_by(
|
avatar = Avatar.find_by(
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
id: avatar_id,
|
id: avatar_id,
|
||||||
)
|
)
|
||||||
avatar.default = true
|
avatar.default = true
|
||||||
avatar.save!
|
avatar.save!
|
||||||
|
@ -277,17 +277,17 @@ remove all avatars of an object
|
||||||
object_id = ObjectLookup.by_name(object_name)
|
object_id = ObjectLookup.by_name(object_name)
|
||||||
Avatar.where(
|
Avatar.where(
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
).destroy_all
|
).destroy_all
|
||||||
|
|
||||||
object_name_store = "Avatar::#{object_name}"
|
object_name_store = "Avatar::#{object_name}"
|
||||||
Store.remove(
|
Store.remove(
|
||||||
object: "#{object_name_store}::Full",
|
object: "#{object_name_store}::Full",
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
)
|
)
|
||||||
Store.remove(
|
Store.remove(
|
||||||
object: "#{object_name_store}::Resize",
|
object: "#{object_name_store}::Resize",
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -303,8 +303,8 @@ remove one avatars of an object
|
||||||
object_id = ObjectLookup.by_name(object_name)
|
object_id = ObjectLookup.by_name(object_name)
|
||||||
Avatar.where(
|
Avatar.where(
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
id: avatar_id,
|
id: avatar_id,
|
||||||
).destroy_all
|
).destroy_all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ return all avatars of an user
|
||||||
object_id = ObjectLookup.by_name(object_name)
|
object_id = ObjectLookup.by_name(object_name)
|
||||||
avatars = Avatar.where(
|
avatars = Avatar.where(
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
).order('initial DESC, deletable ASC, created_at ASC, id DESC')
|
).order('initial DESC, deletable ASC, created_at ASC, id DESC')
|
||||||
|
|
||||||
# add initial avatar
|
# add initial avatar
|
||||||
|
@ -379,15 +379,15 @@ returns:
|
||||||
object_id = ObjectLookup.by_name(object_name)
|
object_id = ObjectLookup.by_name(object_name)
|
||||||
Avatar.find_by(
|
Avatar.find_by(
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
default: true,
|
default: true,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.set_default_items(object_id, o_id, avatar_id)
|
def self.set_default_items(object_id, o_id, avatar_id)
|
||||||
avatars = Avatar.where(
|
avatars = Avatar.where(
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
).order('created_at ASC, id DESC')
|
).order('created_at ASC, id DESC')
|
||||||
avatars.each do |avatar|
|
avatars.each do |avatar|
|
||||||
next if avatar.id == avatar_id
|
next if avatar.id == avatar_id
|
||||||
|
@ -401,7 +401,7 @@ returns:
|
||||||
|
|
||||||
count = Avatar.where(
|
count = Avatar.where(
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
).count
|
).count
|
||||||
return if count.positive?
|
return if count.positive?
|
||||||
|
|
||||||
|
@ -409,14 +409,14 @@ returns:
|
||||||
return if !object_name.constantize.exists?(id: o_id)
|
return if !object_name.constantize.exists?(id: o_id)
|
||||||
|
|
||||||
Avatar.create!(
|
Avatar.create!(
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
default: true,
|
default: true,
|
||||||
source: 'init',
|
source: 'init',
|
||||||
initial: true,
|
initial: true,
|
||||||
deletable: false,
|
deletable: false,
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -187,9 +187,9 @@ returns
|
||||||
|
|
||||||
# create new entry
|
# create new entry
|
||||||
public_holidays[day] = {
|
public_holidays[day] = {
|
||||||
active: true,
|
active: true,
|
||||||
summary: summary,
|
summary: summary,
|
||||||
feed: Digest::MD5.hexdigest(ical_url)
|
feed: Digest::MD5.hexdigest(ical_url)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
self.last_log = nil
|
self.last_log = nil
|
||||||
|
|
|
@ -179,7 +179,7 @@ stream all accounts
|
||||||
next if @@channel_stream[channel_id].present?
|
next if @@channel_stream[channel_id].present?
|
||||||
|
|
||||||
@@channel_stream[channel_id] = {
|
@@channel_stream[channel_id] = {
|
||||||
options: channel.options,
|
options: channel.options,
|
||||||
started_at: Time.zone.now,
|
started_at: Time.zone.now,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ example
|
||||||
end
|
end
|
||||||
disconnect
|
disconnect
|
||||||
return {
|
return {
|
||||||
result: 'ok',
|
result: 'ok',
|
||||||
content_messages: content_messages,
|
content_messages: content_messages,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -253,9 +253,9 @@ example
|
||||||
end
|
end
|
||||||
Rails.logger.info 'done'
|
Rails.logger.info 'done'
|
||||||
{
|
{
|
||||||
result: 'ok',
|
result: 'ok',
|
||||||
fetched: count_fetched,
|
fetched: count_fetched,
|
||||||
notice: notice,
|
notice: notice,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ returns
|
||||||
end
|
end
|
||||||
disconnect
|
disconnect
|
||||||
return {
|
return {
|
||||||
result: 'ok',
|
result: 'ok',
|
||||||
content_messages: content_messages,
|
content_messages: content_messages,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -164,9 +164,9 @@ returns
|
||||||
end
|
end
|
||||||
Rails.logger.info 'done'
|
Rails.logger.info 'done'
|
||||||
{
|
{
|
||||||
result: 'ok',
|
result: 'ok',
|
||||||
fetched: count_fetched,
|
fetched: count_fetched,
|
||||||
notice: notice,
|
notice: notice,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ class Channel::Driver::Sms::Massenversand
|
||||||
|
|
||||||
def self.definition
|
def self.definition
|
||||||
{
|
{
|
||||||
name: 'Massenversand',
|
name: 'Massenversand',
|
||||||
adapter: 'sms/massenversand',
|
adapter: 'sms/massenversand',
|
||||||
notification: [
|
notification: [
|
||||||
{ name: 'options::gateway', display: 'Gateway', tag: 'input', type: 'text', limit: 200, null: false, placeholder: 'https://gate1.goyyamobile.com/sms/sendsms.asp', default: 'https://gate1.goyyamobile.com/sms/sendsms.asp' },
|
{ name: 'options::gateway', display: 'Gateway', tag: 'input', type: 'text', limit: 200, null: false, placeholder: 'https://gate1.goyyamobile.com/sms/sendsms.asp', default: 'https://gate1.goyyamobile.com/sms/sendsms.asp' },
|
||||||
{ name: 'options::token', display: 'Token', tag: 'input', type: 'text', limit: 200, null: false, placeholder: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' },
|
{ name: 'options::token', display: 'Token', tag: 'input', type: 'text', limit: 200, null: false, placeholder: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' },
|
||||||
|
@ -39,11 +39,11 @@ class Channel::Driver::Sms::Massenversand
|
||||||
def build_url(options, attr)
|
def build_url(options, attr)
|
||||||
params = {
|
params = {
|
||||||
authToken: options[:token],
|
authToken: options[:token],
|
||||||
getID: 1,
|
getID: 1,
|
||||||
msg: attr[:message],
|
msg: attr[:message],
|
||||||
msgtype: 'c',
|
msgtype: 'c',
|
||||||
receiver: attr[:recipient],
|
receiver: attr[:recipient],
|
||||||
sender: options[:sender]
|
sender: options[:sender]
|
||||||
}
|
}
|
||||||
|
|
||||||
options[:gateway] + '?' + URI.encode_www_form(params)
|
options[:gateway] + '?' + URI.encode_www_form(params)
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Channel::Driver::Sms::Twilio
|
||||||
if Setting.get('developer_mode') != true
|
if Setting.get('developer_mode') != true
|
||||||
result = api(options).messages.create(
|
result = api(options).messages.create(
|
||||||
from: options[:sender],
|
from: options[:sender],
|
||||||
to: attr[:recipient],
|
to: attr[:recipient],
|
||||||
body: attr[:message],
|
body: attr[:message],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class Channel::Driver::Sms::Twilio
|
||||||
if !user
|
if !user
|
||||||
user = User.create!(
|
user = User.create!(
|
||||||
firstname: attr[:From],
|
firstname: attr[:From],
|
||||||
mobile: attr[:From],
|
mobile: attr[:From],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -81,17 +81,17 @@ class Channel::Driver::Sms::Twilio
|
||||||
title = "#{title[0, 40]}..."
|
title = "#{title[0, 40]}..."
|
||||||
end
|
end
|
||||||
ticket = Ticket.new(
|
ticket = Ticket.new(
|
||||||
group_id: channel.group_id,
|
group_id: channel.group_id,
|
||||||
title: title,
|
title: title,
|
||||||
state_id: Ticket::State.find_by(default_create: true).id,
|
state_id: Ticket::State.find_by(default_create: true).id,
|
||||||
priority_id: Ticket::Priority.find_by(default_create: true).id,
|
priority_id: Ticket::Priority.find_by(default_create: true).id,
|
||||||
customer_id: user.id,
|
customer_id: user.id,
|
||||||
preferences: {
|
preferences: {
|
||||||
channel_id: channel.id,
|
channel_id: channel.id,
|
||||||
sms: {
|
sms: {
|
||||||
AccountSid: attr['AccountSid'],
|
AccountSid: attr['AccountSid'],
|
||||||
From: attr['From'],
|
From: attr['From'],
|
||||||
To: attr['To'],
|
To: attr['To'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -99,20 +99,20 @@ class Channel::Driver::Sms::Twilio
|
||||||
end
|
end
|
||||||
|
|
||||||
Ticket::Article.create!(
|
Ticket::Article.create!(
|
||||||
ticket_id: ticket.id,
|
ticket_id: ticket.id,
|
||||||
type: article_type_sms,
|
type: article_type_sms,
|
||||||
sender: Ticket::Article::Sender.find_by(name: 'Customer'),
|
sender: Ticket::Article::Sender.find_by(name: 'Customer'),
|
||||||
body: attr[:Body],
|
body: attr[:Body],
|
||||||
from: attr[:From],
|
from: attr[:From],
|
||||||
to: attr[:To],
|
to: attr[:To],
|
||||||
message_id: attr[:SmsMessageSid],
|
message_id: attr[:SmsMessageSid],
|
||||||
content_type: 'text/plain',
|
content_type: 'text/plain',
|
||||||
preferences: {
|
preferences: {
|
||||||
channel_id: channel.id,
|
channel_id: channel.id,
|
||||||
sms: {
|
sms: {
|
||||||
AccountSid: attr['AccountSid'],
|
AccountSid: attr['AccountSid'],
|
||||||
From: attr['From'],
|
From: attr['From'],
|
||||||
To: attr['To'],
|
To: attr['To'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -122,9 +122,9 @@ class Channel::Driver::Sms::Twilio
|
||||||
|
|
||||||
def self.definition
|
def self.definition
|
||||||
{
|
{
|
||||||
name: 'twilio',
|
name: 'twilio',
|
||||||
adapter: 'sms/twilio',
|
adapter: 'sms/twilio',
|
||||||
account: [
|
account: [
|
||||||
{ name: 'options::webhook_token', display: 'Webhook Token', tag: 'input', type: 'text', limit: 200, null: false, default: Digest::MD5.hexdigest(rand(999_999_999_999).to_s), disabled: true, readonly: true },
|
{ name: 'options::webhook_token', display: 'Webhook Token', tag: 'input', type: 'text', limit: 200, null: false, default: Digest::MD5.hexdigest(rand(999_999_999_999).to_s), disabled: true, readonly: true },
|
||||||
{ name: 'options::account_id', display: 'Account SID', tag: 'input', type: 'text', limit: 200, null: false, placeholder: 'XXXXXX' },
|
{ name: 'options::account_id', display: 'Account SID', tag: 'input', type: 'text', limit: 200, null: false, placeholder: 'XXXXXX' },
|
||||||
{ name: 'options::token', display: 'Token', tag: 'input', type: 'text', limit: 200, null: false },
|
{ name: 'options::token', display: 'Token', tag: 'input', type: 'text', limit: 200, null: false },
|
||||||
|
|
|
@ -63,10 +63,10 @@ class Channel::Driver::Smtp
|
||||||
|
|
||||||
mail = Channel::EmailBuild.build(attr, notification)
|
mail = Channel::EmailBuild.build(attr, notification)
|
||||||
smtp_params = {
|
smtp_params = {
|
||||||
openssl_verify_mode: options[:openssl_verify_mode],
|
openssl_verify_mode: options[:openssl_verify_mode],
|
||||||
address: options[:host],
|
address: options[:host],
|
||||||
port: options[:port],
|
port: options[:port],
|
||||||
domain: options[:domain],
|
domain: options[:domain],
|
||||||
enable_starttls_auto: options[:enable_starttls_auto],
|
enable_starttls_auto: options[:enable_starttls_auto],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,8 +114,8 @@ module Channel::EmailBuild
|
||||||
content_type = attachment.preferences['Content-Type'] || attachment.preferences['Mime-Type'] || 'application/octet-stream'
|
content_type = attachment.preferences['Content-Type'] || attachment.preferences['Mime-Type'] || 'application/octet-stream'
|
||||||
mail.attachments[attachment.filename] = {
|
mail.attachments[attachment.filename] = {
|
||||||
content_disposition: "#{disposition}; filename=\"#{encoded_filename}\"",
|
content_disposition: "#{disposition}; filename=\"#{encoded_filename}\"",
|
||||||
content_type: "#{content_type}; filename=\"#{encoded_filename}\"",
|
content_type: "#{content_type}; filename=\"#{encoded_filename}\"",
|
||||||
content: attachment.content
|
content: attachment.content
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
class Channel::EmailParser
|
class Channel::EmailParser
|
||||||
EMAIL_REGEX = /.+@.+/
|
EMAIL_REGEX = /.+@.+/.freeze
|
||||||
RECIPIENT_FIELDS = %w[to cc delivered-to x-original-to envelope-to].freeze
|
RECIPIENT_FIELDS = %w[to cc delivered-to x-original-to envelope-to].freeze
|
||||||
SENDER_FIELDS = %w[from reply-to return-path sender].freeze
|
SENDER_FIELDS = %w[from reply-to return-path sender].freeze
|
||||||
EXCESSIVE_LINKS_MSG = 'This message cannot be displayed because it contains over 5,000 links. Download the raw message below and open it via an Email client if you still wish to view it.'.freeze
|
EXCESSIVE_LINKS_MSG = 'This message cannot be displayed because it contains over 5,000 links. Download the raw message below and open it via an Email client if you still wish to view it.'.freeze
|
||||||
|
@ -234,8 +234,8 @@ returns
|
||||||
title = '-'
|
title = '-'
|
||||||
end
|
end
|
||||||
ticket = Ticket.new(
|
ticket = Ticket.new(
|
||||||
group_id: group.id,
|
group_id: group.id,
|
||||||
title: title,
|
title: title,
|
||||||
preferences: preferences,
|
preferences: preferences,
|
||||||
)
|
)
|
||||||
set_attributes_by_x_headers(ticket, 'ticket', mail)
|
set_attributes_by_x_headers(ticket, 'ticket', mail)
|
||||||
|
@ -255,18 +255,18 @@ returns
|
||||||
# set attributes
|
# set attributes
|
||||||
ticket.with_lock do
|
ticket.with_lock do
|
||||||
article = Ticket::Article.new(
|
article = Ticket::Article.new(
|
||||||
ticket_id: ticket.id,
|
ticket_id: ticket.id,
|
||||||
type_id: Ticket::Article::Type.find_by(name: 'email').id,
|
type_id: Ticket::Article::Type.find_by(name: 'email').id,
|
||||||
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
|
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
|
||||||
content_type: mail[:content_type],
|
content_type: mail[:content_type],
|
||||||
body: mail[:body],
|
body: mail[:body],
|
||||||
from: mail[:from],
|
from: mail[:from],
|
||||||
reply_to: mail[:"reply-to"],
|
reply_to: mail[:"reply-to"],
|
||||||
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
|
||||||
|
@ -285,10 +285,10 @@ returns
|
||||||
filename = filename.utf8_encode(fallback: :read_as_sanitized_binary)
|
filename = filename.utf8_encode(fallback: :read_as_sanitized_binary)
|
||||||
end
|
end
|
||||||
Store.add(
|
Store.add(
|
||||||
object: 'Ticket::Article',
|
object: 'Ticket::Article',
|
||||||
o_id: article.id,
|
o_id: article.id,
|
||||||
data: attachment[:data],
|
data: attachment[:data],
|
||||||
filename: filename,
|
filename: filename,
|
||||||
preferences: attachment[:preferences]
|
preferences: attachment[:preferences]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -699,13 +699,13 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
|
||||||
if filename.blank?
|
if filename.blank?
|
||||||
map = {
|
map = {
|
||||||
'message/delivery-status': ['txt', 'delivery-status'],
|
'message/delivery-status': ['txt', 'delivery-status'],
|
||||||
'text/plain': %w[txt document],
|
'text/plain': %w[txt document],
|
||||||
'text/html': %w[html document],
|
'text/html': %w[html document],
|
||||||
'video/quicktime': %w[mov video],
|
'video/quicktime': %w[mov video],
|
||||||
'image/jpeg': %w[jpg image],
|
'image/jpeg': %w[jpg image],
|
||||||
'image/jpg': %w[jpg image],
|
'image/jpg': %w[jpg image],
|
||||||
'image/png': %w[png image],
|
'image/png': %w[png image],
|
||||||
'image/gif': %w[gif image],
|
'image/gif': %w[gif image],
|
||||||
}
|
}
|
||||||
map.each do |type, ext|
|
map.each do |type, ext|
|
||||||
next if headers_store['Content-Type'] !~ /^#{Regexp.quote(type)}/i
|
next if headers_store['Content-Type'] !~ /^#{Regexp.quote(type)}/i
|
||||||
|
@ -766,8 +766,8 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
|
||||||
filename = Mail::Encodings.value_decode(filename)
|
filename = Mail::Encodings.value_decode(filename)
|
||||||
|
|
||||||
attach = {
|
attach = {
|
||||||
data: file.body.to_s,
|
data: file.body.to_s,
|
||||||
filename: filename,
|
filename: filename,
|
||||||
preferences: headers_store,
|
preferences: headers_store,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ module Channel::Filter::FollowUpMerged
|
||||||
return if ticket.state.name != 'merged'
|
return if ticket.state.name != 'merged'
|
||||||
|
|
||||||
links = Link.list(
|
links = Link.list(
|
||||||
link_object: 'Ticket',
|
link_object: 'Ticket',
|
||||||
link_object_value: ticket.id
|
link_object_value: ticket.id
|
||||||
)
|
)
|
||||||
return if links.blank?
|
return if links.blank?
|
||||||
|
|
|
@ -38,9 +38,9 @@ module Channel::Filter::IdentifySender
|
||||||
next if EmailAddress.find_by(email: item.address.downcase)
|
next if EmailAddress.find_by(email: item.address.downcase)
|
||||||
|
|
||||||
customer_user = user_create(
|
customer_user = user_create(
|
||||||
login: item.address,
|
login: item.address,
|
||||||
firstname: item.display_name,
|
firstname: item.display_name,
|
||||||
email: item.address,
|
email: item.address,
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -54,10 +54,10 @@ module Channel::Filter::IdentifySender
|
||||||
# take regular from as customer
|
# take regular from as customer
|
||||||
if !customer_user
|
if !customer_user
|
||||||
customer_user = user_create(
|
customer_user = user_create(
|
||||||
login: mail[ 'x-zammad-customer-login'.to_sym ] || mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email],
|
login: mail[ 'x-zammad-customer-login'.to_sym ] || mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email],
|
||||||
firstname: mail[ 'x-zammad-customer-firstname'.to_sym ] || mail[:from_display_name],
|
firstname: mail[ 'x-zammad-customer-firstname'.to_sym ] || mail[:from_display_name],
|
||||||
lastname: mail[ 'x-zammad-customer-lastname'.to_sym ],
|
lastname: mail[ 'x-zammad-customer-lastname'.to_sym ],
|
||||||
email: mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email],
|
email: mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -77,10 +77,10 @@ module Channel::Filter::IdentifySender
|
||||||
end
|
end
|
||||||
if !session_user
|
if !session_user
|
||||||
session_user = user_create(
|
session_user = user_create(
|
||||||
login: mail[:from_email],
|
login: mail[:from_email],
|
||||||
firstname: mail[:from_display_name],
|
firstname: mail[:from_display_name],
|
||||||
lastname: '',
|
lastname: '',
|
||||||
email: mail[:from_email],
|
email: mail[:from_email],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
if session_user
|
if session_user
|
||||||
|
@ -109,8 +109,8 @@ module Channel::Filter::IdentifySender
|
||||||
|
|
||||||
user_create(
|
user_create(
|
||||||
firstname: address_data.display_name,
|
firstname: address_data.display_name,
|
||||||
lastname: '',
|
lastname: '',
|
||||||
email: email_address,
|
email: email_address,
|
||||||
)
|
)
|
||||||
current_count += 1
|
current_count += 1
|
||||||
return false if current_count == max_count
|
return false if current_count == max_count
|
||||||
|
@ -137,8 +137,8 @@ module Channel::Filter::IdentifySender
|
||||||
|
|
||||||
user_create(
|
user_create(
|
||||||
firstname: display_name,
|
firstname: display_name,
|
||||||
lastname: '',
|
lastname: '',
|
||||||
email: address,
|
email: address,
|
||||||
)
|
)
|
||||||
current_count += 1
|
current_count += 1
|
||||||
return false if current_count == max_count
|
return false if current_count == max_count
|
||||||
|
@ -161,18 +161,18 @@ module Channel::Filter::IdentifySender
|
||||||
|
|
||||||
def self.populate_attributes!(attrs, **extras)
|
def self.populate_attributes!(attrs, **extras)
|
||||||
if attrs[:email].match?(/\S\s+\S/) || attrs[:email].match?(/^<|>$/)
|
if attrs[:email].match?(/\S\s+\S/) || attrs[:email].match?(/^<|>$/)
|
||||||
attrs[:preferences] = { mail_delivery_failed: true,
|
attrs[:preferences] = { mail_delivery_failed: true,
|
||||||
mail_delivery_failed_reason: 'invalid email',
|
mail_delivery_failed_reason: 'invalid email',
|
||||||
mail_delivery_failed_data: Time.zone.now }
|
mail_delivery_failed_data: Time.zone.now }
|
||||||
end
|
end
|
||||||
|
|
||||||
attrs.merge!(
|
attrs.merge!(
|
||||||
email: sanitize_email(attrs[:email]),
|
email: sanitize_email(attrs[:email]),
|
||||||
firstname: sanitize_name(attrs[:firstname]),
|
firstname: sanitize_name(attrs[:firstname]),
|
||||||
lastname: sanitize_name(attrs[:lastname]),
|
lastname: sanitize_name(attrs[:lastname]),
|
||||||
password: '',
|
password: '',
|
||||||
active: true,
|
active: true,
|
||||||
role_ids: extras[:role_ids] || Role.signup_role_ids,
|
role_ids: extras[:role_ids] || Role.signup_role_ids,
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1
|
created_by_id: 1
|
||||||
)
|
)
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Chat < ApplicationModel
|
||||||
url = "#{Setting.get('http_type')}://#{Setting.get('fqdn')}/api/v1/users/image/#{chat_user.image}"
|
url = "#{Setting.get('http_type')}://#{Setting.get('fqdn')}/api/v1/users/image/#{chat_user.image}"
|
||||||
end
|
end
|
||||||
user = {
|
user = {
|
||||||
name: chat_user.fullname,
|
name: chat_user.fullname,
|
||||||
avatar: url,
|
avatar: url,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,15 +29,15 @@ class Chat < ApplicationModel
|
||||||
session = Chat::Session.messages_by_session_id(session_id)
|
session = Chat::Session.messages_by_session_id(session_id)
|
||||||
if session
|
if session
|
||||||
return {
|
return {
|
||||||
state: 'reconnect',
|
state: 'reconnect',
|
||||||
session: session,
|
session: session,
|
||||||
agent: user,
|
agent: user,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif chat_session.state == 'waiting'
|
elsif chat_session.state == 'waiting'
|
||||||
return {
|
return {
|
||||||
state: 'reconnect',
|
state: 'reconnect',
|
||||||
position: chat_session.position,
|
position: chat_session.position,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -84,16 +84,16 @@ class Chat < ApplicationModel
|
||||||
assets = user.assets(assets)
|
assets = user.assets(assets)
|
||||||
end
|
end
|
||||||
{
|
{
|
||||||
waiting_chat_count: waiting_chat_count,
|
waiting_chat_count: waiting_chat_count,
|
||||||
waiting_chat_session_list: waiting_chat_session_list,
|
waiting_chat_session_list: waiting_chat_session_list,
|
||||||
running_chat_count: running_chat_count,
|
running_chat_count: running_chat_count,
|
||||||
running_chat_session_list: runningchat_session_list_local,
|
running_chat_session_list: runningchat_session_list_local,
|
||||||
active_agent_count: active_agent_count,
|
active_agent_count: active_agent_count,
|
||||||
active_agent_ids: active_agent_ids,
|
active_agent_ids: active_agent_ids,
|
||||||
seads_available: seads_available,
|
seads_available: seads_available,
|
||||||
seads_total: seads_total,
|
seads_total: seads_total,
|
||||||
active: Chat::Agent.state(user_id),
|
active: Chat::Agent.state(user_id),
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ optional you can ignore it for dedecated user
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
event: 'chat_status_agent',
|
event: 'chat_status_agent',
|
||||||
data: Chat.agent_state(item.updated_by_id),
|
data: Chat.agent_state(item.updated_by_id),
|
||||||
}
|
}
|
||||||
Sessions.send_to(item.updated_by_id, data)
|
Sessions.send_to(item.updated_by_id, data)
|
||||||
end
|
end
|
||||||
|
@ -210,9 +210,9 @@ broadcast new customer queue position to all waiting customers
|
||||||
position += 1
|
position += 1
|
||||||
data = {
|
data = {
|
||||||
event: 'chat_session_queue',
|
event: 'chat_session_queue',
|
||||||
data: {
|
data: {
|
||||||
state: 'queue',
|
state: 'queue',
|
||||||
position: position,
|
position: position,
|
||||||
session_id: local_chat_session.session_id,
|
session_id: local_chat_session.session_id,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -261,9 +261,9 @@ optional you can put the max oldest chat sessions as argument
|
||||||
chat_session.save
|
chat_session.save
|
||||||
message = {
|
message = {
|
||||||
event: 'chat_session_closed',
|
event: 'chat_session_closed',
|
||||||
data: {
|
data: {
|
||||||
session_id: chat_session.session_id,
|
session_id: chat_session.session_id,
|
||||||
realname: 'System',
|
realname: 'System',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
chat_session.send_to_recipients(message)
|
chat_session.send_to_recipients(message)
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Chat::Agent < ApplicationModel
|
||||||
chat_agent.save
|
chat_agent.save
|
||||||
else
|
else
|
||||||
Chat::Agent.create(
|
Chat::Agent.create(
|
||||||
active: state,
|
active: state,
|
||||||
updated_by_id: user_id,
|
updated_by_id: user_id,
|
||||||
created_by_id: user_id,
|
created_by_id: user_id,
|
||||||
)
|
)
|
||||||
|
|
|
@ -29,7 +29,7 @@ returns if user has no permissions to search
|
||||||
return false if Setting.get('chat') != true || !current_user.permissions?('chat.agent')
|
return false if Setting.get('chat') != true || !current_user.permissions?('chat.agent')
|
||||||
|
|
||||||
{
|
{
|
||||||
prio: 900,
|
prio: 900,
|
||||||
direct_search_index: true,
|
direct_search_index: true,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -62,7 +62,7 @@ returns
|
||||||
errors.push "Delete is not possible for #{new.class}."
|
errors.push "Delete is not possible for #{new.class}."
|
||||||
result = {
|
result = {
|
||||||
errors: errors,
|
errors: errors,
|
||||||
try: try,
|
try: try,
|
||||||
result: 'failed',
|
result: 'failed',
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
@ -82,7 +82,7 @@ returns
|
||||||
errors.push "Unable to parse empty file/string for #{new.class}."
|
errors.push "Unable to parse empty file/string for #{new.class}."
|
||||||
result = {
|
result = {
|
||||||
errors: errors,
|
errors: errors,
|
||||||
try: try,
|
try: try,
|
||||||
result: 'failed',
|
result: 'failed',
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
@ -94,7 +94,7 @@ returns
|
||||||
errors.push "Unable to parse file/string without header for #{new.class}."
|
errors.push "Unable to parse file/string without header for #{new.class}."
|
||||||
result = {
|
result = {
|
||||||
errors: errors,
|
errors: errors,
|
||||||
try: try,
|
try: try,
|
||||||
result: 'failed',
|
result: 'failed',
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
@ -112,7 +112,7 @@ returns
|
||||||
errors.push "No records found in file/string for #{new.class}."
|
errors.push "No records found in file/string for #{new.class}."
|
||||||
result = {
|
result = {
|
||||||
errors: errors,
|
errors: errors,
|
||||||
try: try,
|
try: try,
|
||||||
result: 'failed',
|
result: 'failed',
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
@ -123,7 +123,7 @@ returns
|
||||||
errors.push "No lookup column like #{lookup_keys.map(&:to_s).join(',')} for #{new.class} found."
|
errors.push "No lookup column like #{lookup_keys.map(&:to_s).join(',')} for #{new.class} found."
|
||||||
result = {
|
result = {
|
||||||
errors: errors,
|
errors: errors,
|
||||||
try: try,
|
try: try,
|
||||||
result: 'failed',
|
result: 'failed',
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
@ -274,11 +274,11 @@ returns
|
||||||
end
|
end
|
||||||
|
|
||||||
{
|
{
|
||||||
stats: stats,
|
stats: stats,
|
||||||
records: records,
|
records: records,
|
||||||
errors: errors,
|
errors: errors,
|
||||||
try: try,
|
try: try,
|
||||||
result: result,
|
result: result,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,9 @@ class OwnModel < ApplicationModel
|
||||||
PushMessages.send(
|
PushMessages.send(
|
||||||
message: {
|
message: {
|
||||||
event: class_name + ':create',
|
event: class_name + ':create',
|
||||||
data: { id: id, updated_at: updated_at }
|
data: { id: id, updated_at: updated_at }
|
||||||
},
|
},
|
||||||
type: 'authenticated',
|
type: 'authenticated',
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,9 +69,9 @@ class OwnModel < ApplicationModel
|
||||||
PushMessages.send(
|
PushMessages.send(
|
||||||
message: {
|
message: {
|
||||||
event: class_name + ':update',
|
event: class_name + ':update',
|
||||||
data: { id: id, updated_at: updated_at }
|
data: { id: id, updated_at: updated_at }
|
||||||
},
|
},
|
||||||
type: 'authenticated',
|
type: 'authenticated',
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -102,9 +102,9 @@ class OwnModel < ApplicationModel
|
||||||
PushMessages.send(
|
PushMessages.send(
|
||||||
message: {
|
message: {
|
||||||
event: class_name + ':touch',
|
event: class_name + ':touch',
|
||||||
data: { id: id, updated_at: updated_at }
|
data: { id: id, updated_at: updated_at }
|
||||||
},
|
},
|
||||||
type: 'authenticated',
|
type: 'authenticated',
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -134,9 +134,9 @@ class OwnModel < ApplicationModel
|
||||||
PushMessages.send(
|
PushMessages.send(
|
||||||
message: {
|
message: {
|
||||||
event: class_name + ':destroy',
|
event: class_name + ':destroy',
|
||||||
data: { id: id, updated_at: updated_at }
|
data: { id: id, updated_at: updated_at }
|
||||||
},
|
},
|
||||||
type: 'authenticated',
|
type: 'authenticated',
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,7 +23,7 @@ module ChecksConditionValidation
|
||||||
|
|
||||||
validate_condition['ticket.id'] = {
|
validate_condition['ticket.id'] = {
|
||||||
operator: 'is',
|
operator: 'is',
|
||||||
value: 1,
|
value: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
ticket_count, tickets = Ticket.selectors(validate_condition, 1, User.find(1))
|
ticket_count, tickets = Ticket.selectors(validate_condition, 1, User.find(1))
|
||||||
|
|
|
@ -75,8 +75,8 @@ module HasGroups
|
||||||
return true if group_through.klass.includes(:group).exists?(
|
return true if group_through.klass.includes(:group).exists?(
|
||||||
group_through.foreign_key => id,
|
group_through.foreign_key => id,
|
||||||
group_id: group_id,
|
group_id: group_id,
|
||||||
access: access,
|
access: access,
|
||||||
groups: {
|
groups: {
|
||||||
active: true
|
active: true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -95,10 +95,10 @@ log object update history with all updated attributes, if configured - will be e
|
||||||
end
|
end
|
||||||
data = {
|
data = {
|
||||||
history_attribute: attribute_name,
|
history_attribute: attribute_name,
|
||||||
value_from: value_str[0].to_s,
|
value_from: value_str[0].to_s,
|
||||||
value_to: value_str[1].to_s,
|
value_to: value_str[1].to_s,
|
||||||
id_from: value_id[0],
|
id_from: value_id[0],
|
||||||
id_to: value_id[1],
|
id_to: value_id[1],
|
||||||
}
|
}
|
||||||
#logger.info "HIST NEW #{self.class.to_s}.find(#{self.id}) #{data.inspect}"
|
#logger.info "HIST NEW #{self.class.to_s}.find(#{self.id}) #{data.inspect}"
|
||||||
history_log('updated', updated_by_id, data)
|
history_log('updated', updated_by_id, data)
|
||||||
|
@ -222,7 +222,7 @@ returns
|
||||||
end
|
end
|
||||||
{
|
{
|
||||||
history: history[:list],
|
history: history[:list],
|
||||||
assets: history[:assets],
|
assets: history[:assets],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ delete object link list, will be executed automatically
|
||||||
|
|
||||||
def links_destroy
|
def links_destroy
|
||||||
Link.remove_all(
|
Link.remove_all(
|
||||||
link_object: self.class.to_s,
|
link_object: self.class.to_s,
|
||||||
link_object_value: id,
|
link_object_value: id,
|
||||||
)
|
)
|
||||||
true
|
true
|
||||||
|
|
|
@ -30,7 +30,7 @@ module HasRoles
|
||||||
groups: {
|
groups: {
|
||||||
active: true
|
active: true
|
||||||
},
|
},
|
||||||
roles: {
|
roles: {
|
||||||
active: true
|
active: true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,9 +17,9 @@ add an tag to model
|
||||||
|
|
||||||
def tag_add(name, current_user_id = nil)
|
def tag_add(name, current_user_id = nil)
|
||||||
Tag.tag_add(
|
Tag.tag_add(
|
||||||
object: self.class.to_s,
|
object: self.class.to_s,
|
||||||
o_id: id,
|
o_id: id,
|
||||||
item: name,
|
item: name,
|
||||||
created_by_id: current_user_id,
|
created_by_id: current_user_id,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -35,9 +35,9 @@ remove an tag of model
|
||||||
|
|
||||||
def tag_remove(name, current_user_id = nil)
|
def tag_remove(name, current_user_id = nil)
|
||||||
Tag.tag_remove(
|
Tag.tag_remove(
|
||||||
object: self.class.to_s,
|
object: self.class.to_s,
|
||||||
o_id: id,
|
o_id: id,
|
||||||
item: name,
|
item: name,
|
||||||
created_by_id: current_user_id,
|
created_by_id: current_user_id,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -54,7 +54,7 @@ tag list of model
|
||||||
def tag_list
|
def tag_list
|
||||||
Tag.tag_list(
|
Tag.tag_list(
|
||||||
object: self.class.to_s,
|
object: self.class.to_s,
|
||||||
o_id: id,
|
o_id: id,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ destroy all tags of an object
|
||||||
|
|
||||||
def tag_destroy(current_user_id = nil)
|
def tag_destroy(current_user_id = nil)
|
||||||
Tag.tag_destroy(
|
Tag.tag_destroy(
|
||||||
object: self.class.to_s,
|
object: self.class.to_s,
|
||||||
o_id: id,
|
o_id: id,
|
||||||
created_by_id: current_user_id,
|
created_by_id: current_user_id,
|
||||||
)
|
)
|
||||||
true
|
true
|
||||||
|
|
|
@ -131,11 +131,11 @@ returns
|
||||||
existing_record_ids = Cti::CallerId.where(object: model.to_s, o_id: record.id).pluck(:id)
|
existing_record_ids = Cti::CallerId.where(object: model.to_s, o_id: record.id).pluck(:id)
|
||||||
caller_ids.uniq.each do |caller_id|
|
caller_ids.uniq.each do |caller_id|
|
||||||
existing_record_id = Cti::CallerId.where(
|
existing_record_id = Cti::CallerId.where(
|
||||||
object: model.to_s,
|
object: model.to_s,
|
||||||
o_id: record.id,
|
o_id: record.id,
|
||||||
caller_id: caller_id,
|
caller_id: caller_id,
|
||||||
level: level,
|
level: level,
|
||||||
user_id: user_id,
|
user_id: user_id,
|
||||||
).pluck(:id)
|
).pluck(:id)
|
||||||
if existing_record_id[0]
|
if existing_record_id[0]
|
||||||
existing_record_ids.delete(existing_record_id[0])
|
existing_record_ids.delete(existing_record_id[0])
|
||||||
|
@ -153,10 +153,10 @@ returns
|
||||||
caller_ids_to_add.each do |caller_id|
|
caller_ids_to_add.each do |caller_id|
|
||||||
Cti::CallerId.maybe_add(
|
Cti::CallerId.maybe_add(
|
||||||
caller_id: caller_id,
|
caller_id: caller_id,
|
||||||
level: level,
|
level: level,
|
||||||
object: model.to_s,
|
object: model.to_s,
|
||||||
o_id: record.id,
|
o_id: record.id,
|
||||||
user_id: user_id,
|
user_id: user_id,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
true
|
true
|
||||||
|
|
|
@ -292,7 +292,7 @@ returns
|
||||||
.each.with_object({}) { |user, a| user.assets(a) }
|
.each.with_object({}) { |user, a| user.assets(a) }
|
||||||
|
|
||||||
{
|
{
|
||||||
list: list,
|
list: list,
|
||||||
assets: assets,
|
assets: assets,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -364,18 +364,18 @@ Cti::Log.process(
|
||||||
raise "call_id #{call_id} already exists!" if log
|
raise "call_id #{call_id} already exists!" if log
|
||||||
|
|
||||||
create(
|
create(
|
||||||
direction: params['direction'],
|
direction: params['direction'],
|
||||||
from: params['from'],
|
from: params['from'],
|
||||||
from_comment: from_comment,
|
from_comment: from_comment,
|
||||||
to: params['to'],
|
to: params['to'],
|
||||||
to_comment: to_comment,
|
to_comment: to_comment,
|
||||||
call_id: call_id,
|
call_id: call_id,
|
||||||
comment: cause,
|
comment: cause,
|
||||||
queue: queue,
|
queue: queue,
|
||||||
state: event,
|
state: event,
|
||||||
initialized_at: Time.zone.now,
|
initialized_at: Time.zone.now,
|
||||||
preferences: preferences,
|
preferences: preferences,
|
||||||
done: done,
|
done: done,
|
||||||
)
|
)
|
||||||
when 'answer'
|
when 'answer'
|
||||||
raise "No such call_id #{call_id}" if !log
|
raise "No such call_id #{call_id}" if !log
|
||||||
|
@ -431,7 +431,7 @@ Cti::Log.process(
|
||||||
user.id,
|
user.id,
|
||||||
{
|
{
|
||||||
event: 'cti_event',
|
event: 'cti_event',
|
||||||
data: self,
|
data: self,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -483,7 +483,7 @@ optional you can put the max oldest chat entries as argument
|
||||||
def attributes
|
def attributes
|
||||||
virtual_attributes = {
|
virtual_attributes = {
|
||||||
'from_pretty' => from_pretty,
|
'from_pretty' => from_pretty,
|
||||||
'to_pretty' => to_pretty,
|
'to_pretty' => to_pretty,
|
||||||
}
|
}
|
||||||
|
|
||||||
super.merge(virtual_attributes)
|
super.merge(virtual_attributes)
|
||||||
|
|
|
@ -59,19 +59,19 @@ add a new history entry for an object
|
||||||
|
|
||||||
# create history
|
# create history
|
||||||
record = {
|
record = {
|
||||||
id: data[:id],
|
id: data[:id],
|
||||||
o_id: data[:o_id],
|
o_id: data[:o_id],
|
||||||
history_type_id: history_type.id,
|
history_type_id: history_type.id,
|
||||||
history_object_id: history_object.id,
|
history_object_id: history_object.id,
|
||||||
history_attribute_id: history_attribute_id,
|
history_attribute_id: history_attribute_id,
|
||||||
related_history_object_id: related_history_object_id,
|
related_history_object_id: related_history_object_id,
|
||||||
related_o_id: data[:related_o_id],
|
related_o_id: data[:related_o_id],
|
||||||
value_from: data[:value_from],
|
value_from: data[:value_from],
|
||||||
value_to: data[:value_to],
|
value_to: data[:value_to],
|
||||||
id_from: data[:id_from],
|
id_from: data[:id_from],
|
||||||
id_to: data[:id_to],
|
id_to: data[:id_to],
|
||||||
created_at: data[:created_at],
|
created_at: data[:created_at],
|
||||||
created_by_id: data[:created_by_id]
|
created_by_id: data[:created_by_id]
|
||||||
}
|
}
|
||||||
history_record = nil
|
history_record = nil
|
||||||
if data[:id]
|
if data[:id]
|
||||||
|
@ -102,7 +102,7 @@ remove whole history entries of an object
|
||||||
|
|
||||||
History.where(
|
History.where(
|
||||||
history_object_id: history_object.id,
|
history_object_id: history_object.id,
|
||||||
o_id: requested_object_id,
|
o_id: requested_object_id,
|
||||||
).destroy_all
|
).destroy_all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ returns
|
||||||
end
|
end
|
||||||
if assets
|
if assets
|
||||||
return {
|
return {
|
||||||
list: list,
|
list: list,
|
||||||
assets: asset_list,
|
assets: asset_list,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,10 +23,10 @@ add karma activity log of an object
|
||||||
Karma::ActivityLog.transaction do
|
Karma::ActivityLog.transaction do
|
||||||
last_activity = Karma::ActivityLog.where(user_id: user.id).order(created_at: :desc, id: :desc).lock(true).first
|
last_activity = Karma::ActivityLog.where(user_id: user.id).order(created_at: :desc, id: :desc).lock(true).first
|
||||||
latest_activity = Karma::ActivityLog.where(
|
latest_activity = Karma::ActivityLog.where(
|
||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
activity_id: activity.id,
|
activity_id: activity.id,
|
||||||
).find_by('created_at >= ?', Time.zone.now - activity.once_ttl.seconds)
|
).find_by('created_at >= ?', Time.zone.now - activity.once_ttl.seconds)
|
||||||
return false if !force && latest_activity
|
return false if !force && latest_activity
|
||||||
|
|
||||||
|
@ -42,11 +42,11 @@ add karma activity log of an object
|
||||||
|
|
||||||
Karma::ActivityLog.create(
|
Karma::ActivityLog.create(
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
activity_id: activity.id,
|
activity_id: activity.id,
|
||||||
score: activity.score,
|
score: activity.score,
|
||||||
score_total: local_score_total,
|
score_total: local_score_total,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ remove whole karma activity log of an object
|
||||||
object_id = ObjectLookup.by_name(object_name)
|
object_id = ObjectLookup.by_name(object_name)
|
||||||
Karma::ActivityLog.where(
|
Karma::ActivityLog.where(
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
).destroy_all
|
).destroy_all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -80,22 +80,22 @@ remove whole karma activity log of an object
|
||||||
if last && last[:object_id] == log.object_id && last[:o_id] == log.o_id && last[:created_at] == log.created_at
|
if last && last[:object_id] == log.object_id && last[:o_id] == log.o_id && last[:created_at] == log.created_at
|
||||||
comment = {
|
comment = {
|
||||||
description: Karma::Activity.lookup(id: log.activity_id).description,
|
description: Karma::Activity.lookup(id: log.activity_id).description,
|
||||||
score: log.score,
|
score: log.score,
|
||||||
}
|
}
|
||||||
last[:comments].push comment
|
last[:comments].push comment
|
||||||
last[:score_total] = score_total
|
last[:score_total] = score_total
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
comment = {
|
comment = {
|
||||||
object_id: log.object_id,
|
object_id: log.object_id,
|
||||||
o_id: log.o_id,
|
o_id: log.o_id,
|
||||||
description: Karma::Activity.lookup(id: log.activity_id).description,
|
description: Karma::Activity.lookup(id: log.activity_id).description,
|
||||||
score: log.score,
|
score: log.score,
|
||||||
}
|
}
|
||||||
data = {
|
data = {
|
||||||
comments: [comment],
|
comments: [comment],
|
||||||
score_total: log.score_total,
|
score_total: log.score_total,
|
||||||
created_at: log.created_at,
|
created_at: log.created_at,
|
||||||
}
|
}
|
||||||
result.push data
|
result.push data
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,8 +17,8 @@ class Karma::User < ApplicationModel
|
||||||
end
|
end
|
||||||
Karma::User.create!(
|
Karma::User.create!(
|
||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
level: level,
|
level: level,
|
||||||
score: score,
|
score: score,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ class Link < ApplicationModel
|
||||||
data[:link_object_source_id] = linkobject.id
|
data[:link_object_source_id] = linkobject.id
|
||||||
touch_reference_by_params(
|
touch_reference_by_params(
|
||||||
object: data[:link_object_source],
|
object: data[:link_object_source],
|
||||||
o_id: data[:link_object_source_value],
|
o_id: data[:link_object_source_value],
|
||||||
)
|
)
|
||||||
data.delete(:link_object_source)
|
data.delete(:link_object_source)
|
||||||
end
|
end
|
||||||
|
@ -99,7 +99,7 @@ class Link < ApplicationModel
|
||||||
data[:link_object_target_id] = linkobject.id
|
data[:link_object_target_id] = linkobject.id
|
||||||
touch_reference_by_params(
|
touch_reference_by_params(
|
||||||
object: data[:link_object_target],
|
object: data[:link_object_target],
|
||||||
o_id: data[:link_object_target_value],
|
o_id: data[:link_object_target_value],
|
||||||
)
|
)
|
||||||
data.delete(:link_object_target)
|
data.delete(:link_object_target)
|
||||||
end
|
end
|
||||||
|
@ -136,10 +136,10 @@ class Link < ApplicationModel
|
||||||
data[:link_type_id] = linktype.id
|
data[:link_type_id] = linktype.id
|
||||||
end
|
end
|
||||||
Link.where(
|
Link.where(
|
||||||
link_type_id: data[:link_type_id],
|
link_type_id: data[:link_type_id],
|
||||||
link_object_source_id: data[:link_object_source_id],
|
link_object_source_id: data[:link_object_source_id],
|
||||||
link_object_source_value: data[:link_object_source_value],
|
link_object_source_value: data[:link_object_source_value],
|
||||||
link_object_target_id: data[:link_object_target_id],
|
link_object_target_id: data[:link_object_target_id],
|
||||||
link_object_target_value: data[:link_object_target_value]
|
link_object_target_value: data[:link_object_target_value]
|
||||||
).destroy_all
|
).destroy_all
|
||||||
|
|
||||||
|
@ -150,10 +150,10 @@ class Link < ApplicationModel
|
||||||
end
|
end
|
||||||
|
|
||||||
Link.where(
|
Link.where(
|
||||||
link_type_id: data[:link_type_id],
|
link_type_id: data[:link_type_id],
|
||||||
link_object_target_id: data[:link_object_source_id],
|
link_object_target_id: data[:link_object_source_id],
|
||||||
link_object_target_value: data[:link_object_source_value],
|
link_object_target_value: data[:link_object_source_value],
|
||||||
link_object_source_id: data[:link_object_target_id],
|
link_object_source_id: data[:link_object_target_id],
|
||||||
link_object_source_value: data[:link_object_target_value]
|
link_object_source_value: data[:link_object_target_value]
|
||||||
).destroy_all
|
).destroy_all
|
||||||
end
|
end
|
||||||
|
@ -174,11 +174,11 @@ class Link < ApplicationModel
|
||||||
end
|
end
|
||||||
|
|
||||||
Link.where(
|
Link.where(
|
||||||
link_object_target_id: data[:link_object_id],
|
link_object_target_id: data[:link_object_id],
|
||||||
link_object_target_value: data[:link_object_value],
|
link_object_target_value: data[:link_object_value],
|
||||||
).destroy_all
|
).destroy_all
|
||||||
Link.where(
|
Link.where(
|
||||||
link_object_source_id: data[:link_object_id],
|
link_object_source_id: data[:link_object_id],
|
||||||
link_object_source_value: data[:link_object_value],
|
link_object_source_value: data[:link_object_value],
|
||||||
).destroy_all
|
).destroy_all
|
||||||
|
|
||||||
|
@ -188,11 +188,11 @@ class Link < ApplicationModel
|
||||||
def touch_link_references
|
def touch_link_references
|
||||||
Link.touch_reference_by_params(
|
Link.touch_reference_by_params(
|
||||||
object: Link::Object.lookup(id: link_object_source_id).name,
|
object: Link::Object.lookup(id: link_object_source_id).name,
|
||||||
o_id: link_object_source_value,
|
o_id: link_object_source_value,
|
||||||
)
|
)
|
||||||
Link.touch_reference_by_params(
|
Link.touch_reference_by_params(
|
||||||
object: Link::Object.lookup(id: link_object_target_id).name,
|
object: Link::Object.lookup(id: link_object_target_id).name,
|
||||||
o_id: link_object_target_value,
|
o_id: link_object_target_value,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ all:
|
||||||
version: version,
|
version: version,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
json: true,
|
json: true,
|
||||||
open_timeout: 8,
|
open_timeout: 8,
|
||||||
read_timeout: 24,
|
read_timeout: 24,
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,7 +302,7 @@ possible types
|
||||||
# check new entry - is needed
|
# check new entry - is needed
|
||||||
record = ObjectManager::Attribute.find_by(
|
record = ObjectManager::Attribute.find_by(
|
||||||
object_lookup_id: data[:object_lookup_id],
|
object_lookup_id: data[:object_lookup_id],
|
||||||
name: data[:name],
|
name: data[:name],
|
||||||
)
|
)
|
||||||
if record
|
if record
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ use "force: true" to delete also not editable fields
|
||||||
# check newest entry - is needed
|
# check newest entry - is needed
|
||||||
record = ObjectManager::Attribute.find_by(
|
record = ObjectManager::Attribute.find_by(
|
||||||
object_lookup_id: data[:object_lookup_id],
|
object_lookup_id: data[:object_lookup_id],
|
||||||
name: data[:name],
|
name: data[:name],
|
||||||
)
|
)
|
||||||
if !record
|
if !record
|
||||||
raise "ERROR: No such field #{data[:object]}.#{data[:name]}"
|
raise "ERROR: No such field #{data[:object]}.#{data[:name]}"
|
||||||
|
@ -448,7 +448,7 @@ get the attribute model based on object and name
|
||||||
|
|
||||||
ObjectManager::Attribute.find_by(
|
ObjectManager::Attribute.find_by(
|
||||||
object_lookup_id: data[:object_lookup_id],
|
object_lookup_id: data[:object_lookup_id],
|
||||||
name: data[:name],
|
name: data[:name],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -478,16 +478,16 @@ returns:
|
||||||
# get attributes in right order
|
# get attributes in right order
|
||||||
result = ObjectManager::Attribute.where(
|
result = ObjectManager::Attribute.where(
|
||||||
object_lookup_id: object_lookup_id,
|
object_lookup_id: object_lookup_id,
|
||||||
active: true,
|
active: true,
|
||||||
to_create: false,
|
to_create: false,
|
||||||
to_delete: false,
|
to_delete: false,
|
||||||
).order('position ASC, name ASC')
|
).order('position ASC, name ASC')
|
||||||
attributes = []
|
attributes = []
|
||||||
result.each do |item|
|
result.each do |item|
|
||||||
data = {
|
data = {
|
||||||
name: item.name,
|
name: item.name,
|
||||||
display: item.display,
|
display: item.display,
|
||||||
tag: item.data_type,
|
tag: item.data_type,
|
||||||
#:null => item.null,
|
#:null => item.null,
|
||||||
}
|
}
|
||||||
if item.data_option[:permission]&.any?
|
if item.data_option[:permission]&.any?
|
||||||
|
@ -683,7 +683,7 @@ to send no browser reload event, pass false
|
||||||
attribute.name,
|
attribute.name,
|
||||||
data_type,
|
data_type,
|
||||||
limit: attribute.data_option[:maxlength],
|
limit: attribute.data_option[:maxlength],
|
||||||
null: true
|
null: true
|
||||||
)
|
)
|
||||||
elsif attribute.data_type.match?(/^integer|user_autocompletion|datetime|date$/)
|
elsif attribute.data_type.match?(/^integer|user_autocompletion|datetime|date$/)
|
||||||
ActiveRecord::Migration.change_column(
|
ActiveRecord::Migration.change_column(
|
||||||
|
@ -691,7 +691,7 @@ to send no browser reload event, pass false
|
||||||
attribute.name,
|
attribute.name,
|
||||||
data_type,
|
data_type,
|
||||||
default: attribute.data_option[:default],
|
default: attribute.data_option[:default],
|
||||||
null: true
|
null: true
|
||||||
)
|
)
|
||||||
elsif attribute.data_type.match?(/^boolean|active$/)
|
elsif attribute.data_type.match?(/^boolean|active$/)
|
||||||
ActiveRecord::Migration.change_column(
|
ActiveRecord::Migration.change_column(
|
||||||
|
@ -699,7 +699,7 @@ to send no browser reload event, pass false
|
||||||
attribute.name,
|
attribute.name,
|
||||||
data_type,
|
data_type,
|
||||||
default: attribute.data_option[:default],
|
default: attribute.data_option[:default],
|
||||||
null: true
|
null: true
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
raise "Unknown attribute.data_type '#{attribute.data_type}', can't update attribute"
|
raise "Unknown attribute.data_type '#{attribute.data_type}', can't update attribute"
|
||||||
|
@ -722,7 +722,7 @@ to send no browser reload event, pass false
|
||||||
attribute.name,
|
attribute.name,
|
||||||
data_type,
|
data_type,
|
||||||
limit: attribute.data_option[:maxlength],
|
limit: attribute.data_option[:maxlength],
|
||||||
null: true
|
null: true
|
||||||
)
|
)
|
||||||
elsif attribute.data_type.match?(/^integer|user_autocompletion$/)
|
elsif attribute.data_type.match?(/^integer|user_autocompletion$/)
|
||||||
ActiveRecord::Migration.add_column(
|
ActiveRecord::Migration.add_column(
|
||||||
|
@ -730,7 +730,7 @@ to send no browser reload event, pass false
|
||||||
attribute.name,
|
attribute.name,
|
||||||
data_type,
|
data_type,
|
||||||
default: attribute.data_option[:default],
|
default: attribute.data_option[:default],
|
||||||
null: true
|
null: true
|
||||||
)
|
)
|
||||||
elsif attribute.data_type.match?(/^boolean|active$/)
|
elsif attribute.data_type.match?(/^boolean|active$/)
|
||||||
ActiveRecord::Migration.add_column(
|
ActiveRecord::Migration.add_column(
|
||||||
|
@ -738,7 +738,7 @@ to send no browser reload event, pass false
|
||||||
attribute.name,
|
attribute.name,
|
||||||
data_type,
|
data_type,
|
||||||
default: attribute.data_option[:default],
|
default: attribute.data_option[:default],
|
||||||
null: true
|
null: true
|
||||||
)
|
)
|
||||||
elsif attribute.data_type.match?(/^datetime|date$/)
|
elsif attribute.data_type.match?(/^datetime|date$/)
|
||||||
ActiveRecord::Migration.add_column(
|
ActiveRecord::Migration.add_column(
|
||||||
|
@ -746,7 +746,7 @@ to send no browser reload event, pass false
|
||||||
attribute.name,
|
attribute.name,
|
||||||
data_type,
|
data_type,
|
||||||
default: attribute.data_option[:default],
|
default: attribute.data_option[:default],
|
||||||
null: true
|
null: true
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
raise "Unknown attribute.data_type '#{attribute.data_type}', can't create attribute"
|
raise "Unknown attribute.data_type '#{attribute.data_type}', can't create attribute"
|
||||||
|
|
|
@ -23,8 +23,8 @@ class Observer::Chat::Leave::BackgroundJob
|
||||||
# notify participants
|
# notify participants
|
||||||
message = {
|
message = {
|
||||||
event: 'chat_session_left',
|
event: 'chat_session_left',
|
||||||
data: {
|
data: {
|
||||||
realname: realname,
|
realname: realname,
|
||||||
session_id: chat_session.session_id,
|
session_id: chat_session.session_id,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,12 @@ class Observer::Tag::TicketHistory < ActiveRecord::Observer
|
||||||
|
|
||||||
# add ticket history
|
# add ticket history
|
||||||
History.add(
|
History.add(
|
||||||
o_id: record.o_id,
|
o_id: record.o_id,
|
||||||
history_type: 'added',
|
history_type: 'added',
|
||||||
history_object: 'Ticket',
|
history_object: 'Ticket',
|
||||||
history_attribute: 'tag',
|
history_attribute: 'tag',
|
||||||
value_to: record.tag_item.name,
|
value_to: record.tag_item.name,
|
||||||
created_by_id: record.created_by_id,
|
created_by_id: record.created_by_id,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -25,12 +25,12 @@ class Observer::Tag::TicketHistory < ActiveRecord::Observer
|
||||||
|
|
||||||
# add ticket history
|
# add ticket history
|
||||||
History.add(
|
History.add(
|
||||||
o_id: record.o_id,
|
o_id: record.o_id,
|
||||||
history_type: 'removed',
|
history_type: 'removed',
|
||||||
history_object: 'Ticket',
|
history_object: 'Ticket',
|
||||||
history_attribute: 'tag',
|
history_attribute: 'tag',
|
||||||
value_to: record.tag_item.name,
|
value_to: record.tag_item.name,
|
||||||
created_by_id: record.created_by_id,
|
created_by_id: record.created_by_id,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,16 +53,16 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
|
||||||
begin
|
begin
|
||||||
message = channel.deliver(
|
message = channel.deliver(
|
||||||
{
|
{
|
||||||
message_id: record.message_id,
|
message_id: record.message_id,
|
||||||
in_reply_to: record.in_reply_to,
|
in_reply_to: record.in_reply_to,
|
||||||
references: ticket.get_references([record.message_id]),
|
references: ticket.get_references([record.message_id]),
|
||||||
from: record.from,
|
from: record.from,
|
||||||
to: record.to,
|
to: record.to,
|
||||||
cc: record.cc,
|
cc: record.cc,
|
||||||
subject: subject,
|
subject: subject,
|
||||||
content_type: record.content_type,
|
content_type: record.content_type,
|
||||||
body: record.body,
|
body: record.body,
|
||||||
attachments: record.attachments
|
attachments: record.attachments
|
||||||
},
|
},
|
||||||
notification
|
notification
|
||||||
)
|
)
|
||||||
|
@ -103,14 +103,14 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
|
||||||
return if recipient_list == ''
|
return if recipient_list == ''
|
||||||
|
|
||||||
History.add(
|
History.add(
|
||||||
o_id: record.id,
|
o_id: record.id,
|
||||||
history_type: 'email',
|
history_type: 'email',
|
||||||
history_object: 'Ticket::Article',
|
history_object: 'Ticket::Article',
|
||||||
related_o_id: ticket.id,
|
related_o_id: ticket.id,
|
||||||
related_history_object: 'Ticket',
|
related_history_object: 'Ticket',
|
||||||
value_from: record.subject,
|
value_from: record.subject,
|
||||||
value_to: recipient_list,
|
value_to: recipient_list,
|
||||||
created_by_id: record.created_by_id,
|
created_by_id: record.created_by_id,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -142,16 +142,16 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
|
||||||
Observer::Transaction.reset
|
Observer::Transaction.reset
|
||||||
UserInfo.current_user_id = 1
|
UserInfo.current_user_id = 1
|
||||||
Ticket::Article.create!(
|
Ticket::Article.create!(
|
||||||
ticket_id: local_record.ticket_id,
|
ticket_id: local_record.ticket_id,
|
||||||
content_type: 'text/plain',
|
content_type: 'text/plain',
|
||||||
body: "Unable to send email to '#{recipient_list}': #{message}",
|
body: "Unable to send email to '#{recipient_list}': #{message}",
|
||||||
internal: true,
|
internal: true,
|
||||||
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
||||||
type: Ticket::Article::Type.find_by(name: 'note'),
|
type: Ticket::Article::Type.find_by(name: 'note'),
|
||||||
preferences: {
|
preferences: {
|
||||||
delivery_article_id_related: local_record.id,
|
delivery_article_id_related: local_record.id,
|
||||||
delivery_message: true,
|
delivery_message: true,
|
||||||
notification: true,
|
notification: true,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
ticket = Ticket.find(local_record.ticket_id)
|
ticket = Ticket.find(local_record.ticket_id)
|
||||||
|
|
|
@ -73,15 +73,15 @@ class Observer::Ticket::Article::CommunicateFacebook::BackgroundJob
|
||||||
|
|
||||||
if local_record.preferences['delivery_retry'] > 3
|
if local_record.preferences['delivery_retry'] > 3
|
||||||
Ticket::Article.create(
|
Ticket::Article.create(
|
||||||
ticket_id: local_record.ticket_id,
|
ticket_id: local_record.ticket_id,
|
||||||
content_type: 'text/plain',
|
content_type: 'text/plain',
|
||||||
body: "Unable to send post: #{message}",
|
body: "Unable to send post: #{message}",
|
||||||
internal: true,
|
internal: true,
|
||||||
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
||||||
type: Ticket::Article::Type.find_by(name: 'note'),
|
type: Ticket::Article::Type.find_by(name: 'note'),
|
||||||
preferences: {
|
preferences: {
|
||||||
delivery_article_id_related: local_record.id,
|
delivery_article_id_related: local_record.id,
|
||||||
delivery_message: true,
|
delivery_message: true,
|
||||||
},
|
},
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
|
|
|
@ -32,13 +32,13 @@ class Observer::Ticket::Article::CommunicateSms::BackgroundJob
|
||||||
article.preferences['sms_recipients'].each do |recipient|
|
article.preferences['sms_recipients'].each do |recipient|
|
||||||
channel.deliver(
|
channel.deliver(
|
||||||
recipient: recipient,
|
recipient: recipient,
|
||||||
message: article.body.first(160),
|
message: article.body.first(160),
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
channel.deliver(
|
channel.deliver(
|
||||||
recipient: article.to,
|
recipient: article.to,
|
||||||
message: article.body.first(160),
|
message: article.body.first(160),
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
|
@ -70,15 +70,15 @@ class Observer::Ticket::Article::CommunicateSms::BackgroundJob
|
||||||
|
|
||||||
if local_record.preferences['delivery_retry'] >= max_attempts
|
if local_record.preferences['delivery_retry'] >= max_attempts
|
||||||
Ticket::Article.create(
|
Ticket::Article.create(
|
||||||
ticket_id: local_record.ticket_id,
|
ticket_id: local_record.ticket_id,
|
||||||
content_type: 'text/plain',
|
content_type: 'text/plain',
|
||||||
body: "#{log_error_prefix}: #{message}",
|
body: "#{log_error_prefix}: #{message}",
|
||||||
internal: true,
|
internal: true,
|
||||||
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
||||||
type: Ticket::Article::Type.find_by(name: 'note'),
|
type: Ticket::Article::Type.find_by(name: 'note'),
|
||||||
preferences: {
|
preferences: {
|
||||||
delivery_article_id_related: local_record.id,
|
delivery_article_id_related: local_record.id,
|
||||||
delivery_message: true,
|
delivery_message: true,
|
||||||
},
|
},
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
|
@ -92,14 +92,14 @@ class Observer::Ticket::Article::CommunicateSms::BackgroundJob
|
||||||
return if recipient_list.blank?
|
return if recipient_list.blank?
|
||||||
|
|
||||||
History.add(
|
History.add(
|
||||||
o_id: article.id,
|
o_id: article.id,
|
||||||
history_type: history_type,
|
history_type: history_type,
|
||||||
history_object: 'Ticket::Article',
|
history_object: 'Ticket::Article',
|
||||||
related_o_id: ticket.id,
|
related_o_id: ticket.id,
|
||||||
related_history_object: 'Ticket',
|
related_history_object: 'Ticket',
|
||||||
value_from: article.subject,
|
value_from: article.subject,
|
||||||
value_to: recipient_list,
|
value_to: recipient_list,
|
||||||
created_by_id: article.created_by_id,
|
created_by_id: article.created_by_id,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -51,9 +51,9 @@ class Observer::Ticket::Article::CommunicateTelegram::BackgroundJob
|
||||||
article.to = "@#{result['chat']['username']}"
|
article.to = "@#{result['chat']['username']}"
|
||||||
|
|
||||||
article.preferences['telegram'] = {
|
article.preferences['telegram'] = {
|
||||||
date: result['date'],
|
date: result['date'],
|
||||||
from_id: result['from']['id'],
|
from_id: result['from']['id'],
|
||||||
chat_id: result['chat']['id'],
|
chat_id: result['chat']['id'],
|
||||||
message_id: result['message_id']
|
message_id: result['message_id']
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -62,9 +62,9 @@ class Observer::Ticket::Article::CommunicateTelegram::BackgroundJob
|
||||||
article.to = "#{result['chat']['title']} Channel"
|
article.to = "#{result['chat']['title']} Channel"
|
||||||
|
|
||||||
article.preferences['telegram'] = {
|
article.preferences['telegram'] = {
|
||||||
date: result['date'],
|
date: result['date'],
|
||||||
from_id: me['id'],
|
from_id: me['id'],
|
||||||
chat_id: result['chat']['id'],
|
chat_id: result['chat']['id'],
|
||||||
message_id: result['message_id']
|
message_id: result['message_id']
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -92,15 +92,15 @@ class Observer::Ticket::Article::CommunicateTelegram::BackgroundJob
|
||||||
|
|
||||||
if local_record.preferences['delivery_retry'] > 3
|
if local_record.preferences['delivery_retry'] > 3
|
||||||
Ticket::Article.create(
|
Ticket::Article.create(
|
||||||
ticket_id: local_record.ticket_id,
|
ticket_id: local_record.ticket_id,
|
||||||
content_type: 'text/plain',
|
content_type: 'text/plain',
|
||||||
body: "Unable to send telegram message: #{message}",
|
body: "Unable to send telegram message: #{message}",
|
||||||
internal: true,
|
internal: true,
|
||||||
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
||||||
type: Ticket::Article::Type.find_by(name: 'note'),
|
type: Ticket::Article::Type.find_by(name: 'note'),
|
||||||
preferences: {
|
preferences: {
|
||||||
delivery_article_id_related: local_record.id,
|
delivery_article_id_related: local_record.id,
|
||||||
delivery_message: true,
|
delivery_message: true,
|
||||||
},
|
},
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
|
|
|
@ -61,7 +61,7 @@ class Observer::Ticket::Article::CommunicateTwitter::BackgroundJob
|
||||||
|
|
||||||
article.preferences['twitter'] = {
|
article.preferences['twitter'] = {
|
||||||
recipient_id: tweet[:event][:message_create][:target][:recipient_id],
|
recipient_id: tweet[:event][:message_create][:target][:recipient_id],
|
||||||
sender_id: tweet[:event][:message_create][:sender_id],
|
sender_id: tweet[:event][:message_create][:sender_id],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -82,17 +82,17 @@ class Observer::Ticket::Article::CommunicateTwitter::BackgroundJob
|
||||||
end
|
end
|
||||||
article.to = to
|
article.to = to
|
||||||
article.preferences['twitter'] = TwitterSync.preferences_cleanup(
|
article.preferences['twitter'] = TwitterSync.preferences_cleanup(
|
||||||
mention_ids: mention_ids,
|
mention_ids: mention_ids,
|
||||||
geo: tweet.geo,
|
geo: tweet.geo,
|
||||||
retweeted: tweet.retweeted?,
|
retweeted: tweet.retweeted?,
|
||||||
possibly_sensitive: tweet.possibly_sensitive?,
|
possibly_sensitive: tweet.possibly_sensitive?,
|
||||||
in_reply_to_user_id: tweet.in_reply_to_user_id,
|
in_reply_to_user_id: tweet.in_reply_to_user_id,
|
||||||
place: tweet.place,
|
place: tweet.place,
|
||||||
retweet_count: tweet.retweet_count,
|
retweet_count: tweet.retweet_count,
|
||||||
source: tweet.source,
|
source: tweet.source,
|
||||||
favorited: tweet.favorited?,
|
favorited: tweet.favorited?,
|
||||||
truncated: tweet.truncated?,
|
truncated: tweet.truncated?,
|
||||||
created_at: tweet.created_at,
|
created_at: tweet.created_at,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -107,9 +107,9 @@ class Observer::Ticket::Article::CommunicateTwitter::BackgroundJob
|
||||||
article.message_id = tweet_id
|
article.message_id = tweet_id
|
||||||
article.preferences['links'] = [
|
article.preferences['links'] = [
|
||||||
{
|
{
|
||||||
url: "https://twitter.com/statuses/#{tweet_id}",
|
url: "https://twitter.com/statuses/#{tweet_id}",
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
name: 'on Twitter',
|
name: 'on Twitter',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -129,15 +129,15 @@ class Observer::Ticket::Article::CommunicateTwitter::BackgroundJob
|
||||||
|
|
||||||
if local_record.preferences['delivery_retry'] > 3
|
if local_record.preferences['delivery_retry'] > 3
|
||||||
Ticket::Article.create(
|
Ticket::Article.create(
|
||||||
ticket_id: local_record.ticket_id,
|
ticket_id: local_record.ticket_id,
|
||||||
content_type: 'text/plain',
|
content_type: 'text/plain',
|
||||||
body: "Unable to send tweet: #{message}",
|
body: "Unable to send tweet: #{message}",
|
||||||
internal: true,
|
internal: true,
|
||||||
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
sender: Ticket::Article::Sender.find_by(name: 'System'),
|
||||||
type: Ticket::Article::Type.find_by(name: 'note'),
|
type: Ticket::Article::Type.find_by(name: 'note'),
|
||||||
preferences: {
|
preferences: {
|
||||||
delivery_article_id_related: local_record.id,
|
delivery_article_id_related: local_record.id,
|
||||||
delivery_message: true,
|
delivery_message: true,
|
||||||
},
|
},
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
|
|
|
@ -13,14 +13,14 @@ class Observer::Ticket::UserTicketCounter::BackgroundJob
|
||||||
state_open = Ticket::State.by_category(:open)
|
state_open = Ticket::State.by_category(:open)
|
||||||
tickets_open = Ticket.where(
|
tickets_open = Ticket.where(
|
||||||
customer_id: @customer_id,
|
customer_id: @customer_id,
|
||||||
state_id: state_open,
|
state_id: state_open,
|
||||||
).count()
|
).count()
|
||||||
|
|
||||||
# closed ticket count
|
# closed ticket count
|
||||||
state_closed = Ticket::State.by_category(:closed)
|
state_closed = Ticket::State.by_category(:closed)
|
||||||
tickets_closed = Ticket.where(
|
tickets_closed = Ticket.where(
|
||||||
customer_id: @customer_id,
|
customer_id: @customer_id,
|
||||||
state_id: state_closed,
|
state_id: state_closed,
|
||||||
).count()
|
).count()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -182,11 +182,11 @@ class Observer::Transaction < ActiveRecord::Observer
|
||||||
return true if Setting.get('import_mode')
|
return true if Setting.get('import_mode')
|
||||||
|
|
||||||
e = {
|
e = {
|
||||||
object: record.class.name,
|
object: record.class.name,
|
||||||
type: 'create',
|
type: 'create',
|
||||||
data: record,
|
data: record,
|
||||||
id: record.id,
|
id: record.id,
|
||||||
user_id: record.created_by_id,
|
user_id: record.created_by_id,
|
||||||
created_at: Time.zone.now,
|
created_at: Time.zone.now,
|
||||||
}
|
}
|
||||||
EventBuffer.add('transaction', e)
|
EventBuffer.add('transaction', e)
|
||||||
|
@ -225,12 +225,12 @@ class Observer::Transaction < ActiveRecord::Observer
|
||||||
end
|
end
|
||||||
|
|
||||||
e = {
|
e = {
|
||||||
object: record.class.name,
|
object: record.class.name,
|
||||||
type: 'update',
|
type: 'update',
|
||||||
data: record,
|
data: record,
|
||||||
changes: real_changes,
|
changes: real_changes,
|
||||||
id: record.id,
|
id: record.id,
|
||||||
user_id: changed_by_id,
|
user_id: changed_by_id,
|
||||||
created_at: Time.zone.now,
|
created_at: Time.zone.now,
|
||||||
}
|
}
|
||||||
EventBuffer.add('transaction', e)
|
EventBuffer.add('transaction', e)
|
||||||
|
|
|
@ -45,15 +45,15 @@ add a new online notification for this user
|
||||||
exists_by_object_and_id?(data[:object], data[:o_id])
|
exists_by_object_and_id?(data[:object], data[:o_id])
|
||||||
|
|
||||||
record = {
|
record = {
|
||||||
o_id: data[:o_id],
|
o_id: data[:o_id],
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
type_lookup_id: type_id,
|
type_lookup_id: type_id,
|
||||||
seen: data[:seen],
|
seen: data[:seen],
|
||||||
user_id: data[:user_id],
|
user_id: data[:user_id],
|
||||||
created_by_id: data[:created_by_id],
|
created_by_id: data[:created_by_id],
|
||||||
updated_by_id: data[:updated_by_id] || data[:created_by_id],
|
updated_by_id: data[:updated_by_id] || data[:created_by_id],
|
||||||
created_at: data[:created_at] || Time.zone.now,
|
created_at: data[:created_at] || Time.zone.now,
|
||||||
updated_at: data[:updated_at] || Time.zone.now,
|
updated_at: data[:updated_at] || Time.zone.now,
|
||||||
}
|
}
|
||||||
|
|
||||||
OnlineNotification.create!(record)
|
OnlineNotification.create!(record)
|
||||||
|
@ -87,7 +87,7 @@ remove whole online notifications of an object
|
||||||
object_id = ObjectLookup.by_name(object_name)
|
object_id = ObjectLookup.by_name(object_name)
|
||||||
OnlineNotification.where(
|
OnlineNotification.where(
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
).destroy_all
|
).destroy_all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -104,9 +104,9 @@ remove whole online notifications of an object by type
|
||||||
type_id = TypeLookup.by_name(type_name)
|
type_id = TypeLookup.by_name(type_name)
|
||||||
OnlineNotification.where(
|
OnlineNotification.where(
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
type_lookup_id: type_id,
|
type_lookup_id: type_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
).destroy_all
|
).destroy_all
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ return all online notifications of an object
|
||||||
object_id = ObjectLookup.by_name(object_name)
|
object_id = ObjectLookup.by_name(object_name)
|
||||||
notifications = OnlineNotification.where(
|
notifications = OnlineNotification.where(
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
)
|
)
|
||||||
.order('created_at DESC, id DESC')
|
.order('created_at DESC, id DESC')
|
||||||
.limit(10_000)
|
.limit(10_000)
|
||||||
|
@ -155,8 +155,8 @@ mark online notification as seen by object
|
||||||
object_id = ObjectLookup.by_name(object_name)
|
object_id = ObjectLookup.by_name(object_name)
|
||||||
notifications = OnlineNotification.where(
|
notifications = OnlineNotification.where(
|
||||||
object_lookup_id: object_id,
|
object_lookup_id: object_id,
|
||||||
o_id: o_id,
|
o_id: o_id,
|
||||||
seen: false,
|
seen: false,
|
||||||
)
|
)
|
||||||
notifications.each do |notification|
|
notifications.each do |notification|
|
||||||
notification.seen = true
|
notification.seen = true
|
||||||
|
@ -170,7 +170,7 @@ mark online notification as seen by object
|
||||||
user_id,
|
user_id,
|
||||||
{
|
{
|
||||||
event: 'OnlineNotification::changed',
|
event: 'OnlineNotification::changed',
|
||||||
data: {}
|
data: {}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -260,7 +260,7 @@ with dedicated times
|
||||||
user.id,
|
user.id,
|
||||||
{
|
{
|
||||||
event: 'OnlineNotification::changed',
|
event: 'OnlineNotification::changed',
|
||||||
data: {}
|
data: {}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
sleep 2 # slow down client requests
|
sleep 2 # slow down client requests
|
||||||
|
|
|
@ -34,7 +34,7 @@ returns if user has no permissions to search
|
||||||
return false if !current_user.permissions?('ticket.agent') && !current_user.permissions?('admin.organization')
|
return false if !current_user.permissions?('ticket.agent') && !current_user.permissions?('admin.organization')
|
||||||
|
|
||||||
{
|
{
|
||||||
prio: 1000,
|
prio: 1000,
|
||||||
direct_search_index: true,
|
direct_search_index: true,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -83,9 +83,9 @@ returns
|
||||||
|
|
||||||
# try search index backend
|
# try search index backend
|
||||||
if SearchIndexBackend.enabled?
|
if SearchIndexBackend.enabled?
|
||||||
items = SearchIndexBackend.search(query, 'Organization', limit: limit,
|
items = SearchIndexBackend.search(query, 'Organization', limit: limit,
|
||||||
from: offset,
|
from: offset,
|
||||||
sort_by: sort_by,
|
sort_by: sort_by,
|
||||||
order_by: order_by)
|
order_by: order_by)
|
||||||
organizations = []
|
organizations = []
|
||||||
items.each do |item|
|
items.each do |item|
|
||||||
|
|
|
@ -234,10 +234,10 @@ returns
|
||||||
|
|
||||||
# package meta data
|
# package meta data
|
||||||
meta = {
|
meta = {
|
||||||
name: package['name'],
|
name: package['name'],
|
||||||
version: package['version'],
|
version: package['version'],
|
||||||
vendor: package['vendor'],
|
vendor: package['vendor'],
|
||||||
state: 'uninstalled',
|
state: 'uninstalled',
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
}
|
}
|
||||||
|
@ -256,10 +256,10 @@ returns
|
||||||
|
|
||||||
# uninstall files of old package
|
# uninstall files of old package
|
||||||
uninstall(
|
uninstall(
|
||||||
name: package_db.name,
|
name: package_db.name,
|
||||||
version: package_db.version,
|
version: package_db.version,
|
||||||
migration_not_down: true,
|
migration_not_down: true,
|
||||||
reinstall: data[:reinstall],
|
reinstall: data[:reinstall],
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -267,11 +267,11 @@ returns
|
||||||
if !data[:reinstall]
|
if !data[:reinstall]
|
||||||
package_db = Package.create(meta)
|
package_db = Package.create(meta)
|
||||||
Store.add(
|
Store.add(
|
||||||
object: 'Package',
|
object: 'Package',
|
||||||
o_id: package_db.id,
|
o_id: package_db.id,
|
||||||
data: package.to_json,
|
data: package.to_json,
|
||||||
filename: "#{meta[:name]}-#{meta[:version]}.zpm",
|
filename: "#{meta[:name]}-#{meta[:version]}.zpm",
|
||||||
preferences: {},
|
preferences: {},
|
||||||
created_by_id: UserInfo.current_user_id || 1,
|
created_by_id: UserInfo.current_user_id || 1,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -357,7 +357,7 @@ returns
|
||||||
# delete package
|
# delete package
|
||||||
if !data[:reinstall]
|
if !data[:reinstall]
|
||||||
record = Package.find_by(
|
record = Package.find_by(
|
||||||
name: package['name'],
|
name: package['name'],
|
||||||
version: package['version'],
|
version: package['version'],
|
||||||
)
|
)
|
||||||
record.destroy
|
record.destroy
|
||||||
|
@ -384,7 +384,7 @@ execute all pending package migrations at once
|
||||||
|
|
||||||
def self._get_bin(name, version)
|
def self._get_bin(name, version)
|
||||||
package = Package.find_by(
|
package = Package.find_by(
|
||||||
name: name,
|
name: name,
|
||||||
version: version,
|
version: version,
|
||||||
)
|
)
|
||||||
if !package
|
if !package
|
||||||
|
@ -393,7 +393,7 @@ execute all pending package migrations at once
|
||||||
|
|
||||||
list = Store.list(
|
list = Store.list(
|
||||||
object: 'Package',
|
object: 'Package',
|
||||||
o_id: package.id,
|
o_id: package.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# find file
|
# find file
|
||||||
|
|
|
@ -17,9 +17,9 @@ class RecentView < ApplicationModel
|
||||||
|
|
||||||
exists_by_object_and_id?(object, o_id)
|
exists_by_object_and_id?(object, o_id)
|
||||||
|
|
||||||
RecentView.create!(o_id: o_id,
|
RecentView.create!(o_id: o_id,
|
||||||
recent_view_object_id: ObjectLookup.by_name(object),
|
recent_view_object_id: ObjectLookup.by_name(object),
|
||||||
created_by_id: user.id)
|
created_by_id: user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.log_destroy(requested_object, requested_object_id)
|
def self.log_destroy(requested_object, requested_object_id)
|
||||||
|
@ -70,7 +70,7 @@ class RecentView < ApplicationModel
|
||||||
created_by_id,
|
created_by_id,
|
||||||
{
|
{
|
||||||
event: 'RecentView::changed',
|
event: 'RecentView::changed',
|
||||||
data: {}
|
data: {}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,210 +9,210 @@ class Report
|
||||||
config[:metric] = {}
|
config[:metric] = {}
|
||||||
|
|
||||||
config[:metric][:count] = {
|
config[:metric][:count] = {
|
||||||
name: 'count',
|
name: 'count',
|
||||||
display: 'Ticket Count',
|
display: 'Ticket Count',
|
||||||
default: true,
|
default: true,
|
||||||
prio: 10_000,
|
prio: 10_000,
|
||||||
}
|
}
|
||||||
backend = [
|
backend = [
|
||||||
{
|
{
|
||||||
name: 'created',
|
name: 'created',
|
||||||
display: 'Created',
|
display: 'Created',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: true,
|
dataDownload: true,
|
||||||
adapter: Report::TicketGenericTime,
|
adapter: Report::TicketGenericTime,
|
||||||
params: { field: 'created_at' }
|
params: { field: 'created_at' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'closed',
|
name: 'closed',
|
||||||
display: 'Closed',
|
display: 'Closed',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: true,
|
dataDownload: true,
|
||||||
adapter: Report::TicketGenericTime,
|
adapter: Report::TicketGenericTime,
|
||||||
params: { field: 'close_at' }
|
params: { field: 'close_at' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'backlog',
|
name: 'backlog',
|
||||||
display: 'Backlog',
|
display: 'Backlog',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: false,
|
dataDownload: false,
|
||||||
adapter: Report::TicketBacklog
|
adapter: Report::TicketBacklog
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'first_solution',
|
name: 'first_solution',
|
||||||
display: 'First Solution',
|
display: 'First Solution',
|
||||||
selected: false,
|
selected: false,
|
||||||
dataDownload: true,
|
dataDownload: true,
|
||||||
adapter: Report::TicketFirstSolution
|
adapter: Report::TicketFirstSolution
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'reopened',
|
name: 'reopened',
|
||||||
display: 'Reopened',
|
display: 'Reopened',
|
||||||
selected: false,
|
selected: false,
|
||||||
dataDownload: true,
|
dataDownload: true,
|
||||||
adapter: Report::TicketReopened
|
adapter: Report::TicketReopened
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'movedin',
|
name: 'movedin',
|
||||||
display: 'Moved in',
|
display: 'Moved in',
|
||||||
selected: false,
|
selected: false,
|
||||||
dataDownload: true,
|
dataDownload: true,
|
||||||
adapter: Report::TicketMoved,
|
adapter: Report::TicketMoved,
|
||||||
params: { type: 'in' }
|
params: { type: 'in' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'movedout',
|
name: 'movedout',
|
||||||
display: 'Moved out',
|
display: 'Moved out',
|
||||||
selected: false,
|
selected: false,
|
||||||
dataDownload: true,
|
dataDownload: true,
|
||||||
adapter: Report::TicketMoved,
|
adapter: Report::TicketMoved,
|
||||||
params: { type: 'out' }
|
params: { type: 'out' }
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
config[:metric][:count][:backend] = backend
|
config[:metric][:count][:backend] = backend
|
||||||
|
|
||||||
config[:metric][:create_channels] = {
|
config[:metric][:create_channels] = {
|
||||||
name: 'create_channels',
|
name: 'create_channels',
|
||||||
display: 'Create Channels',
|
display: 'Create Channels',
|
||||||
prio: 9000,
|
prio: 9000,
|
||||||
}
|
}
|
||||||
backend = [
|
backend = [
|
||||||
{
|
{
|
||||||
name: 'phone_in',
|
name: 'phone_in',
|
||||||
display: 'Phone (in)',
|
display: 'Phone (in)',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: true,
|
dataDownload: true,
|
||||||
adapter: Report::TicketGenericTime,
|
adapter: Report::TicketGenericTime,
|
||||||
params: {
|
params: {
|
||||||
field: 'created_at',
|
field: 'created_at',
|
||||||
selector: {
|
selector: {
|
||||||
'create_article_type_id' => {
|
'create_article_type_id' => {
|
||||||
'operator' => 'is',
|
'operator' => 'is',
|
||||||
'value' => Ticket::Article::Type.lookup(name: 'phone').id,
|
'value' => Ticket::Article::Type.lookup(name: 'phone').id,
|
||||||
},
|
},
|
||||||
'create_article_sender_id' => {
|
'create_article_sender_id' => {
|
||||||
'operator' => 'is',
|
'operator' => 'is',
|
||||||
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
|
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'phone_out',
|
name: 'phone_out',
|
||||||
display: 'Phone (out)',
|
display: 'Phone (out)',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: true,
|
dataDownload: true,
|
||||||
adapter: Report::TicketGenericTime,
|
adapter: Report::TicketGenericTime,
|
||||||
params: {
|
params: {
|
||||||
field: 'created_at',
|
field: 'created_at',
|
||||||
selector: {
|
selector: {
|
||||||
'create_article_type_id' => {
|
'create_article_type_id' => {
|
||||||
'operator' => 'is',
|
'operator' => 'is',
|
||||||
'value' => Ticket::Article::Type.lookup(name: 'phone').id,
|
'value' => Ticket::Article::Type.lookup(name: 'phone').id,
|
||||||
},
|
},
|
||||||
'create_article_sender_id' => {
|
'create_article_sender_id' => {
|
||||||
'operator' => 'is',
|
'operator' => 'is',
|
||||||
'value' => Ticket::Article::Sender.lookup(name: 'Agent').id,
|
'value' => Ticket::Article::Sender.lookup(name: 'Agent').id,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'email_in',
|
name: 'email_in',
|
||||||
display: 'Email (in)',
|
display: 'Email (in)',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: true,
|
dataDownload: true,
|
||||||
adapter: Report::TicketGenericTime,
|
adapter: Report::TicketGenericTime,
|
||||||
params: {
|
params: {
|
||||||
field: 'created_at',
|
field: 'created_at',
|
||||||
selector: {
|
selector: {
|
||||||
'create_article_type_id' => {
|
'create_article_type_id' => {
|
||||||
'operator' => 'is',
|
'operator' => 'is',
|
||||||
'value' => Ticket::Article::Type.lookup(name: 'email').id,
|
'value' => Ticket::Article::Type.lookup(name: 'email').id,
|
||||||
},
|
},
|
||||||
'create_article_sender_id' => {
|
'create_article_sender_id' => {
|
||||||
'operator' => 'is',
|
'operator' => 'is',
|
||||||
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
|
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'email_out',
|
name: 'email_out',
|
||||||
display: 'Email (out)',
|
display: 'Email (out)',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: true,
|
dataDownload: true,
|
||||||
adapter: Report::TicketGenericTime,
|
adapter: Report::TicketGenericTime,
|
||||||
params: {
|
params: {
|
||||||
field: 'created_at',
|
field: 'created_at',
|
||||||
selector: {
|
selector: {
|
||||||
'create_article_type_id' => {
|
'create_article_type_id' => {
|
||||||
'operator' => 'is',
|
'operator' => 'is',
|
||||||
'value' => Ticket::Article::Type.lookup(name: 'email').id,
|
'value' => Ticket::Article::Type.lookup(name: 'email').id,
|
||||||
},
|
},
|
||||||
'create_article_sender_id' => {
|
'create_article_sender_id' => {
|
||||||
'operator' => 'is',
|
'operator' => 'is',
|
||||||
'value' => Ticket::Article::Sender.lookup(name: 'Agent').id,
|
'value' => Ticket::Article::Sender.lookup(name: 'Agent').id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'web_in',
|
name: 'web_in',
|
||||||
display: 'Web (in)',
|
display: 'Web (in)',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: true,
|
dataDownload: true,
|
||||||
adapter: Report::TicketGenericTime,
|
adapter: Report::TicketGenericTime,
|
||||||
params: {
|
params: {
|
||||||
field: 'created_at',
|
field: 'created_at',
|
||||||
selector: {
|
selector: {
|
||||||
'create_article_type_id' => {
|
'create_article_type_id' => {
|
||||||
'operator' => 'is',
|
'operator' => 'is',
|
||||||
'value' => Ticket::Article::Type.lookup(name: 'web').id,
|
'value' => Ticket::Article::Type.lookup(name: 'web').id,
|
||||||
},
|
},
|
||||||
'create_article_sender_id' => {
|
'create_article_sender_id' => {
|
||||||
'operator' => 'is',
|
'operator' => 'is',
|
||||||
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
|
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'twitter_in',
|
name: 'twitter_in',
|
||||||
display: 'Twitter (in)',
|
display: 'Twitter (in)',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: true,
|
dataDownload: true,
|
||||||
adapter: Report::TicketGenericTime,
|
adapter: Report::TicketGenericTime,
|
||||||
params: {
|
params: {
|
||||||
field: 'created_at',
|
field: 'created_at',
|
||||||
selector: {
|
selector: {
|
||||||
'create_article_type_id' => {
|
'create_article_type_id' => {
|
||||||
'operator' => 'is',
|
'operator' => 'is',
|
||||||
'value' => Ticket::Article::Type.lookup(name: 'twitter status').id,
|
'value' => Ticket::Article::Type.lookup(name: 'twitter status').id,
|
||||||
},
|
},
|
||||||
'create_article_sender_id' => {
|
'create_article_sender_id' => {
|
||||||
'operator' => 'is',
|
'operator' => 'is',
|
||||||
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
|
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'twitter_out',
|
name: 'twitter_out',
|
||||||
display: 'Twitter (out)',
|
display: 'Twitter (out)',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: true,
|
dataDownload: true,
|
||||||
adapter: Report::TicketGenericTime,
|
adapter: Report::TicketGenericTime,
|
||||||
params: {
|
params: {
|
||||||
field: 'created_at',
|
field: 'created_at',
|
||||||
selector: {
|
selector: {
|
||||||
'create_article_type_id' => {
|
'create_article_type_id' => {
|
||||||
'operator' => 'is',
|
'operator' => 'is',
|
||||||
'value' => Ticket::Article::Type.lookup(name: 'twitter status').id,
|
'value' => Ticket::Article::Type.lookup(name: 'twitter status').id,
|
||||||
},
|
},
|
||||||
'create_article_sender_id' => {
|
'create_article_sender_id' => {
|
||||||
'operator' => 'is',
|
'operator' => 'is',
|
||||||
'value' => Ticket::Article::Sender.lookup(name: 'Agent').id,
|
'value' => Ticket::Article::Sender.lookup(name: 'Agent').id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -221,85 +221,85 @@ class Report
|
||||||
config[:metric][:create_channels][:backend] = backend
|
config[:metric][:create_channels][:backend] = backend
|
||||||
|
|
||||||
config[:metric][:communication] = {
|
config[:metric][:communication] = {
|
||||||
name: 'communication',
|
name: 'communication',
|
||||||
display: 'Communication',
|
display: 'Communication',
|
||||||
prio: 7000,
|
prio: 7000,
|
||||||
}
|
}
|
||||||
backend = [
|
backend = [
|
||||||
{
|
{
|
||||||
name: 'phone_in',
|
name: 'phone_in',
|
||||||
display: 'Phone (in)',
|
display: 'Phone (in)',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: false,
|
dataDownload: false,
|
||||||
adapter: Report::ArticleByTypeSender,
|
adapter: Report::ArticleByTypeSender,
|
||||||
params: {
|
params: {
|
||||||
type: 'phone',
|
type: 'phone',
|
||||||
sender: 'Customer',
|
sender: 'Customer',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'phone_out',
|
name: 'phone_out',
|
||||||
display: 'Phone (out)',
|
display: 'Phone (out)',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: false,
|
dataDownload: false,
|
||||||
adapter: Report::ArticleByTypeSender,
|
adapter: Report::ArticleByTypeSender,
|
||||||
params: {
|
params: {
|
||||||
type: 'phone',
|
type: 'phone',
|
||||||
sender: 'Agent',
|
sender: 'Agent',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'email_in',
|
name: 'email_in',
|
||||||
display: 'Email (in)',
|
display: 'Email (in)',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: false,
|
dataDownload: false,
|
||||||
adapter: Report::ArticleByTypeSender,
|
adapter: Report::ArticleByTypeSender,
|
||||||
params: {
|
params: {
|
||||||
type: 'email',
|
type: 'email',
|
||||||
sender: 'Customer',
|
sender: 'Customer',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'email_out',
|
name: 'email_out',
|
||||||
display: 'Email (out)',
|
display: 'Email (out)',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: false,
|
dataDownload: false,
|
||||||
adapter: Report::ArticleByTypeSender,
|
adapter: Report::ArticleByTypeSender,
|
||||||
params: {
|
params: {
|
||||||
type: 'email',
|
type: 'email',
|
||||||
sender: 'Agent',
|
sender: 'Agent',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'web_in',
|
name: 'web_in',
|
||||||
display: 'Web (in)',
|
display: 'Web (in)',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: false,
|
dataDownload: false,
|
||||||
adapter: Report::ArticleByTypeSender,
|
adapter: Report::ArticleByTypeSender,
|
||||||
params: {
|
params: {
|
||||||
type: 'web',
|
type: 'web',
|
||||||
sender: 'Customer',
|
sender: 'Customer',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'twitter_in',
|
name: 'twitter_in',
|
||||||
display: 'Twitter (in)',
|
display: 'Twitter (in)',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: false,
|
dataDownload: false,
|
||||||
adapter: Report::ArticleByTypeSender,
|
adapter: Report::ArticleByTypeSender,
|
||||||
params: {
|
params: {
|
||||||
type: 'twitter status',
|
type: 'twitter status',
|
||||||
sender: 'Customer',
|
sender: 'Customer',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'twitter_out',
|
name: 'twitter_out',
|
||||||
display: 'Twitter (out)',
|
display: 'Twitter (out)',
|
||||||
selected: true,
|
selected: true,
|
||||||
dataDownload: false,
|
dataDownload: false,
|
||||||
adapter: Report::ArticleByTypeSender,
|
adapter: Report::ArticleByTypeSender,
|
||||||
params: {
|
params: {
|
||||||
type: 'twitter status',
|
type: 'twitter status',
|
||||||
sender: 'Agent',
|
sender: 'Agent',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue