Updated rubocop - applied custom Layout/AlignHash style.

This commit is contained in:
Thorsten Eckel 2018-12-19 18:31:51 +01:00
parent 1be60c91db
commit e8a57517f4
533 changed files with 22170 additions and 22161 deletions

View file

@ -93,6 +93,15 @@ Style/MethodDefParentheses:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
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:
Description: "Keeps track of empty lines around class bodies."
Enabled: false

View file

@ -317,7 +317,7 @@ GEM
omniauth (~> 1.5)
omniauth-oauth2 (>= 1.4.0)
parallel (1.12.1)
parser (2.5.1.2)
parser (2.5.3.0)
ast (~> 2.4.0)
pg (0.21.0)
pluginator (1.5.0)
@ -401,14 +401,14 @@ GEM
rspec-mocks (~> 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)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
unicode-display_width (~> 1.4.0)
ruby-progressbar (1.10.0)
ruby_dep (1.5.0)
rubyzip (1.2.2)

View file

@ -25,7 +25,7 @@ class ActivityStreamController < ApplicationController
end
render json: {
record_ids: item_ids,
assets: assets,
assets: assets,
}, status: :ok
return
end

View file

@ -10,8 +10,8 @@ module ApplicationController::Authenticates
def permission_check(key)
if @_token_auth
user = Token.check(
action: 'api',
name: @_token_auth,
action: 'api',
name: @_token_auth,
permission: key,
)
return false if user
@ -84,15 +84,15 @@ module ApplicationController::Authenticates
end
user = Token.check(
action: 'api',
name: token_string,
action: 'api',
name: token_string,
inactive_user: true,
)
if user && auth_param[:permission]
user = Token.check(
action: 'api',
name: token_string,
permission: auth_param[:permission],
action: 'api',
name: token_string,
permission: auth_param[:permission],
inactive_user: true,
)
raise Exceptions::NotAuthorized, 'Not authorized (token)!' if !user

View file

