Merge branch 'stable' of https://github.com/zammad/zammad into antifascista-stable

This commit is contained in:
f 2022-02-11 14:06:58 -03:00
commit 62f319b589
245 changed files with 5677 additions and 2989 deletions

View file

@ -0,0 +1,20 @@
module.exports = class PreventUnderscoreBackport
rule:
name: 'prevent_underscore_backport'
level: 'error'
message: 'The method __(...) is not available in current stable'
description: '''
'''
constructor: ->
@callTokens = []
tokens: ['CALL_START']
lintToken: (token, tokenApi) ->
[type, tokenValue] = token
p = tokenApi.peek(-1)
if p[1] == '__'
return { }

3
.gitignore vendored
View file

@ -84,6 +84,9 @@
# Eclipse # Eclipse
/.project /.project
# VSCode
/.vscode
# Byebug # Byebug
/.byebug_history /.byebug_history

View file

@ -1,5 +1,5 @@
default: default:
image: registry.znuny.com/docker/zammad-ci:2.7.4 image: $CI_REGISTRY/docker/zammad-ci:2.7.4
include: include:
- local: '/.gitlab/ci/base.yml' - local: '/.gitlab/ci/base.yml'
@ -55,7 +55,7 @@ cache:
# Initialize application env # Initialize application env
before_script: before_script:
- source /etc/profile.d/rvm.sh - source /etc/profile.d/rvm.sh
- source /opt/rh/rh-nodejs12/enable - source /opt/rh/rh-nodejs*/enable
- bundle install -j $(nproc) --path vendor - bundle install -j $(nproc) --path vendor
- bundle exec ruby .gitlab/configure_environment.rb - bundle exec ruby .gitlab/configure_environment.rb
- source .gitlab/environment.env - source .gitlab/environment.env

View file

@ -74,35 +74,35 @@
# DB Docker # DB Docker
.docker_mysql: &docker_mysql .docker_mysql: &docker_mysql
name: registry.znuny.com/docker/zammad-mysql:stable name: $CI_REGISTRY/docker/zammad-mysql:stable
alias: mysql alias: mysql
.docker_postgresql: &docker_postgresql .docker_postgresql: &docker_postgresql
name: registry.znuny.com/docker/zammad-postgresql:stable name: $CI_REGISTRY/docker/zammad-postgresql:stable
alias: postgresql alias: postgresql
.docker_elasticsearch: &docker_elasticsearch .docker_elasticsearch: &docker_elasticsearch
name: registry.znuny.com/docker/zammad-elasticsearch:$ELASTICSEARCH_TAG name: $CI_REGISTRY/docker/zammad-elasticsearch:$ELASTICSEARCH_TAG
alias: elasticsearch alias: elasticsearch
.docker_selenium_chrome: &docker_selenium_chrome .docker_selenium_chrome: &docker_selenium_chrome
name: registry.znuny.com/docker/zammad-selenium-chrome:stable name: $CI_REGISTRY/docker/zammad-selenium-chrome:stable
alias: selenium-chrome alias: selenium-chrome
.docker_selenium_firefox: &docker_selenium_firefox .docker_selenium_firefox: &docker_selenium_firefox
name: registry.znuny.com/docker/zammad-selenium-firefox:stable name: $CI_REGISTRY/docker/zammad-selenium-firefox:stable
alias: selenium-firefox alias: selenium-firefox
.docker_imap: &docker_imap .docker_imap: &docker_imap
name: registry.znuny.com/docker/zammad-imap:stable name: $CI_REGISTRY/docker/zammad-imap:stable
alias: mail alias: mail
.docker_redis: &docker_redis .docker_redis: &docker_redis
name: registry.znuny.com/docker/zammad-redis:stable name: $CI_REGISTRY/docker/zammad-redis:stable
alias: redis alias: redis
.docker_memcached: &docker_memcached .docker_memcached: &docker_memcached
name: registry.znuny.com/docker/zammad-memcached:stable name: $CI_REGISTRY/docker/zammad-memcached:stable
alias: memcached alias: memcached
command: ["memcached", "-m", "256M"] command: ["memcached", "-m", "256M"]

View file

@ -8,7 +8,7 @@ api_client_php:
script: script:
- RAILS_ENV=test bundle exec rake db:create - RAILS_ENV=test bundle exec rake db:create
- RAILS_ENV=test bundle exec rake zammad:ci:test:start zammad:setup:auto_wizard - RAILS_ENV=test bundle exec rake zammad:ci:test:start zammad:setup:auto_wizard
- git clone https://github.com/zammad/zammad-api-client-php.git - git clone https://github.com/zammad/zammad-api-client-php.git -b zammad-ci-5.0 # Use state with tests compatible to 5.0
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php composer-setup.php --install-dir=/usr/local/bin - php composer-setup.php --install-dir=/usr/local/bin
- ln -s /usr/local/bin/composer.phar /usr/local/bin/composer - ln -s /usr/local/bin/composer.phar /usr/local/bin/composer

View file

@ -7,11 +7,11 @@ otrs_chrome:
IMPORT_OTRS_ENDPOINT: "http://zammad-ci-otrsimport-app/otrs/public.pl?Action=ZammadMigrator" IMPORT_OTRS_ENDPOINT: "http://zammad-ci-otrsimport-app/otrs/public.pl?Action=ZammadMigrator"
TZ: "Europe/Berlin" # Required for the zammad-ci-otrsimport-app containers TZ: "Europe/Berlin" # Required for the zammad-ci-otrsimport-app containers
services: services:
- name: registry.znuny.com/docker/zammad-postgresql:stable - name: $CI_REGISTRY/docker/zammad-postgresql:stable
alias: postgresql alias: postgresql
- name: registry.znuny.com/docker/zammad-selenium-chrome:stable - name: $CI_REGISTRY/docker/zammad-selenium-chrome:stable
alias: selenium-chrome alias: selenium-chrome
- name: registry.znuny.com/docker/zammad-ci-otrsimport-db:otrs6 - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-db:otrs6
alias: zammad-ci-otrsimport-db alias: zammad-ci-otrsimport-db
- name: registry.znuny.com/docker/zammad-ci-otrsimport-app:otrs6 - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-app:otrs6
alias: zammad-ci-otrsimport-app alias: zammad-ci-otrsimport-app

View file

@ -11,7 +11,6 @@
- bundle exec rails test test/integration/elasticsearch_active_test.rb - bundle exec rails test test/integration/elasticsearch_active_test.rb
- bundle exec rails test test/integration/elasticsearch_test.rb - bundle exec rails test test/integration/elasticsearch_test.rb
- bundle exec rspec --tag searchindex --tag ~type:system --profile 10 - bundle exec rspec --tag searchindex --tag ~type:system --profile 10
- bundle exec rails test test/integration/report_test.rb
es:7: es:7:
<<: *template_integration_es <<: *template_integration_es

View file

@ -12,71 +12,71 @@
otrs:6: otrs:6:
<<: *template_integration_otrs <<: *template_integration_otrs
services: services:
- name: registry.znuny.com/docker/zammad-mysql:stable - name: $CI_REGISTRY/docker/zammad-mysql:stable
alias: mysql alias: mysql
- name: registry.znuny.com/docker/zammad-postgresql:stable - name: $CI_REGISTRY/docker/zammad-postgresql:stable
alias: postgresql alias: postgresql
- name: registry.znuny.com/docker/zammad-ci-otrsimport-db:otrs6 - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-db:otrs6
alias: zammad-ci-otrsimport-db alias: zammad-ci-otrsimport-db
- name: registry.znuny.com/docker/zammad-ci-otrsimport-app:otrs6 - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-app:otrs6
alias: zammad-ci-otrsimport-app alias: zammad-ci-otrsimport-app
otrs:5: otrs:5:
<<: *template_integration_otrs <<: *template_integration_otrs
services: services:
- name: registry.znuny.com/docker/zammad-mysql:stable - name: $CI_REGISTRY/docker/zammad-mysql:stable
alias: mysql alias: mysql
- name: registry.znuny.com/docker/zammad-postgresql:stable - name: $CI_REGISTRY/docker/zammad-postgresql:stable
alias: postgresql alias: postgresql
- name: registry.znuny.com/docker/zammad-ci-otrsimport-db:otrs5 - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-db:otrs5
alias: zammad-ci-otrsimport-db alias: zammad-ci-otrsimport-db
- name: registry.znuny.com/docker/zammad-ci-otrsimport-app:otrs5 - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-app:otrs5
alias: zammad-ci-otrsimport-app alias: zammad-ci-otrsimport-app
otrs:4: otrs:4:
<<: *template_integration_otrs <<: *template_integration_otrs
services: services:
- name: registry.znuny.com/docker/zammad-mysql:stable - name: $CI_REGISTRY/docker/zammad-mysql:stable
alias: mysql alias: mysql
- name: registry.znuny.com/docker/zammad-postgresql:stable - name: $CI_REGISTRY/docker/zammad-postgresql:stable
alias: postgresql alias: postgresql
- name: registry.znuny.com/docker/zammad-ci-otrsimport-db:otrs4 - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-db:otrs4
alias: zammad-ci-otrsimport-db alias: zammad-ci-otrsimport-db
- name: registry.znuny.com/docker/zammad-ci-otrsimport-app:otrs4 - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-app:otrs4
alias: zammad-ci-otrsimport-app alias: zammad-ci-otrsimport-app
otrs:33: otrs:33:
<<: *template_integration_otrs <<: *template_integration_otrs
services: services:
- name: registry.znuny.com/docker/zammad-mysql:stable - name: $CI_REGISTRY/docker/zammad-mysql:stable
alias: mysql alias: mysql
- name: registry.znuny.com/docker/zammad-postgresql:stable - name: $CI_REGISTRY/docker/zammad-postgresql:stable
alias: postgresql alias: postgresql
- name: registry.znuny.com/docker/zammad-ci-otrsimport-db:otrs33 - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-db:otrs33
alias: zammad-ci-otrsimport-db alias: zammad-ci-otrsimport-db
- name: registry.znuny.com/docker/zammad-ci-otrsimport-app:otrs33 - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-app:otrs33
alias: zammad-ci-otrsimport-app alias: zammad-ci-otrsimport-app
otrs:32: otrs:32:
<<: *template_integration_otrs <<: *template_integration_otrs
services: services:
- name: registry.znuny.com/docker/zammad-mysql:stable - name: $CI_REGISTRY/docker/zammad-mysql:stable
alias: mysql alias: mysql
- name: registry.znuny.com/docker/zammad-postgresql:stable - name: $CI_REGISTRY/docker/zammad-postgresql:stable
alias: postgresql alias: postgresql
- name: registry.znuny.com/docker/zammad-ci-otrsimport-db:otrs32 - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-db:otrs32
alias: zammad-ci-otrsimport-db alias: zammad-ci-otrsimport-db
- name: registry.znuny.com/docker/zammad-ci-otrsimport-app:otrs32 - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-app:otrs32
alias: zammad-ci-otrsimport-app alias: zammad-ci-otrsimport-app
otrs:31: otrs:31:
<<: *template_integration_otrs <<: *template_integration_otrs
services: services:
- name: registry.znuny.com/docker/zammad-mysql:stable - name: $CI_REGISTRY/docker/zammad-mysql:stable
alias: mysql alias: mysql
- name: registry.znuny.com/docker/zammad-postgresql:stable - name: $CI_REGISTRY/docker/zammad-postgresql:stable
alias: postgresql alias: postgresql
- name: registry.znuny.com/docker/zammad-ci-otrsimport-db:otrs31 - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-db:otrs31
alias: zammad-ci-otrsimport-db alias: zammad-ci-otrsimport-db
- name: registry.znuny.com/docker/zammad-ci-otrsimport-app:otrs31 - name: $CI_REGISTRY/docker/zammad-ci-otrsimport-app:otrs31
alias: zammad-ci-otrsimport-app alias: zammad-ci-otrsimport-app

View file