@ -17,10 +17,10 @@ module ApplicationController::LogsHttpAccess
# request
request_data = {
content: '',
content_type: request.headers['Content-Type'],
content: '',
content_type: request.headers['Content-Type'],
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|
next if key[0, 5] != 'HTTP_'
@ -39,11 +39,11 @@ module ApplicationController::LogsHttpAccess
# response
response_data = {
code: response.status = response.code,
content: '',
content_type: nil,
code: response.status = response.code,
content: '',
content_type: nil,
content_encoding: nil,
source: nil,
source: nil,
}
response.headers.each do |key, value|
response_data[:content] += "#{key}: #{value}\n"
@ -55,13 +55,13 @@ module ApplicationController::LogsHttpAccess
response_data[:content] = response_data[:content].slice(0, 8000)
record = {
direction: 'in',
facility: @http_log_support[:facility],
url: url_for(only_path: false, overwrite_params: {}),
status: response.status,
ip: request.remote_ip,
request: request_data,
response: response_data,
method: request.method,
facility: @http_log_support[:facility],
url: url_for(only_path: false, overwrite_params: {}),
status: response.status,
ip: request.remote_ip,
request: request_data,
response: response_data,
method: request.method,
}
HttpLog.create(record)
end

View file

@ -136,7 +136,7 @@ module ApplicationController::RendersModels
end
render json: {
record_ids: item_ids,
assets: assets,
assets: assets,
}, status: :ok
return
end

View file

@ -19,7 +19,7 @@ class ApplicationsController < ApplicationController
end
render json: {
record_ids: item_ids,
assets: assets,
assets: assets,
}, status: :ok
return
end

View file

@ -14,8 +14,8 @@ class CalendarSubscriptionsController < ApplicationController
send_data(
ical,
filename: 'zammad.ical',
type: 'text/plain',
filename: 'zammad.ical',
type: 'text/plain',
disposition: 'inline'
)
rescue => e
@ -36,8 +36,8 @@ class CalendarSubscriptionsController < ApplicationController
send_data(
ical,
filename: 'zammad.ical',
type: 'text/plain',
filename: 'zammad.ical',
type: 'text/plain',
disposition: 'inline'
)
rescue => e

View file

@ -16,8 +16,8 @@ class CalendarsController < ApplicationController
render json: {
record_ids: record_ids,
ical_feeds: ical_feeds,
timezones: timezones,
assets: assets,
timezones: timezones,
assets: assets,
}, status: :ok
end

View file

@ -37,16 +37,16 @@ class ChannelsEmailController < ApplicationController
end
end
render json: {
accounts_fixed: accounts_fixed,
assets: assets,
account_channel_ids: account_channel_ids,
notification_channel_ids: notification_channel_ids,
email_address_ids: email_address_ids,
accounts_fixed: accounts_fixed,
assets: assets,
account_channel_ids: account_channel_ids,
notification_channel_ids: notification_channel_ids,
email_address_ids: email_address_ids,
not_used_email_address_ids: not_used_email_address_ids,
channel_driver: {
channel_driver: {
email: EmailHelper.available_driver,
},
config: {
config: {
notification_sender: Setting.get('notification_sender'),
}
}
@ -56,9 +56,9 @@ class ChannelsEmailController < ApplicationController
# probe settings based on email and password
result = EmailHelper::Probe.full(
email: params[:email],
email: params[:email],
password: params[:password],
folder: params[:folder],
folder: params[:folder],
)
# verify if user+host already exists
@ -107,9 +107,9 @@ class ChannelsEmailController < ApplicationController
# check delivery for 30 sek.
result = EmailHelper::Verify.email(
outbound: params[:outbound].to_h,
inbound: params[:inbound].to_h,
sender: email,
subject: params[:subject],
inbound: params[:inbound].to_h,
sender: email,
subject: params[:subject],
)
if result[:result] != 'ok'
@ -126,15 +126,15 @@ class ChannelsEmailController < ApplicationController
if channel_id
channel = Channel.find(channel_id)
channel.update!(
options: {
inbound: params[:inbound].to_h,
options: {
inbound: params[:inbound].to_h,
outbound: params[:outbound].to_h,
},
group_id: params[:group_id],
last_log_in: nil,
group_id: params[:group_id],
last_log_in: nil,
last_log_out: nil,
status_in: 'ok',
status_out: 'ok',
status_in: 'ok',
status_out: 'ok',
)
render json: result
return
@ -142,17 +142,17 @@ class ChannelsEmailController < ApplicationController
# create new account
channel = Channel.create(
area: 'Email::Account',
options: {
inbound: params[:inbound].to_h,
area: 'Email::Account',
options: {
inbound: params[:inbound].to_h,
outbound: params[:outbound].to_h,
},
group_id: params[:group_id],
last_log_in: nil,
group_id: params[:group_id],
last_log_in: nil,
last_log_out: nil,
status_in: 'ok',
status_out: 'ok',
active: true,
status_in: 'ok',
status_out: 'ok',
active: true,
)
# remember address && set channel for email address
@ -165,16 +165,16 @@ class ChannelsEmailController < ApplicationController
if address
address.update!(
realname: params[:meta][:realname],
email: email,
active: true,
realname: params[:meta][:realname],
email: email,
active: true,
channel_id: channel.id,
)
else
address = EmailAddress.create(
realname: params[:meta][:realname],
email: email,
active: true,
realname: params[:meta][:realname],
email: email,
active: true,
channel_id: channel.id,
)
end
@ -259,7 +259,7 @@ class ChannelsEmailController < ApplicationController
next if channel.id.to_s == channel_id.to_s
render json: {
result: 'duplicate',
result: 'duplicate',
message: 'Account already exists!',
}
return true

View file

@ -14,8 +14,8 @@ class ChannelsFacebookController < ApplicationController
channel_ids.push channel.id
end
render json: {
assets: assets,
channel_ids: channel_ids,
assets: assets,
channel_ids: channel_ids,
callback_url: ExternalCredential.callback_url('facebook'),
}
end

View file

@ -8,10 +8,10 @@ class ChannelsSmsController < ApplicationChannelController
def index
assets = {}
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),
config: channels_config,
assets: assets
config: channels_config,
assets: assets
}
end
@ -37,7 +37,7 @@ class ChannelsSmsController < ApplicationChannelController
end
if !channel
render(
json: { message: 'channel not found' },
json: { message: 'channel not found' },
status: :not_found
)
return

View file

@ -12,7 +12,7 @@ class ChannelsTelegramController < ApplicationController
channel_ids.push channel.id
end
render json: {
assets: assets,
assets: assets,
channel_ids: channel_ids
}
end

View file

@ -74,10 +74,10 @@ class ChannelsTwitterController < ApplicationController
channel_ids.push channel.id
end
render json: {
assets: assets,
channel_ids: channel_ids,
assets: assets,
channel_ids: channel_ids,
external_credential_ids: external_credential_ids,
callback_url: ExternalCredential.callback_url('twitter'),
callback_url: ExternalCredential.callback_url('twitter'),
}
end

View file

@ -14,7 +14,7 @@ class ChatsController < ApplicationController
assets = setting.assets(assets)
render json: {
chat_ids: chat_ids,
assets: assets,
assets: assets,
}
end

View file

@ -8,7 +8,7 @@ module ClonesTicketArticleAttachments
existing_attachments = Store.list(
object: 'UploadCache',
o_id: params[:form_id],
o_id: params[:form_id],
)
attachments = []
article.attachments.each do |new_attachment|
@ -31,10 +31,10 @@ module ClonesTicketArticleAttachments
next if already_added == true
file = Store.add(
object: 'UploadCache',
o_id: params[:form_id],
data: new_attachment.content,
filename: new_attachment.filename,
object: 'UploadCache',
o_id: params[:form_id],
data: new_attachment.content,
filename: new_attachment.filename,
preferences: new_attachment.preferences,
)
attachments.push file

View file

@ -57,7 +57,7 @@ module CreatesTicketArticles
if form_id
article.attachments = Store.list(
object: 'UploadCache',
o_id: form_id,
o_id: form_id,
)
end
@ -69,10 +69,10 @@ module CreatesTicketArticles
# store inline attachments
attachments_inline.each do |attachment|
Store.add(
object: 'Ticket::Article',
o_id: article.id,
data: attachment[:data],
filename: attachment[:filename],
object: 'Ticket::Article',
o_id: article.id,
data: attachment[:data],
filename: attachment[:filename],
preferences: attachment[:preferences],
)
end
@ -104,10 +104,10 @@ module CreatesTicketArticles
end
Store.add(
object: 'Ticket::Article',
o_id: article.id,
data: attachment_data,
filename: attachment[:filename],
object: 'Ticket::Article',
o_id: article.id,
data: attachment_data,
filename: attachment[:filename],
preferences: preferences,
)
end
@ -116,9 +116,9 @@ module CreatesTicketArticles
# account time
if time_unit.present?
Ticket::TimeAccounting.create!(
ticket_id: article.ticket_id,
ticket_id: article.ticket_id,
ticket_article_id: article.id,
time_unit: time_unit
time_unit: time_unit
)
end
@ -133,7 +133,7 @@ module CreatesTicketArticles
# remove attachments from upload cache
Store.remove(
object: 'UploadCache',
o_id: form_id,
o_id: form_id,
)
article

View file

@ -5,11 +5,11 @@ module TicketStats
def ticket_ids_and_assets(condition, current_user, limit, assets)
tickets = Ticket.search(
limit: limit,
condition: condition,
limit: limit,
condition: condition,
current_user: current_user,
sort_by: 'created_at',
order_by: 'desc',
sort_by: 'created_at',
order_by: 'desc',
)
assets_of_tickets(tickets, assets)
end
@ -36,11 +36,11 @@ module TicketStats
.count
data = {
month: date_to_check.month,
year: date_to_check.year,
text: Date::MONTHNAMES[date_to_check.month],
month: date_to_check.month,
year: date_to_check.year,
text: Date::MONTHNAMES[date_to_check.month],
created: created,
closed: closed,
closed: closed,
}
volume_by_year.push data
end

View file

@ -7,19 +7,19 @@ class CtiController < ApplicationController
def index
backends = [
{
name: 'CTI (generic)',
name: 'CTI (generic)',
enabled: Setting.get('cti_integration'),
url: '#system/integration/cti',
url: '#system/integration/cti',
},
{
name: 'sipgate.io',
name: 'sipgate.io',
enabled: Setting.get('sipgate_integration'),
url: '#system/integration/sipgate',
url: '#system/integration/sipgate',
},
{
name: 'Placetel',
name: 'Placetel',
enabled: Setting.get('placetel_integration'),
url: '#system/integration/placetel',
url: '#system/integration/placetel',
}
]

View file

@ -48,54 +48,54 @@ class FirstStepsController < ApplicationController
result = [
{
name: 'Configuration',
name: 'Configuration',
items: [
{
name: 'Branding',
checked: true,
name: 'Branding',
checked: true,
location: '#settings/branding',
},
{
name: 'Your Email Configuration',
checked: email_active,
name: 'Your Email Configuration',
checked: email_active,
location: '#channels/email',
},
{
name: 'Invite agents/colleagues to help working on tickets',
checked: invite_agents,
name: 'Invite agents/colleagues to help working on tickets',
checked: invite_agents,
location: '#',
class: 'js-inviteAgent',
class: 'js-inviteAgent',
},
{
name: 'Invite customers to create issues in Zammad',
checked: invite_customers,
name: 'Invite customers to create issues in Zammad',
checked: invite_customers,
location: '#',
class: 'js-inviteCustomer',
class: 'js-inviteCustomer',
},
],
},
{
name: 'How to use it',
name: 'How to use it',
items: [
{
name: 'Intro',
checked: true,
name: 'Intro',
checked: true,
location: '#clues',
},
{
name: 'Create a Test Ticket',
checked: false,
name: 'Create a Test Ticket',
checked: false,
location: '#',
class: 'js-testTicket',
class: 'js-testTicket',
},
{
name: 'Create Text Modules',
checked: text_module_active,
name: 'Create Text Modules',
checked: text_module_active,
location: '#manage/text_modules',
},
{
name: 'Create Macros',
checked: macro_active,
name: 'Create Macros',
checked: macro_active,
location: '#manage/macros',
},
#{
@ -106,26 +106,26 @@ class FirstStepsController < ApplicationController
],
},
{
name: 'Additional Channels',
name: 'Additional Channels',
items: [
{
name: 'Twitter',
checked: twitter_active,
name: 'Twitter',
checked: twitter_active,
location: '#channels/twitter',
},
{
name: 'Facebook',
checked: facebook_active,
name: 'Facebook',
checked: facebook_active,
location: '#channels/facebook',
},
{
name: 'Chat',
checked: chat_active,
name: 'Chat',
checked: chat_active,
location: '#channels/chat',
},
{
name: 'Online Forms',
checked: from_active,
name: 'Online Forms',
checked: from_active,
location: '#channels/form',
},
],
@ -140,24 +140,24 @@ class FirstStepsController < ApplicationController
result = [
{
name: 'How to use it',
name: 'How to use it',
items: [
{
name: 'Intro',
checked: true,
name: 'Intro',
checked: true,
location: '#clues',
},
{
name: 'Create a Test Ticket',
checked: false,
name: 'Create a Test Ticket',
checked: false,
location: '#',
class: 'js-testTicket',
class: 'js-testTicket',
},
{
name: 'Invite customers to create issues in Zammad',
checked: invite_customers,
name: 'Invite customers to create issues in Zammad',
checked: invite_customers,
location: '#',
class: 'js-inviteCustomer',
class: 'js-inviteCustomer',
},
],
},
@ -177,27 +177,27 @@ class FirstStepsController < ApplicationController
original_user_id = UserInfo.current_user_id
result = NotificationFactory::Mailer.template(
template: 'test_ticket',
locale: agent.preferences[:locale] || Setting.get('locale_default') || 'en-us',
locale: agent.preferences[:locale] || Setting.get('locale_default') || 'en-us',
objects: {
agent: agent,
agent: agent,
customer: customer,
},
raw: true,
raw: true,
)
UserInfo.current_user_id = customer.id
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,
title: result[:subject],
title: result[:subject],
)
article = Ticket::Article.create!(
ticket_id: ticket.id,
type_id: Ticket::Article::Type.find_by(name: 'phone').id,
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
from: from,
body: result[:body],
ticket_id: ticket.id,
type_id: Ticket::Article::Type.find_by(name: 'phone').id,
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
from: from,
body: result[:body],
content_type: 'text/html',
internal: false,
internal: false,
)
UserInfo.current_user_id = original_user_id
overview = test_overview
@ -206,8 +206,8 @@ class FirstStepsController < ApplicationController
assets = overview.assets(assets)
render json: {
overview_id: overview.id,
ticket_id: ticket.id,
assets: assets,
ticket_id: ticket.id,
assets: assets,
}
end

View file

@ -85,11 +85,11 @@ class FormController < ApplicationController
if !customer
role_ids = Role.signup_role_ids
customer = User.create(
firstname: name,
lastname: '',
email: email,
active: true,
role_ids: role_ids,
firstname: name,
lastname: '',
email: email,
active: true,
role_ids: role_ids,
updated_by_id: 1,
created_by_id: 1,
)
@ -106,31 +106,31 @@ class FormController < ApplicationController
end
end
ticket = Ticket.create!(
group_id: group.id,
group_id: group.id,
customer_id: customer.id,
title: params[:title],
title: params[:title],
preferences: {
form: {
remote_ip: request.remote_ip,
remote_ip: request.remote_ip,
fingerprint_md5: Digest::MD5.hexdigest(params[:fingerprint]),
}
}
)
article = Ticket::Article.create!(
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,
body: params[:body],
subject: params[:title],
internal: false,
body: params[:body],
subject: params[:title],
internal: false,
)
params[:file]&.each do |file|
Store.add(
object: 'Ticket::Article',
o_id: article.id,
data: file.read,
filename: file.original_filename,
object: 'Ticket::Article',
o_id: article.id,
data: file.read,
filename: file.original_filename,
preferences: {
'Mime-Type' => file.content_type,
}
@ -141,7 +141,7 @@ class FormController < ApplicationController
result = {
ticket: {
id: ticket.id,
id: ticket.id,
number: ticket.number
}
}

View file

@ -41,9 +41,9 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
# return result
render json: {
setup_done: setup_done,
import_mode: Setting.get('import_mode'),
import_backend: Setting.get('import_backend'),
setup_done: setup_done,
import_mode: Setting.get('import_mode'),
import_backend: Setting.get('import_backend'),
system_online_service: Setting.get('system_online_service'),
}
end
@ -65,9 +65,9 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
auto_wizard_data = AutoWizard.data
if auto_wizard_data.blank?
render json: {
auto_wizard: true,
auto_wizard: true,
auto_wizard_success: false,
message: 'Invalid auto wizard file.',
message: 'Invalid auto wizard file.',
}
return
end
@ -75,7 +75,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
# verify auto wizard token
if auto_wizard_data['Token'] && auto_wizard_data['Token'] != params[:token]
render json: {
auto_wizard: true,
auto_wizard: true,
auto_wizard_success: false,
}
return
@ -85,9 +85,9 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
auto_wizard_admin = AutoWizard.setup
if !auto_wizard_admin
render json: {
auto_wizard: true,
auto_wizard: true,
auto_wizard_success: false,
message: 'Error during execution of auto wizard.',
message: 'Error during execution of auto wizard.',
}
return
end
@ -99,7 +99,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
Setting.set('system_init_done', true)
render json: {
auto_wizard: true,
auto_wizard: true,
auto_wizard_success: true,
}
end
@ -150,7 +150,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
if messages.present?
render json: {
result: 'invalid',
result: 'invalid',
messages: messages,
}
return
@ -181,7 +181,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
end
render json: {
result: 'ok',
result: 'ok',
settings: settings,
}
end
@ -214,14 +214,14 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
addresses = EmailAddress.where(active: true)
render json: {
setup_done: true,
import_mode: Setting.get('import_mode'),
import_backend: Setting.get('import_backend'),
setup_done: true,
import_mode: Setting.get('import_mode'),
import_backend: Setting.get('import_backend'),
system_online_service: Setting.get('system_online_service'),
addresses: addresses,
groups: groups,
config: config_to_update,
channel_driver: {
addresses: addresses,
groups: groups,
config: config_to_update,
channel_driver: {
email: EmailHelper.available_driver,
},
}

View file

@ -8,7 +8,7 @@ class ImportOtrsController < ApplicationController
# validate
if !params[:url] || params[:url] !~ %r{^(http|https)://.+?$}
render json: {
result: 'invalid',
result: 'invalid',
message: 'Invalid URL!',
}
return
@ -31,9 +31,9 @@ class ImportOtrsController < ApplicationController
end
end
render json: {
result: 'invalid',
result: 'invalid',
message_human: message_human,
message: response.error.to_s,
message: response.error.to_s,
}
return
end
@ -59,7 +59,7 @@ class ImportOtrsController < ApplicationController
if !key_parts[1]
render json: {
result: 'invalid',
result: 'invalid',
message_human: 'Unable to get key from URL!'
}
return
@ -78,22 +78,22 @@ class ImportOtrsController < ApplicationController
result = {
result: 'ok',
url: params[:url],
url: params[:url],
}
else
result = {
result: 'invalid',
result: 'invalid',
message_human: migrator_response['Error']
}
end
elsif response.body.match?(/(otrs\sag|otrs\.com|otrs\.org)/i)
result = {
result: 'invalid',
result: 'invalid',
message_human: 'Host found, but no OTRS migrator is installed!'
}
else
result = {
result: 'invalid',
result: 'invalid',
message_human: 'Host found, but it seems to be no OTRS installation!',
}
end
@ -109,7 +109,7 @@ class ImportOtrsController < ApplicationController
if !welcome
render json: {
message: 'Migrator can\'t read OTRS output!',
result: 'invalid',
result: 'invalid',
}
return
end

View file

@ -7,7 +7,7 @@ class ImportZendeskController < ApplicationController
# validate
if params[:url].blank? || params[:url] !~ %r{^(http|https)://.+?$}
render json: {
result: 'invalid',
result: 'invalid',
message: 'Invalid URL!',
}
return
@ -31,9 +31,9 @@ class ImportZendeskController < ApplicationController
end
end
render json: {
result: 'invalid',
result: 'invalid',
message_human: message_human,
message: response.error.to_s,
message: response.error.to_s,
}
return
end
@ -41,7 +41,7 @@ class ImportZendeskController < ApplicationController
# since 2016-10-15 a redirect to a marketing page has been implemented
if !response.body.match?(/#{params[:url]}/)
render json: {
result: 'invalid',
result: 'invalid',
message_human: 'Hostname not found!',
}
return
@ -53,7 +53,7 @@ class ImportZendeskController < ApplicationController
render json: {
result: 'ok',
url: params[:url],
url: params[:url],
}
end
@ -63,7 +63,7 @@ class ImportZendeskController < ApplicationController
if !params[:username] || !params[:token]
render json: {
result: 'invalid',
result: 'invalid',
message_human: 'Incomplete credentials',
}
return
@ -80,7 +80,7 @@ class ImportZendeskController < ApplicationController
Setting.set('import_zendesk_endpoint_key', nil)
render json: {
result: 'invalid',
result: 'invalid',
message_human: 'Invalid credentials!',
}
return

View file

@ -57,16 +57,16 @@ UserAgent: #{request.env['HTTP_USER_AGENT']}
article = Ticket::Article.create!(
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,
body: body,
subject: title,
internal: false,
body: body,
subject: title,
internal: false,
)
end
if (!auto_close && params[:state].match(/#{state_recovery_match}/i)) || !params[:state].match(/#{state_recovery_match}/i)
render json: {
result: 'ticket already open, added note',
result: 'ticket already open, added note',
ticket_ids: ticket_ids_found,
}
return
@ -90,35 +90,35 @@ UserAgent: #{request.env['HTTP_USER_AGENT']}
ticket.save!
end
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,
}
return
end
ticket = Ticket.create!(
group_id: group_id,
group_id: group_id,
customer_id: customer.id,
title: title,
title: title,
preferences: {
check_mk: {
host: params[:host],
host: params[:host],
service: params[:service],
},
}
)
article = Ticket::Article.create!(
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,
body: body,
subject: title,
internal: false,
body: body,
subject: title,
internal: false,
)
render json: {
result: "new ticket created (ticket id: #{ticket.id})",
ticket_id: ticket.id,
result: "new ticket created (ticket id: #{ticket.id})",
ticket_id: ticket.id,
ticket_number: ticket.number,
}
end

View file

@ -51,18 +51,18 @@ class Integration::CtiController < ApplicationController
from = row[:caller_id]
data = {
action: 'dial',
action: 'dial',
caller_id: from,
number: params[:to]
number: params[:to]
}
break
end
if data.blank? && default_caller_id.present?
from = default_caller_id
data = {
action: 'dial',
action: 'dial',
caller_id: default_caller_id,
number: params[:to]
number: params[:to]
}
end
end

View file

@ -8,7 +8,7 @@ class Integration::IdoitController < ApplicationController
def verify
response = ::Idoit.verify(params[:api_token], params[:endpoint], params[:client_id])
render json: {
result: 'ok',
result: 'ok',
response: response,
}
rescue => e
@ -23,7 +23,7 @@ class Integration::IdoitController < ApplicationController
def query
response = ::Idoit.query(params[:method], params[:filter])
render json: {
result: 'ok',
result: 'ok',
response: response,
}
rescue => e

View file

@ -42,9 +42,9 @@ class Integration::LdapController < ApplicationController
user_uid: user.uid_attribute,
# the order of these calls is relevant!
group_filter: group.filter,
groups: group.list,
group_uid: group.uid_attribute,
group_filter: group.filter,
groups: group.list,
group_uid: group.uid_attribute,
}
end
end

View file

@ -184,12 +184,12 @@ class Integration::PlacetelController < ApplicationController
api_key: config_integration[:api_token],
},
{
log: {
log: {
facility: 'placetel',
},
json: true,
open_timeout: 4,
read_timeout: 6,
json: true,
open_timeout: 4,
read_timeout: 6,
total_timeout: 6,
},
)

View file

@ -6,8 +6,8 @@ class KarmaController < ApplicationController
def index
render json: {
levels: Setting.get('karma_levels'),
user: Karma::User.by_user(current_user),
logs: Karma::ActivityLog.latest(current_user, 20),
user: Karma::User.by_user(current_user),
logs: Karma::ActivityLog.latest(current_user, 20),
}
end

View file

@ -6,7 +6,7 @@ class LinksController < ApplicationController
# GET /api/v1/links
def index
links = Link.list(
link_object: params[:link_object],
link_object: params[:link_object],
link_object_value: params[:link_object_value],
)
@ -22,7 +22,7 @@ class LinksController < ApplicationController
# return result
render json: {
links: link_list,
links: link_list,
assets: assets,
}
end
@ -37,10 +37,10 @@ class LinksController < ApplicationController
end
link = Link.add(
link_type: params[:link_type],
link_object_target: params[:link_object_target],
link_type: params[:link_type],
link_object_target: params[:link_object_target],
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,
)

View file

@ -29,12 +29,12 @@ class LongPollingController < ApplicationController
Sessions.create(client_id, session_data, { type: 'ajax' })
elsif data['event']
message = Sessions::Event.run(
event: data['event'],
payload: data,
session: session_data,
event: data['event'],
payload: data,
session: session_data,
client_id: client_id,
clients: {},
options: {},
clients: {},
options: {},
)
if message
Sessions.send(client_id, message)

View file

@ -152,7 +152,7 @@ curl http://localhost/api/v1/monitoring/health_check?token=XXX
result = {
healthy: true,
message: 'success',
token: token,
token: token,
}
render json: result
return
@ -204,19 +204,19 @@ curl http://localhost/api/v1/monitoring/status?token=XXX
end
status = {
counts: {},
counts: {},
last_created_at: {},
last_login: last_login,
agents: User.with_permissions('ticket.agent').count,
last_login: last_login,
agents: User.with_permissions('ticket.agent').count,
}
map = {
users: User,
groups: Group,
overviews: Overview,
tickets: Ticket,
users: User,
groups: Group,
overviews: Overview,
tickets: Ticket,
ticket_articles: Ticket::Article,
text_modules: TextModule,
text_modules: TextModule,
}
map.each do |key, class_name|
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 count > params[row[:param]].to_i
result = {
state: row[:notice],
state: row[:notice],
message: "The limit of #{params[row[:param]]} was exceeded with #{count} in the last #{params[:periode]}",
count: count,
count: count,
}
break
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
result = {
state: row[:notice],
state: row[:notice],
message: "The minimum of #{params[row[:param]]} was undercut by #{count} in the last #{params[:periode]}",
count: count,
count: count,
}
break
end
if result.blank?
result = {
state: 'ok',
state: 'ok',
message: '',
count: Ticket.where('created_at >= ?', created_at).count,
count: Ticket.where('created_at >= ?', created_at).count,
}
end

View file

@ -25,21 +25,21 @@ class ObjectManagerAttributesController < ApplicationController
# check if attribute already exists
exists = ObjectManager::Attribute.get(
object: permitted_params[:object],
name: permitted_params[:name],
name: permitted_params[:name],
)
raise Exceptions::UnprocessableEntity, 'already exists' if exists
begin
object_manager_attribute = ObjectManager::Attribute.add(
object: permitted_params[:object],
name: permitted_params[:name],
display: permitted_params[:display],
data_type: permitted_params[:data_type],
object: permitted_params[:object],
name: permitted_params[:name],
display: permitted_params[:display],
data_type: permitted_params[:data_type],
data_option: permitted_params[:data_option],
active: permitted_params[:active],
screens: permitted_params[:screens],
position: 1550,
editable: true,
active: permitted_params[:active],
screens: permitted_params[:screens],
position: 1550,
editable: true,
)
render json: object_manager_attribute.attributes_with_association_ids, status: :created
rescue => e
@ -52,15 +52,15 @@ class ObjectManagerAttributesController < ApplicationController
def update
object_manager_attribute = ObjectManager::Attribute.add(
object: permitted_params[:object],
name: permitted_params[:name],
display: permitted_params[:display],
data_type: permitted_params[:data_type],
object: permitted_params[:object],
name: permitted_params[:name],
display: permitted_params[:display],
data_type: permitted_params[:data_type],
data_option: permitted_params[:data_option],
active: permitted_params[:active],
screens: permitted_params[:screens],
position: 1550,
editable: true,
active: permitted_params[:active],
screens: permitted_params[:screens],
position: 1550,
editable: true,
)
render json: object_manager_attribute.attributes_with_association_ids, status: :ok
rescue => e
@ -74,7 +74,7 @@ class ObjectManagerAttributesController < ApplicationController
object_manager_attribute = ObjectManager::Attribute.find(params[:id])
ObjectManager::Attribute.remove(
object_lookup_id: object_manager_attribute.object_lookup_id,
name: object_manager_attribute.name,
name: object_manager_attribute.name,
)
model_destroy_render_item
rescue => e

View file

@ -67,7 +67,7 @@ curl http://localhost/api/v1/online_notifications.json -v -u #{login}:#{password
end
render json: {
record_ids: item_ids,
assets: assets,
assets: assets,
}, status: :ok
return
end

View file

@ -87,7 +87,7 @@ curl http://localhost/api/v1/organizations -v -u #{login}:#{password}
end
render json: {
record_ids: item_ids,
assets: assets,
assets: assets,
}, status: :ok
return
end
@ -243,11 +243,11 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co
query = query.permit!.to_h
end
query_params = {
query: query,
limit: per_page,
offset: offset,
sort_by: params[:sort_by],
order_by: params[:order_by],
query: query,
limit: per_page,
offset: offset,
sort_by: params[:sort_by],
order_by: params[:order_by],
current_user: current_user,
}
if params[:role_ids].present?
@ -289,7 +289,7 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co
# return result
render json: {
assets: assets,
assets: assets,
organization_ids: organization_ids.uniq,
}
return
@ -332,8 +332,8 @@ curl http://localhost/api/v1/organization/{id} -v -u #{login}:#{password} -H "Co
permission_check('admin.organization')
send_data(
Organization.csv_example,
filename: 'organization-example.csv',
type: 'text/csv',
filename: 'organization-example.csv',
type: 'text/csv',
disposition: 'attachment'
)
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?
result = Organization.csv_import(
string: string,
string: string,
parse_params: {
col_sep: params[:col_sep] || ',',
},
try: params[:try],
delete: params[:delete],
try: params[:try],
delete: params[:delete],
)
render json: result, status: :ok
end

View file

@ -17,7 +17,7 @@ class ProxyController < ApplicationController
)
rescue => e
render json: {
result: 'failed',
result: 'failed',
message: e.inspect
}
return
@ -29,7 +29,7 @@ class ProxyController < ApplicationController
return
end
render json: {
result: 'failed',
result: 'failed',
message: result.body || result.error || result.code
}
end

View file

@ -39,7 +39,7 @@ curl http://localhost/api/v1/recent_view -v -u #{login}:#{password} -H "Content-
end
render json: {
record_ids: item_ids,
assets: assets,
assets: assets,
}, status: :ok
return
end

View file

@ -11,7 +11,7 @@ class ReportsController < ApplicationController
return
end
render json: {
config: Report.config,
config: Report.config,
profiles: Report::Profile.list,
}
end
@ -102,8 +102,8 @@ class ReportsController < ApplicationController
content = sheet(get_params[:profile], backend[:display], result)
send_data(
content,
filename: "tickets-#{get_params[:profile].name}-#{backend[:display]}.xls",
type: 'application/vnd.ms-excel',
filename: "tickets-#{get_params[:profile].name}-#{backend[:display]}.xls",
type: 'application/vnd.ms-excel',
disposition: 'attachment'
)
end
@ -163,11 +163,11 @@ class ReportsController < ApplicationController
end
{
profile: profile,
metric: metric,
config: local_config,
start: start,
stop: stop,
range: range,
metric: metric,
config: local_config,
start: start,
stop: stop,
range: range,
}
end
@ -217,9 +217,9 @@ class ReportsController < ApplicationController
# ObjectManager attributes
header_column = 14
# needs to be skipped
objects = ObjectManager::Attribute.where(editable: true,
active: true,
to_create: false,
objects = ObjectManager::Attribute.where(editable: true,
active: true,
to_create: false,
object_lookup_id: ObjectLookup.lookup(name: 'Ticket').id)
.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 } }

View file

@ -6,8 +6,8 @@ module ExtraCollection
item = StatsStore.search(
object: 'User',
o_id: user.id,
key: 'dashboard',
o_id: user.id,
key: 'dashboard',
)
return [collections, assets] if !item

View file

@ -51,12 +51,12 @@ class SessionsController < ApplicationController
# return new session data
render status: :created,
json: {
session: user,
config: config_frontend,
models: models,
json: {
session: user,
config: config_frontend,
models: models,
collections: collections,
assets: assets,
assets: assets,
}
end
@ -74,9 +74,9 @@ class SessionsController < ApplicationController
models = SessionHelper.models()
render json: {
error: 'no valid session',
config: config_frontend,
models: models,
error: 'no valid session',
config: config_frontend,
models: models,
collections: {
Locale.to_app_model => Locale.where(active: true)
},
@ -103,11 +103,11 @@ class SessionsController < ApplicationController
# return current session
render json: {
session: user,
config: config_frontend,
models: models,
session: user,
config: config_frontend,
models: models,
collections: collections,
assets: assets,
assets: assets,
}
end
@ -206,7 +206,7 @@ class SessionsController < ApplicationController
# check user
if !params[:id]
render(
json: { message: 'no user given' },
json: { message: 'no user given' },
status: :not_found
)
return false
@ -215,7 +215,7 @@ class SessionsController < ApplicationController
user = User.find(params[:id])
if !user
render(
json: {},
json: {},
status: :not_found
)
return false
@ -232,7 +232,7 @@ class SessionsController < ApplicationController
render(
json: {
success: true,
success: true,
location: '',
},
)
@ -250,7 +250,7 @@ class SessionsController < ApplicationController
user = User.lookup(id: session[:switched_from_user_id])
if !user
render(
json: {},
json: {},
status: :not_found
)
return false
@ -270,7 +270,7 @@ class SessionsController < ApplicationController
render(
json: {
success: true,
success: true,
location: '',
},
)
@ -299,7 +299,7 @@ class SessionsController < ApplicationController
end
render json: {
sessions: sessions_clean,
assets: assets,
assets: assets,
}
end

View file

@ -39,7 +39,7 @@ class SettingsController < ApplicationController
if !clean_params[:logo]
render json: {
result: 'invalid',
result: 'invalid',
message: 'Need logo param',
}
return
@ -48,7 +48,7 @@ class SettingsController < ApplicationController
# validate image
if !clean_params[:logo].match?(/^data:image/i)
render json: {
result: 'invalid',
result: 'invalid',
message: 'Invalid payload, need data:image in logo param',
}
return
@ -58,7 +58,7 @@ class SettingsController < ApplicationController
file = StaticAssets.data_url_attributes(clean_params[:logo])
if !file[:content] || !file[:mime_type]
render json: {
result: 'invalid',
result: 'invalid',
message: 'Unable to process image upload.',
}
return
@ -80,7 +80,7 @@ class SettingsController < ApplicationController
end
render json: {
result: 'ok',
result: 'ok',
settings: [setting],
}
end

View file

@ -65,7 +65,7 @@ curl http://localhost/api/v1/slas.json -v -u #{login}:#{password}
end
render json: {
record_ids: sla_ids,
assets: assets,
assets: assets,
}, status: :ok
return
end

View file

@ -9,7 +9,7 @@ class TagsController < ApplicationController
results = []
list.each do |item|
result = {
id: item.id,
id: item.id,
value: item.name,
}
results.push result
@ -21,7 +21,7 @@ class TagsController < ApplicationController
def list
list = Tag.tag_list(
object: params[:object],
o_id: params[:o_id],
o_id: params[:o_id],
)
# return result
@ -34,8 +34,8 @@ class TagsController < ApplicationController
def add
success = Tag.tag_add(
object: params[:object],
o_id: params[:o_id],
item: params[:item],
o_id: params[:o_id],
item: params[:item],
)
if success
render json: success, status: :created
@ -48,8 +48,8 @@ class TagsController < ApplicationController
def remove
success = Tag.tag_remove(
object: params[:object],
o_id: params[:o_id],
item: params[:item],
o_id: params[:o_id],
item: params[:item],
)
if success
render json: success, status: :created
@ -65,8 +65,8 @@ class TagsController < ApplicationController
results = []
list.each do |item|
result = {
id: item.id,
name: item.name,
id: item.id,
name: item.name,
count: Tag.where(tag_item_id: item.id).count
}
results.push result
@ -85,7 +85,7 @@ class TagsController < ApplicationController
def admin_rename
permission_check('admin.tag')
Tag::Item.rename(
id: params[:id],
id: params[:id],
name: params[:name],
)
render json: {}

View file

@ -168,8 +168,8 @@ curl http://localhost/api/v1/text_modules.json -v -u #{login}:#{password} -H "Co
)
send_data(
csv_string,
filename: 'text_module-example.csv',
type: 'text/csv',
filename: 'text_module-example.csv',
type: 'text/csv',
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?
result = TextModule.csv_import(
string: string,
string: string,
parse_params: {
col_sep: params[:col_sep] || ',',
},
try: params[:try],
delete: params[:delete],
try: params[:try],
delete: params[:delete],
)
render json: result, status: :ok
end

View file

@ -66,7 +66,7 @@ class TicketArticlesController < ApplicationController
end
render json: {
record_ids: record_ids,
assets: assets,
assets: assets,
}, status: :ok
return
end
@ -196,20 +196,20 @@ class TicketArticlesController < ApplicationController
'Content-Type' => content_type
}
store = Store.add(
object: 'UploadCache',
o_id: params[:form_id],
data: file.read,
filename: file.original_filename,
object: 'UploadCache',
o_id: params[:form_id],
data: file.read,
filename: file.original_filename,
preferences: headers_store
)
# return result
render json: {
success: true,
data: {
id: store.id,
data: {
id: store.id,
filename: file.original_filename,
size: store.size,
size: store.size,
}
}
end
@ -257,8 +257,8 @@ class TicketArticlesController < ApplicationController
send_data(
file.content,
filename: file.filename,
type: file.preferences['Content-Type'] || file.preferences['Mime-Type'] || 'application/octet-stream',
filename: file.filename,
type: file.preferences['Content-Type'] || file.preferences['Mime-Type'] || 'application/octet-stream',
disposition: disposition
)
end
@ -275,8 +275,8 @@ class TicketArticlesController < ApplicationController
send_data(
file.content,
filename: file.filename,
type: 'message/rfc822',
filename: file.filename,
type: 'message/rfc822',
disposition: 'inline'
)
end
@ -296,8 +296,8 @@ class TicketArticlesController < ApplicationController
)
send_data(
csv_string,
filename: 'example.csv',
type: 'text/csv',
filename: 'example.csv',
type: 'text/csv',
disposition: 'attachment'
)
@ -325,11 +325,11 @@ class TicketArticlesController < ApplicationController
raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank?
result = Ticket::Article.csv_import(
string: string,
string: string,
parse_params: {
col_sep: ';',
},
try: params[:try],
try: params[:try],
)
render json: result, status: :ok
end

View file

@ -13,9 +13,9 @@ class TicketOverviewsController < ApplicationController
assets = {}
overview = Overview.lookup(id: index[:overview][:id])
meta = {
name: overview.name,
prio: overview.prio,
link: overview.link,
name: overview.name,
prio: overview.prio,
link: overview.link,
count: index[:count],
}
indexes.push meta
@ -42,7 +42,7 @@ class TicketOverviewsController < ApplicationController
render json: {
assets: assets,
index: result,
index: result,
}
end

View file

@ -44,7 +44,7 @@ class TicketsController < ApplicationController
end
render json: {
record_ids: item_ids,
assets: assets,
assets: assets,
}, status: :ok
return
end
@ -107,11 +107,11 @@ class TicketsController < ApplicationController
role_ids = Role.signup_role_ids
local_customer = User.create(
firstname: '',
lastname: '',
email: email,
password: '',
active: true,
role_ids: role_ids,
lastname: '',
email: email,
password: '',
active: true,
role_ids: role_ids,
)
end
clean_params[:customer_id] = local_customer.id
@ -186,10 +186,10 @@ class TicketsController < ApplicationController
object_ids.each do |local_object_id|
link = Link.add(
link_type: link_type,
link_object_target: target_object,
link_type: link_type,
link_object_target: target_object,
link_object_target_value: local_object_id,
link_object_source: 'Ticket',
link_object_source: 'Ticket',
link_object_source_value: ticket.id,
)
end
@ -281,7 +281,7 @@ class TicketsController < ApplicationController
# return result
result = Ticket::ScreenOptions.list_by_customer(
customer_id: params[:customer_id],
limit: 15,
limit: 15,
)
render json: result
end
@ -312,7 +312,7 @@ class TicketsController < ApplicationController
ticket_lists = Ticket
.where(
customer_id: ticket.customer_id,
state_id: Ticket::State.by_category(:open)
state_id: Ticket::State.by_category(:open)
)
.where(access_condition)
.where('id != ?', [ ticket.id ])
@ -353,8 +353,8 @@ class TicketsController < ApplicationController
# return result
render json: {
assets: assets,
ticket_ids_by_customer: ticket_ids_by_customer,
assets: assets,
ticket_ids_by_customer: ticket_ids_by_customer,
ticket_ids_recent_viewed: ticket_ids_recent_viewed,
}
end
@ -366,7 +366,7 @@ class TicketsController < ApplicationController
ticket_master = Ticket.find_by(number: params[:master_ticket_number])
if !ticket_master
render json: {
result: 'failed',
result: 'failed',
message: 'No such master ticket number!',
}
return
@ -377,7 +377,7 @@ class TicketsController < ApplicationController
ticket_slave = Ticket.find_by(id: params[:slave_ticket_id])
if !ticket_slave
render json: {
result: 'failed',
result: 'failed',
message: 'No such slave ticket!',
}
return
@ -386,15 +386,15 @@ class TicketsController < ApplicationController
# merge ticket
ticket_slave.merge_to(
ticket_id: ticket_master.id,
ticket_id: ticket_master.id,
created_by_id: current_user.id,
)
# return result
render json: {
result: 'success',
result: 'success',
master_ticket: ticket_master.attributes,
slave_ticket: ticket_slave.attributes,
slave_ticket: ticket_slave.attributes,
}
end
@ -409,7 +409,7 @@ class TicketsController < ApplicationController
assets = article.assets(assets)
render json: {
assets: assets,
assets: assets,
attachments: article_attachments_clone(article),
}
end
@ -448,12 +448,12 @@ class TicketsController < ApplicationController
# build result list
tickets = Ticket.search(
query: query,
condition: params[:condition].to_h,
limit: per_page,
offset: offset,
order_by: params[:order_by],
sort_by: params[:sort_by],
query: query,
condition: params[:condition].to_h,
limit: per_page,
offset: offset,
order_by: params[:order_by],
sort_by: params[:sort_by],
current_user: current_user,
)
@ -475,9 +475,9 @@ class TicketsController < ApplicationController
# return result
render json: {
tickets: ticket_result,
tickets: ticket_result,
tickets_count: tickets.count,
assets: assets,
assets: assets,
}
end
@ -496,9 +496,9 @@ class TicketsController < ApplicationController
# return result
render json: {
ticket_ids: ticket_ids,
ticket_ids: ticket_ids,
ticket_count: ticket_count || 0,
assets: assets,
assets: assets,
}
end
@ -523,23 +523,23 @@ class TicketsController < ApplicationController
conditions = {
closed_ids: {
'ticket.state_id' => {
'ticket.state_id' => {
operator: 'is',
value: Ticket::State.by_category(:closed).pluck(:id),
value: Ticket::State.by_category(:closed).pluck(:id),
},
'ticket.customer_id' => {
operator: 'is',
value: user.id,
value: user.id,
},
},
open_ids: {
'ticket.state_id' => {
open_ids: {
'ticket.state_id' => {
operator: 'is',
value: Ticket::State.by_category(:open).pluck(:id),
value: Ticket::State.by_category(:open).pluck(:id),
},
'ticket.customer_id' => {
operator: 'is',
value: user.id,
value: user.id,
},
},
}
@ -565,23 +565,23 @@ class TicketsController < ApplicationController
conditions = {
closed_ids: {
'ticket.state_id' => {
'ticket.state_id' => {
operator: 'is',
value: Ticket::State.by_category(:closed).pluck(:id),
value: Ticket::State.by_category(:closed).pluck(:id),
},
'ticket.organization_id' => {
operator: 'is',
value: organization.id,
value: organization.id,
},
},
open_ids: {
'ticket.state_id' => {
open_ids: {
'ticket.state_id' => {
operator: 'is',
value: Ticket::State.by_category(:open).pluck(:id),
value: Ticket::State.by_category(:open).pluck(:id),
},
'ticket.organization_id' => {
operator: 'is',
value: organization.id,
value: organization.id,
},
},
}
@ -598,9 +598,9 @@ class TicketsController < ApplicationController
# return result
render json: {
user: user_tickets,
user: user_tickets,
organization: org_tickets,
assets: assets,
assets: assets,
}
end
@ -619,8 +619,8 @@ class TicketsController < ApplicationController
)
send_data(
csv_string,
filename: 'example.csv',
type: 'text/csv',
filename: 'example.csv',
type: 'text/csv',
disposition: 'attachment'
)
@ -648,11 +648,11 @@ class TicketsController < ApplicationController
raise Exceptions::UnprocessableEntity, 'No source data submitted!' if string.blank?
result = Ticket.csv_import(
string: string,
string: string,
parse_params: {
col_sep: params[:col_sep] || ',',
},
try: params[:try],
try: params[:try],
)
render json: result, status: :ok
end
@ -693,7 +693,7 @@ class TicketsController < ApplicationController
# get links
links = Link.list(
link_object: 'Ticket',
link_object: 'Ticket',
link_object_value: ticket.id,
)
link_list = []
@ -710,12 +710,12 @@ class TicketsController < ApplicationController
# return result
{
ticket_id: ticket.id,
ticket_id: ticket.id,
ticket_article_ids: article_ids,
assets: assets,
links: link_list,
tags: tags,
form_meta: attributes_to_change[:form_meta],
assets: assets,
links: link_list,
tags: tags,
form_meta: attributes_to_change[:form_meta],
}
end

View file

@ -16,7 +16,7 @@ class TimeAccountingsController < ApplicationController
if !time_unit[record[0]]
time_unit[record[0]] = {
time_unit: 0,
agent_id: record[2],
agent_id: record[2],
}
end
time_unit[record[0]][:time_unit] += record[1]
@ -55,11 +55,11 @@ class TimeAccountingsController < ApplicationController
end
end
result = {
ticket: ticket.attributes,
time_unit: local_time_unit[:time_unit],
customer: customers[ticket.customer_id],
ticket: ticket.attributes,
time_unit: local_time_unit[:time_unit],
customer: customers[ticket.customer_id],
organization: organizations[ticket.organization_id],
agent: agents[local_time_unit[:agent_id]],
agent: agents[local_time_unit[:agent_id]],
}
results.push result
end
@ -67,105 +67,105 @@ class TimeAccountingsController < ApplicationController
if params[:download]
header = [
{
name: 'Ticket#',
name: 'Ticket#',
width: 15,
},
{
name: 'Title',
name: 'Title',
width: 30,
},
{
name: 'Customer',
name: 'Customer',
width: 20,
},
{
name: 'Organization',
name: 'Organization',
width: 20,
},
{
name: 'Agent',
name: 'Agent',
width: 20,
},
{
name: 'Time Units',
name: 'Time Units',
width: 10,
},
{
name: 'Time Units Total',
name: 'Time Units Total',
width: 10,
},
{
name: 'Created at',
name: 'Created at',
width: 10,
},
{
name: 'Closed at',
name: 'Closed at',
width: 10,
},
{
name: 'Close Escalation At',
name: 'Close Escalation At',
width: 10,
},
{
name: 'Close In Min',
name: 'Close In Min',
width: 10,
},
{
name: 'Close Diff In Min',
name: 'Close Diff In Min',
width: 10,
},
{
name: 'First Response At',
name: 'First Response At',
width: 10,
},
{
name: 'First Response Escalation At',
name: 'First Response Escalation At',
width: 10,
},
{
name: 'First Response In Min',
name: 'First Response In Min',
width: 10,
},
{
name: 'First Response Diff In Min',
name: 'First Response Diff In Min',
width: 10,
},
{
name: 'Update Escalation At',
name: 'Update Escalation At',
width: 10,
},
{
name: 'Update In Min',
name: 'Update In Min',
width: 10,
},
{
name: 'Update Diff In Min',
name: 'Update Diff In Min',
width: 10,
},
{
name: 'Last Contact At',
name: 'Last Contact At',
width: 10,
},
{
name: 'Last Contact Agent At',
name: 'Last Contact Agent At',
width: 10,
},
{
name: 'Last Contact Customer At',
name: 'Last Contact Customer At',
width: 10,
},
{
name: 'Article Count',
name: 'Article Count',
width: 10,
},
{
name: 'Escalation At',
name: 'Escalation At',
width: 10,
},
]
objects = ObjectManager::Attribute.where(editable: true,
active: true,
to_create: false,
objects = ObjectManager::Attribute.where(editable: true,
active: true,
to_create: false,
object_lookup_id: ObjectLookup.lookup(name: 'Ticket').id)
.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 } }
@ -233,8 +233,8 @@ class TimeAccountingsController < ApplicationController
content = sheet("By Ticket #{year}-#{month}", header, result)
send_data(
content,
filename: "by_ticket-#{year}-#{month}.xls",
type: 'application/vnd.ms-excel',
filename: "by_ticket-#{year}-#{month}.xls",
type: 'application/vnd.ms-excel',
disposition: 'attachment'
)
return
@ -256,7 +256,7 @@ class TimeAccountingsController < ApplicationController
if !time_unit[record[0]]
time_unit[record[0]] = {
time_unit: 0,
agent_id: record[2],
agent_id: record[2],
}
end
time_unit[record[0]][:time_unit] += record[1]
@ -273,9 +273,9 @@ class TimeAccountingsController < ApplicationController
organization = Organization.lookup(id: ticket.organization_id).attributes
end
customers[ticket.customer_id] = {
customer: User.lookup(id: ticket.customer_id).attributes,
customer: User.lookup(id: ticket.customer_id).attributes,
organization: organization,
time_unit: local_time_unit[:time_unit],
time_unit: local_time_unit[:time_unit],
}
next
end
@ -289,15 +289,15 @@ class TimeAccountingsController < ApplicationController
if params[:download]
header = [
{
name: 'Customer',
name: 'Customer',
width: 30,
},
{
name: 'Organization',
name: 'Organization',
width: 30,
},
{
name: 'Time Units',
name: 'Time Units',
width: 10,
}
]
@ -314,8 +314,8 @@ class TimeAccountingsController < ApplicationController
content = sheet("By Customer #{year}-#{month}", header, result)
send_data(
content,
filename: "by_customer-#{year}-#{month}.xls",
type: 'application/vnd.ms-excel',
filename: "by_customer-#{year}-#{month}.xls",
type: 'application/vnd.ms-excel',
disposition: 'attachment'
)
return
@ -337,7 +337,7 @@ class TimeAccountingsController < ApplicationController
if !time_unit[record[0]]
time_unit[record[0]] = {
time_unit: 0,
agent_id: record[2],
agent_id: record[2],
}
end
time_unit[record[0]][:time_unit] += record[1]
@ -352,7 +352,7 @@ class TimeAccountingsController < ApplicationController
if !organizations[ticket.organization_id]
organizations[ticket.organization_id] = {
organization: Organization.lookup(id: ticket.organization_id).attributes,
time_unit: local_time_unit[:time_unit],
time_unit: local_time_unit[:time_unit],
}
next
end
@ -366,11 +366,11 @@ class TimeAccountingsController < ApplicationController
if params[:download]
header = [
{
name: 'Organization',
name: 'Organization',
width: 40,
},
{
name: 'Time Units',
name: 'Time Units',
width: 20,
}
]
@ -386,8 +386,8 @@ class TimeAccountingsController < ApplicationController
content = sheet("By Organization #{year}-#{month}", header, result)
send_data(
content,
filename: "by_organization-#{year}-#{month}.xls",
type: 'application/vnd.ms-excel',
filename: "by_organization-#{year}-#{month}.xls",
type: 'application/vnd.ms-excel',
disposition: 'attachment'
)
return

View file

@ -61,7 +61,7 @@ curl http://localhost/api/v1/user_access_token -v -u #{login}:#{password}
end
render json: {
tokens: token_list,
tokens: token_list,
permissions: permissions,
}, status: :ok
end

View file

@ -52,7 +52,7 @@ class UsersController < ApplicationController
end
render json: {
record_ids: item_ids,
assets: assets,
assets: assets,
}, status: :ok
return
end
@ -211,10 +211,10 @@ class UsersController < ApplicationController
token = Token.create(action: 'PasswordReset', user_id: user.id)
NotificationFactory::Mailer.notification(
template: 'user_invite',
user: user,
objects: {
token: token,
user: user,
user: user,
objects: {
token: token,
user: user,
current_user: current_user,
}
)
@ -225,8 +225,8 @@ class UsersController < ApplicationController
result = User.signup_new_token(user)
NotificationFactory::Mailer.notification(
template: 'signup',
user: user,
objects: result,
user: user,
objects: result,
)
end
@ -389,10 +389,10 @@ class UsersController < ApplicationController
# build result list
tickets = Ticket.search(
query: query,
condition: params[:condition].to_h,
limit: per_page,
offset: offset,
query: query,
condition: params[:condition].to_h,
limit: per_page,
offset: offset,
current_user: current_user,
)
@ -402,11 +402,11 @@ class UsersController < ApplicationController
end
query_params = {
query: query,
limit: per_page,
offset: offset,
sort_by: params[:sort_by],
order_by: params[:order_by],
query: query,
limit: per_page,
offset: offset,
sort_by: params[:sort_by],
order_by: params[:order_by],
current_user: current_user,
}
%i[role_ids permissions].each do |key|
@ -464,7 +464,7 @@ class UsersController < ApplicationController
# return result
render json: {
assets: assets,
assets: assets,
user_ids: user_ids.uniq,
}
return
@ -577,8 +577,8 @@ curl http://localhost/api/v1/users/email_verify_send -v -u #{login}:#{password}
user = result[:user]
NotificationFactory::Mailer.notification(
template: 'signup',
user: user,
objects: result
user: user,
objects: result
)
# 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]
NotificationFactory::Mailer.notification(
template: 'password_reset',
user: user,
objects: result
user: user,
objects: result
)
# 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
NotificationFactory::Mailer.notification(
template: 'password_change',
user: user,
objects: {
user: user,
user: user,
objects: {
user: 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(
template: 'password_change',
user: user,
objects: {
user: user,
user: user,
objects: {
user: 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
record = Authorization.where(
user_id: current_user.id,
user_id: current_user.id,
provider: params[:provider],
uid: params[:uid],
uid: params[:uid],
)
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
send_data(
file.content,
filename: file.filename,
type: file.preferences['Content-Type'] || file.preferences['Mime-Type'],
filename: file.filename,
type: file.preferences['Content-Type'] || file.preferences['Mime-Type'],
disposition: 'inline'
)
return
@ -918,8 +918,8 @@ curl http://localhost/api/v1/users/image/8d6cca1c6bdc226cf2ba131e264ca2c7 -v -u
image = 'R0lGODdhMAAwAOMAAMzMzJaWlr6+vqqqqqOjo8XFxbe3t7GxsZycnAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAMAAwAAAEcxDISau9OOvNu/9gKI5kaZ5oqq5s675wLM90bd94ru98TwuAA+KQAQqJK8EAgBAgMEqmkzUgBIeSwWGZtR5XhSqAULACCoGCJGwlm1MGQrq9RqgB8fm4ZTUgDBIEcRR9fz6HiImKi4yNjo+QkZKTlJWWkBEAOw=='
send_data(
Base64.decode64(image),
filename: 'image.gif',
type: 'image/gif',
filename: 'image.gif',
type: 'image/gif',
disposition: 'inline'
)
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])
avatar = Avatar.add(
object: 'User',
o_id: current_user.id,
full: {
content: file_full[:content],
object: 'User',
o_id: current_user.id,
full: {
content: file_full[:content],
mime_type: file_full[:mime_type],
},
resize: {
content: file_resize[:content],
resize: {
content: file_resize[:content],
mime_type: file_resize[:mime_type],
},
source: 'upload ' + Time.zone.now.to_s,
source: 'upload ' + Time.zone.now.to_s,
deletable: true,
)
@ -1026,8 +1026,8 @@ curl http://localhost/api/v1/users/avatar -v -u #{login}:#{password} -H "Content
permission_check('admin.user')
send_data(
User.csv_example,
filename: 'user-example.csv',
type: 'text/csv',
filename: 'user-example.csv',
type: 'text/csv',
disposition: 'attachment'
)
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?
result = User.csv_import(
string: string,
string: string,
parse_params: {
col_sep: params[:col_sep] || ',',
},
try: params[:try],
delete: params[:delete],
try: params[:try],
delete: params[:delete],
)
render json: result, status: :ok
end

View file

@ -54,11 +54,11 @@ add a new activity entry for an object
# check newest entry - is needed
result = ActivityStream.where(
o_id: data[:o_id],
o_id: data[:o_id],
#:activity_stream_type_id => type_id,
permission_id: permission_id,
permission_id: permission_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
# resturn if old entry is really fresh
@ -69,13 +69,13 @@ add a new activity entry for an object
# create history
record = {
o_id: data[:o_id],
activity_stream_type_id: type_id,
o_id: data[:o_id],
activity_stream_type_id: type_id,
activity_stream_object_id: object_id,
permission_id: permission_id,
group_id: data[:group_id],
created_at: data[:created_at],
created_by_id: data[:created_by_id]
permission_id: permission_id,
group_id: data[:group_id],
created_at: data[:created_at],
created_by_id: data[:created_by_id]
}
ActivityStream.create(record)
@ -93,7 +93,7 @@ remove whole activity entries of an object
object_id = ObjectLookup.by_name(object_name)
ActivityStream.where(
activity_stream_object_id: object_id,
o_id: o_id,
o_id: o_id,
).destroy_all
end

View file

@ -118,7 +118,7 @@ return object and assets
object = find(id)
assets = object.assets({})
{
id: object.id,
id: object.id,
assets: assets,
}
end

View file

@ -61,11 +61,11 @@ store attachments for this object
article_store = []
attachments_buffer.each do |attachment|
article_store.push Store.add(
object: self.class.to_s,
o_id: id,
data: attachment.content,
filename: attachment.filename,
preferences: attachment.preferences,
object: self.class.to_s,
o_id: id,
data: attachment.content,
filename: attachment.filename,
preferences: attachment.preferences,
created_by_id: created_by_id,
)
end

View file

@ -15,7 +15,7 @@ class Authorization < ApplicationModel
# update auth tokens
auth.update!(
token: hash['credentials']['token'],
token: hash['credentials']['token'],
secret: hash['credentials']['secret']
)
@ -40,11 +40,11 @@ class Authorization < ApplicationModel
# update image if needed
if hash['info']['image'].present?
avatar = Avatar.add(
object: 'User',
o_id: user.id,
url: hash['info']['image'],
source: hash['provider'],
deletable: true,
object: 'User',
o_id: user.id,
url: hash['info']['image'],
source: hash['provider'],
deletable: true,
updated_by_id: user.id,
created_by_id: user.id,
)
@ -75,11 +75,11 @@ class Authorization < ApplicationModel
# save/update avatar
if hash['info'].present? && hash['info']['image'].present?
avatar = Avatar.add(
object: 'User',
o_id: user.id,
url: hash['info']['image'],
source: hash['provider'],
deletable: true,
object: 'User',
o_id: user.id,
url: hash['info']['image'],
source: hash['provider'],
deletable: true,
updated_by_id: user.id,
created_by_id: user.id,
)
@ -92,12 +92,12 @@ class Authorization < ApplicationModel
end
Authorization.create!(
user: user,
uid: hash['uid'],
user: user,
uid: hash['uid'],
username: hash['info']['nickname'] || hash['info']['username'] || hash['info']['name'] || hash['info']['email'] || hash['username'],
provider: hash['provider'],
token: hash['credentials']['token'],
secret: hash['credentials']['secret']
token: hash['credentials']['token'],
secret: hash['credentials']['secret']
)
end

View file

@ -24,11 +24,11 @@ add an avatar based on auto detection (email address)
return if data[:url].blank?
Avatar.add(
object: data[:object],
o_id: data[:o_id],
url: data[:url],
source: 'zammad.com',
deletable: false,
object: data[:object],
o_id: data[:o_id],
url: data[:url],
source: 'zammad.com',
deletable: false,
updated_by_id: 1,
created_by_id: 1,
)
@ -82,15 +82,15 @@ add avatar by url
_add_init_avatar(object_id, data[:o_id])
record = {
o_id: data[:o_id],
o_id: data[:o_id],
object_lookup_id: object_id,
default: true,
deletable: data[:deletable],
initial: false,
source: data[:source],
source_url: data[:url],
updated_by_id: data[:updated_by_id],
created_by_id: data[:created_by_id],
default: true,
deletable: data[:deletable],
initial: false,
source: data[:source],
source_url: data[:url],
updated_by_id: data[:updated_by_id],
created_by_id: data[:created_by_id],
}
# check if avatar with url already exists
@ -98,8 +98,8 @@ add avatar by url
if data[:source].present?
avatar_already_exists = Avatar.find_by(
object_lookup_id: object_id,
o_id: data[:o_id],
source: data[:source],
o_id: data[:o_id],
source: data[:source],
)
end
@ -142,8 +142,8 @@ add avatar by url
url,
{},
{
open_timeout: 4,
read_timeout: 6,
open_timeout: 4,
read_timeout: 6,
total_timeout: 6,
},
)
@ -198,11 +198,11 @@ add avatar by url
object_name = "Avatar::#{data[:object]}"
if data[:full].present?
store_full = Store.add(
object: "#{object_name}::Full",
o_id: data[:o_id],
data: data[:full][:content],
filename: 'avatar_full',
preferences: {
object: "#{object_name}::Full",
o_id: data[:o_id],
data: data[:full][:content],
filename: 'avatar_full',
preferences: {
'Mime-Type' => data[:full][:mime_type]
},
created_by_id: data[:created_by_id],
@ -212,11 +212,11 @@ add avatar by url
end
if data[:resize].present?
store_resize = Store.add(
object: "#{object_name}::Resize",
o_id: data[:o_id],
data: data[:resize][:content],
filename: 'avatar',
preferences: {
object: "#{object_name}::Resize",
o_id: data[:o_id],
data: data[:resize][:content],
filename: 'avatar',
preferences: {
'Mime-Type' => data[:resize][:mime_type]
},
created_by_id: data[:created_by_id],
@ -253,8 +253,8 @@ set avatars as default
object_id = ObjectLookup.by_name(object_name)
avatar = Avatar.find_by(
object_lookup_id: object_id,
o_id: o_id,
id: avatar_id,
o_id: o_id,
id: avatar_id,
)
avatar.default = true
avatar.save!
@ -277,17 +277,17 @@ remove all avatars of an object
object_id = ObjectLookup.by_name(object_name)
Avatar.where(
object_lookup_id: object_id,
o_id: o_id,
o_id: o_id,
).destroy_all
object_name_store = "Avatar::#{object_name}"
Store.remove(
object: "#{object_name_store}::Full",
o_id: o_id,
o_id: o_id,
)
Store.remove(
object: "#{object_name_store}::Resize",
o_id: o_id,
o_id: o_id,
)
end
@ -303,8 +303,8 @@ remove one avatars of an object
object_id = ObjectLookup.by_name(object_name)
Avatar.where(
object_lookup_id: object_id,
o_id: o_id,
id: avatar_id,
o_id: o_id,
id: avatar_id,
).destroy_all
end
@ -322,7 +322,7 @@ return all avatars of an user
object_id = ObjectLookup.by_name(object_name)
avatars = Avatar.where(
object_lookup_id: object_id,
o_id: o_id,
o_id: o_id,
).order('initial DESC, deletable ASC, created_at ASC, id DESC')
# add initial avatar
@ -379,15 +379,15 @@ returns:
object_id = ObjectLookup.by_name(object_name)
Avatar.find_by(
object_lookup_id: object_id,
o_id: o_id,
default: true,
o_id: o_id,
default: true,
)
end
def self.set_default_items(object_id, o_id, avatar_id)
avatars = Avatar.where(
object_lookup_id: object_id,
o_id: o_id,
o_id: o_id,
).order('created_at ASC, id DESC')
avatars.each do |avatar|
next if avatar.id == avatar_id
@ -401,7 +401,7 @@ returns:
count = Avatar.where(
object_lookup_id: object_id,
o_id: o_id,
o_id: o_id,
).count
return if count.positive?
@ -409,14 +409,14 @@ returns:
return if !object_name.constantize.exists?(id: o_id)
Avatar.create!(
o_id: o_id,
o_id: o_id,
object_lookup_id: object_id,
default: true,
source: 'init',
initial: true,
deletable: false,
updated_by_id: 1,
created_by_id: 1,
default: true,
source: 'init',
initial: true,
deletable: false,
updated_by_id: 1,
created_by_id: 1,
)
end
end

View file

@ -187,9 +187,9 @@ returns
# create new entry
public_holidays[day] = {
active: true,
active: true,
summary: summary,
feed: Digest::MD5.hexdigest(ical_url)
feed: Digest::MD5.hexdigest(ical_url)
}
end
self.last_log = nil

View file

@ -179,7 +179,7 @@ stream all accounts
next if @@channel_stream[channel_id].present?
@@channel_stream[channel_id] = {
options: channel.options,
options: channel.options,
started_at: Time.zone.now,
}

View file

@ -156,7 +156,7 @@ example
end
disconnect
return {
result: 'ok',
result: 'ok',
content_messages: content_messages,
}
end
@ -253,9 +253,9 @@ example
end
Rails.logger.info 'done'
{
result: 'ok',
result: 'ok',
fetched: count_fetched,
notice: notice,
notice: notice,
}
end

View file

@ -101,7 +101,7 @@ returns
end
disconnect
return {
result: 'ok',
result: 'ok',
content_messages: content_messages,
}
end
@ -164,9 +164,9 @@ returns
end
Rails.logger.info 'done'
{
result: 'ok',
result: 'ok',
fetched: count_fetched,
notice: notice,
notice: notice,
}
end

View file

@ -24,8 +24,8 @@ class Channel::Driver::Sms::Massenversand
def self.definition
{
name: 'Massenversand',
adapter: 'sms/massenversand',
name: 'Massenversand',
adapter: 'sms/massenversand',
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::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)
params = {
authToken: options[:token],
getID: 1,
msg: attr[:message],
msgtype: 'c',
receiver: attr[:recipient],
sender: options[:sender]
getID: 1,
msg: attr[:message],
msgtype: 'c',
receiver: attr[:recipient],
sender: options[:sender]
}
options[:gateway] + '?' + URI.encode_www_form(params)

View file

@ -15,7 +15,7 @@ class Channel::Driver::Sms::Twilio
if Setting.get('developer_mode') != true
result = api(options).messages.create(
from: options[:sender],
to: attr[:recipient],
to: attr[:recipient],
body: attr[:message],
)
@ -50,7 +50,7 @@ class Channel::Driver::Sms::Twilio
if !user
user = User.create!(
firstname: attr[:From],
mobile: attr[:From],
mobile: attr[:From],
)
end
@ -81,17 +81,17 @@ class Channel::Driver::Sms::Twilio
title = "#{title[0, 40]}..."
end
ticket = Ticket.new(
group_id: channel.group_id,
title: title,
state_id: Ticket::State.find_by(default_create: true).id,
group_id: channel.group_id,
title: title,
state_id: Ticket::State.find_by(default_create: true).id,
priority_id: Ticket::Priority.find_by(default_create: true).id,
customer_id: user.id,
preferences: {
channel_id: channel.id,
sms: {
sms: {
AccountSid: attr['AccountSid'],
From: attr['From'],
To: attr['To'],
From: attr['From'],
To: attr['To'],
}
}
)
@ -99,20 +99,20 @@ class Channel::Driver::Sms::Twilio
end
Ticket::Article.create!(
ticket_id: ticket.id,
type: article_type_sms,
sender: Ticket::Article::Sender.find_by(name: 'Customer'),
body: attr[:Body],
from: attr[:From],
to: attr[:To],
message_id: attr[:SmsMessageSid],
ticket_id: ticket.id,
type: article_type_sms,
sender: Ticket::Article::Sender.find_by(name: 'Customer'),
body: attr[:Body],
from: attr[:From],
to: attr[:To],
message_id: attr[:SmsMessageSid],
content_type: 'text/plain',
preferences: {
preferences: {
channel_id: channel.id,
sms: {
sms: {
AccountSid: attr['AccountSid'],
From: attr['From'],
To: attr['To'],
From: attr['From'],
To: attr['To'],
}
}
)
@ -122,9 +122,9 @@ class Channel::Driver::Sms::Twilio
def self.definition
{
name: 'twilio',
adapter: 'sms/twilio',
account: [
name: 'twilio',
adapter: 'sms/twilio',
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::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 },

View file

@ -63,10 +63,10 @@ class Channel::Driver::Smtp
mail = Channel::EmailBuild.build(attr, notification)
smtp_params = {
openssl_verify_mode: options[:openssl_verify_mode],
address: options[:host],
port: options[:port],
domain: options[:domain],
openssl_verify_mode: options[:openssl_verify_mode],
address: options[:host],
port: options[:port],
domain: options[:domain],
enable_starttls_auto: options[:enable_starttls_auto],
}

View file

@ -114,8 +114,8 @@ module Channel::EmailBuild
content_type = attachment.preferences['Content-Type'] || attachment.preferences['Mime-Type'] || 'application/octet-stream'
mail.attachments[attachment.filename] = {
content_disposition: "#{disposition}; filename=\"#{encoded_filename}\"",
content_type: "#{content_type}; filename=\"#{encoded_filename}\"",
content: attachment.content
content_type: "#{content_type}; filename=\"#{encoded_filename}\"",
content: attachment.content
}
end
end

View file

@ -3,7 +3,7 @@
# encoding: utf-8
class Channel::EmailParser
EMAIL_REGEX = /.+@.+/
EMAIL_REGEX = /.+@.+/.freeze
RECIPIENT_FIELDS = %w[to cc delivered-to x-original-to envelope-to].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
@ -234,8 +234,8 @@ returns
title = '-'
end
ticket = Ticket.new(
group_id: group.id,
title: title,
group_id: group.id,
title: title,
preferences: preferences,
)
set_attributes_by_x_headers(ticket, 'ticket', mail)
@ -255,18 +255,18 @@ returns
# set attributes
ticket.with_lock do
article = Ticket::Article.new(
ticket_id: ticket.id,
type_id: Ticket::Article::Type.find_by(name: 'email').id,
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
ticket_id: ticket.id,
type_id: Ticket::Article::Type.find_by(name: 'email').id,
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
content_type: mail[:content_type],
body: mail[:body],
from: mail[:from],
reply_to: mail[:"reply-to"],
to: mail[:to],
cc: mail[:cc],
subject: mail[:subject],
message_id: mail[:message_id],
internal: false,
body: mail[:body],
from: mail[:from],
reply_to: mail[:"reply-to"],
to: mail[:to],
cc: mail[:cc],
subject: mail[:subject],
message_id: mail[:message_id],
internal: false,
)
# x-headers lookup
@ -285,10 +285,10 @@ returns
filename = filename.utf8_encode(fallback: :read_as_sanitized_binary)
end
Store.add(
object: 'Ticket::Article',
o_id: article.id,
data: attachment[:data],
filename: filename,
object: 'Ticket::Article',
o_id: article.id,
data: attachment[:data],
filename: filename,
preferences: attachment[:preferences]
)
end
@ -699,13 +699,13 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
if filename.blank?
map = {
'message/delivery-status': ['txt', 'delivery-status'],
'text/plain': %w[txt document],
'text/html': %w[html document],
'video/quicktime': %w[mov video],
'image/jpeg': %w[jpg image],
'image/jpg': %w[jpg image],
'image/png': %w[png image],
'image/gif': %w[gif image],
'text/plain': %w[txt document],
'text/html': %w[html document],
'video/quicktime': %w[mov video],
'image/jpeg': %w[jpg image],
'image/jpg': %w[jpg image],
'image/png': %w[png image],
'image/gif': %w[gif image],
}
map.each do |type, ext|
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)
attach = {
data: file.body.to_s,
filename: filename,
data: file.body.to_s,
filename: filename,
preferences: headers_store,
}

View file

@ -18,7 +18,7 @@ module Channel::Filter::FollowUpMerged
return if ticket.state.name != 'merged'
links = Link.list(
link_object: 'Ticket',
link_object: 'Ticket',
link_object_value: ticket.id
)
return if links.blank?

View file

@ -38,9 +38,9 @@ module Channel::Filter::IdentifySender
next if EmailAddress.find_by(email: item.address.downcase)
customer_user = user_create(
login: item.address,
login: item.address,
firstname: item.display_name,
email: item.address,
email: item.address,
)
break
end
@ -54,10 +54,10 @@ module Channel::Filter::IdentifySender
# take regular from as customer
if !customer_user
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],
lastname: mail[ 'x-zammad-customer-lastname'.to_sym ],
email: mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email],
lastname: mail[ 'x-zammad-customer-lastname'.to_sym ],
email: mail[ 'x-zammad-customer-email'.to_sym ] || mail[:from_email],
)
end
@ -77,10 +77,10 @@ module Channel::Filter::IdentifySender
end
if !session_user
session_user = user_create(
login: mail[:from_email],
login: mail[:from_email],
firstname: mail[:from_display_name],
lastname: '',
email: mail[:from_email],
lastname: '',
email: mail[:from_email],
)
end
if session_user
@ -109,8 +109,8 @@ module Channel::Filter::IdentifySender
user_create(
firstname: address_data.display_name,
lastname: '',
email: email_address,
lastname: '',
email: email_address,
)
current_count += 1
return false if current_count == max_count
@ -137,8 +137,8 @@ module Channel::Filter::IdentifySender
user_create(
firstname: display_name,
lastname: '',
email: address,
lastname: '',
email: address,
)
current_count += 1
return false if current_count == max_count
@ -161,18 +161,18 @@ module Channel::Filter::IdentifySender
def self.populate_attributes!(attrs, **extras)
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_data: Time.zone.now }
mail_delivery_failed_data: Time.zone.now }
end
attrs.merge!(
email: sanitize_email(attrs[:email]),
firstname: sanitize_name(attrs[:firstname]),
lastname: sanitize_name(attrs[:lastname]),
password: '',
active: true,
role_ids: extras[:role_ids] || Role.signup_role_ids,
email: sanitize_email(attrs[:email]),
firstname: sanitize_name(attrs[:firstname]),
lastname: sanitize_name(attrs[:lastname]),
password: '',
active: true,
role_ids: extras[:role_ids] || Role.signup_role_ids,
updated_by_id: 1,
created_by_id: 1
)

View file

@ -21,7 +21,7 @@ class Chat < ApplicationModel
url = "#{Setting.get('http_type')}://#{Setting.get('fqdn')}/api/v1/users/image/#{chat_user.image}"
end
user = {
name: chat_user.fullname,
name: chat_user.fullname,
avatar: url,
}
@ -29,15 +29,15 @@ class Chat < ApplicationModel
session = Chat::Session.messages_by_session_id(session_id)
if session
return {
state: 'reconnect',
state: 'reconnect',
session: session,
agent: user,
agent: user,
}
end
end
elsif chat_session.state == 'waiting'
return {
state: 'reconnect',
state: 'reconnect',
position: chat_session.position,
}
end
@ -84,16 +84,16 @@ class Chat < ApplicationModel
assets = user.assets(assets)
end
{
waiting_chat_count: waiting_chat_count,
waiting_chat_count: waiting_chat_count,
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,
active_agent_count: active_agent_count,
active_agent_ids: active_agent_ids,
seads_available: seads_available,
seads_total: seads_total,
active: Chat::Agent.state(user_id),
assets: assets,
active_agent_count: active_agent_count,
active_agent_ids: active_agent_ids,
seads_available: seads_available,
seads_total: seads_total,
active: Chat::Agent.state(user_id),
assets: assets,
}
end
@ -188,7 +188,7 @@ optional you can ignore it for dedecated user
data = {
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)
end
@ -210,9 +210,9 @@ broadcast new customer queue position to all waiting customers
position += 1
data = {
event: 'chat_session_queue',
data: {
state: 'queue',
position: position,
data: {
state: 'queue',
position: position,
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
message = {
event: 'chat_session_closed',
data: {
data: {
session_id: chat_session.session_id,
realname: 'System',
realname: 'System',
},
}
chat_session.send_to_recipients(message)

View file

@ -23,7 +23,7 @@ class Chat::Agent < ApplicationModel
chat_agent.save
else
Chat::Agent.create(
active: state,
active: state,
updated_by_id: user_id,
created_by_id: user_id,
)

View file

@ -29,7 +29,7 @@ returns if user has no permissions to search
return false if Setting.get('chat') != true || !current_user.permissions?('chat.agent')
{
prio: 900,
prio: 900,
direct_search_index: true,
}
end

View file

@ -62,7 +62,7 @@ returns
errors.push "Delete is not possible for #{new.class}."
result = {
errors: errors,
try: try,
try: try,
result: 'failed',
}
return result
@ -82,7 +82,7 @@ returns
errors.push "Unable to parse empty file/string for #{new.class}."
result = {
errors: errors,
try: try,
try: try,
result: 'failed',
}
return result
@ -94,7 +94,7 @@ returns
errors.push "Unable to parse file/string without header for #{new.class}."
result = {
errors: errors,
try: try,
try: try,
result: 'failed',
}
return result
@ -112,7 +112,7 @@ returns
errors.push "No records found in file/string for #{new.class}."
result = {
errors: errors,
try: try,
try: try,
result: 'failed',
}
return result
@ -123,7 +123,7 @@ returns
errors.push "No lookup column like #{lookup_keys.map(&:to_s).join(',')} for #{new.class} found."
result = {
errors: errors,
try: try,
try: try,
result: 'failed',
}
return result
@ -274,11 +274,11 @@ returns
end
{
stats: stats,
stats: stats,
records: records,
errors: errors,
try: try,
result: result,
errors: errors,
try: try,
result: result,
}
end

View file

@ -36,9 +36,9 @@ class OwnModel < ApplicationModel
PushMessages.send(
message: {
event: class_name + ':create',
data: { id: id, updated_at: updated_at }
data: { id: id, updated_at: updated_at }
},
type: 'authenticated',
type: 'authenticated',
)
end
@ -69,9 +69,9 @@ class OwnModel < ApplicationModel
PushMessages.send(
message: {
event: class_name + ':update',
data: { id: id, updated_at: updated_at }
data: { id: id, updated_at: updated_at }
},
type: 'authenticated',
type: 'authenticated',
)
end
@ -102,9 +102,9 @@ class OwnModel < ApplicationModel
PushMessages.send(
message: {
event: class_name + ':touch',
data: { id: id, updated_at: updated_at }
data: { id: id, updated_at: updated_at }
},
type: 'authenticated',
type: 'authenticated',
)
end
@ -134,9 +134,9 @@ class OwnModel < ApplicationModel
PushMessages.send(
message: {
event: class_name + ':destroy',
data: { id: id, updated_at: updated_at }
data: { id: id, updated_at: updated_at }
},
type: 'authenticated',
type: 'authenticated',
)
end
end

View file

@ -23,7 +23,7 @@ module ChecksConditionValidation
validate_condition['ticket.id'] = {
operator: 'is',
value: 1,
value: 1,
}
ticket_count, tickets = Ticket.selectors(validate_condition, 1, User.find(1))

View file

@ -75,8 +75,8 @@ module HasGroups
return true if group_through.klass.includes(:group).exists?(
group_through.foreign_key => id,
group_id: group_id,
access: access,
groups: {
access: access,
groups: {
active: true
}
)

View file

@ -95,10 +95,10 @@ log object update history with all updated attributes, if configured - will be e
end
data = {
history_attribute: attribute_name,
value_from: value_str[0].to_s,
value_to: value_str[1].to_s,
id_from: value_id[0],
id_to: value_id[1],
value_from: value_str[0].to_s,
value_to: value_str[1].to_s,
id_from: value_id[0],
id_to: value_id[1],
}
#logger.info "HIST NEW #{self.class.to_s}.find(#{self.id}) #{data.inspect}"
history_log('updated', updated_by_id, data)
@ -222,7 +222,7 @@ returns
end
{
history: history[:list],
assets: history[:assets],
assets: history[:assets],
}
end

View file

@ -17,7 +17,7 @@ delete object link list, will be executed automatically
def links_destroy
Link.remove_all(
link_object: self.class.to_s,
link_object: self.class.to_s,
link_object_value: id,
)
true

View file

@ -30,7 +30,7 @@ module HasRoles
groups: {
active: true
},
roles: {
roles: {
active: true
}
)

View file

@ -17,9 +17,9 @@ add an tag to model
def tag_add(name, current_user_id = nil)
Tag.tag_add(
object: self.class.to_s,
o_id: id,
item: name,
object: self.class.to_s,
o_id: id,
item: name,
created_by_id: current_user_id,
)
end
@ -35,9 +35,9 @@ remove an tag of model
def tag_remove(name, current_user_id = nil)
Tag.tag_remove(
object: self.class.to_s,
o_id: id,
item: name,
object: self.class.to_s,
o_id: id,
item: name,
created_by_id: current_user_id,
)
end
@ -54,7 +54,7 @@ tag list of model
def tag_list
Tag.tag_list(
object: self.class.to_s,
o_id: id,
o_id: id,
)
end
@ -69,8 +69,8 @@ destroy all tags of an object
def tag_destroy(current_user_id = nil)
Tag.tag_destroy(
object: self.class.to_s,
o_id: id,
object: self.class.to_s,
o_id: id,
created_by_id: current_user_id,
)
true

View file

@ -131,11 +131,11 @@ returns
existing_record_ids = Cti::CallerId.where(object: model.to_s, o_id: record.id).pluck(:id)
caller_ids.uniq.each do |caller_id|
existing_record_id = Cti::CallerId.where(
object: model.to_s,
o_id: record.id,
object: model.to_s,
o_id: record.id,
caller_id: caller_id,
level: level,
user_id: user_id,
level: level,
user_id: user_id,
).pluck(:id)
if 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|
Cti::CallerId.maybe_add(
caller_id: caller_id,
level: level,
object: model.to_s,
o_id: record.id,
user_id: user_id,
level: level,
object: model.to_s,
o_id: record.id,
user_id: user_id,
)
end
true

View file

@ -292,7 +292,7 @@ returns
.each.with_object({}) { |user, a| user.assets(a) }
{
list: list,
list: list,
assets: assets,
}
end
@ -364,18 +364,18 @@ Cti::Log.process(
raise "call_id #{call_id} already exists!" if log
create(
direction: params['direction'],
from: params['from'],
from_comment: from_comment,
to: params['to'],
to_comment: to_comment,
call_id: call_id,
comment: cause,
queue: queue,
state: event,
direction: params['direction'],
from: params['from'],
from_comment: from_comment,
to: params['to'],
to_comment: to_comment,
call_id: call_id,
comment: cause,
queue: queue,
state: event,
initialized_at: Time.zone.now,
preferences: preferences,
done: done,
preferences: preferences,
done: done,
)
when 'answer'
raise "No such call_id #{call_id}" if !log
@ -431,7 +431,7 @@ Cti::Log.process(
user.id,
{
event: 'cti_event',
data: self,
data: self,
},
)
end
@ -483,7 +483,7 @@ optional you can put the max oldest chat entries as argument
def attributes
virtual_attributes = {
'from_pretty' => from_pretty,
'to_pretty' => to_pretty,
'to_pretty' => to_pretty,
}
super.merge(virtual_attributes)

View file

@ -59,19 +59,19 @@ add a new history entry for an object
# create history
record = {
id: data[:id],
o_id: data[:o_id],
history_type_id: history_type.id,
history_object_id: history_object.id,
history_attribute_id: history_attribute_id,
id: data[:id],
o_id: data[:o_id],
history_type_id: history_type.id,
history_object_id: history_object.id,
history_attribute_id: history_attribute_id,
related_history_object_id: related_history_object_id,
related_o_id: data[:related_o_id],
value_from: data[:value_from],
value_to: data[:value_to],
id_from: data[:id_from],
id_to: data[:id_to],
created_at: data[:created_at],
created_by_id: data[:created_by_id]
related_o_id: data[:related_o_id],
value_from: data[:value_from],
value_to: data[:value_to],
id_from: data[:id_from],
id_to: data[:id_to],
created_at: data[:created_at],
created_by_id: data[:created_by_id]
}
history_record = nil
if data[:id]
@ -102,7 +102,7 @@ remove whole history entries of an object
History.where(
history_object_id: history_object.id,
o_id: requested_object_id,
o_id: requested_object_id,
).destroy_all
end
@ -206,7 +206,7 @@ returns
end
if assets
return {
list: list,
list: list,
assets: asset_list,
}
end

View file

@ -23,10 +23,10 @@ add karma activity log of an object
Karma::ActivityLog.transaction do
last_activity = Karma::ActivityLog.where(user_id: user.id).order(created_at: :desc, id: :desc).lock(true).first
latest_activity = Karma::ActivityLog.where(
user_id: user.id,
user_id: user.id,
object_lookup_id: object_id,
o_id: o_id,
activity_id: activity.id,
o_id: o_id,
activity_id: activity.id,
).find_by('created_at >= ?', Time.zone.now - activity.once_ttl.seconds)
return false if !force && latest_activity
@ -42,11 +42,11 @@ add karma activity log of an object
Karma::ActivityLog.create(
object_lookup_id: object_id,
o_id: o_id,
user_id: user.id,
activity_id: activity.id,
score: activity.score,
score_total: local_score_total,
o_id: o_id,
user_id: user.id,
activity_id: activity.id,
score: activity.score,
score_total: local_score_total,
)
end
@ -68,7 +68,7 @@ remove whole karma activity log of an object
object_id = ObjectLookup.by_name(object_name)
Karma::ActivityLog.where(
object_lookup_id: object_id,
o_id: o_id,
o_id: o_id,
).destroy_all
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
comment = {
description: Karma::Activity.lookup(id: log.activity_id).description,
score: log.score,
score: log.score,
}
last[:comments].push comment
last[:score_total] = score_total
next
end
comment = {
object_id: log.object_id,
o_id: log.o_id,
object_id: log.object_id,
o_id: log.o_id,
description: Karma::Activity.lookup(id: log.activity_id).description,
score: log.score,
score: log.score,
}
data = {
comments: [comment],
comments: [comment],
score_total: log.score_total,
created_at: log.created_at,
created_at: log.created_at,
}
result.push data
end

View file

@ -17,8 +17,8 @@ class Karma::User < ApplicationModel
end
Karma::User.create!(
user_id: user.id,
level: level,
score: score,
level: level,
score: score,
)
end

View file

@ -89,7 +89,7 @@ class Link < ApplicationModel
data[:link_object_source_id] = linkobject.id
touch_reference_by_params(
object: data[:link_object_source],
o_id: data[:link_object_source_value],
o_id: data[:link_object_source_value],
)
data.delete(:link_object_source)
end
@ -99,7 +99,7 @@ class Link < ApplicationModel
data[:link_object_target_id] = linkobject.id
touch_reference_by_params(
object: data[:link_object_target],
o_id: data[:link_object_target_value],
o_id: data[:link_object_target_value],
)
data.delete(:link_object_target)
end
@ -136,10 +136,10 @@ class Link < ApplicationModel
data[:link_type_id] = linktype.id
end
Link.where(
link_type_id: data[:link_type_id],
link_object_source_id: data[:link_object_source_id],
link_type_id: data[:link_type_id],
link_object_source_id: data[:link_object_source_id],
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]
).destroy_all
@ -150,10 +150,10 @@ class Link < ApplicationModel
end
Link.where(
link_type_id: data[:link_type_id],
link_object_target_id: data[:link_object_source_id],
link_type_id: data[:link_type_id],
link_object_target_id: data[:link_object_source_id],
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]
).destroy_all
end
@ -174,11 +174,11 @@ class Link < ApplicationModel
end
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],
).destroy_all
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],
).destroy_all
@ -188,11 +188,11 @@ class Link < ApplicationModel
def touch_link_references
Link.touch_reference_by_params(
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(
object: Link::Object.lookup(id: link_object_target_id).name,
o_id: link_object_target_value,
o_id: link_object_target_value,
)
end

View file

@ -100,7 +100,7 @@ all:
version: version,
},
{
json: true,
json: true,
open_timeout: 8,
read_timeout: 24,
}

View file

@ -302,7 +302,7 @@ possible types
# check new entry - is needed
record = ObjectManager::Attribute.find_by(
object_lookup_id: data[:object_lookup_id],
name: data[:name],
name: data[:name],
)
if record
@ -400,7 +400,7 @@ use "force: true" to delete also not editable fields
# check newest entry - is needed
record = ObjectManager::Attribute.find_by(
object_lookup_id: data[:object_lookup_id],
name: data[:name],
name: data[:name],
)
if !record
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(
object_lookup_id: data[:object_lookup_id],
name: data[:name],
name: data[:name],
)
end
@ -478,16 +478,16 @@ returns:
# get attributes in right order
result = ObjectManager::Attribute.where(
object_lookup_id: object_lookup_id,
active: true,
to_create: false,
to_delete: false,
active: true,
to_create: false,
to_delete: false,
).order('position ASC, name ASC')
attributes = []
result.each do |item|
data = {
name: item.name,
name: item.name,
display: item.display,
tag: item.data_type,
tag: item.data_type,
#:null => item.null,
}
if item.data_option[:permission]&.any?
@ -683,7 +683,7 @@ to send no browser reload event, pass false
attribute.name,
data_type,
limit: attribute.data_option[:maxlength],
null: true
null: true
)
elsif attribute.data_type.match?(/^integer|user_autocompletion|datetime|date$/)
ActiveRecord::Migration.change_column(
@ -691,7 +691,7 @@ to send no browser reload event, pass false
attribute.name,
data_type,
default: attribute.data_option[:default],
null: true
null: true
)
elsif attribute.data_type.match?(/^boolean|active$/)
ActiveRecord::Migration.change_column(
@ -699,7 +699,7 @@ to send no browser reload event, pass false
attribute.name,
data_type,
default: attribute.data_option[:default],
null: true
null: true
)
else
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,
data_type,
limit: attribute.data_option[:maxlength],
null: true
null: true
)
elsif attribute.data_type.match?(/^integer|user_autocompletion$/)
ActiveRecord::Migration.add_column(
@ -730,7 +730,7 @@ to send no browser reload event, pass false
attribute.name,
data_type,
default: attribute.data_option[:default],
null: true
null: true
)
elsif attribute.data_type.match?(/^boolean|active$/)
ActiveRecord::Migration.add_column(
@ -738,7 +738,7 @@ to send no browser reload event, pass false
attribute.name,
data_type,
default: attribute.data_option[:default],
null: true
null: true
)
elsif attribute.data_type.match?(/^datetime|date$/)
ActiveRecord::Migration.add_column(
@ -746,7 +746,7 @@ to send no browser reload event, pass false
attribute.name,
data_type,
default: attribute.data_option[:default],
null: true
null: true
)
else
raise "Unknown attribute.data_type '#{attribute.data_type}', can't create attribute"

View file

@ -23,8 +23,8 @@ class Observer::Chat::Leave::BackgroundJob
# notify participants
message = {
event: 'chat_session_left',
data: {
realname: realname,
data: {
realname: realname,
session_id: chat_session.session_id,
},
}

View file

@ -9,12 +9,12 @@ class Observer::Tag::TicketHistory < ActiveRecord::Observer
# add ticket history
History.add(
o_id: record.o_id,
history_type: 'added',
history_object: 'Ticket',
o_id: record.o_id,
history_type: 'added',
history_object: 'Ticket',
history_attribute: 'tag',
value_to: record.tag_item.name,
created_by_id: record.created_by_id,
value_to: record.tag_item.name,
created_by_id: record.created_by_id,
)
end
@ -25,12 +25,12 @@ class Observer::Tag::TicketHistory < ActiveRecord::Observer
# add ticket history
History.add(
o_id: record.o_id,
history_type: 'removed',
history_object: 'Ticket',
o_id: record.o_id,
history_type: 'removed',
history_object: 'Ticket',
history_attribute: 'tag',
value_to: record.tag_item.name,
created_by_id: record.created_by_id,
value_to: record.tag_item.name,
created_by_id: record.created_by_id,
)
end
end

View file

@ -53,16 +53,16 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
begin
message = channel.deliver(
{
message_id: record.message_id,
in_reply_to: record.in_reply_to,
references: ticket.get_references([record.message_id]),
from: record.from,
to: record.to,
cc: record.cc,
subject: subject,
message_id: record.message_id,
in_reply_to: record.in_reply_to,
references: ticket.get_references([record.message_id]),
from: record.from,
to: record.to,
cc: record.cc,
subject: subject,
content_type: record.content_type,
body: record.body,
attachments: record.attachments
body: record.body,
attachments: record.attachments
},
notification
)
@ -103,14 +103,14 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
return if recipient_list == ''
History.add(
o_id: record.id,
history_type: 'email',
history_object: 'Ticket::Article',
related_o_id: ticket.id,
o_id: record.id,
history_type: 'email',
history_object: 'Ticket::Article',
related_o_id: ticket.id,
related_history_object: 'Ticket',
value_from: record.subject,
value_to: recipient_list,
created_by_id: record.created_by_id,
value_from: record.subject,
value_to: recipient_list,
created_by_id: record.created_by_id,
)
end
@ -142,16 +142,16 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
Observer::Transaction.reset
UserInfo.current_user_id = 1
Ticket::Article.create!(
ticket_id: local_record.ticket_id,
ticket_id: local_record.ticket_id,
content_type: 'text/plain',
body: "Unable to send email to '#{recipient_list}': #{message}",
internal: true,
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'note'),
preferences: {
body: "Unable to send email to '#{recipient_list}': #{message}",
internal: true,
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'note'),
preferences: {
delivery_article_id_related: local_record.id,
delivery_message: true,
notification: true,
delivery_message: true,
notification: true,
},
)
ticket = Ticket.find(local_record.ticket_id)

View file

@ -73,15 +73,15 @@ class Observer::Ticket::Article::CommunicateFacebook::BackgroundJob
if local_record.preferences['delivery_retry'] > 3
Ticket::Article.create(
ticket_id: local_record.ticket_id,
content_type: 'text/plain',
body: "Unable to send post: #{message}",
internal: true,
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'note'),
preferences: {
ticket_id: local_record.ticket_id,
content_type: 'text/plain',
body: "Unable to send post: #{message}",
internal: true,
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'note'),
preferences: {
delivery_article_id_related: local_record.id,
delivery_message: true,
delivery_message: true,
},
updated_by_id: 1,
created_by_id: 1,

View file

@ -32,13 +32,13 @@ class Observer::Ticket::Article::CommunicateSms::BackgroundJob
article.preferences['sms_recipients'].each do |recipient|
channel.deliver(
recipient: recipient,
message: article.body.first(160),
message: article.body.first(160),
)
end
else
channel.deliver(
recipient: article.to,
message: article.body.first(160),
message: article.body.first(160),
)
end
rescue => e
@ -70,15 +70,15 @@ class Observer::Ticket::Article::CommunicateSms::BackgroundJob
if local_record.preferences['delivery_retry'] >= max_attempts
Ticket::Article.create(
ticket_id: local_record.ticket_id,
content_type: 'text/plain',
body: "#{log_error_prefix}: #{message}",
internal: true,
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'note'),
preferences: {
ticket_id: local_record.ticket_id,
content_type: 'text/plain',
body: "#{log_error_prefix}: #{message}",
internal: true,
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'note'),
preferences: {
delivery_article_id_related: local_record.id,
delivery_message: true,
delivery_message: true,
},
updated_by_id: 1,
created_by_id: 1,
@ -92,14 +92,14 @@ class Observer::Ticket::Article::CommunicateSms::BackgroundJob
return if recipient_list.blank?
History.add(
o_id: article.id,
history_type: history_type,
history_object: 'Ticket::Article',
related_o_id: ticket.id,
o_id: article.id,
history_type: history_type,
history_object: 'Ticket::Article',
related_o_id: ticket.id,
related_history_object: 'Ticket',
value_from: article.subject,
value_to: recipient_list,
created_by_id: article.created_by_id,
value_from: article.subject,
value_to: recipient_list,
created_by_id: article.created_by_id,
)
end

View file

@ -51,9 +51,9 @@ class Observer::Ticket::Article::CommunicateTelegram::BackgroundJob
article.to = "@#{result['chat']['username']}"
article.preferences['telegram'] = {
date: result['date'],
from_id: result['from']['id'],
chat_id: result['chat']['id'],
date: result['date'],
from_id: result['from']['id'],
chat_id: result['chat']['id'],
message_id: result['message_id']
}
else
@ -62,9 +62,9 @@ class Observer::Ticket::Article::CommunicateTelegram::BackgroundJob
article.to = "#{result['chat']['title']} Channel"
article.preferences['telegram'] = {
date: result['date'],
from_id: me['id'],
chat_id: result['chat']['id'],
date: result['date'],
from_id: me['id'],
chat_id: result['chat']['id'],
message_id: result['message_id']
}
end
@ -92,15 +92,15 @@ class Observer::Ticket::Article::CommunicateTelegram::BackgroundJob
if local_record.preferences['delivery_retry'] > 3
Ticket::Article.create(
ticket_id: local_record.ticket_id,
content_type: 'text/plain',
body: "Unable to send telegram message: #{message}",
internal: true,
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'note'),
preferences: {
ticket_id: local_record.ticket_id,
content_type: 'text/plain',
body: "Unable to send telegram message: #{message}",
internal: true,
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'note'),
preferences: {
delivery_article_id_related: local_record.id,
delivery_message: true,
delivery_message: true,
},
updated_by_id: 1,
created_by_id: 1,

View file

@ -61,7 +61,7 @@ class Observer::Ticket::Article::CommunicateTwitter::BackgroundJob
article.preferences['twitter'] = {
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
@ -82,17 +82,17 @@ class Observer::Ticket::Article::CommunicateTwitter::BackgroundJob
end
article.to = to
article.preferences['twitter'] = TwitterSync.preferences_cleanup(
mention_ids: mention_ids,
geo: tweet.geo,
retweeted: tweet.retweeted?,
possibly_sensitive: tweet.possibly_sensitive?,
mention_ids: mention_ids,
geo: tweet.geo,
retweeted: tweet.retweeted?,
possibly_sensitive: tweet.possibly_sensitive?,
in_reply_to_user_id: tweet.in_reply_to_user_id,
place: tweet.place,
retweet_count: tweet.retweet_count,
source: tweet.source,
favorited: tweet.favorited?,
truncated: tweet.truncated?,
created_at: tweet.created_at,
place: tweet.place,
retweet_count: tweet.retweet_count,
source: tweet.source,
favorited: tweet.favorited?,
truncated: tweet.truncated?,
created_at: tweet.created_at,
)
end
else
@ -107,9 +107,9 @@ class Observer::Ticket::Article::CommunicateTwitter::BackgroundJob
article.message_id = tweet_id
article.preferences['links'] = [
{
url: "https://twitter.com/statuses/#{tweet_id}",
url: "https://twitter.com/statuses/#{tweet_id}",
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
Ticket::Article.create(
ticket_id: local_record.ticket_id,
content_type: 'text/plain',
body: "Unable to send tweet: #{message}",
internal: true,
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'note'),
preferences: {
ticket_id: local_record.ticket_id,
content_type: 'text/plain',
body: "Unable to send tweet: #{message}",
internal: true,
sender: Ticket::Article::Sender.find_by(name: 'System'),
type: Ticket::Article::Type.find_by(name: 'note'),
preferences: {
delivery_article_id_related: local_record.id,
delivery_message: true,
delivery_message: true,
},
updated_by_id: 1,
created_by_id: 1,

View file

@ -13,14 +13,14 @@ class Observer::Ticket::UserTicketCounter::BackgroundJob
state_open = Ticket::State.by_category(:open)
tickets_open = Ticket.where(
customer_id: @customer_id,
state_id: state_open,
state_id: state_open,
).count()
# closed ticket count
state_closed = Ticket::State.by_category(:closed)
tickets_closed = Ticket.where(
customer_id: @customer_id,
state_id: state_closed,
state_id: state_closed,
).count()
end

View file

@ -182,11 +182,11 @@ class Observer::Transaction < ActiveRecord::Observer
return true if Setting.get('import_mode')
e = {
object: record.class.name,
type: 'create',
data: record,
id: record.id,
user_id: record.created_by_id,
object: record.class.name,
type: 'create',
data: record,
id: record.id,
user_id: record.created_by_id,
created_at: Time.zone.now,
}
EventBuffer.add('transaction', e)
@ -225,12 +225,12 @@ class Observer::Transaction < ActiveRecord::Observer
end
e = {
object: record.class.name,
type: 'update',
data: record,
changes: real_changes,
id: record.id,
user_id: changed_by_id,
object: record.class.name,
type: 'update',
data: record,
changes: real_changes,
id: record.id,
user_id: changed_by_id,
created_at: Time.zone.now,
}
EventBuffer.add('transaction', e)

View file

@ -45,15 +45,15 @@ add a new online notification for this user
exists_by_object_and_id?(data[:object], data[:o_id])
record = {
o_id: data[:o_id],
o_id: data[:o_id],
object_lookup_id: object_id,
type_lookup_id: type_id,
seen: data[:seen],
user_id: data[:user_id],
created_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,
updated_at: data[:updated_at] || Time.zone.now,
type_lookup_id: type_id,
seen: data[:seen],
user_id: data[:user_id],
created_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,
updated_at: data[:updated_at] || Time.zone.now,
}
OnlineNotification.create!(record)
@ -87,7 +87,7 @@ remove whole online notifications of an object
object_id = ObjectLookup.by_name(object_name)
OnlineNotification.where(
object_lookup_id: object_id,
o_id: o_id,
o_id: o_id,
).destroy_all
end
@ -104,9 +104,9 @@ remove whole online notifications of an object by type
type_id = TypeLookup.by_name(type_name)
OnlineNotification.where(
object_lookup_id: object_id,
type_lookup_id: type_id,
o_id: o_id,
user_id: user.id,
type_lookup_id: type_id,
o_id: o_id,
user_id: user.id,
).destroy_all
end
@ -136,7 +136,7 @@ return all online notifications of an object
object_id = ObjectLookup.by_name(object_name)
notifications = OnlineNotification.where(
object_lookup_id: object_id,
o_id: o_id,
o_id: o_id,
)
.order('created_at DESC, id DESC')
.limit(10_000)
@ -155,8 +155,8 @@ mark online notification as seen by object
object_id = ObjectLookup.by_name(object_name)
notifications = OnlineNotification.where(
object_lookup_id: object_id,
o_id: o_id,
seen: false,
o_id: o_id,
seen: false,
)
notifications.each do |notification|
notification.seen = true
@ -170,7 +170,7 @@ mark online notification as seen by object
user_id,
{
event: 'OnlineNotification::changed',
data: {}
data: {}
}
)
end
@ -260,7 +260,7 @@ with dedicated times
user.id,
{
event: 'OnlineNotification::changed',
data: {}
data: {}
}
)
sleep 2 # slow down client requests

View file

@ -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')
{
prio: 1000,
prio: 1000,
direct_search_index: true,
}
end
@ -83,9 +83,9 @@ returns
# try search index backend
if SearchIndexBackend.enabled?
items = SearchIndexBackend.search(query, 'Organization', limit: limit,
from: offset,
sort_by: sort_by,
items = SearchIndexBackend.search(query, 'Organization', limit: limit,
from: offset,
sort_by: sort_by,
order_by: order_by)
organizations = []
items.each do |item|

View file

@ -234,10 +234,10 @@ returns
# package meta data
meta = {
name: package['name'],
version: package['version'],
vendor: package['vendor'],
state: 'uninstalled',
name: package['name'],
version: package['version'],
vendor: package['vendor'],
state: 'uninstalled',
created_by_id: 1,
updated_by_id: 1,
}
@ -256,10 +256,10 @@ returns
# uninstall files of old package
uninstall(
name: package_db.name,
version: package_db.version,
name: package_db.name,
version: package_db.version,
migration_not_down: true,
reinstall: data[:reinstall],
reinstall: data[:reinstall],
)
end
@ -267,11 +267,11 @@ returns
if !data[:reinstall]
package_db = Package.create(meta)
Store.add(
object: 'Package',
o_id: package_db.id,
data: package.to_json,
filename: "#{meta[:name]}-#{meta[:version]}.zpm",
preferences: {},
object: 'Package',
o_id: package_db.id,
data: package.to_json,
filename: "#{meta[:name]}-#{meta[:version]}.zpm",
preferences: {},
created_by_id: UserInfo.current_user_id || 1,
)
end
@ -357,7 +357,7 @@ returns
# delete package
if !data[:reinstall]
record = Package.find_by(
name: package['name'],
name: package['name'],
version: package['version'],
)
record.destroy
@ -384,7 +384,7 @@ execute all pending package migrations at once
def self._get_bin(name, version)
package = Package.find_by(
name: name,
name: name,
version: version,
)
if !package
@ -393,7 +393,7 @@ execute all pending package migrations at once
list = Store.list(
object: 'Package',
o_id: package.id,
o_id: package.id,
)
# find file

View file

@ -17,9 +17,9 @@ class RecentView < ApplicationModel
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),
created_by_id: user.id)
created_by_id: user.id)
end
def self.log_destroy(requested_object, requested_object_id)
@ -70,7 +70,7 @@ class RecentView < ApplicationModel
created_by_id,
{
event: 'RecentView::changed',
data: {}
data: {}
}
)
end

View file

@ -9,210 +9,210 @@ class Report
config[:metric] = {}
config[:metric][:count] = {
name: 'count',
name: 'count',
display: 'Ticket Count',
default: true,
prio: 10_000,
prio: 10_000,
}
backend = [
{
name: 'created',
display: 'Created',
selected: true,
name: 'created',
display: 'Created',
selected: true,
dataDownload: true,
adapter: Report::TicketGenericTime,
params: { field: 'created_at' }
adapter: Report::TicketGenericTime,
params: { field: 'created_at' }
},
{
name: 'closed',
display: 'Closed',
selected: true,
name: 'closed',
display: 'Closed',
selected: true,
dataDownload: true,
adapter: Report::TicketGenericTime,
params: { field: 'close_at' }
adapter: Report::TicketGenericTime,
params: { field: 'close_at' }
},
{
name: 'backlog',
display: 'Backlog',
selected: true,
name: 'backlog',
display: 'Backlog',
selected: true,
dataDownload: false,
adapter: Report::TicketBacklog
adapter: Report::TicketBacklog
},
{
name: 'first_solution',
display: 'First Solution',
selected: false,
name: 'first_solution',
display: 'First Solution',
selected: false,
dataDownload: true,
adapter: Report::TicketFirstSolution
adapter: Report::TicketFirstSolution
},
{
name: 'reopened',
display: 'Reopened',
selected: false,
name: 'reopened',
display: 'Reopened',
selected: false,
dataDownload: true,
adapter: Report::TicketReopened
adapter: Report::TicketReopened
},
{
name: 'movedin',
display: 'Moved in',
selected: false,
name: 'movedin',
display: 'Moved in',
selected: false,
dataDownload: true,
adapter: Report::TicketMoved,
params: { type: 'in' }
adapter: Report::TicketMoved,
params: { type: 'in' }
},
{
name: 'movedout',
display: 'Moved out',
selected: false,
name: 'movedout',
display: 'Moved out',
selected: false,
dataDownload: true,
adapter: Report::TicketMoved,
params: { type: 'out' }
adapter: Report::TicketMoved,
params: { type: 'out' }
},
]
config[:metric][:count][:backend] = backend
config[:metric][:create_channels] = {
name: 'create_channels',
name: 'create_channels',
display: 'Create Channels',
prio: 9000,
prio: 9000,
}
backend = [
{
name: 'phone_in',
display: 'Phone (in)',
selected: true,
name: 'phone_in',
display: 'Phone (in)',
selected: true,
dataDownload: true,
adapter: Report::TicketGenericTime,
params: {
field: 'created_at',
adapter: Report::TicketGenericTime,
params: {
field: 'created_at',
selector: {
'create_article_type_id' => {
'create_article_type_id' => {
'operator' => 'is',
'value' => Ticket::Article::Type.lookup(name: 'phone').id,
'value' => Ticket::Article::Type.lookup(name: 'phone').id,
},
'create_article_sender_id' => {
'operator' => 'is',
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
},
},
},
},
{
name: 'phone_out',
display: 'Phone (out)',
selected: true,
name: 'phone_out',
display: 'Phone (out)',
selected: true,
dataDownload: true,
adapter: Report::TicketGenericTime,
params: {
field: 'created_at',
adapter: Report::TicketGenericTime,
params: {
field: 'created_at',
selector: {
'create_article_type_id' => {
'create_article_type_id' => {
'operator' => 'is',
'value' => Ticket::Article::Type.lookup(name: 'phone').id,
'value' => Ticket::Article::Type.lookup(name: 'phone').id,
},
'create_article_sender_id' => {
'operator' => 'is',
'value' => Ticket::Article::Sender.lookup(name: 'Agent').id,
'value' => Ticket::Article::Sender.lookup(name: 'Agent').id,
},
}
},
},
{
name: 'email_in',
display: 'Email (in)',
selected: true,
name: 'email_in',
display: 'Email (in)',
selected: true,
dataDownload: true,
adapter: Report::TicketGenericTime,
params: {
field: 'created_at',
adapter: Report::TicketGenericTime,
params: {
field: 'created_at',
selector: {
'create_article_type_id' => {
'create_article_type_id' => {
'operator' => 'is',
'value' => Ticket::Article::Type.lookup(name: 'email').id,
'value' => Ticket::Article::Type.lookup(name: 'email').id,
},
'create_article_sender_id' => {
'operator' => 'is',
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
},
},
},
},
{
name: 'email_out',
display: 'Email (out)',
selected: true,
name: 'email_out',
display: 'Email (out)',
selected: true,
dataDownload: true,
adapter: Report::TicketGenericTime,
params: {
field: 'created_at',
adapter: Report::TicketGenericTime,
params: {
field: 'created_at',
selector: {
'create_article_type_id' => {
'create_article_type_id' => {
'operator' => 'is',
'value' => Ticket::Article::Type.lookup(name: 'email').id,
'value' => Ticket::Article::Type.lookup(name: 'email').id,
},
'create_article_sender_id' => {
'operator' => 'is',
'value' => Ticket::Article::Sender.lookup(name: 'Agent').id,
'value' => Ticket::Article::Sender.lookup(name: 'Agent').id,
},
},
},
},
{
name: 'web_in',
display: 'Web (in)',
selected: true,
name: 'web_in',
display: 'Web (in)',
selected: true,
dataDownload: true,
adapter: Report::TicketGenericTime,
params: {
field: 'created_at',
adapter: Report::TicketGenericTime,
params: {
field: 'created_at',
selector: {
'create_article_type_id' => {
'create_article_type_id' => {
'operator' => 'is',
'value' => Ticket::Article::Type.lookup(name: 'web').id,
'value' => Ticket::Article::Type.lookup(name: 'web').id,
},
'create_article_sender_id' => {
'operator' => 'is',
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
},
},
},
},
{
name: 'twitter_in',
display: 'Twitter (in)',
selected: true,
name: 'twitter_in',
display: 'Twitter (in)',
selected: true,
dataDownload: true,
adapter: Report::TicketGenericTime,
params: {
field: 'created_at',
adapter: Report::TicketGenericTime,
params: {
field: 'created_at',
selector: {
'create_article_type_id' => {
'create_article_type_id' => {
'operator' => 'is',
'value' => Ticket::Article::Type.lookup(name: 'twitter status').id,
'value' => Ticket::Article::Type.lookup(name: 'twitter status').id,
},
'create_article_sender_id' => {
'operator' => 'is',
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
},
},
},
},
{
name: 'twitter_out',
display: 'Twitter (out)',
selected: true,
name: 'twitter_out',
display: 'Twitter (out)',
selected: true,
dataDownload: true,
adapter: Report::TicketGenericTime,
params: {
field: 'created_at',
adapter: Report::TicketGenericTime,
params: {
field: 'created_at',
selector: {
'create_article_type_id' => {
'create_article_type_id' => {
'operator' => 'is',
'value' => Ticket::Article::Type.lookup(name: 'twitter status').id,
'value' => Ticket::Article::Type.lookup(name: 'twitter status').id,
},
'create_article_sender_id' => {
'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][:communication] = {
name: 'communication',
name: 'communication',
display: 'Communication',
prio: 7000,
prio: 7000,
}
backend = [
{
name: 'phone_in',
display: 'Phone (in)',
selected: true,
name: 'phone_in',
display: 'Phone (in)',
selected: true,
dataDownload: false,
adapter: Report::ArticleByTypeSender,
params: {
type: 'phone',
adapter: Report::ArticleByTypeSender,
params: {
type: 'phone',
sender: 'Customer',
},
},
{
name: 'phone_out',
display: 'Phone (out)',
selected: true,
name: 'phone_out',
display: 'Phone (out)',
selected: true,
dataDownload: false,
adapter: Report::ArticleByTypeSender,
params: {
type: 'phone',
adapter: Report::ArticleByTypeSender,
params: {
type: 'phone',
sender: 'Agent',
},
},
{
name: 'email_in',
display: 'Email (in)',
selected: true,
name: 'email_in',
display: 'Email (in)',
selected: true,
dataDownload: false,
adapter: Report::ArticleByTypeSender,
params: {
type: 'email',
adapter: Report::ArticleByTypeSender,
params: {
type: 'email',
sender: 'Customer',
},
},
{
name: 'email_out',
display: 'Email (out)',
selected: true,
name: 'email_out',
display: 'Email (out)',
selected: true,
dataDownload: false,
adapter: Report::ArticleByTypeSender,
params: {
type: 'email',
adapter: Report::ArticleByTypeSender,
params: {
type: 'email',
sender: 'Agent',
},
},
{
name: 'web_in',
display: 'Web (in)',
selected: true,
name: 'web_in',
display: 'Web (in)',
selected: true,
dataDownload: false,
adapter: Report::ArticleByTypeSender,
params: {
type: 'web',
adapter: Report::ArticleByTypeSender,
params: {
type: 'web',
sender: 'Customer',
},
},
{
name: 'twitter_in',
display: 'Twitter (in)',
selected: true,
name: 'twitter_in',
display: 'Twitter (in)',
selected: true,
dataDownload: false,
adapter: Report::ArticleByTypeSender,
params: {
type: 'twitter status',
adapter: Report::ArticleByTypeSender,
params: {
type: 'twitter status',
sender: 'Customer',
},
},
{
name: 'twitter_out',
display: 'Twitter (out)',
selected: true,
name: 'twitter_out',
display: 'Twitter (out)',
selected: true,
dataDownload: false,
adapter: Report::ArticleByTypeSender,
params: {
type: 'twitter status',
adapter: Report::ArticleByTypeSender,
params: {
type: 'twitter status',
sender: 'Agent',
},
},

Some files were not shown because too many files have changed in this diff Show more