@ -6,7 +6,7 @@
- .rules_singletest - .rules_singletest
before_script: before_script:
- source /etc/profile.d/rvm.sh # ensure RVM is loaded - source /etc/profile.d/rvm.sh # ensure RVM is loaded
- source /opt/rh/rh-nodejs12/enable # ensure Node.js is available - source /opt/rh/rh-nodejs*/enable # ensure Node.js is available
rubocop: rubocop:
<<: *template_pre <<: *template_pre
@ -48,7 +48,7 @@ brakeman:
coffeelint: coffeelint:
<<: *template_pre <<: *template_pre
script: script:
- coffeelint app/ - coffeelint --rules ./.coffeelint/rules/* app/
bundle-audit: bundle-audit:
<<: *template_pre <<: *template_pre
@ -62,8 +62,9 @@ github:
tags: tags:
- deploy - deploy
before_script: before_script:
- "" # no RVM present in deploy ENV - '' # no RVM present in deploy ENV
script: script:
- git fetch --unshallow
- script/build/sync_repo.sh git@github.com:zammad/zammad.git - script/build/sync_repo.sh git@github.com:zammad/zammad.git
global_refresh_envs: global_refresh_envs:

View file

@ -56,6 +56,18 @@ targets:
- libimlib2 - libimlib2
- libimlib2-dev - libimlib2-dev
- shared-mime-info - shared-mime-info
debian-11:
dependencies:
- curl
- elasticsearch|elasticsearch-oss
- nginx|apache2
- postgresql|mariadb-server
- libimlib2
- shared-mime-info
build_dependencies:
- libimlib2
- libimlib2-dev
- shared-mime-info
ubuntu-16.04: ubuntu-16.04:
dependencies: dependencies:
- curl - curl

View file

@ -17,7 +17,7 @@ module RuboCop
PATTERN PATTERN
def_node_matcher :has_reset?, <<-PATTERN def_node_matcher :has_reset?, <<-PATTERN
$(send _ {:describe :context :it} (_ ...) (hash ... (pair (sym :db_strategy) (sym {:reset :reset_all})))) $(send _ {:describe :context :it :shared_examples} (_ ...) (hash <(pair (sym :db_strategy) (sym {:reset :reset_all})) ...> ))
PATTERN PATTERN
MSG = 'Add a `db_strategy: :reset` to your context/decribe when you are creating object manager attributes!'.freeze MSG = 'Add a `db_strategy: :reset` to your context/decribe when you are creating object manager attributes!'.freeze

View file

@ -0,0 +1,17 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
module RuboCop
module Cop
module Zammad
class PreventUnderscroreBackport < Base
MSG = <<~ERROR_MESSAGE.freeze
The method __(...) is not available in current stable.
ERROR_MESSAGE
def on_send(node)
add_offense(node) if node.method_name.eql? :__
end
end
end
end
end

View file

@ -13,7 +13,8 @@ module RuboCop
def on_new_investigation def on_new_investigation
if processed_source.raw_source.include? '# Copyright (C) 2012-' if processed_source.raw_source.include? '# Copyright (C) 2012-'
update_copyright # Disabled for stable branches.
# update_copyright
else else
insert_copyright insert_copyright
end end

View file

@ -10,3 +10,4 @@ require_relative 'cop/zammad/no_to_sym_on_string'
require_relative 'cop/zammad/prefer_negated_if_over_unless' require_relative 'cop/zammad/prefer_negated_if_over_unless'
require_relative 'cop/zammad/update_copyright' require_relative 'cop/zammad/update_copyright'
require_relative 'cop/zammad/forbid_rand' require_relative 'cop/zammad/forbid_rand'
require_relative 'cop/zammad/prevent_underscore_backport'

View file

@ -1,19 +1,85 @@
# Change Log # Change Log
## [5.0.3](https://github.com/zammad/zammad/tree/5.0.3) (2021-12-07)
[Full Changelog](https://github.com/zammad/zammad/compare/5.0.2...5.0.3)
**Implemented enhancements:**
- Possibility to specify the order of objects [294](https://github.com/zammad/zammad/issues/294) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] [[object manager attribute](https://github.com/zammad/zammad/labels/object manager attribute)]
- Display callback urls for third-party applications [3622](https://github.com/zammad/zammad/issues/3622) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)]
- Add clear selection action or has changed condition [3821](https://github.com/zammad/zammad/issues/3821) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)] [[specification required](https://github.com/zammad/zammad/labels/specification required)] [[core workflows](https://github.com/zammad/zammad/labels/core workflows)]
**Fixed bugs:**
- Missing ticket updates on high load in MariaDB/MySQL environments [3877](https://github.com/zammad/zammad/issues/3877) [[bug](https://github.com/zammad/zammad/labels/bug)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)]
- Wrong SLA is used (alphabetical order is ignored) [3871](https://github.com/zammad/zammad/issues/3871) [[bug](https://github.com/zammad/zammad/labels/bug)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)] [[regression](https://github.com/zammad/zammad/labels/regression)]
- Agent with CREATE only permission acts "on behalf" ticket customer on shared organizations [3872](https://github.com/zammad/zammad/issues/3872) [[bug](https://github.com/zammad/zammad/labels/bug)]
- Provide meaningful modal if report profile tries to use dates out side the filtered date range [3616](https://github.com/zammad/zammad/issues/3616) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] [[reporting](https://github.com/zammad/zammad/labels/reporting)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)]
- Allow `position` to determine an attributes position entirely [3594](https://github.com/zammad/zammad/issues/3594) [[bug](https://github.com/zammad/zammad/labels/bug)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)] [[object manager attribute](https://github.com/zammad/zammad/labels/object manager attribute)] [[specification required](https://github.com/zammad/zammad/labels/specification required)]
- Till label not assigned to corresponding input fields in calendar edit view [3793](https://github.com/zammad/zammad/issues/3793) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] [[frontend / JS app](https://github.com/zammad/zammad/labels/frontend / JS app)]
- Simple quote characters (`'`) not properly displayed [3846](https://github.com/zammad/zammad/issues/3846) [[bug](https://github.com/zammad/zammad/labels/bug)] [[frontend / JS app](https://github.com/zammad/zammad/labels/frontend / JS app)]
- Remove api user and password for sipgate integration [3848](https://github.com/zammad/zammad/issues/3848) [[bug](https://github.com/zammad/zammad/labels/bug)] [[admin area](https://github.com/zammad/zammad/labels/admin area)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)]
- No signature on new ticket if email is default message type [3844](https://github.com/zammad/zammad/issues/3844) [[bug](https://github.com/zammad/zammad/labels/bug)]
- Forwarding no longer possible for email and web articles [3855](https://github.com/zammad/zammad/issues/3855) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)] [[regression](https://github.com/zammad/zammad/labels/regression)]
- Default values of new group dialog is different in german vs. english [3851](https://github.com/zammad/zammad/issues/3851) [[bug](https://github.com/zammad/zammad/labels/bug)]
- If no date is set the UI show it's shown as NaN.NaN.NaN. [3850](https://github.com/zammad/zammad/issues/3850) [[bug](https://github.com/zammad/zammad/labels/bug)]
- Number of to show caller log entries is inconsistent setting wise [3852](https://github.com/zammad/zammad/issues/3852) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] [[admin area](https://github.com/zammad/zammad/labels/admin area)] [[integration](https://github.com/zammad/zammad/labels/integration)]
- Reply all: Duplicate email on changing recipient and cc in a certain way [3825](https://github.com/zammad/zammad/issues/3825) [[bug](https://github.com/zammad/zammad/labels/bug)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)]
- Removing calendars via UI and API does not check for references [3845](https://github.com/zammad/zammad/issues/3845) [[bug](https://github.com/zammad/zammad/labels/bug)] [[blocker](https://github.com/zammad/zammad/labels/blocker)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] [[escalation logic](https://github.com/zammad/zammad/labels/escalation logic)]
- Email address not shown inside forwarded email [3824](https://github.com/zammad/zammad/issues/3824) [[bug](https://github.com/zammad/zammad/labels/bug)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)]
- Wrong escalation update time in admin interface is shown [3837](https://github.com/zammad/zammad/issues/3837) [[bug](https://github.com/zammad/zammad/labels/bug)]
- Zammad returns stack error when one tries to remove groups via API [3841](https://github.com/zammad/zammad/issues/3841) [[bug](https://github.com/zammad/zammad/labels/bug)] [[API](https://github.com/zammad/zammad/labels/API)]
- Zammad ignores relative GitLab URLs [3830](https://github.com/zammad/zammad/issues/3830) [[bug](https://github.com/zammad/zammad/labels/bug)] [[integration](https://github.com/zammad/zammad/labels/integration)]
- If selected value is not part of the restriction of set_fixed_to it should recalculate it with the new value [3822](https://github.com/zammad/zammad/issues/3822) [[bug](https://github.com/zammad/zammad/labels/bug)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)]
- Invalid group and owner list for tickets created via customer profile [3835](https://github.com/zammad/zammad/issues/3835) [[bug](https://github.com/zammad/zammad/labels/bug)] [[core workflows](https://github.com/zammad/zammad/labels/core workflows)]
- Ticket zoom will loose attachments on rerender [3831](https://github.com/zammad/zammad/issues/3831) [[bug](https://github.com/zammad/zammad/labels/bug)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)]
- Package installation creates database.yml as `root` and thus breaks the installation until next update [3834](https://github.com/zammad/zammad/issues/3834) [[bug](https://github.com/zammad/zammad/labels/bug)] [[blocker](https://github.com/zammad/zammad/labels/blocker)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)] [[regression](https://github.com/zammad/zammad/labels/regression)]
- Ticket create screen will loose attachments by time [3827](https://github.com/zammad/zammad/issues/3827) [[bug](https://github.com/zammad/zammad/labels/bug)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)]
- Simple quote characters (`'`) not properly displayed [3733](https://github.com/zammad/zammad/issues/3733) [[bug](https://github.com/zammad/zammad/labels/bug)] [[frontend / JS app](https://github.com/zammad/zammad/labels/frontend / JS app)]
- When quoting, no breakout from div container possible [3094](https://github.com/zammad/zammad/issues/3094) [[bug](https://github.com/zammad/zammad/labels/bug)] [[ticket](https://github.com/zammad/zammad/labels/ticket)]
- Quoting not working cleanly, if content gets too much [2334](https://github.com/zammad/zammad/issues/2334) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] [[ticket](https://github.com/zammad/zammad/labels/ticket)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)]
- Zammad database credentials are world-readable [3828](https://github.com/zammad/zammad/issues/3828) [[bug](https://github.com/zammad/zammad/labels/bug)]
- Update time SLAs escalates tickets with agent response [3140](https://github.com/zammad/zammad/issues/3140) [[bug](https://github.com/zammad/zammad/labels/bug)] [[escalation logic](https://github.com/zammad/zammad/labels/escalation logic)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)]
## [5.0.2](https://github.com/zammad/zammad/tree/5.0.2) (2021-10-28)
[Full Changelog](https://github.com/zammad/zammad/compare/5.0.1...5.0.2)
**Fixed bugs:**
- When looking for customers, it is no longer possible to change into organizations [3815](https://github.com/zammad/zammad/issues/3815) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)]
- Owner should get cleared if not listed in changed group [3818](https://github.com/zammad/zammad/issues/3818) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)] [[core workflows](https://github.com/zammad/zammad/labels/core workflows)]
- Custom date and datetime attributes are filled with dates on creation of tickets/users after update from 4.1 to 5.x [3810](https://github.com/zammad/zammad/issues/3810) [[bug](https://github.com/zammad/zammad/labels/bug)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)]
- ActionController::UnknownHttpMethod FRAGE [3807](https://github.com/zammad/zammad/issues/3807) [[bug](https://github.com/zammad/zammad/labels/bug)] [[blocker](https://github.com/zammad/zammad/labels/blocker)] [[overviews](https://github.com/zammad/zammad/labels/overviews)] [[macros](https://github.com/zammad/zammad/labels/macros)]
- Remote change of the group id does show it falsly as user change and not render the new value to the ticket [3801](https://github.com/zammad/zammad/issues/3801) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)] [[core workflows](https://github.com/zammad/zammad/labels/core workflows)]
- Adding private keys allows adding certificates [3727](https://github.com/zammad/zammad/issues/3727) [[bug](https://github.com/zammad/zammad/labels/bug)]
- Able to create custom fields for existing relation (e. g. ticket.state) - will lead to non bootable Zammad [3811](https://github.com/zammad/zammad/issues/3811) [[bug](https://github.com/zammad/zammad/labels/bug)] [[regression](https://github.com/zammad/zammad/labels/regression)]
- Sort order group_by broken (alphabetical) [3800](https://github.com/zammad/zammad/issues/3800) [[bug](https://github.com/zammad/zammad/labels/bug)] [[overviews](https://github.com/zammad/zammad/labels/overviews)] [[regression](https://github.com/zammad/zammad/labels/regression)]
- Ticket owner selection is not updated if owner selection should be empty [3809](https://github.com/zammad/zammad/issues/3809) [[bug](https://github.com/zammad/zammad/labels/bug)] [[core workflows](https://github.com/zammad/zammad/labels/core workflows)]
- Chat can't be closed after timeout [2471](https://github.com/zammad/zammad/issues/2471) [[bug](https://github.com/zammad/zammad/labels/bug)] [[chat](https://github.com/zammad/zammad/labels/chat)]
- Support workflow mechanism to do pending reminder state hide pending time use case [3790](https://github.com/zammad/zammad/issues/3790) [[bug](https://github.com/zammad/zammad/labels/bug)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)]
- Cache.clear in postinstall.sh throws ugly errors on fresh installations [3808](https://github.com/zammad/zammad/issues/3808) [[bug](https://github.com/zammad/zammad/labels/bug)] [[blocker](https://github.com/zammad/zammad/labels/blocker)] [[regression](https://github.com/zammad/zammad/labels/regression)]
- Example payload in webhook view leads to 500 error [3794](https://github.com/zammad/zammad/issues/3794) [[bug](https://github.com/zammad/zammad/labels/bug)] [[regression](https://github.com/zammad/zammad/labels/regression)]
- OS package upgrade fails (activity_stream_object_id) [3797](https://github.com/zammad/zammad/issues/3797) [[bug](https://github.com/zammad/zammad/labels/bug)]
## [5.0.1](https://github.com/zammad/zammad/tree/5.0.1) (2021-10-08) ## [5.0.1](https://github.com/zammad/zammad/tree/5.0.1) (2021-10-08)
[Full Changelog](https://github.com/zammad/zammad/compare/5.0.0...5.0.1) [Full Changelog](https://github.com/zammad/zammad/compare/5.0.0...5.0.1)
**Fixed bugs:** **Fixed bugs:**
- Bug Report 4.1.x Overview Sort - Grouped by user [3737](https://github.com/zammad/zammad/issues/3737) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] [[overviews](https://github.com/zammad/zammad/labels/overviews)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)] [[regression](https://github.com/zammad/zammad/labels/regression)] - Bug Report 4.1.x Overview Sort - Grouped by user [3737](https://github.com/zammad/zammad/issues/3737) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] [[overviews](https://github.com/zammad/zammad/labels/overviews)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)] [[regression](https://github.com/zammad/zammad/labels/regression)]
- Article box opening on tickets with no changes [3789](https://github.com/zammad/zammad/issues/3789) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] - Article box opening on tickets with no changes [3789](https://github.com/zammad/zammad/issues/3789) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)]
- UploadCacheCleanupJob does not execute [3787](https://github.com/zammad/zammad/issues/3787) [[bug](https://github.com/zammad/zammad/labels/bug)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)] - UploadCacheCleanupJob does not execute [3787](https://github.com/zammad/zammad/issues/3787) [[bug](https://github.com/zammad/zammad/labels/bug)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)]
- lib/fill_db.rb fails to work in production environments [3788](https://github.com/zammad/zammad/issues/3788) [[bug](https://github.com/zammad/zammad/labels/bug)] - lib/fill_db.rb fails to work in production environments [3788](https://github.com/zammad/zammad/issues/3788) [[bug](https://github.com/zammad/zammad/labels/bug)]
## [5.0.0](https://github.com/zammad/zammad/tree/5.0.0) (2021-10-05) ## [5.0.0](https://github.com/zammad/zammad/tree/5.0.0) (2021-10-05)
[Full Changelog](https://github.com/zammad/zammad/compare/4.1.0...5.0.0) [Full Changelog](https://github.com/zammad/zammad/compare/4.1.0...5.0.0)
**Implemented enhancements:** **Implemented enhancements:**
- Core Workflow: Add organization condition attributes for object User [3779](https://github.com/zammad/zammad/issues/3779) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)] - Core Workflow: Add organization condition attributes for object User [3779](https://github.com/zammad/zammad/issues/3779) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)]
- No script content (e. g. javascript) in emails [3365](https://github.com/zammad/zammad/issues/3365) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)] [[mail processing](https://github.com/zammad/zammad/labels/mail processing)] - No script content (e. g. javascript) in emails [3365](https://github.com/zammad/zammad/issues/3365) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)] [[mail processing](https://github.com/zammad/zammad/labels/mail processing)]
- Read-only custom objects [2102](https://github.com/zammad/zammad/issues/2102) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)] [[object manager attribute](https://github.com/zammad/zammad/labels/object manager attribute)] [[core workflows](https://github.com/zammad/zammad/labels/core workflows)] - Read-only custom objects [2102](https://github.com/zammad/zammad/issues/2102) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] [[prioritised by payment](https://github.com/zammad/zammad/labels/prioritised by payment)] [[object manager attribute](https://github.com/zammad/zammad/labels/object manager attribute)] [[core workflows](https://github.com/zammad/zammad/labels/core workflows)]
@ -44,6 +110,7 @@
- Display minutes for session timeouts instead of seconds [3575](https://github.com/zammad/zammad/issues/3575) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] [[admin area](https://github.com/zammad/zammad/labels/admin area)] - Display minutes for session timeouts instead of seconds [3575](https://github.com/zammad/zammad/issues/3575) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] [[admin area](https://github.com/zammad/zammad/labels/admin area)]
**Fixed bugs:** **Fixed bugs:**
- Inconstant alignment in the listing of attachments/submit button in new article area [3773](https://github.com/zammad/zammad/issues/3773) [[bug](https://github.com/zammad/zammad/labels/bug)] - Inconstant alignment in the listing of attachments/submit button in new article area [3773](https://github.com/zammad/zammad/issues/3773) [[bug](https://github.com/zammad/zammad/labels/bug)]
- Improve contrasts in answer search for articles [3783](https://github.com/zammad/zammad/issues/3783) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] [[knowledge base](https://github.com/zammad/zammad/labels/knowledge base)] - Improve contrasts in answer search for articles [3783](https://github.com/zammad/zammad/issues/3783) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] [[knowledge base](https://github.com/zammad/zammad/labels/knowledge base)]
- escaped 'Set fixed' workflows don't refresh set values on active ticket sessions [3757](https://github.com/zammad/zammad/issues/3757) [[bug](https://github.com/zammad/zammad/labels/bug)] [[core workflows](https://github.com/zammad/zammad/labels/core workflows)] - escaped 'Set fixed' workflows don't refresh set values on active ticket sessions [3757](https://github.com/zammad/zammad/issues/3757) [[bug](https://github.com/zammad/zammad/labels/bug)] [[core workflows](https://github.com/zammad/zammad/labels/core workflows)]

View file

@ -21,50 +21,50 @@ GEM
specs: specs:
aasm (5.2.0) aasm (5.2.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
actioncable (6.0.4.1) actioncable (6.0.4.4)
actionpack (= 6.0.4.1) actionpack (= 6.0.4.4)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailbox (6.0.4.1) actionmailbox (6.0.4.4)
actionpack (= 6.0.4.1) actionpack (= 6.0.4.4)
activejob (= 6.0.4.1) activejob (= 6.0.4.4)
activerecord (= 6.0.4.1) activerecord (= 6.0.4.4)
activestorage (= 6.0.4.1) activestorage (= 6.0.4.4)
activesupport (= 6.0.4.1) activesupport (= 6.0.4.4)
mail (>= 2.7.1) mail (>= 2.7.1)
actionmailer (6.0.4.1) actionmailer (6.0.4.4)
actionpack (= 6.0.4.1) actionpack (= 6.0.4.4)
actionview (= 6.0.4.1) actionview (= 6.0.4.4)
activejob (= 6.0.4.1) activejob (= 6.0.4.4)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (6.0.4.1) actionpack (6.0.4.4)
actionview (= 6.0.4.1) actionview (= 6.0.4.4)
activesupport (= 6.0.4.1) activesupport (= 6.0.4.4)
rack (~> 2.0, >= 2.0.8) rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.4.1) actiontext (6.0.4.4)
actionpack (= 6.0.4.1) actionpack (= 6.0.4.4)
activerecord (= 6.0.4.1) activerecord (= 6.0.4.4)
activestorage (= 6.0.4.1) activestorage (= 6.0.4.4)
activesupport (= 6.0.4.1) activesupport (= 6.0.4.4)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (6.0.4.1) actionview (6.0.4.4)
activesupport (= 6.0.4.1) activesupport (= 6.0.4.4)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.4.1) activejob (6.0.4.4)
activesupport (= 6.0.4.1) activesupport (= 6.0.4.4)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (6.0.4.1) activemodel (6.0.4.4)
activesupport (= 6.0.4.1) activesupport (= 6.0.4.4)
activerecord (6.0.4.1) activerecord (6.0.4.4)
activemodel (= 6.0.4.1) activemodel (= 6.0.4.4)
activesupport (= 6.0.4.1) activesupport (= 6.0.4.4)
activerecord-import (1.2.0) activerecord-import (1.2.0)
activerecord (>= 3.2) activerecord (>= 3.2)
activerecord-nulldb-adapter (0.7.0) activerecord-nulldb-adapter (0.7.0)
@ -75,12 +75,12 @@ GEM
multi_json (~> 1.11, >= 1.11.2) multi_json (~> 1.11, >= 1.11.2)
rack (>= 2.0.8, < 3) rack (>= 2.0.8, < 3)
railties (>= 5.2.4.1) railties (>= 5.2.4.1)
activestorage (6.0.4.1) activestorage (6.0.4.4)
actionpack (= 6.0.4.1) actionpack (= 6.0.4.4)
activejob (= 6.0.4.1) activejob (= 6.0.4.4)
activerecord (= 6.0.4.1) activerecord (= 6.0.4.4)
marcel (~> 1.0.0) marcel (~> 1.0.0)
activesupport (6.0.4.1) activesupport (6.0.4.4)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
minitest (~> 5.1) minitest (~> 5.1)
@ -250,7 +250,7 @@ GEM
rainbow (>= 2.2.1) rainbow (>= 2.2.1)
rake (>= 10.0) rake (>= 10.0)
gli (2.20.1) gli (2.20.1)
globalid (0.5.2) globalid (1.0.0)
activesupport (>= 5.0) activesupport (>= 5.0)
gmail_xoauth (0.4.2) gmail_xoauth (0.4.2)
oauth (>= 0.3.6) oauth (>= 0.3.6)
@ -319,7 +319,7 @@ GEM
logging (2.3.0) logging (2.3.0)
little-plugger (~> 1.1) little-plugger (~> 1.1)
multi_json (~> 1.14) multi_json (~> 1.14)
loofah (2.12.0) loofah (2.13.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
lumberjack (1.2.8) lumberjack (1.2.8)
@ -335,7 +335,7 @@ GEM
mini_portile2 (2.6.1) mini_portile2 (2.6.1)
mini_racer (0.2.9) mini_racer (0.2.9)
libv8 (>= 6.9.411) libv8 (>= 6.9.411)
minitest (5.14.4) minitest (5.15.0)
msgpack (1.4.2) msgpack (1.4.2)
msgpack (1.4.2-x86_64-linux-musl) msgpack (1.4.2-x86_64-linux-musl)
multi_json (1.15.0) multi_json (1.15.0)
@ -458,20 +458,20 @@ GEM
rack rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (6.0.4.1) rails (6.0.4.4)
actioncable (= 6.0.4.1) actioncable (= 6.0.4.4)
actionmailbox (= 6.0.4.1) actionmailbox (= 6.0.4.4)
actionmailer (= 6.0.4.1) actionmailer (= 6.0.4.4)
actionpack (= 6.0.4.1) actionpack (= 6.0.4.4)
actiontext (= 6.0.4.1) actiontext (= 6.0.4.4)
actionview (= 6.0.4.1) actionview (= 6.0.4.4)
activejob (= 6.0.4.1) activejob (= 6.0.4.4)
activemodel (= 6.0.4.1) activemodel (= 6.0.4.4)
activerecord (= 6.0.4.1) activerecord (= 6.0.4.4)
activestorage (= 6.0.4.1) activestorage (= 6.0.4.4)
activesupport (= 6.0.4.1) activesupport (= 6.0.4.4)
bundler (>= 1.3.0) bundler (>= 1.3.0)
railties (= 6.0.4.1) railties (= 6.0.4.4)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5) rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1) actionpack (>= 5.0.1.rc1)
@ -482,9 +482,9 @@ GEM
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.4.1) rails-html-sanitizer (1.4.1)
loofah (~> 2.3) loofah (~> 2.3)
railties (6.0.4.1) railties (6.0.4.4)
actionpack (= 6.0.4.1) actionpack (= 6.0.4.4)
activesupport (= 6.0.4.1) activesupport (= 6.0.4.4)
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0) thor (>= 0.20.3, < 2.0)
@ -597,9 +597,9 @@ GEM
sprockets (3.7.2) sprockets (3.7.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.2.2) sprockets-rails (3.4.2)
actionpack (>= 4.0) actionpack (>= 5.2)
activesupport (>= 4.0) activesupport (>= 5.2)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sync (0.5.0) sync (0.5.0)
tcr (0.2.2) tcr (0.2.2)

View file

@ -300,9 +300,10 @@ class App.Controller extends Spine.Controller
frontendTimeUpdateItem: (item, currentVal) => frontendTimeUpdateItem: (item, currentVal) =>
timestamp = item.attr('datetime') timestamp = item.attr('datetime')
time = @humanTime(timestamp, item.hasClass('escalation')) return if timestamp is 'null'
# only do dom updates on changes # only do dom updates on changes
time = @humanTime(timestamp, item.hasClass('escalation'))
return if time is currentVal return if time is currentVal
newTitle = App.i18n.translateTimestamp(timestamp) newTitle = App.i18n.translateTimestamp(timestamp)

View file

@ -418,11 +418,11 @@ class App.ControllerForm extends App.Controller
if !@constructor.fieldIsMandatory(field_by_name) if !@constructor.fieldIsMandatory(field_by_name)
field_by_name.attr('required', true) field_by_name.attr('required', true)
field_by_name.parents('.form-group').find('label span').html('*') field_by_name.closest('.form-group').find('label span').html('*')
field_by_name.closest('.form-group').addClass('is-required') field_by_name.closest('.form-group').addClass('is-required')
if !@constructor.fieldIsMandatory(field_by_data) if !@constructor.fieldIsMandatory(field_by_data)
field_by_data.attr('required', true) field_by_data.attr('required', true)
field_by_data.parents('.form-group').find('label span').html('*') field_by_data.closest('.form-group').find('label span').html('*')
field_by_data.closest('.form-group').addClass('is-required') field_by_data.closest('.form-group').addClass('is-required')
optional: (name, el = @form) -> optional: (name, el = @form) ->
@ -434,11 +434,11 @@ class App.ControllerForm extends App.Controller
if @constructor.fieldIsMandatory(field_by_name) if @constructor.fieldIsMandatory(field_by_name)
field_by_name.attr('required', false) field_by_name.attr('required', false)
field_by_name.parents('.form-group').find('label span').html('') field_by_name.closest('.form-group').find('label span').html('')
field_by_name.closest('.form-group').removeClass('is-required') field_by_name.closest('.form-group').removeClass('is-required')
if @constructor.fieldIsMandatory(field_by_data) if @constructor.fieldIsMandatory(field_by_data)
field_by_data.attr('required', false) field_by_data.attr('required', false)
field_by_data.parents('.form-group').find('label span').html('') field_by_data.closest('.form-group').find('label span').html('')
field_by_data.closest('.form-group').removeClass('is-required') field_by_data.closest('.form-group').removeClass('is-required')
readonly: (name, el = @form) -> readonly: (name, el = @form) ->

View file

@ -493,14 +493,6 @@ class App.ControllerTable extends App.Controller
sortable: @dndCallback sortable: @dndCallback
)) ))
getGroupByKeyName: (object, groupBy) ->
reference_key = groupBy + '_id'
if reference_key of object
return reference_key
groupBy
sortObjectKeys: (objects, direction) -> sortObjectKeys: (objects, direction) ->
sorted = Object.keys(objects).sort() sorted = Object.keys(objects).sort()
@ -523,7 +515,7 @@ class App.ControllerTable extends App.Controller
objectsToShow = @objectsOfPage(@pagerShownPage) objectsToShow = @objectsOfPage(@pagerShownPage)
if @groupBy if @groupBy
# group by raw (and not printable) value so dates work also # group by raw (and not printable) value so dates work also
objectsGrouped = _.groupBy(objectsToShow, (object) => object[@getGroupByKeyName(object, @groupBy)]) objectsGrouped = _.groupBy(objectsToShow, (object) => @groupObjectName(object, @groupBy, excludeTags: ['date', 'datetime']))
else else
objectsGrouped = { '': objectsToShow } objectsGrouped = { '': objectsToShow }
@ -863,11 +855,15 @@ class App.ControllerTable extends App.Controller
@objects = localObjects @objects = localObjects
@lastSortedobjects = localObjects @lastSortedobjects = localObjects
groupObjectName: (object, key = undefined) -> groupObjectName: (object, key = undefined, options = {}) ->
group = object group = object
if key if key
if key not of object if key not of object
key += '_id' key += '_id'
# return internal value if needed
return object[key] if options.excludeTags && _.find(@attributesList, (attr) -> attr.name == key && _.contains(options.excludeTags, attr.tag))
group = App.viewPrint(object, key, @attributesList) group = App.viewPrint(object, key, @attributesList)
if _.isEmpty(group) if _.isEmpty(group)
group = '' group = ''

View file

@ -0,0 +1,9 @@
class App.ControllerTechnicalErrorModal extends App.ControllerModal
head: "StatusCode: #{status}"
contentCode: ''
buttonClose: false
buttonSubmit: 'Ok'
onSubmit: (e) -> @close(e)
content: ->
"<pre><code>#{@contentCode}</code></pre>"

View file

@ -428,20 +428,7 @@ class ChannelEmailAccountWizard extends App.ControllerWizardModal
ui.hide('options::folder') ui.hide('options::folder')
ui.hide('options::keep_on_server') ui.hide('options::keep_on_server')
handlePort = (params, attribute, attributes, classname, form, ui) -> form = new App.ControllerForm(
return if !params
return if !params.options
currentPort = @$('[name="options::port"]').val()
if params.options.ssl is true
if !currentPort || currentPort is '143'
@$('[name="options::port"]').val('993')
return
if params.options.ssl is false
if !currentPort || currentPort is '993'
@$('[name="options::port"]').val('143')
return
new App.ControllerForm(
el: @$('.base-inbound-settings'), el: @$('.base-inbound-settings'),
model: model:
configure_attributes: configureAttributesInbound configure_attributes: configureAttributesInbound
@ -449,10 +436,16 @@ class ChannelEmailAccountWizard extends App.ControllerWizardModal
params: @account.inbound params: @account.inbound
handlers: [ handlers: [
showHideFolder, showHideFolder,
handlePort,
] ]
) )
form.el.find("select[name='options::ssl']").off('change').on('change', (e) ->
if $(e.target).val() is 'true'
form.el.find("[name='options::port']").val('993')
else
form.el.find("[name='options::port']").val('143')
)
toggleOutboundAdapter: => toggleOutboundAdapter: =>
# fill user / password based on intro info # fill user / password based on intro info

View file

@ -60,6 +60,30 @@ class Form extends App.Controller
placetel_token: App.Setting.get('placetel_token') placetel_token: App.Setting.get('placetel_token')
) )
configure_attributes = [
{
name: 'view_limit',
display: '',
tag: 'select',
null: false,
options: [
{ name: 60, value: 60 }
{ name: 120, value: 120 }
{ name: 180, value: 180 }
{ name: 240, value: 240 }
{ name: 300, value: 300 }
]
},
]
new App.ControllerForm(
el: @$('.js-viewLimit')
model:
configure_attributes: configure_attributes,
params:
view_limit: @config['view_limit']
autofocus: false
)
updateCurrentConfig: => updateCurrentConfig: =>
config = @config config = @config
cleanupInput = @cleanupInput cleanupInput = @cleanupInput
@ -70,6 +94,10 @@ class Form extends App.Controller
default_caller_id = @$('input[name=default_caller_id]').val() default_caller_id = @$('input[name=default_caller_id]').val()
config.outbound.default_caller_id = cleanupInput(default_caller_id) config.outbound.default_caller_id = cleanupInput(default_caller_id)
# default view limit
view_limit = @$('select[name=view_limit]').val()
config.view_limit = parseInt(view_limit)
# routing table # routing table
config.outbound.routing_table = [] config.outbound.routing_table = []
@$('.js-outboundRouting .js-row').each(-> @$('.js-outboundRouting .js-row').each(->

View file

@ -59,17 +59,42 @@ class Form extends App.Controller
config: @config config: @config
) )
configure_attributes = [
{
name: 'view_limit',
display: '',
tag: 'select',
null: false,
options: [
{ name: 60, value: 60 }
{ name: 120, value: 120 }
{ name: 180, value: 180 }
{ name: 240, value: 240 }
{ name: 300, value: 300 }
]
},
]
new App.ControllerForm(
el: @$('.js-viewLimit')
model:
configure_attributes: configure_attributes,
params:
view_limit: @config['view_limit']
autofocus: false
)
updateCurrentConfig: => updateCurrentConfig: =>
config = @config config = @config
cleanupInput = @cleanupInput cleanupInput = @cleanupInput
config.api_user = cleanupInput(@$('input[name=api_user]').val())
config.api_password = cleanupInput(@$('input[name=api_password]').val())
# default caller_id # default caller_id
default_caller_id = @$('input[name=default_caller_id]').val() default_caller_id = @$('input[name=default_caller_id]').val()
config.outbound.default_caller_id = cleanupInput(default_caller_id) config.outbound.default_caller_id = cleanupInput(default_caller_id)
# default view limit
view_limit = @$('select[name=view_limit]').val()
config.view_limit = parseInt(view_limit)
# routing table # routing table
config.outbound.routing_table = [] config.outbound.routing_table = []
@$('.js-outboundRouting .js-row').each(-> @$('.js-outboundRouting .js-row').each(->

View file

@ -96,6 +96,8 @@ class App.UiElement.ApplicationSelector
# ignore passwords and relations # ignore passwords and relations
if row.type isnt 'password' && row.name.substr(row.name.length-4,4) isnt '_ids' && row.searchable isnt false if row.type isnt 'password' && row.name.substr(row.name.length-4,4) isnt '_ids' && row.searchable isnt false
config = _.clone(row) config = _.clone(row)
if config.tag is 'textarea'
config.expanding = false
if config.type is 'email' || config.type is 'tel' if config.type is 'email' || config.type is 'tel'
config.type = 'text' config.type = 'text'
for operatorRegEx, operator of operators_type for operatorRegEx, operator of operators_type

View file

@ -46,7 +46,7 @@ class App.UiElement.ApplicationUiElement
result = [] result = []
for row in selection for row in selection
if attribute.translate if attribute.translate
row.name = App.i18n.translateInline(row.name) row.name = App.i18n.translatePlain(row.name)
if !_.isEmpty(row.children) if !_.isEmpty(row.children)
row.children = @getConfigOptionListArray(attribute, row.children) row.children = @getConfigOptionListArray(attribute, row.children)
result.push row result.push row
@ -65,7 +65,7 @@ class App.UiElement.ApplicationUiElement
for key in order for key in order
name_new = selection[key] name_new = selection[key]
if attribute.translate if attribute.translate
name_new = App.i18n.translateInline(name_new) name_new = App.i18n.translatePlain(name_new)
attribute.options.push { attribute.options.push {
name: name_new name: name_new
value: key value: key
@ -162,7 +162,7 @@ class App.UiElement.ApplicationUiElement
nameNew = item.name nameNew = item.name
if attribute.translate if attribute.translate
nameNew = App.i18n.translateInline(nameNew) nameNew = App.i18n.translatePlain(nameNew)
row = row =
value: item.id, value: item.id,

View file

@ -0,0 +1,9 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.auth_provider
@render: (attribute) ->
for key, value of App.Config.get('auth_provider_all')
continue if value.config isnt attribute.provider
attribute.value = "#{App.Config.get('http_type')}://#{App.Config.get('fqdn')}#{value.url}/callback"
break
$( App.view('generic/auth_provider')( attribute: attribute ) )

View file

@ -155,4 +155,4 @@ class App.UiElement.basedate
clear: 'clear' clear: 'clear'
} }
App.i18n.translateDeep(data) App.i18n.translateDeepPlain(data)

View file

@ -50,15 +50,15 @@ class App.UiElement.core_workflow_condition extends App.UiElement.ApplicationSel
operatorsType = operatorsType =
'active$': ['is'] 'active$': ['is']
'boolean$': ['is', 'is not', 'is set', 'not set'] 'boolean$': ['is', 'is not', 'is set', 'not set', 'has changed', 'changed to']
'integer$': ['is', 'is not', 'is set', 'not set'] 'integer$': ['is', 'is not', 'is set', 'not set', 'has changed', 'changed to']
'^select$': ['is', 'is not', 'is set', 'not set'] '^select$': ['is', 'is not', 'is set', 'not set', 'has changed', 'changed to']
'^tree_select$': ['is', 'is not', 'is set', 'not set'] '^tree_select$': ['is', 'is not', 'is set', 'not set', 'has changed', 'changed to']
'^(input|textarea|richtext)$': ['is', 'is not', 'is set', 'not set', 'regex match', 'regex mismatch'] '^(input|textarea|richtext)$': ['is', 'is not', 'is set', 'not set', 'has changed', 'changed to', 'regex match', 'regex mismatch']
operatorsName = operatorsName =
'_id$': ['is', 'is not', 'is set', 'not set'] '_id$': ['is', 'is not', 'is set', 'not set', 'has changed', 'changed to']
'_ids$': ['is', 'is not', 'is set', 'not set'] '_ids$': ['is', 'is not', 'is set', 'not set', 'has changed', 'changed to']
# merge config # merge config
elements = {} elements = {}
@ -153,6 +153,8 @@ class App.UiElement.core_workflow_condition extends App.UiElement.ApplicationSel
# ignore passwords and relations # ignore passwords and relations
if row.type isnt 'password' && row.name.substr(row.name.length-4,4) isnt '_ids' && row.searchable isnt false if row.type isnt 'password' && row.name.substr(row.name.length-4,4) isnt '_ids' && row.searchable isnt false
config = _.clone(row) config = _.clone(row)
if config.tag is 'textarea'
config.expanding = false
if config.tag is 'select' if config.tag is 'select'
config.multiple = true config.multiple = true
config.default = undefined config.default = undefined
@ -175,7 +177,7 @@ class App.UiElement.core_workflow_condition extends App.UiElement.ApplicationSel
currentOperator = elementRow.find('.js-operator option:selected').attr('value') currentOperator = elementRow.find('.js-operator option:selected').attr('value')
name = @buildValueName(elementFull, elementRow, groupAndAttribute, elements, meta, attribute) name = @buildValueName(elementFull, elementRow, groupAndAttribute, elements, meta, attribute)
if _.contains(['is set', 'not set'], currentOperator) if _.contains(['is set', 'not set', 'has changed'], currentOperator)
elementRow.find('.js-value').addClass('hide').html('<input type="hidden" name="' + name + '" value="true" />') elementRow.find('.js-value').addClass('hide').html('<input type="hidden" name="' + name + '" value="true" />')
return return

View file

@ -128,7 +128,7 @@ class App.UiElement.core_workflow_perform extends App.UiElement.ApplicationSelec
super(elementFull, elementRow, groupAndAttribute, elements, meta, attribute) super(elementFull, elementRow, groupAndAttribute, elements, meta, attribute)
@buildValueConfigMultiple: (config, meta) -> @buildValueConfigMultiple: (config, meta) ->
if _.contains(['add_option', 'remove_option', 'set_fixed_to'], meta.operator) if _.contains(['add_option', 'remove_option', 'set_fixed_to', 'select'], meta.operator)
config.multiple = true config.multiple = true
config.nulloption = true config.nulloption = true
else else

View file

@ -244,7 +244,7 @@ class App.UiElement.object_manager_attribute extends App.UiElement.ApplicationUi
params: params params: params
) )
configureAttributes = [ configureAttributes = [
{ name: 'data_option::diff', display: 'Default time Diff (minutes)', tag: 'integer', null: false, default: 24 }, { name: 'data_option::diff', display: 'Default time Diff (minutes)', tag: 'integer', null: true },
] ]
datetimeDiff = new App.ControllerForm( datetimeDiff = new App.ControllerForm(
model: model:
@ -258,7 +258,7 @@ class App.UiElement.object_manager_attribute extends App.UiElement.ApplicationUi
@date: (item, localParams, params) -> @date: (item, localParams, params) ->
configureAttributes = [ configureAttributes = [
{ name: 'data_option::diff', display: 'Default time Diff (hours)', tag: 'integer', null: false, default: 24 }, { name: 'data_option::diff', display: 'Default time Diff (hours)', tag: 'integer', null: true },
] ]
dateDiff = new App.ControllerForm( dateDiff = new App.ControllerForm(
model: model:

View file

@ -27,6 +27,8 @@ class App.UiElement.richtext
renderFile = (file) -> renderFile = (file) ->
item.find('.attachments').append(App.view('generic/attachment_item')(file)) item.find('.attachments').append(App.view('generic/attachment_item')(file))
attachments.push file attachments.push file
if form.richTextUploadRenderCallback
form.richTextUploadRenderCallback(attribute, attachments)
if params && params.attachments if params && params.attachments
for file in params.attachments for file in params.attachments
@ -54,6 +56,8 @@ class App.UiElement.richtext
return if item.id.toString() is id.toString() return if item.id.toString() is id.toString()
item item
) )
if form.richTextUploadDeleteCallback
form.richTextUploadDeleteCallback(attribute, attachments)
form_id = item.closest('form').find('[name=form_id]').val() form_id = item.closest('form').find('[name=form_id]').val()

View file

@ -8,9 +8,11 @@ class App.UiElement.sla_times
item = $( App.view('generic/sla_times')( item = $( App.view('generic/sla_times')(
attribute: attribute attribute: attribute
first_response_time: params.first_response_time first_response_time: params.first_response_time
response_time: params.response_time
update_time: params.update_time update_time: params.update_time
solution_time: params.solution_time solution_time: params.solution_time
first_response_time_in_text: @toText(params.first_response_time) first_response_time_in_text: @toText(params.first_response_time)
response_time_in_text: @toText(params.response_time)
update_time_in_text: @toText(params.update_time) update_time_in_text: @toText(params.update_time)
solution_time_in_text: @toText(params.solution_time) solution_time_in_text: @toText(params.solution_time)
) ) ) )
@ -26,12 +28,16 @@ class App.UiElement.sla_times
row = element.closest('tr') row = element.closest('tr')
if element.prop('checked') if element.prop('checked')
row.addClass('is-active') row.addClass('is-active')
if row.has('.js-updateTypeSelector').length > 0 && row.has('.js-updateTypeSelector:checked').length == 0
row.find('.js-updateTypeSelector:first').prop('checked', true)
else else
row.removeClass('is-active') row.removeClass('is-active')
# reset data item # reset data item
row.find('.js-timeConvertFrom').val('') row.find('.js-timeConvertFrom').val('')
row.find('.js-timeConvertTo').val('') row.find('.js-timeConvertTo').val('')
row.find('.js-updateTypeSelector').attr('checked', false)
row.find('.help-inline').empty() row.find('.help-inline').empty()
row.removeClass('has-error') row.removeClass('has-error')
) )
@ -42,12 +48,16 @@ class App.UiElement.sla_times
inText = element.val() inText = element.val()
row = element.closest('tr') row = element.closest('tr')
row.find('.js-activateRow').prop('checked', true)
row
.find('.js-activateRow')
.prop('checked', true)
.trigger('change')
row.addClass('is-active') row.addClass('is-active')
element row
.closest('td') .find("[name='#{element.data('name')}']")
.find('.js-timeConvertTo')
.val(@toMinutes(inText) || '') .val(@toMinutes(inText) || '')
) )
@ -56,9 +66,19 @@ class App.UiElement.sla_times
$(e.currentTarget).closest('tr').find('.checkbox-replacement').click() $(e.currentTarget).closest('tr').find('.checkbox-replacement').click()
) )
# toggle update type on clicking around the element
item.find('.js-forward-radio').bind('click', (e) ->
elem = $(e.currentTarget).closest('p').find('.js-updateTypeSelector')
elem.prop('checked', true)
elem.trigger('change')
)
# focus time input on clicking surrounding cell # focus time input on clicking surrounding cell
item.find('.js-focus-input').bind('click', (e) -> item.find('.js-focus-input').bind('click', (e) ->
$(e.currentTarget).find('.form-control').focus() $(e.currentTarget)
.find('.form-control:visible')
.focus()
) )
# show placeholder instead of 00:00 # show placeholder instead of 00:00
@ -67,15 +87,36 @@ class App.UiElement.sla_times
$(e.currentTarget).val('') $(e.currentTarget).val('')
) )
# switch update/response times when type is selected accordingly
item.find('.js-updateTypeSelector').bind('change', (e) ->
element = $(e.target)
row = element.closest('tr')
row.find('.js-activateRow').prop('checked', true)
row.addClass('is-active')
row
.find('.js-timeConvertFrom')
.addClass('hidden')
.val('')
row
.find('.js-timeConvertTo')
.val('')
row
.find("[data-name='#{element.val()}_time']")
.removeClass('hidden')
)
# set initial active/inactive rows # set initial active/inactive rows
item.find('.js-timeConvertFrom').each(-> item.find('.js-timeConvertFrom').each(->
row = $(@).closest('tr') row = $(@).closest('tr')
checkbox = row.find('.js-activateRow') checkbox = row.find('.js-activateRow')
if $(@).val()
return if !$(@).val()
checkbox.prop('checked', true) checkbox.prop('checked', true)
row.addClass('is-active') row.addClass('is-active')
else
checkbox.prop('checked', false)
) )
item item

View file

@ -4,6 +4,7 @@ class App.UiElement.textarea
fileUploaderId = 'file-uploader-' + new Date().getTime() + '-' + Math.floor( Math.random() * 99999 ) fileUploaderId = 'file-uploader-' + new Date().getTime() + '-' + Math.floor( Math.random() * 99999 )
item = $( App.view('generic/textarea')( attribute: attribute ) + '<div class="file-uploader ' + attribute.class + '" id="' + fileUploaderId + '"></div>' ) item = $( App.view('generic/textarea')( attribute: attribute ) + '<div class="file-uploader ' + attribute.class + '" id="' + fileUploaderId + '"></div>' )
if attribute.expanding isnt false
a = -> a = ->
visible = $( item[0] ).is(':visible') visible = $( item[0] ).is(':visible')
if visible && !$( item[0] ).expanding('active') if visible && !$( item[0] ).expanding('active')

View file

@ -48,12 +48,15 @@ class App.TicketCreate extends App.Controller
if @ticket_id && @article_id if @ticket_id && @article_id
@split = "/#{@ticket_id}/#{@article_id}" @split = "/#{@ticket_id}/#{@article_id}"
load = (data) => @ajax(
type: 'GET'
url: "#{@apiPath}/ticket_create"
processData: true
success: (data, status, xhr) =>
App.Collection.loadAssets(data.assets) App.Collection.loadAssets(data.assets)
@formMeta = data.form_meta @formMeta = data.form_meta
@buildScreen(params) @buildScreen(params)
@bindId = App.TicketCreateCollection.bind(load, false) )
App.TicketCreateCollection.fetch()
# rerender view, e. g. on langauge change # rerender view, e. g. on langauge change
@controllerBind('ui:rerender', => @controllerBind('ui:rerender', =>
@ -69,9 +72,6 @@ class App.TicketCreate extends App.Controller
@sidebarWidget.render(@params()) @sidebarWidget.render(@params())
) )
release: =>
App.TicketCreateCollection.unbindById(@bindId)
currentChannel: => currentChannel: =>
if !type if !type
type = @$('.type-tabs .tab.active').data('type') type = @$('.type-tabs .tab.active').data('type')
@ -282,8 +282,15 @@ class App.TicketCreate extends App.Controller
return if !@formMeta return if !@formMeta
App.QueueManager.run(@queueKey) App.QueueManager.run(@queueKey)
updateTaskManagerAttachments: (attribute, attachments) =>
taskData = App.TaskManager.get(@taskKey)
return if _.isEmpty(taskData)
taskData.attachments = attachments
App.TaskManager.update(@taskKey, taskData)
render: (template = {}) -> render: (template = {}) ->
return if !@formMeta
# get params # get params
params = @prefilledParams || {} params = @prefilledParams || {}
if template && !_.isEmpty(template.options) if template && !_.isEmpty(template.options)
@ -330,7 +337,6 @@ class App.TicketCreate extends App.Controller
model: App.Ticket model: App.Ticket
screen: 'create_middle' screen: 'create_middle'
handlersConfig: handlers handlersConfig: handlers
filter: @formMeta.filter
formMeta: @formMeta formMeta: @formMeta
params: params params: params
noFieldset: true noFieldset: true
@ -359,8 +365,6 @@ class App.TicketCreate extends App.Controller
events: events:
'change [name=customer_id]': @localUserInfo 'change [name=customer_id]': @localUserInfo
handlersConfig: handlersTunnel handlersConfig: handlersTunnel
filter: @formMeta.filter
formMeta: @formMeta
autofocus: true autofocus: true
params: params params: params
taskKey: @taskKey taskKey: @taskKey
@ -376,6 +380,8 @@ class App.TicketCreate extends App.Controller
handlersConfig: handlersTunnel handlersConfig: handlersTunnel
params: params params: params
taskKey: @taskKey taskKey: @taskKey
richTextUploadRenderCallback: @updateTaskManagerAttachments
richTextUploadDeleteCallback: @updateTaskManagerAttachments
) )
@controllerFormCreateBottom = new App.ControllerForm( @controllerFormCreateBottom = new App.ControllerForm(
el: @$('.ticket-form-bottom') el: @$('.ticket-form-bottom')
@ -383,8 +389,6 @@ class App.TicketCreate extends App.Controller
model: App.Ticket model: App.Ticket
screen: 'create_bottom' screen: 'create_bottom'
handlersConfig: handlersTunnel handlersConfig: handlersTunnel
filter: @formMeta.filter
formMeta: @formMeta
params: params params: params
taskKey: @taskKey taskKey: @taskKey
) )

View file

@ -1,4 +1,4 @@
class TicketCreateFormHanderSignature class TicketCreateFormHandlerSignature
@run: (params, attribute, attributes, classname, form, ui) -> @run: (params, attribute, attributes, classname, form, ui) ->
return if !attribute return if !attribute
@ -19,9 +19,6 @@ class TicketCreateFormHanderSignature
if App.Utils.signatureCheck(currentBody.html() || '', signatureFinished) if App.Utils.signatureCheck(currentBody.html() || '', signatureFinished)
# if signature has changed, in case remove old signature # if signature has changed, in case remove old signature
signature_id = ui.el.closest('.content').find('[data-signature=true]').data('signature-id')
if signature_id && signature_id.toString() isnt signature.id.toString()
ui.el.closest('.content').find('[data-signature="true"]').remove() ui.el.closest('.content').find('[data-signature="true"]').remove()
if !App.Utils.htmlLastLineEmpty(currentBody) if !App.Utils.htmlLastLineEmpty(currentBody)
@ -35,4 +32,4 @@ class TicketCreateFormHanderSignature
else else
ui.el.closest('.content').find('[data-name="body"]').find('[data-signature=true]').remove() ui.el.closest('.content').find('[data-name="body"]').find('[data-signature=true]').remove()
App.Config.set('200-ticketFormSignature', TicketCreateFormHanderSignature, 'TicketCreateFormHandler') App.Config.set('200-ticketFormSignature', TicketCreateFormHandlerSignature, 'TicketCreateFormHandler')

View file

@ -13,13 +13,7 @@ class CustomerTicketCreate extends App.ControllerAppContent
@form_id = App.ControllerForm.formId() @form_id = App.ControllerForm.formId()
@navupdate '#customer_ticket_new' @navupdate '#customer_ticket_new'
load = (data) =>
App.Collection.loadAssets(data.assets)
@formMeta = data.form_meta
@render() @render()
@bindId = App.TicketCreateCollection.bind(load, false)
App.TicketCreateCollection.fetch()
render: (template = {}) -> render: (template = {}) ->
if !@Config.get('customer_ticket_create') if !@Config.get('customer_ticket_create')
@ -43,8 +37,6 @@ class CustomerTicketCreate extends App.ControllerAppContent
form_id: @form_id form_id: @form_id
model: App.Ticket model: App.Ticket
screen: 'create_middle' screen: 'create_middle'
filter: @formMeta.filter
formMeta: @formMeta
params: defaults params: defaults
noFieldset: true noFieldset: true
handlersConfig: handlers handlersConfig: handlers
@ -70,8 +62,6 @@ class CustomerTicketCreate extends App.ControllerAppContent
model: App.Ticket model: App.Ticket
screen: 'create_top' screen: 'create_top'
handlersConfig: handlersTunnel handlersConfig: handlersTunnel
filter: @formMeta.filter
formMeta: @formMeta
autofocus: true autofocus: true
params: defaults params: defaults
) )
@ -83,8 +73,6 @@ class CustomerTicketCreate extends App.ControllerAppContent
events: events:
'fileUploadStart .richtext': => @submitDisable() 'fileUploadStart .richtext': => @submitDisable()
'fileUploadStop .richtext': => @submitEnable() 'fileUploadStop .richtext': => @submitEnable()
filter: @formMeta.filter
formMeta: @formMeta
params: defaults params: defaults
handlersConfig: handlersTunnel handlersConfig: handlersTunnel
) )
@ -95,8 +83,6 @@ class CustomerTicketCreate extends App.ControllerAppContent
model: App.Ticket model: App.Ticket
screen: 'create_bottom' screen: 'create_bottom'
handlersConfig: handlersTunnel handlersConfig: handlersTunnel
filter: @formMeta.filter
formMeta: @formMeta
params: defaults params: defaults
) )

View file

@ -91,20 +91,7 @@ class GettingStartedChannelEmail extends App.ControllerWizardFullScreen
ui.hide('options::folder') ui.hide('options::folder')
ui.hide('options::keep_on_server') ui.hide('options::keep_on_server')
handlePort = (params, attribute, attributes, classname, form, ui) -> form = new App.ControllerForm(
return if !params
return if !params.options
currentPort = @$('.base-inbound-settings [name="options::port"]').val()
if params.options.ssl is true
if !currentPort
@$('.base-inbound-settings [name="options::port"]').val('993')
return
if params.options.ssl is false
if !currentPort || currentPort is '993'
@$('.base-inbound-settings [name="options::port"]').val('143')
return
new App.ControllerForm(
el: @$('.base-inbound-settings') el: @$('.base-inbound-settings')
model: model:
configure_attributes: configureAttributesInbound configure_attributes: configureAttributesInbound
@ -112,10 +99,16 @@ class GettingStartedChannelEmail extends App.ControllerWizardFullScreen
params: @account.inbound params: @account.inbound
handlers: [ handlers: [
showHideFolder, showHideFolder,
handlePort,
] ]
) )
form.el.find("select[name='options::ssl']").off('change').on('change', (e) ->
if $(e.target).val() is 'true'
form.el.find("[name='options::port']").val('993')
else
form.el.find("[name='options::port']").val('143')
)
toggleOutboundAdapter: => toggleOutboundAdapter: =>
# fill user / password based on intro info # fill user / password based on intro info

View file

@ -165,7 +165,7 @@ class ImportFreshdesk extends App.ControllerWizardFullScreen
@$('.js-error').addClass('hide') @$('.js-error').addClass('hide')
if !_.isEmpty(data.finished_at) && _.isEmpty(data.result['error']) if !_.isEmpty(data.finished_at) && _.isEmpty(data.result['error'])
window.location.reload() @redirectToLogin()
return return
if !_.isEmpty(data.result) if !_.isEmpty(data.result)

View file

@ -163,7 +163,7 @@ class ImportZendesk extends App.ControllerWizardFullScreen
@$('.js-error').addClass('hide') @$('.js-error').addClass('hide')
if !_.isEmpty(data.finished_at) && _.isEmpty(data.result['error']) if !_.isEmpty(data.finished_at) && _.isEmpty(data.result['error'])
window.location.reload() @redirectToLogin()
return return
if !_.isEmpty(data.result) if !_.isEmpty(data.result)

View file

@ -247,8 +247,6 @@ class Edit extends App.ControllerGenericEdit
#if attribute.name is 'data_type' #if attribute.name is 'data_type'
# attribute.disabled = true # attribute.disabled = true
console.log('configure_attributes', configure_attributes)
@controller = new App.ControllerForm( @controller = new App.ControllerForm(
model: model:
configure_attributes: configure_attributes configure_attributes: configure_attributes

View file

@ -153,7 +153,7 @@ class Object extends App.ControllerObserver
elLocal.find('.js-userList').html(members) elLocal.find('.js-userList').html(members)
) )
if @organization.member_ids.length < @memberLimit if @organization.member_ids.length <= @memberLimit
@el.find('.js-showMoreMembers').parent().addClass('hidden') @el.find('.js-showMoreMembers').parent().addClass('hidden')
else else
@el.find('.js-showMoreMembers').parent().removeClass('hidden') @el.find('.js-showMoreMembers').parent().removeClass('hidden')

View file

@ -171,6 +171,13 @@ class Graph extends App.Controller
backends: @params.backendSelected backends: @params.backendSelected
) )
processData: true processData: true
error: (xhr) =>
return if !_.include([401, 403, 404, 422, 502], xhr.status)
@bodyModal = new App.ControllerTechnicalErrorModal(
head: 'Cannot generate report'
contentCode: xhr.responseJSON.error
)
success: (data) => success: (data) =>
@update(data) @update(data)
@delay(@render, interval, 'report-update', 'page') @delay(@render, interval, 'report-update', 'page')

View file

@ -56,13 +56,9 @@ class App.Search extends App.Controller
@navupdate(url: '#search', type: 'menu') @navupdate(url: '#search', type: 'menu')
return if _.isEmpty(params.query) return if _.isEmpty(params.query)
@$('.js-search').val(params.query).trigger('change') @$('.js-search').val(params.query).trigger('keyup')
return if @shown
@search(1000, true)
hide: -> hide: ->
@shown = false
if @table if @table
@table.hide() @table.hide()
@ -108,6 +104,7 @@ class App.Search extends App.Controller
return return
# on other keys, show result # on other keys, show result
@navigate "#search/#{encodeURIComponent(@searchInput.val())}"
@search(0) @search(0)
empty: => empty: =>

View file

@ -26,12 +26,6 @@ class Sla extends App.ControllerSubContent
sortBy: 'name' sortBy: 'name'
) )
for sla in slas for sla in slas
if sla.first_response_time
sla.first_response_time_in_text = @toText(sla.first_response_time)
if sla.update_time
sla.update_time_in_text = @toText(sla.update_time)
if sla.solution_time
sla.solution_time_in_text = @toText(sla.solution_time)
sla.rules = App.UiElement.ticket_selector.humanText(sla.condition) sla.rules = App.UiElement.ticket_selector.humanText(sla.condition)
sla.calendar = App.Calendar.find(sla.calendar_id) sla.calendar = App.Calendar.find(sla.calendar_id)
@ -95,21 +89,8 @@ class Sla extends App.ControllerSubContent
description: (e) => description: (e) =>
new App.ControllerGenericDescription( new App.ControllerGenericDescription(
description: App.Calendar.description description: App.Sla.description
container: @el.closest('.content') container: @el.closest('.content')
) )
toText: (m) ->
m = parseInt(m)
return if !m
minutes = m % 60
hours = Math.floor(m / 60)
if minutes < 10
minutes = "0#{minutes}"
if hours < 10
hours = "0#{hours}"
"#{hours}:#{minutes}"
App.Config.set('Sla', { prio: 2900, name: 'SLAs', parent: '#manage', target: '#manage/slas', controller: Sla, permission: ['admin.sla'] }, 'NavBarAdmin') App.Config.set('Sla', { prio: 2900, name: 'SLAs', parent: '#manage', target: '#manage/slas', controller: Sla, permission: ['admin.sla'] }, 'NavBarAdmin')

View file

@ -206,22 +206,13 @@ class App.TicketOverview extends App.Controller
article: article article: article
) )
ticket.article = article ticket.article = article
ticket.ajax().update( ticket.save(
ticket.attributes()
# this option will prevent callbacks and invalid data states in case of an error
failResponseNoTrigger: true
done: (r) => done: (r) =>
@batchCountIndex++ @batchCountIndex++
# refresh view after all tickets are proceeded # refresh view after all tickets are proceeded
if @batchCountIndex == @batchCount if @batchCountIndex == @batchCount
App.Event.trigger('overview:fetch') App.Event.trigger('overview:fetch')
fail: (record, settings, details) ->
console.log('record, settings, details', record, settings, details)
App.Event.trigger('notify', {
type: 'error'
msg: App.i18n.translateContent('Bulk action stopped %s!', error)
})
) )
return return
@ -234,21 +225,13 @@ class App.TicketOverview extends App.Controller
ticket.owner_id = id ticket.owner_id = id
if !_.isEmpty(groupId) if !_.isEmpty(groupId)
ticket.group_id = groupId ticket.group_id = groupId
ticket.ajax().update( ticket.save(
ticket.attributes()
# this option will prevent callbacks and invalid data states in case of an error
failResponseNoTrigger: true
done: (r) => done: (r) =>
@batchCountIndex++ @batchCountIndex++
# refresh view after all tickets are proceeded # refresh view after all tickets are proceeded
if @batchCountIndex == @batchCount if @batchCountIndex == @batchCount
App.Event.trigger('overview:fetch') App.Event.trigger('overview:fetch')
fail: (record, settings, details) ->
App.Event.trigger('notify', {
type: 'error'
msg: App.i18n.translateContent('Bulk action stopped %s!', settings.error)
})
) )
return return
@ -259,21 +242,13 @@ class App.TicketOverview extends App.Controller
#console.log "perform action #{action} with id #{id} on ", $(item).val() #console.log "perform action #{action} with id #{id} on ", $(item).val()
ticket = App.Ticket.find($(item).val()) ticket = App.Ticket.find($(item).val())
ticket.group_id = id ticket.group_id = id
ticket.ajax().update( ticket.save(
ticket.attributes()
# this option will prevent callbacks and invalid data states in case of an error
failResponseNoTrigger: true
done: (r) => done: (r) =>
@batchCountIndex++ @batchCountIndex++
# refresh view after all tickets are proceeded # refresh view after all tickets are proceeded
if @batchCountIndex == @batchCount if @batchCountIndex == @batchCount
App.Event.trigger('overview:fetch') App.Event.trigger('overview:fetch')
fail: (record, settings, details) ->
App.Event.trigger('notify', {
type: 'error'
msg: App.i18n.translateContent('Bulk action stopped %s!', error)
})
) )
return return

View file

@ -501,8 +501,14 @@ class App.TicketZoom extends App.Controller
defaults: @taskGet('article') defaults: @taskGet('article')
taskKey: @taskKey taskKey: @taskKey
ui: @ ui: @
callbackFileUploadStart: @submitDisable richTextUploadStartCallback: @submitDisable
callbackFileUploadStop: @submitEnable richTextUploadRenderCallback: (attachments) =>
@submitEnable()
@taskUpdateAttachments('article', attachments)
@delay(@markForm, 250, 'ticket-zoom-form-update')
richTextUploadDeleteCallback: (attachments) =>
@taskUpdateAttachments('article', attachments)
@delay(@markForm, 250, 'ticket-zoom-form-update')
) )
@highligher = new App.TicketZoomHighlighter( @highligher = new App.TicketZoomHighlighter(
@ -641,6 +647,7 @@ class App.TicketZoom extends App.Controller
# update changes in ui # update changes in ui
currentStore = @currentStore() currentStore = @currentStore()
modelDiff = @formDiff(currentParams, currentStore) modelDiff = @formDiff(currentParams, currentStore)
return if _.isEmpty(modelDiff)
# set followup state if needed # set followup state if needed
@setDefaultFollowUpState(modelDiff, currentStore) @setDefaultFollowUpState(modelDiff, currentStore)
@ -720,7 +727,7 @@ class App.TicketZoom extends App.Controller
# add attachments if exist # add attachments if exist
attachmentCount = @$('.article-add .textBubble .attachments .attachment').length attachmentCount = @$('.article-add .textBubble .attachments .attachment').length
if attachmentCount > 0 if attachmentCount > 0
currentParams.article.attachments = true currentParams.article.attachments = attachmentCount
else else
delete currentParams.article.attachments delete currentParams.article.attachments
@ -735,6 +742,14 @@ class App.TicketZoom extends App.Controller
# do not compare null or undefined value # do not compare null or undefined value
if currentStore.ticket if currentStore.ticket
# make sure that the compared state is same in local storage and
# rendered html. Else we could have race conditions of data
# which is not rendered yet
renderedUpdatedAt = @el.find('.edit').attr('data-ticket-updated-at')
return if !renderedUpdatedAt
return if currentStore.ticket.updated_at.toString() isnt renderedUpdatedAt
for key, value of currentStore.ticket for key, value of currentStore.ticket
if value is null || value is undefined if value is null || value is undefined
currentStore.ticket[key] = '' currentStore.ticket[key] = ''
@ -969,15 +984,14 @@ class App.TicketZoom extends App.Controller
processData: true processData: true
success: (data) => success: (data) =>
#App.SessionStorage.set(@key, data)
@load(data, true, true)
# reset article - should not be resubmitted on next ticket update # reset article - should not be resubmitted on next ticket update
ticket.article = undefined ticket.article = undefined
# reset form after save # reset form after save
@reset() @reset()
@load(data, false, true)
if @sidebarWidget if @sidebarWidget
@sidebarWidget.commit() @sidebarWidget.commit()
@ -1070,6 +1084,13 @@ class App.TicketZoom extends App.Controller
App.TaskManager.update(@taskKey, taskData) App.TaskManager.update(@taskKey, taskData)
taskUpdateAttachments: (area, attachments) =>
taskData = App.TaskManager.get(@taskKey)
return if !taskData
taskData.attachments = attachments
App.TaskManager.update(@taskKey, taskData)
taskUpdateAll: (data) => taskUpdateAll: (data) =>
@localTaskData = data @localTaskData = data
@localTaskData.article['form_id'] = @form_id @localTaskData.article['form_id'] = @form_id
@ -1092,7 +1113,7 @@ class App.TicketZoom extends App.Controller
@localTaskData = @localTaskData =
ticket: {} ticket: {}
article: {} article: {}
App.TaskManager.update(@taskKey, { 'state': @localTaskData }) App.TaskManager.update(@taskKey, { 'state': @localTaskData, attachments: [] })
renderOverviewNavigator: (parentEl) -> renderOverviewNavigator: (parentEl) ->
new App.TicketZoomOverviewNavigator( new App.TicketZoomOverviewNavigator(

View file

@ -198,17 +198,17 @@ class App.TicketZoomArticleNew extends App.Controller
inputField: @$('.article-attachment input') inputField: @$('.article-attachment input')
onFileStartCallback: => onFileStartCallback: =>
@callbackFileUploadStart?() @richTextUploadStartCallback?()
onFileCompletedCallback: (response) => onFileCompletedCallback: (response) =>
@attachments.push response.data @attachments.push response.data
@renderAttachment(response.data) @renderAttachment(response.data)
@$('.article-attachment input').val('') @$('.article-attachment input').val('')
@callbackFileUploadStop?() @richTextUploadRenderCallback?(@attachments)
onFileAbortedCallback: => onFileAbortedCallback: =>
@callbackFileUploadStop?() @richTextUploadRenderCallback?(@attachments)
attachmentPlaceholder: @attachmentPlaceholder attachmentPlaceholder: @attachmentPlaceholder
attachmentUpload: @attachmentUpload attachmentUpload: @attachmentUpload
@ -287,7 +287,6 @@ class App.TicketZoomArticleNew extends App.Controller
params.preferences ||= {} params.preferences ||= {}
params.preferences.security = @paramsSecurity() params.preferences.security = @paramsSecurity()
params.attachments = @attachments
params params
validate: => validate: =>
@ -624,6 +623,8 @@ class App.TicketZoomArticleNew extends App.Controller
$(e.currentTarget).closest('.attachment').remove() $(e.currentTarget).closest('.attachment').remove()
if element.find('.attachment').length == 0 if element.find('.attachment').length == 0
element.empty() element.empty()
@richTextUploadDeleteCallback?(@attachments)
) )
actions: -> actions: ->

View file

@ -79,6 +79,12 @@ class App.FormHandlerCoreWorkflow
return if !App.WebSocket.channel() return if !App.WebSocket.channel()
return !App.Config.get('core_workflow_ajax_mode') return !App.Config.get('core_workflow_ajax_mode')
@restrictValuesAttributeCache: (attribute, values) ->
result = { values: values }
return result if !attribute.relation
result.lastUpdatedAt = App[attribute.relation].lastUpdatedAt()
return result
# restricts the dropdown and tree select values of a form # restricts the dropdown and tree select values of a form
@restrictValues: (classname, form, ui, attributes, params, data) -> @restrictValues: (classname, form, ui, attributes, params, data) ->
return if _.isEmpty(data.restrict_values) return if _.isEmpty(data.restrict_values)
@ -111,17 +117,17 @@ class App.FormHandlerCoreWorkflow
# cache state for performance and only run # cache state for performance and only run
# if values or param differ # if values or param differ
if coreWorkflowRestrictions?[classname]?[item.name] if coreWorkflowRestrictions?[classname]?[item.name]
compare = values compare = App.FormHandlerCoreWorkflow.restrictValuesAttributeCache(attribute, values)
continue if _.isEqual(coreWorkflowRestrictions[classname][item.name], compare) continue if _.isEqual(coreWorkflowRestrictions[classname][item.name], compare)
coreWorkflowRestrictions[classname] ||= {} coreWorkflowRestrictions[classname] ||= {}
coreWorkflowRestrictions[classname][item.name] = values coreWorkflowRestrictions[classname][item.name] = App.FormHandlerCoreWorkflow.restrictValuesAttributeCache(attribute, values)
valueFound = false valueFound = false
for value in values for value in values
# false values are valid values e.g. for boolean fields (be careful) # false values are valid values e.g. for boolean fields (be careful)
if value isnt undefined && paramValue isnt undefined if value isnt undefined && paramValue isnt undefined && value isnt null && paramValue isnt null
if value.toString() == paramValue.toString() if value.toString() == paramValue.toString()
valueFound = true valueFound = true
break break
@ -133,6 +139,11 @@ class App.FormHandlerCoreWorkflow
if valueFound if valueFound
item.default = paramValue item.default = paramValue
item.newValue = paramValue item.newValue = paramValue
else if params.id
obj = App[ui.model.className].find(params.id)
if obj && obj[item.name]
item.default = obj[item.name]
item.newValue = obj[item.name]
else else
item.default = '' item.default = ''
item.newValue = '' item.newValue = ''
@ -299,6 +310,11 @@ class App.FormHandlerCoreWorkflow
screen: ui.screen screen: ui.screen
} }
# send last changed attribute only once for has changed condition
if ui.lastChangedAttribute
requestData.last_changed_attribute = ui.lastChangedAttribute
ui.lastChangedAttribute = '-'
if App.FormHandlerCoreWorkflow.useWebSockets() if App.FormHandlerCoreWorkflow.useWebSockets()
App.WebSocket.send(requestData) App.WebSocket.send(requestData)
else else
@ -324,8 +340,12 @@ class App.FormHandlerCoreWorkflow
# get params and add id from ui if needed # get params and add id from ui if needed
params = App.FormHandlerCoreWorkflow.cleanParams(params_ref) params = App.FormHandlerCoreWorkflow.cleanParams(params_ref)
if ui?.params?.id
# add object id for edit screens
if ui?.params?.id && ui.screen.match(/edit/)
params.id = ui.params.id params.id = ui.params.id
else
delete params.id
# skip double checks # skip double checks
return if _.isEqual(coreWorkflowParams[classname], params) return if _.isEqual(coreWorkflowParams[classname], params)

View file

@ -29,9 +29,15 @@ class Edit extends App.Controller
# for the new ticket + eventually changed task state # for the new ticket + eventually changed task state
@formMeta.core_workflow = undefined @formMeta.core_workflow = undefined
if followUpPossible == 'new_ticket' && ticketState != 'closed' || editable = @ticket.editable()
followUpPossible != 'new_ticket' || if followUpPossible == 'new_ticket' && ticketState != 'closed' || followUpPossible != 'new_ticket' || @permissionCheck('admin') || @ticket.currentView() is 'agent'
@permissionCheck('admin') || @ticket.currentView() is 'agent' editable = !editable
# reset updated_at for the sidbar because we render a new state
# it is used to compare the ticket with the rendered data later
# and needed to prevent race conditions
@el.removeAttr('data-ticket-updated-at')
@controllerFormSidebarTicket = new App.ControllerForm( @controllerFormSidebarTicket = new App.ControllerForm(
elReplace: @el elReplace: @el
model: { className: 'Ticket', configure_attributes: @formMeta.configure_attributes || App.Ticket.configure_attributes } model: { className: 'Ticket', configure_attributes: @formMeta.configure_attributes || App.Ticket.configure_attributes }
@ -40,23 +46,7 @@ class Edit extends App.Controller
filter: @formMeta.filter filter: @formMeta.filter
formMeta: @formMeta formMeta: @formMeta
params: defaults params: defaults
isDisabled: !@ticket.editable() isDisabled: editable
taskKey: @taskKey
core_workflow: {
callbacks: [@markForm]
}
#bookmarkable: true
)
else
@controllerFormSidebarTicket = new App.ControllerForm(
elReplace: @el
model: { className: 'Ticket', configure_attributes: @formMeta.configure_attributes || App.Ticket.configure_attributes }
screen: 'edit'
handlersConfig: handlers
filter: @formMeta.filter
formMeta: @formMeta
params: defaults
isDisabled: @ticket.editable()
taskKey: @taskKey taskKey: @taskKey
core_workflow: { core_workflow: {
callbacks: [@markForm] callbacks: [@markForm]
@ -64,6 +54,8 @@ class Edit extends App.Controller
#bookmarkable: true #bookmarkable: true
) )
# set updated_at for the sidbar because we render a new state
@el.attr('data-ticket-updated-at', defaults.updated_at)
@markForm(true) @markForm(true)
return if @resetBind return if @resetBind

View file

@ -33,7 +33,7 @@ class App.WidgetOrganization extends App.Controller
elLocal.find('.js-userList').html(members) elLocal.find('.js-userList').html(members)
) )
if @organization.member_ids.length < @memberLimit if @organization.member_ids.length <= @memberLimit
@el.find('.js-showMoreMembers').parent().addClass('hidden') @el.find('.js-showMoreMembers').parent().addClass('hidden')
else else
@el.find('.js-showMoreMembers').parent().removeClass('hidden') @el.find('.js-showMoreMembers').parent().removeClass('hidden')

View file

@ -14,6 +14,7 @@ class App.ObjectOrganizationAutocompletion extends App.Controller
'click': 'stopPropagation' 'click': 'stopPropagation'
'change .js-objectId': 'executeCallback' 'change .js-objectId': 'executeCallback'
'click .js-remove': 'removeThisToken' 'click .js-remove': 'removeThisToken'
'click .js-showMoreMembers': 'showMoreMembers'
elements: elements:
'.recipientList': 'recipientList' '.recipientList': 'recipientList'
@ -251,14 +252,42 @@ class App.ObjectOrganizationAutocompletion extends App.Controller
objectCount: objectCount objectCount: objectCount
) )
showMoreMembers: (e) ->
@preventDefaultAndStopPropagation(e)
memberElement = $(e.target).closest('.js-showMoreMembers')
oldMemberLimit = memberElement.attr('organization-member-limit')
newMemberLimit = (parseInt(oldMemberLimit / 25) + 1) * 25
memberElement.attr('organization-member-limit', newMemberLimit)
@renderMembers(memberElement, oldMemberLimit, newMemberLimit)
renderMembers: (element, fromMemberLimit, toMemberLimit) ->
id = element.closest('.recipientList-organizationMembers').attr('organization-id')
organization = App.Organization.find(id)
# only first 10 members else we would need more ajax requests
organization.members(fromMemberLimit, toMemberLimit, (users) =>
for user in users
element.before(@buildObjectItem(user))
if element.closest('ul').hasClass('is-shown')
@showOrganizationMembers(undefined, element.closest('ul'))
)
if organization.member_ids.length <= toMemberLimit
element.addClass('hidden')
else
element.removeClass('hidden')
buildOrganizationMembers: (organization) => buildOrganizationMembers: (organization) =>
organizationMemebers = $( App.view(@templateOrganizationItemMembers)( organizationMembers = $( App.view(@templateOrganizationItemMembers)(
organization: organization organization: organization
) ) ) )
if organization[@referenceAttribute]
for objectId in organization[@referenceAttribute] @renderMembers(organizationMembers.find('.js-showMoreMembers'), 0, 10)
object = App[@objectSingle].fullLocal(objectId)
organizationMemebers.append(@buildObjectItem(object)) organizationMembers
buildObjectItem: (object) => buildObjectItem: (object) =>
icon = @objectIcon icon = @objectIcon
@ -404,8 +433,7 @@ class App.ObjectOrganizationAutocompletion extends App.Controller
e.stopPropagation() e.stopPropagation()
listEntry = $(e.currentTarget) listEntry = $(e.currentTarget)
organizationId = listEntry.data('organization-id') organizationId = listEntry.data('organization-id') || listEntry.attr('organization-id')
@organizationList = @$("[organization-id=#{ organizationId }]") @organizationList = @$("[organization-id=#{ organizationId }]")
return if !@organizationList.get(0) return if !@organizationList.get(0)

View file

@ -102,12 +102,18 @@ class _ajaxSingleton
# do not show any error message with code 502 # do not show any error message with code 502
return if status is 502 return if status is 502
try
json = JSON.parse(detail)
text = json.error_human || json.error
text = detail if !text
escaped = App.Utils.htmlEscape(text)
# show error message # show error message
new App.ControllerModal( new App.ControllerTechnicalErrorModal(
contentCode: escaped
head: "StatusCode: #{status}" head: "StatusCode: #{status}"
contentInline: "<pre>#{App.Utils.htmlEscape(detail)}</pre>"
buttonClose: true
buttonSubmit: false
) )
) )

View file

@ -28,7 +28,7 @@ class App.FullQuoteHeader
@fullQuoteHeaderForwardTo: (article) -> @fullQuoteHeaderForwardTo: (article) ->
if article.type.name is 'email' || article.type.name is 'web' if article.type.name is 'email' || article.type.name is 'web'
@fullQuoteHeaderEnsurePrivacy(article.to) || article.to @fullQuoteHeaderEnsureMultiPrivacy(article.to)
else if article.sender.name is 'Customer' && article.type.name is 'phone' else if article.sender.name is 'Customer' && article.type.name is 'phone'
if email_address_id = App.Group.findByAttribute('name', article.to)?.email_address_id if email_address_id = App.Group.findByAttribute('name', article.to)?.email_address_id
App.EmailAddress.find(email_address_id).displayName() App.EmailAddress.find(email_address_id).displayName()
@ -36,15 +36,17 @@ class App.FullQuoteHeader
article.to article.to
else if article.sender.name is 'Agent' && article.type.name is 'phone' else if article.sender.name is 'Agent' && article.type.name is 'phone'
ticket = App.Ticket.find article.ticket_id ticket = App.Ticket.find article.ticket_id
@fullQuoteHeaderEnsurePrivacy(ticket.customer_id) || @fullQuoteHeaderEnsurePrivacy(article.to) || article.to @fullQuoteHeaderEnsurePrivacy(ticket.customer_id) || @fullQuoteHeaderEnsureMultiPrivacy(article.to)
else else
article.to article.to
@fullQuoteHeaderForwardCC: (article) -> @fullQuoteHeaderForwardCC: (article) ->
return if !article.cc @fullQuoteHeaderEnsureMultiPrivacy(article.cc)
article @fullQuoteHeaderEnsureMultiPrivacy: (input) ->
.cc return if !input
input
.split(',') .split(',')
.map (elem) -> .map (elem) ->
elem.trim() elem.trim()

View file

@ -8,7 +8,12 @@ class App.i18n
@translateDeep: (input, args...) -> @translateDeep: (input, args...) ->
if _instance == undefined if _instance == undefined
_instance ?= new _i18nSingleton() _instance ?= new _i18nSingleton()
_instance.translateDeep(input, args) _instance.translateDeep(input, args, false)
@translateDeepPlain: (input, args...) ->
if _instance == undefined
_instance ?= new _i18nSingleton()
_instance.translateDeep(input, args, true)
@translateContent: (string, args...) -> @translateContent: (string, args...) ->
if _instance == undefined if _instance == undefined
@ -230,15 +235,18 @@ class _i18nSingleton extends Spine.Module
return string if !string return string if !string
@translate(string, args, true) @translate(string, args, true)
translateDeep: (input, args) => translateDeep: (input, args, plain) =>
if _.isArray(input) if _.isArray(input)
_.map input, (item) => _.map input, (item) =>
@translateDeep(item, args) @translateDeep(item, args, plain)
else if _.isObject(input) else if _.isObject(input)
_.reduce _.keys(input), (memo, item) => _.reduce _.keys(input), (memo, item) =>
memo[item] = @translateDeep(input[item]) memo[item] = @translateDeep(input[item], args, plain)
memo memo
, {} , {}
else
if plain
@translatePlain(input, args)
else else
@translateInline(input, args) @translateInline(input, args)

View file

@ -1,27 +0,0 @@
class _Singleton extends App._CollectionSingletonBase
event: 'ticket_create_attributes'
restEndpoint: '/ticket_create'
class App.TicketCreateCollection
_instance = new _Singleton
@get: ->
_instance.get()
@one: (callback, init = true) ->
_instance.bind(callback, init, true)
@bind: (callback, init = true) ->
_instance.bind(callback, init, false)
@unbind: (callback) ->
_instance.unbind(callback)
@unbindById: (id) ->
_instance.unbindById(id)
@trigger: ->
_instance.trigger()
@fetch: ->
_instance.fetch()

View file

@ -1327,7 +1327,7 @@ class App.Utils
if type is 'email' && !e.attrs.value.match(/@/) || e.attrs.value.match(/\s/) if type is 'email' && !e.attrs.value.match(/@/) || e.attrs.value.match(/\s/)
e.preventDefault() e.preventDefault()
return false return false
e.attrs.label = e.attrs.value e.attrs.label ||= e.attrs.value
true true
) )
App.Delay.set(a, 500, undefined, 'tags') App.Delay.set(a, 500, undefined, 'tags')

View file

@ -654,6 +654,11 @@
var tokensBefore = this.getTokensList() var tokensBefore = this.getTokensList()
this.setTokens( this.$input.val(), true ) this.setTokens( this.$input.val(), true )
// remove token text was cleared while editing
if (this.$input.data( 'edit' ) && !this.$input.val()) {
this.$element.val( this.getTokensList() )
}
if (tokensBefore == this.getTokensList() && this.$input.val().length) if (tokensBefore == this.getTokensList() && this.$input.val().length)
return false // No tokens were added, do nothing (prevent form submit) return false // No tokens were added, do nothing (prevent form submit)

View file

@ -114,12 +114,23 @@
sel = window.getSelection() sel = window.getSelection()
if (sel) { if (sel) {
node = $(sel.anchorNode) node = $(sel.anchorNode)
if (node && node.parent() && node.parent().is('blockquote')) {
if (node.closest('blockquote').length > 0) {
// Special handling when the line is not wrapped inside of a html element.
if (!node.is('div') && node.parent().is('blockquote') && node.text()) {
e.preventDefault() e.preventDefault()
document.execCommand('Insertparagraph') document.execCommand('formatBlock', false, 'div')
document.execCommand('Outdent') document.execCommand('insertParagraph')
return return
} }
if (!e.shiftKey && node && (node.is('blockquote') || (node.parent() && node.parent().is('blockquote')) || !node.text())) {
e.preventDefault()
document.execCommand('insertParagraph')
document.execCommand('outdent')
return
}
}
} }
// behavior to enter new line on alt+enter // behavior to enter new line on alt+enter

View file

@ -48,10 +48,26 @@ App.ViewHelpers =
# Output like "1:01" or "4:03:59" or "123:03:59" # Output like "1:01" or "4:03:59" or "123:03:59"
mins = "0#{mins}" if mins < 10 mins = "0#{mins}" if mins < 10
secs = "0#{secs}" if secs < 10 secs = "0#{secs}" if secs < 10
if hrs > 0 if hrs > 0
return "#{hrs}:#{mins}:#{secs}" return "#{hrs}:#{mins}:#{secs}"
"#{mins}:#{secs}" "#{mins}:#{secs}"
# define time_duration / hh:mm
time_duration_hh_mm: (time_in_minutes) ->
return '' if !time_in_minutes
return '' if isNaN(parseInt(time_in_minutes))
# Hours, minutes and seconds
hrs = ~~parseInt((time_in_minutes / 60))
mins = ~~parseInt((time_in_minutes % 60))
hrs = "0#{hrs}" if hrs < 10
mins = "0#{mins}" if mins < 10
"#{hrs}:#{mins}"
# define mask helper # define mask helper
# mask an value like 'a***********yz' # mask an value like 'a***********yz'
M: (item, start = 1, end = 2) -> M: (item, start = 1, end = 2) ->

View file

@ -234,7 +234,6 @@ class Singleton extends Base
failResponse: (options) => failResponse: (options) =>
(xhr, statusText, error, settings) => (xhr, statusText, error, settings) =>
if options.failResponseNoTrigger isnt true
switch settings.type switch settings.type
when 'POST' then @createFailed() when 'POST' then @createFailed()
when 'DELETE' then @destroyFailed() when 'DELETE' then @destroyFailed()
@ -247,7 +246,6 @@ class Singleton extends Base
details = JSON.parse(detailsRaw) details = JSON.parse(detailsRaw)
options.fail?.call(@record, settings, details) options.fail?.call(@record, settings, details)
if options.failResponseNoTrigger isnt true
@record.trigger('destroy', @record) @record.trigger('destroy', @record)
# /add errors to calllback # /add errors to calllback

View file

@ -916,20 +916,25 @@ set new attributes of model (remove already available attributes)
# use jquery instead of ._clone() because we need a deep copy of the obj # use jquery instead of ._clone() because we need a deep copy of the obj
@org_configure_attributes = $.extend(true, [], @configure_attributes) @org_configure_attributes = $.extend(true, [], @configure_attributes)
configure_attributes = $.extend(true, [], @configure_attributes)
allAttributes = []
for attribute in attributes for attribute in attributes
@attributes.push attribute.name @attributes.push attribute.name
found = false found = false
for attribute_model, index in @configure_attributes for attribute_model, index in configure_attributes
continue if attribute_model.name != attribute.name continue if attribute_model.name != attribute.name
@configure_attributes[index] = _.extend(attribute_model, attribute) allAttributes.push $.extend(true, attribute_model, attribute)
configure_attributes.splice(index, 1) # remove found attribute
found = true found = true
break break
if !found if !found
@configure_attributes.push attribute allAttributes.push $.extend(true, {}, attribute)
@configure_attributes = $.extend(true, [], allAttributes.concat(configure_attributes))
@resetAttributes: -> @resetAttributes: ->
return if _.isEmpty(@org_configure_attributes) return if _.isEmpty(@org_configure_attributes)

View file

@ -6,8 +6,8 @@ class App.ObjectManagerAttribute extends App.Model
{ name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false }, { name: 'name', display: 'Name', tag: 'input', type: 'text', limit: 100, null: false },
{ name: 'display', display: 'Display', tag: 'input', type: 'text', limit: 100, null: false }, { name: 'display', display: 'Display', tag: 'input', type: 'text', limit: 100, null: false },
{ name: 'object', display: 'Object', tag: 'input', readonly: 1 }, { name: 'object', display: 'Object', tag: 'input', readonly: 1 },
{ name: 'position', display: 'Position', tag: 'input', readonly: 1 },
{ name: 'active', display: 'Active', tag: 'active', default: true }, { name: 'active', display: 'Active', tag: 'active', default: true },
{ name: 'data_type', display: 'Format', tag: 'object_manager_attribute', null: false }, { name: 'data_type', display: 'Format', tag: 'object_manager_attribute', null: false },
{ name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 },
{ name: 'position', display: 'Position', tag: 'integer', type: 'number', limit: 100, null: true },
] ]

View file

@ -36,7 +36,7 @@ Using **Organisations** you can **group** customers. This has among others two i
userResult = -> userResult = ->
users = [] users = []
for user_id in member_ids for user_id in member_ids
user = App.User.find(user_id) user = App.User.fullLocal(user_id)
continue if !user continue if !user
users.push(user) users.push(user)
return users return users

View file

@ -1,5 +1,5 @@
class App.Sla extends App.Model class App.Sla extends App.Model
@configure 'Sla', 'name', 'first_response_time', 'update_time', 'solution_time', 'condition', 'calendar_id' @configure 'Sla', 'name', 'first_response_time', 'response_time', 'update_time', 'solution_time', 'condition', 'calendar_id'
@extend Spine.Model.Ajax @extend Spine.Model.Ajax
@url: @apiPath + '/slas' @url: @apiPath + '/slas'
@configure_attributes = [ @configure_attributes = [
@ -12,6 +12,7 @@ class App.Sla extends App.Model
{ name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 },
{ name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 }, { name: 'updated_at', display: 'Updated', tag: 'datetime', readonly: 1 },
{ name: 'first_response_time',skipRendering: true }, { name: 'first_response_time',skipRendering: true },
{ name: 'response_time', skipRendering: true },
{ name: 'update_time', skipRendering: true }, { name: 'update_time', skipRendering: true },
{ name: 'solution_time', skipRendering: true }, { name: 'solution_time', skipRendering: true },
] ]

View file

@ -14,7 +14,7 @@
</div> </div>
<div class="form-group js-sure"> <div class="form-group js-sure">
<h3 class="danger-color"><%- @T('Warning') %></h3> <h3 class="danger-color"><%- @T('Warning') %></h3>
<p class="danger-color"><%- @T('There is no rollback of this deletion possible. If you are absolutely sure to do this, then type in "%s" into the input.', App.i18n.translateInline('delete').toUpperCase()) %></p> <p class="danger-color"><%- @T('There is no rollback of this deletion possible. If you are absolutely sure to do this, then type in "%s" into the input.', App.i18n.translatePlain('delete').toUpperCase()) %></p>
<%- @sure_html %> <%- @sure_html %>
</div> </div>
</div> </div>

View file

@ -0,0 +1 @@
<input type="text" disabled="disabled" readonly="readonly" value="<%= @attribute.value %>" class="form-control" />

View file

@ -20,8 +20,8 @@
<td data-day="<%- id %>" data-slot="<%- slot %>" class="form-group day-time<%- ' is-active' if @hours[id].active %>"> <td data-day="<%- id %>" data-slot="<%- slot %>" class="form-group day-time<%- ' is-active' if @hours[id].active %>">
<label for="<%- id %>_start_time">from</label> <label for="<%- id %>_start_time">from</label>
<input type="text" id="<%- id %>_start_time" name="<%= @attribute.name %>::<%- id %>::start" value="<%- @hours[id].timeframes[slot][0] %>" data-day="<%- id %>" data-slot="<%- slot %>" data-i="0" class="form-control form-control--small time js-time"> <input type="text" id="<%- id %>_start_time" name="<%= @attribute.name %>::<%- id %>::start" value="<%- @hours[id].timeframes[slot][0] %>" data-day="<%- id %>" data-slot="<%- slot %>" data-i="0" class="form-control form-control--small time js-time">
<label for="monday_end_time">till</label> <label for="<%- id %>_end_time">till</label>
<input type="text" id="monday_end_time" name="<%= @attribute.name %>::<%- id %>::end" value="<%- @hours[id].timeframes[slot][1] %>" data-day="<%- id %>" data-slot="<%- slot %>" data-i="1" class="form-control form-control--small time js-time"> <input type="text" id="<%- id %>_end_time" name="<%= @attribute.name %>::<%- id %>::end" value="<%- @hours[id].timeframes[slot][1] %>" data-day="<%- id %>" data-slot="<%- slot %>" data-i="1" class="form-control form-control--small time js-time">
<% else: %> <% else: %>
<td class="empty-cell"> <td class="empty-cell">
<% end %> <% end %>

View file

@ -3,7 +3,7 @@
<% if @attribute.multiple: %> <% if @attribute.multiple: %>
<%- @tokens %> <%- @tokens %>
<% end %> <% end %>
<input name="<%- @attribute.name %>_completion" class="user-select token-input js-objectSelect" autocapitalize="off" placeholder="<%- @Ti(@attribute.placeholder) %>" autocomplete="off" <%= @attribute.autofocus %> role="textbox" aria-autocomplete="list" value="<%= @name %>" aria-haspopup="true"> <input name="<%= @attribute.name %>_completion" class="user-select token-input js-objectSelect form-control" autocapitalize="off" placeholder="<%- @Ti(@attribute.placeholder) %>" autocomplete="off" <%= @attribute.autofocus %> role="textbox" aria-autocomplete="list" value="<%= @name %>" aria-haspopup="true">
<% if @attribute.disableCreateObject isnt true: %><%- @Icon('arrow-down', 'dropdown-arrow') %><% end %> <% if @attribute.disableCreateObject isnt true: %><%- @Icon('arrow-down', 'dropdown-arrow') %><% end %>
</div> </div>

View file

@ -4,4 +4,9 @@
<%- @Icon('arrow-left') %> <%- @Icon('arrow-left') %>
<span class="btn-label"><%- @T('Back') %></span> <span class="btn-label"><%- @T('Back') %></span>
</div> </div>
<li class="recipientList-controls js-showMoreMembers" organization-member-limit="10">
<div class="btn btn--action btn--onDark">
<span class="btn-label"><%- @T('show more') %></span>
</div>
</ul> </ul>

View file

@ -6,7 +6,7 @@
<th><%- @T('Time') %> <span class="text-muted"><%- @T('in hours') %></span> <th><%- @T('Time') %> <span class="text-muted"><%- @T('in hours') %></span>
</thead> </thead>
<tbody> <tbody>
<tr class="form-group"> <tr>
<td class="u-positionOrigin"> <td class="u-positionOrigin">
<label class="checkbox-replacement checkbox-replacement--fullscreen dont-grey-out"> <label class="checkbox-replacement checkbox-replacement--fullscreen dont-grey-out">
<input type="checkbox" class="js-activateRow" id="first_response_time" name="first_response_time_enabled"> <input type="checkbox" class="js-activateRow" id="first_response_time" name="first_response_time_enabled">
@ -16,25 +16,51 @@
<td class="u-clickable js-forward-click"> <td class="u-clickable js-forward-click">
<div><%- @T('First Response Time') %></div> <div><%- @T('First Response Time') %></div>
<p class="subtle"><%- @T('Timeframe for the first response.') %></p> <p class="subtle"><%- @T('Timeframe for the first response.') %></p>
<td class="u-clickable js-focus-input"> <td class="u-clickable js-focus-input form-group">
<input type="hidden" name="first_response_time" value="<%= @first_response_time %>" class="js-timeConvertTo"> <input type="hidden" name="first_response_time" value="<%= @first_response_time %>" class="js-timeConvertTo">
<input type="text" value="<%= @first_response_time_in_text %>" class="form-control form-control--small timeframe js-timeConvertFrom" placeholder="hh:mm" name="first_response_time_in_text" data-name="first_response_time"> <input type="text" value="<%= @first_response_time_in_text %>" class="form-control form-control--small timeframe js-timeConvertFrom" placeholder="hh:mm" name="first_response_time_in_text" data-name="first_response_time">
<tr class="form-group"> <tr>
<td class="u-positionOrigin"> <td class="u-positionOrigin">
<label class="checkbox-replacement checkbox-replacement--fullscreen dont-grey-out"> <label class="checkbox-replacement checkbox-replacement--fullscreen dont-grey-out">
<input type="checkbox" class="js-activateRow" id="update_time" name="update_time_enabled"> <input type="checkbox" class="js-activateRow" id="update_time" name="update_time_enabled">
<%- @Icon('checkbox', 'icon-unchecked') %> <%- @Icon('checkbox', 'icon-unchecked') %>
<%- @Icon('checkbox-checked', 'icon-checked') %> <%- @Icon('checkbox-checked', 'icon-checked') %>
</label> </label>
<td class="u-clickable js-forward-click">
<div><%- @T('Update Time') %></div>
<p class="subtle"><%- @T('Timeframe for every following response.') %></p>
<td> <td>
<input type="hidden" name="update_time" value="<%= @update_time %>" class="js-timeConvertTo"> <div class="u-clickable js-forward-click">
<input type="text" value="<%= @update_time_in_text %>" class="form-control form-control--small timeframe js-timeConvertFrom" placeholder="hh:mm" name="update_time_in_text" data-name="update_time"> <div><%- @T('Update Time') %></div>
<p class="subtle"><%- @T('Timeframe between agent updates or for an agent to respond.') %></p>
</div>
<tr class="form-group"> <p class="sla_radio_container js-forward-radio">
<label class="inline-label radio-replacement">
<input class="js-updateTypeSelector" type="radio" name="update_type" value="update" <% if @update_time: %>checked<% end %>>
<%- @Icon('radio', 'icon-unchecked') %>
<%- @Icon('radio-checked', 'icon-checked') %>
<span class="label-text"><%- @T('between agent updates') %></span>
</label>
</p>
<p class="sla_radio_container js-forward-radio u-clickable">
<label class="inline-label radio-replacement">
<input class="js-updateTypeSelector" type="radio" name="update_type" value="response" <% if @response_time: %>checked<% end %>>
<%- @Icon('radio', 'icon-unchecked') %>
<%- @Icon('radio-checked', 'icon-checked') %>
<span class="label-text"><%- @T('for an agent to respond') %></span>
</label>
</p>
<td class="form-group u-clickable js-focus-input u-clickable">
<span class="form-group">
<input type="hidden" name="update_time" value="<%= @update_time %>" class="js-timeConvertTo">
<input type="text" value="<%= @update_time_in_text %>" class="form-control form-control--small timeframe js-timeConvertFrom <% if @response_time: %>hidden<% end %>" placeholder="hh:mm" name="update_time_in_text" data-name="update_time">
</span>
<span class="form-group">
<input type="hidden" name="response_time" value="<%= @response_time %>" class="js-timeConvertTo">
<input type="text" value="<%= @response_time_in_text %>" class="form-control form-control--small timeframe js-timeConvertFrom <% if !@response_time: %>hidden<% end %>" placeholder="hh:mm" name="response_time_in_text" data-name="response_time">
</span>
<tr>
<td class="u-positionOrigin"> <td class="u-positionOrigin">
<label class="checkbox-replacement checkbox-replacement--fullscreen dont-grey-out"> <label class="checkbox-replacement checkbox-replacement--fullscreen dont-grey-out">
<input type="checkbox" id="solution_time" class="js-activateRow" name="solution_time_enabled"> <input type="checkbox" id="solution_time" class="js-activateRow" name="solution_time_enabled">
@ -44,7 +70,7 @@
<td class="u-clickable js-forward-click"> <td class="u-clickable js-forward-click">
<div><%- @T('Solution Time') %></div> <div><%- @T('Solution Time') %></div>
<p class="subtle"><%- @T('Timeframe for solving the problem.') %></p> <p class="subtle"><%- @T('Timeframe for solving the problem.') %></p>
<td> <td class="form-group u-clickable js-focus-input">
<input type="hidden" name="solution_time" value="<%= @solution_time %>" class="js-timeConvertTo"> <input type="hidden" name="solution_time" value="<%= @solution_time %>" class="js-timeConvertTo">
<input type="text" value="<%= @solution_time_in_text %>" class="form-control form-control--small timeframe js-timeConvertFrom" placeholder="hh:mm" name="solution_time_in_text" data-name="solution_time"> <input type="text" value="<%= @solution_time_in_text %>" class="form-control form-control--small timeframe js-timeConvertFrom" placeholder="hh:mm" name="solution_time_in_text" data-name="solution_time">

View file

@ -82,7 +82,7 @@
<table class="settings-list" style="width: 100%;"> <table class="settings-list" style="width: 100%;">
<thead> <thead>
<tr> <tr>
<th width="50%"><%- @T('Name') %> <th width="50%"><%- @T('Value') %>
<th width="50%"><%- @T('Description') %> <th width="50%"><%- @T('Description') %>
</thead> </thead>
<tbody> <tbody>

View file

@ -91,24 +91,30 @@
</tbody> </tbody>
</table> </table>
</div> </div>
-->
<p><%- @T('Default caller id.') %> <p><%- @T('Settings') %>
<div class="settings-entry"> <div class="settings-entry">
<table class="settings-list" style="width: 100%;"> <table class="settings-list" style="width: 100%;">
<thead> <thead>
<tr> <tr>
<th width="50%"><%- @T('Default caller id') %> <th width="50%"><%- @T('Value') %>
<th width="50%"><%- @T('Note') %> <th width="50%"><%- @T('Description') %>
</thead> </thead>
<tbody> <tbody>
<!--
<tr> <tr>
<td class="settings-list-control-cell"><input name="default_caller_id" value="<%= @config.outbound.default_caller_id %>" placeholder="4930609854189" class="form-control form-control--small js-summary"> <td class="settings-list-control-cell"><input name="default_caller_id" value="<%= @config.outbound.default_caller_id %>" placeholder="4930609854189" class="form-control form-control--small js-summary">
<td class="settings-list-row-control"><%- @T('Default caller id for outbound calls.') %> <td class="settings-list-row-control"><%- @T('Default caller id for outbound calls.') %>
-->
<tr>
<td class="settings-list-control-cell js-viewLimit">
<td class="settings-list-row-control"><%- @T('Shown records in caller log.') %>
</tbody> </tbody>
</table> </table>
</div> </div>
-->
<h2><%- @T('User assignment to telephones') %></h2> <h2><%- @T('User assignment to telephones') %></h2>
<p><%- @T('User assignment to telephones to be able to offer extended like open new ticket screen on answering a call.') %> <p><%- @T('User assignment to telephones to be able to offer extended like open new ticket screen on answering a call.') %>

View file

@ -79,38 +79,22 @@
</table> </table>
</div> </div>
<p><%- @T('Default caller id.') %> <p><%- @T('Settings') %>
<div class="settings-entry"> <div class="settings-entry">
<table class="settings-list" style="width: 100%;"> <table class="settings-list" style="width: 100%;">
<thead> <thead>
<tr> <tr>
<th width="50%"><%- @T('Default caller id') %> <th width="50%"><%- @T('Value') %>
<th width="50%"><%- @T('Note') %> <th width="50%"><%- @T('Description') %>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td class="settings-list-control-cell"><input name="default_caller_id" value="<%= @config.outbound.default_caller_id %>" placeholder="4930609854189" class="form-control form-control--small js-summary"> <td class="settings-list-control-cell"><input name="default_caller_id" value="<%= @config.outbound.default_caller_id %>" placeholder="4930609854189" class="form-control form-control--small js-summary">
<td class="settings-list-row-control"><%- @T('Default caller id for outbound calls.') %> <td class="settings-list-row-control"><%- @T('Default caller id for outbound calls.') %>
</tbody>
</table>
</div>
<p><%- @T('In order for Zammad to access %s, a %s API user and password must be stored here', 'Sipgate', 'Sipgate') %>:<p>
<div class="settings-entry">
<table class="settings-list" style="width: 100%;">
<thead>
<tr> <tr>
<th width="20%"><%- @T('Type') %> <td class="settings-list-control-cell js-viewLimit">
<th width="80%"><%- @T('Content') %> <td class="settings-list-row-control"><%- @T('Shown records in caller log.') %>
</thead>
<tbody>
<tr>
<td class="settings-list-row-control"><%- @T('API User') %>
<td class="settings-list-control-cell"><input type="input" class="form-control form-control--small js-select" value="<%= @config.api_user %>" name="api_user" placeholder="someuser@example.com">
<tr>
<td class="settings-list-row-control"><%- @T('API Password') %>
<td class="settings-list-control-cell"><input type="password" class="form-control form-control--small js-select" value="<%= @config.api_password %>" name="api_password" placeholder="">
</tbody> </tbody>
</table> </table>
</div> </div>

View file

@ -55,6 +55,7 @@
<th class=""><%- @T('Display') %></th> <th class=""><%- @T('Display') %></th>
<th class=""><%- @T('Name') %></th> <th class=""><%- @T('Name') %></th>
<th class="" style="width: 200px;"><%- @T('Type') %></th> <th class="" style="width: 200px;"><%- @T('Type') %></th>
<th><%- @T('Position') %></th>
<th class="" style="width: 140px;"><%- @T('Action') %></th> <th class="" style="width: 140px;"><%- @T('Action') %></th>
</tr> </tr>
</thead> </thead>
@ -64,6 +65,7 @@
<td><%= item.display %></td> <td><%= item.display %></td>
<td><%= item.name %></td> <td><%= item.name %></td>
<td><%= item.data_type %></td> <td><%= item.data_type %></td>
<td><%= item.position %></td>
<td> <td>
<% if item.to_create is true: %> <% if item.to_create is true: %>
<%- @T('will be created') %> <%- @T('will be created') %>

View file

@ -3,7 +3,7 @@
<% if @object.member_ids: %> <% if @object.member_ids: %>
<hr> <hr>
<div class="popover-block"> <div class="popover-block">
<label><%- @T('Members') %></label> <label><%- @T('Members') %> (<%= @object.member_ids.length %>)</label>
<div class="userList js-userList"></div> <div class="userList js-userList"></div>
</div> </div>
<% end %> <% end %>

View file

@ -34,15 +34,19 @@
<div class="action-block action-block--flex"> <div class="action-block action-block--flex">
<div class="label"><%- @T('Escalation Times') %></div> <div class="label"><%- @T('Escalation Times') %></div>
<% if sla.first_response_time: %> <% if sla.first_response_time: %>
<%- sla.first_response_time_in_text %> <%- @T('hours') %> - <%- @T('First Response Time') %> <%- @time_duration_hh_mm(sla.first_response_time) %> <%- @T('hours') %> - <%- @T('First Response Time') %>
<% end %>
<% if sla.response_time: %>
<br>
<%- @time_duration_hh_mm(sla.response_time) %> <%- @T('hours') %> - <%- @T('Response Time') %>
<% end %> <% end %>
<% if sla.update_time: %> <% if sla.update_time: %>
<br> <br>
<%- sla.update_time_in_text %> <%- @T('hours') %> - <%- @T('Update Time') %> <%- @time_duration_hh_mm(sla.update_time) %> <%- @T('hours') %> - <%- @T('Update Time') %>
<% end %> <% end %>
<% if sla.solution_time: %> <% if sla.solution_time: %>
<br> <br>
<%- sla.solution_time_in_text %> <%- @T('hours') %> - <%- @T('Solution Time') %> <%- @time_duration_hh_mm(sla.solution_time) %> <%- @T('hours') %> - <%- @T('Solution Time') %>
<% end %> <% end %>
<br> <br>
</div> </div>

View file

@ -1,39 +1,39 @@
@font-face { @font-face {
font-family: 'Fira Sans'; font-family: 'Fira Sans';
src: url('fonts/FiraSans-Bold.eot'); src: url('assets/fonts/FiraSans-Bold.eot');
src: url('fonts/FiraSans-Bold.woff2') format('woff2'), src: url('assets/fonts/FiraSans-Bold.woff2') format('woff2'),
url('fonts/FiraSans-Bold.woff') format('woff'), url('assets/fonts/FiraSans-Bold.woff') format('woff'),
url('fonts/FiraSans-Bold.ttf') format('truetype'); url('assets/fonts/FiraSans-Bold.ttf') format('truetype');
font-weight: bold; font-weight: bold;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'Fira Sans'; font-family: 'Fira Sans';
src: url('fonts/FiraSans-Regular.eot'); src: url('assets/fonts/FiraSans-Regular.eot');
src: url('fonts/FiraSans-Regular.woff2') format('woff2'), src: url('assets/fonts/FiraSans-Regular.woff2') format('woff2'),
url('fonts/FiraSans-Regular.woff') format('woff'), url('assets/fonts/FiraSans-Regular.woff') format('woff'),
url('fonts/FiraSans-Regular.ttf') format('truetype'); url('assets/fonts/FiraSans-Regular.ttf') format('truetype');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'Fira Sans'; font-family: 'Fira Sans';
src: url('fonts/FiraSans-Medium.eot'); src: url('assets/fonts/FiraSans-Medium.eot');
src: url('fonts/FiraSans-Medium.woff2') format('woff2'), src: url('assets/fonts/FiraSans-Medium.woff2') format('woff2'),
url('fonts/FiraSans-Medium.woff') format('woff'), url('assets/fonts/FiraSans-Medium.woff') format('woff'),
url('fonts/FiraSans-Medium.ttf') format('truetype'); url('assets/fonts/FiraSans-Medium.ttf') format('truetype');
font-weight: 500; font-weight: 500;
font-style: normal; font-style: normal;
} }
@font-face { @font-face {
font-family: 'Fira Sans'; font-family: 'Fira Sans';
src: url('fonts/FiraSans-Light.eot'); src: url('assets/fonts/FiraSans-Light.eot');
src: url('fonts/FiraSans-Light.woff2') format('woff2'), src: url('assets/fonts/FiraSans-Light.woff2') format('woff2'),
url('fonts/FiraSans-Light.woff') format('woff'), url('assets/fonts/FiraSans-Light.woff') format('woff'),
url('fonts/FiraSans-Light.ttf') format('truetype'); url('assets/fonts/FiraSans-Light.ttf') format('truetype');
font-weight: 300; font-weight: 300;
font-style: normal; font-style: normal;
} }

View file

@ -358,6 +358,26 @@ ol, ul {
z-index: 1; z-index: 1;
} }
code {
background: hsla(0, 0%, 0%, 0.2);
border-radius: 3px;
box-decoration-break: clone;
}
code,
.hljs {
padding: 2px 4px;
font-size: 0.88em;
}
.hljs {
background: none;
}
pre code.hljs {
font-size: 1em;
}
pre { pre {
display: block; display: block;
padding: 9.5px; padding: 9.5px;
@ -371,30 +391,26 @@ pre {
border: 1px solid hsl(0,0%,90%); border: 1px solid hsl(0,0%,90%);
border-radius: 3px; border-radius: 3px;
} }
.modal-content pre {
background: hsl(0, 0%, 97%);
border: 1px solid hsl(0, 0%, 87%);
}
pre code { pre code {
padding: 0; padding: 0;
font-size: inherit; font-size: inherit;
color: inherit; color: inherit;
white-space: pre-wrap; white-space: pre-wrap;
background-color: transparent;
border-radius: 0;
}
.hljs,
code {
background: none; background: none;
padding: 2px 4px; border-radius: 0;
font-size: 0.88em; border: none;
} overflow-x: auto;
code:not(.hljs) { &.hljs {
border: 1px solid rgba(0,0,0,.2); padding: 0;
border-radius: 3px; background: none;
white-space: nowrap;
} }
pre code.hljs {
font-size: 1em;
} }
.textarea::placeholder, .textarea::placeholder,
@ -13157,3 +13173,10 @@ span.is-disabled {
.text-modules-box { .text-modules-box {
max-height: 40vh; max-height: 40vh;
} }
.sla_times {
.sla_radio_container {
padding-top: 0.5em;
padding-left: 0.5em;
}
}

View file

@ -43,6 +43,10 @@ module ApplicationController::Authenticates
end end
def authentication_check_only(auth_param = {}) def authentication_check_only(auth_param = {})
if Rails.env.test? && ENV['FAKE_SELENIUM_LOGIN_USER_ID'].present? && session[:user_id].blank?
session[:user_id] = ENV['FAKE_SELENIUM_LOGIN_USER_ID'].to_i
end
# logger.debug 'authentication_check' # logger.debug 'authentication_check'
# logger.debug params.inspect # logger.debug params.inspect
# logger.debug session.inspect # logger.debug session.inspect

View file

@ -38,6 +38,7 @@ class CalendarsController < ApplicationController
end end
def destroy def destroy
model_references_check(Calendar, params)
model_destroy_render(Calendar, params) model_destroy_render(Calendar, params)
end end

View file

@ -149,6 +149,7 @@ curl http://localhost/api/v1/groups/{id} -v -u #{login}:#{password} -H "Content-
=end =end
def destroy def destroy
model_references_check(Group, params)
model_destroy_render(Group, params) model_destroy_render(Group, params)
end end
end end

View file

@ -50,9 +50,9 @@ class ImportFreshdeskController < ApplicationController
Setting.set('import_freshdesk_endpoint_key', params[:token]) Setting.set('import_freshdesk_endpoint_key', params[:token])
result = Sequencer.process('Import::Freshdesk::ConnectionTest') connection_result = Sequencer.process('Import::Freshdesk::ConnectionTest')
if !result[:connected] if !connection_result[:connected]
Setting.set('import_freshdesk_endpoint_key', nil) Setting.set('import_freshdesk_endpoint_key', nil)
@ -63,6 +63,19 @@ class ImportFreshdeskController < ApplicationController
return return
end end
permission_result = Sequencer.process('Import::Freshdesk::PermissionCheck')
if !permission_result[:permission_present]
Setting.set('import_freshdesk_endpoint_key', nil)
render json: {
result: 'invalid',
message_human: 'Missing administrator permission!',
}
return
end
render json: { render json: {
result: 'ok', result: 'ok',
} }

View file

@ -42,9 +42,7 @@ class Integration::SMIMEController < ApplicationController
string = params[:file].read.force_encoding('utf-8') string = params[:file].read.force_encoding('utf-8')
end end
items = string.scan(%r{.+?-+END(?: TRUSTED)? CERTIFICATE-+}mi).each_with_object([]) do |cert, result| items = SMIMECertificate.create_certificates(string)
result << SMIMECertificate.create!(public_key: cert)
end
render json: { render json: {
result: 'ok', result: 'ok',
@ -73,14 +71,8 @@ class Integration::SMIMEController < ApplicationController
raise "Parameter 'data' or 'file' required." if string.blank? raise "Parameter 'data' or 'file' required." if string.blank?
private_key = OpenSSL::PKey.read(string, params[:secret]) SMIMECertificate.create_certificates(string)
modulus = private_key.public_key.n.to_s(16) SMIMECertificate.create_private_keys(string, params[:secret])
certificate = SMIMECertificate.find_by(modulus: modulus)
raise Exceptions::UnprocessableEntity, 'Unable for find certificate for this private key.' if !certificate
certificate.update!(private_key: string, private_key_secret: params[:secret])
render json: { render json: {
result: 'ok', result: 'ok',

View file

@ -29,7 +29,7 @@ class ObjectManagerAttributesController < ApplicationController
) )
raise Exceptions::UnprocessableEntity, 'already exists' if exists raise Exceptions::UnprocessableEntity, 'already exists' if exists
add_attribute_using_params(permitted_params.merge(position: 1550), status: :created) add_attribute_using_params(permitted_params, status: :created)
end end
# PUT /object_manager_attributes/1 # PUT /object_manager_attributes/1

View file

@ -22,6 +22,7 @@ class ReportsController < ApplicationController
get_params = params_all get_params = params_all
return if !get_params return if !get_params
begin
result = {} result = {}
get_params[:metric][:backend].each do |backend| get_params[:metric][:backend].each do |backend|
condition = get_params[:profile].condition condition = get_params[:profile].condition
@ -43,6 +44,13 @@ class ReportsController < ApplicationController
current_user: current_user current_user: current_user
) )
end end
rescue => e
if e.message.include? 'Conflicting date range'
raise Exceptions::UnprocessableEntity, 'Conflicting date ranges. Please check your selected report profile.'
end
raise e
end
render json: { render json: {
data: result data: result

View file

@ -1,31 +0,0 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
class TicketCreateScreenJob < ApplicationJob
include HasActiveJobLock
def perform
Sessions.list.each do |client_id, data|
next if client_id.blank?
user_id = data&.dig(:user, 'id')
next if user_id.blank?
user = User.lookup(id: user_id)
next if !user&.permissions?('ticket.agent')
# get attributes to update
ticket_create_attributes = Ticket::ScreenOptions.attributes_to_change(
current_user: user,
)
# no data exists
next if ticket_create_attributes.blank?
Rails.logger.debug { "push ticket_create for user #{user.id}" }
Sessions.send(client_id, {
event: 'ticket_create_attributes',
data: ticket_create_attributes,
})
end
end
end

View file

@ -373,18 +373,14 @@ returns
end end
# check if sla's are refer to an existing calendar # check if sla's are refer to an existing calendar
if destroyed?
default_calendar = Calendar.find_by(default: true) default_calendar = Calendar.find_by(default: true)
Sla.find_each do |sla| Sla.where(calendar_id: id).find_each do |sla|
if !sla.calendar_id
sla.calendar_id = default_calendar.id
sla.save!
next
end
if !Calendar.exists?(id: sla.calendar_id)
sla.calendar_id = default_calendar.id sla.calendar_id = default_calendar.id
sla.save! sla.save!
end end
end end
true true
end end

View file

@ -17,7 +17,7 @@ class Channel::Driver::Sms::MessageBird < Channel::Driver::Sms::Base
send_create(options, attr) send_create(options, attr)
true true
rescue => e rescue => e
Rails.logger.debug { "MessageBird error: #{e.inspect}" } Rails.logger.error { "MessageBird error: #{e.inspect}" }
raise e raise e
end end
end end

View file

@ -606,6 +606,20 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
if mail.html_part&.body.present? if mail.html_part&.body.present?
content_type = mail.html_part.mime_type || 'text/plain' content_type = mail.html_part.mime_type || 'text/plain'
body = body_text(mail.html_part, strict_html: true) body = body_text(mail.html_part, strict_html: true)
elsif mail.text_part.present? && mail.all_parts.any? { |elem| elem.inline? && elem.content_type&.start_with?('image') }
content_type = 'text/html'
body = mail
.all_parts
.reduce('') do |memo, part|
if part.mime_type == 'text/plain' && !part.attachment?
memo += body_text(part, strict_html: false).text2html
elsif part.inline? && part.content_type&.start_with?('image')
memo += "<img src=\'cid:#{part.cid}\'>"
end
memo
end
elsif mail.text_part.present? elsif mail.text_part.present?
content_type = 'text/plain' content_type = 'text/plain'
@ -614,9 +628,6 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
.reduce('') do |memo, part| .reduce('') do |memo, part|
if part.mime_type == 'text/plain' && !part.attachment? if part.mime_type == 'text/plain' && !part.attachment?
memo += body_text(part, strict_html: false) memo += body_text(part, strict_html: false)
elsif part.inline? && part.content_type&.start_with?('image')
content_type = 'text/html'
memo += "<img src=\'cid:#{part.cid}\'>"
end end
memo memo

View file

@ -14,8 +14,7 @@ module HasGroupRelationDefinition
validates :access, presence: true validates :access, presence: true
validate :validate_access validate :validate_access
after_save :touch_related after_commit :touch_related
after_destroy :touch_related
end end
private private

View file

@ -251,7 +251,6 @@ module HasGroups
yield yield
self.group_access_buffer = nil self.group_access_buffer = nil
cache_delete cache_delete
push_ticket_create_screen_background_job
end end
def process_group_access_buffer def process_group_access_buffer

View file

@ -6,9 +6,9 @@ module HasRoles
included do included do
has_and_belongs_to_many :roles, has_and_belongs_to_many :roles,
before_add: %i[validate_agent_limit_by_role validate_roles], before_add: %i[validate_agent_limit_by_role validate_roles],
after_add: %i[cache_update check_notifications push_ticket_create_screen_for_role_change], after_add: %i[cache_update check_notifications],
before_remove: :last_admin_check_by_role, before_remove: :last_admin_check_by_role,
after_remove: %i[cache_update push_ticket_create_screen_for_role_change] after_remove: %i[cache_update]
end end
# Checks a given Group( ID) for given access(es) for the instance associated roles. # Checks a given Group( ID) for given access(es) for the instance associated roles.
@ -45,15 +45,6 @@ module HasRoles
) )
end end
def push_ticket_create_screen_for_role_change(role)
return if Setting.get('import_mode')
permission = Permission.lookup(name: 'ticket.agent')
return if !role.permissions.exists?(id: permission.id)
push_ticket_create_screen_background_job
end
# methods defined here are going to extend the class, not the instance of it # methods defined here are going to extend the class, not the instance of it
class_methods do class_methods do

View file

@ -216,23 +216,26 @@ reload search index with full data
def search_index_reload def search_index_reload
tolerance = 10 tolerance = 10
tolerance_count = 0 tolerance_count = 0
batch_size = 100 query = order(created_at: :desc)
query = all.order(created_at: :desc)
total = query.count total = query.count
query.find_in_batches(batch_size: batch_size).with_index do |group, batch| record_count = 0
group.each do |item| batch_size = 100
next if item.ignore_search_indexing?(:destroy) query.as_batches(size: batch_size) do |record|
if !record.ignore_search_indexing?(:destroy)
begin begin
item.search_index_update_backend record.search_index_update_backend
rescue => e rescue => e
logger.error "Unable to send #{item.class}.find(#{item.id}).search_index_update_backend backend: #{e.inspect}" logger.error "Unable to send #{record.class}.find(#{record.id}).search_index_update_backend backend: #{e.inspect}"
tolerance_count += 1 tolerance_count += 1
sleep 15 sleep 15
raise "Unable to send #{item.class}.find(#{item.id}).search_index_update_backend backend: #{e.inspect}" if tolerance_count == tolerance raise "Unable to send #{record.class}.find(#{record.id}).search_index_update_backend backend: #{e.inspect}" if tolerance_count == tolerance
end end
end end
puts "\t#{[(batch + 1) * batch_size, total].min}/#{total}" # rubocop:disable Rails/Output
record_count += 1
if (record_count % batch_size).zero? || record_count == total
puts "\t#{record_count}/#{total}" # rubocop:disable Rails/Output
end
end end
end end
end end

View file

@ -1,28 +0,0 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
module HasTicketCreateScreenImpact
extend ActiveSupport::Concern
included do
after_commit :push_ticket_create_screen
end
def push_ticket_create_screen?
return true if destroyed?
%w[id name active updated_at].any? do |attribute|
saved_change_to_attribute?(attribute)
end
end
def push_ticket_create_screen
return if Setting.get('import_mode')
return if !push_ticket_create_screen?
push_ticket_create_screen_background_job
end
def push_ticket_create_screen_background_job
TicketCreateScreenJob.set(wait: 10.seconds).perform_later
end
end

View file

@ -56,22 +56,42 @@ class CoreWorkflow::Attributes
result result
end end
def selected def exists?
if @payload['params']['id'] && payload_class.exists?(id: @payload['params']['id']) return if @payload['params']['id'].blank?
result = saved_only
@exists ||= payload_class.exists?(id: @payload['params']['id'])
end
def overwritten
# params loading and preparing is very expensive so cache it
checksum = Digest::MD5.hexdigest(Marshal.dump(@payload['params']))
return @overwritten[checksum] if @overwritten.present? && @overwritten[checksum]
@overwritten = {}
@overwritten[checksum] = begin
result = saved_only(dump: true)
overwrite_selected(result) overwrite_selected(result)
end
end
def selected
if exists?
overwritten
else else
selected_only selected_only
end end
end end
def saved_only def saved_only(dump: false)
return if @payload['params']['id'].blank? return if !exists?
# dont use lookup here because the cache will not # dont use lookup here because the cache will not
# know about new attributes and make crashes # know about new attributes and make crashes
@saved_only ||= payload_class.find_by(id: @payload['params']['id']) @saved_only ||= payload_class.find_by(id: @payload['params']['id'])
return @saved_only if !dump
# we use marshal here because clone still uses references and dup can't # we use marshal here because clone still uses references and dup can't
# detect changes for the rails object # detect changes for the rails object
Marshal.load(Marshal.dump(@saved_only)) Marshal.load(Marshal.dump(@saved_only))
@ -193,7 +213,7 @@ class CoreWorkflow::Attributes
end end
def attribute_options_relation?(attribute) def attribute_options_relation?(attribute)
attribute[:relation].present? attribute[:tag] == 'select' && attribute[:relation].present?
end end
def values(attribute) def values(attribute)
@ -238,13 +258,10 @@ class CoreWorkflow::Attributes
end end
def saved_attribute_value(attribute) def saved_attribute_value(attribute)
saved_attribute_value = saved_only&.try(attribute[:name])
# special case for owner_id # special case for owner_id
if saved_only&.class == Ticket && attribute[:name] == 'owner_id' && saved_attribute_value == 1 return if saved_only&.class == Ticket && attribute[:name] == 'owner_id'
saved_attribute_value = nil
end
saved_attribute_value saved_only&.try(attribute[:name])
end end
end end

View file

@ -3,8 +3,11 @@
class CoreWorkflow::Attributes::User < CoreWorkflow::Attributes::Base class CoreWorkflow::Attributes::User < CoreWorkflow::Attributes::Base
def values def values
if @attribute[:name] == 'owner_id' && @attributes.payload['class_name'] == 'Ticket'
return ticket_owner_id_bulk if @attributes.payload['screen'] == 'overview_bulk' return ticket_owner_id_bulk if @attributes.payload['screen'] == 'overview_bulk'
return ticket_owner_id if @attributes.payload['class_name'] == 'Ticket' && @attribute[:name] == 'owner_id'
return ticket_owner_id
end
[] []
end end
@ -35,7 +38,10 @@ class CoreWorkflow::Attributes::User < CoreWorkflow::Attributes::Base
def ticket_owner_id def ticket_owner_id
return [''] if @attributes.selected_only.group_id.blank? return [''] if @attributes.selected_only.group_id.blank?
group_owner_ids owner_ids = group_owner_ids
return [''] if owner_ids.blank?
owner_ids
end end
def group_owner_ids def group_owner_ids

View file

@ -10,6 +10,10 @@ class CoreWorkflow::Condition::Backend
attr_reader :value attr_reader :value
def field
@key.sub(%r{.*\.}, '')
end
def object?(object) def object?(object)
@condition_object.attributes.instance_of?(object) @condition_object.attributes.instance_of?(object)
end end

View file

@ -0,0 +1,9 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
class CoreWorkflow::Condition::ChangedTo < CoreWorkflow::Condition::Backend
def match
return if !CoreWorkflow::Condition::HasChanged.new(condition_object: @condition_object, key: @key, condition: @condition, value: @value).match
CoreWorkflow::Condition::Is.new(condition_object: @condition_object, key: @key, condition: @condition, value: @value).match
end
end

View file

@ -0,0 +1,9 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
class CoreWorkflow::Condition::HasChanged < CoreWorkflow::Condition::Backend
def match
return if @condition_object.payload['last_changed_attribute'] != field
true
end
end

View file

@ -16,7 +16,13 @@ class CoreWorkflow::Custom::AdminSla < CoreWorkflow::Custom::Backend
end end
def update_time_enabled def update_time_enabled
return 'set_mandatory' if params['update_time_enabled'].present? return 'set_mandatory' if params['update_time_enabled'].present? && params['update_type'] == 'update'
'set_optional'
end
def response_time_enabled
return 'set_mandatory' if params['update_time_enabled'].present? && params['update_type'] == 'response'
'set_optional' 'set_optional'
end end
@ -32,6 +38,7 @@ class CoreWorkflow::Custom::AdminSla < CoreWorkflow::Custom::Backend
# make fields mandatory if checkbox is checked # make fields mandatory if checkbox is checked
result(first_response_time_enabled, 'first_response_time_in_text') result(first_response_time_enabled, 'first_response_time_in_text')
result(update_time_enabled, 'update_time_in_text') result(update_time_enabled, 'update_time_in_text')
result(response_time_enabled, 'response_time_in_text')
result(solution_time_enabled, 'solution_time_in_text') result(solution_time_enabled, 'solution_time_in_text')
end end
end end

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