From 8d576333904bf653bf1bcfe53bbd4335aa75e86c Mon Sep 17 00:00:00 2001 From: Roy Kaldung Date: Mon, 5 Aug 2013 19:18:52 +0200 Subject: [PATCH 001/286] minor changes on comments --- app/controllers/tickets_controller.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index 7bef119a14a1..4d2adb13ca42 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -10,7 +10,7 @@ def index render :json => @tickets end - # GET /api/tickets/1 + # GET /api/tickets/:id def show @ticket = Ticket.find( params[:id] ) @@ -80,7 +80,7 @@ def create render :json => @ticket, :status => :created end - # PUT /api/tickets/1 + # PUT /api/tickets/:id def update @ticket = Ticket.find(params[:id]) @@ -94,7 +94,7 @@ def update end end - # DELETE /api/tickets/1 + # DELETE /api/tickets/:id def destroy @ticket = Ticket.find( params[:id] ) @@ -139,7 +139,7 @@ def ticket_customer } end - # GET /api/ticket_history/1 + # GET /api/ticket_history/:id def ticket_history # get ticket data @@ -209,7 +209,7 @@ def ticket_history } end - # GET /api/ticket_merge_list/1 + # GET /api/ticket_merge_list/:id def ticket_merge_list # get closed/open states @@ -251,7 +251,7 @@ def ticket_merge_list } end - # GET /ticket_merge/1/1 + # GET /ticket_merge/:master_id/:slave_id def ticket_merge # check master ticket @@ -305,7 +305,7 @@ def ticket_merge } end - # GET /ticket_full/1 + # GET /ticket_full/:id def ticket_full # permission check From d4205d9ba6543a238c9dcd20ef1e03c4d76b2d05 Mon Sep 17 00:00:00 2001 From: Roy Kaldung Date: Wed, 14 Aug 2013 20:08:23 +0200 Subject: [PATCH 002/286] removed Windows ;-) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 38b7533620ca..d2cc46aa2b33 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ Welcome to Zammad Zammad is a web based open source helpdesk/ticket system with many features to manage customer telephone calls and e-mails. It is distributed under the -GNU AFFERO General Public License (AGPL) and tested on Linux, Solaris, AIX, -Windows, FreeBSD, OpenBSD and Mac OS 10.x. Do you receive many e-mails and +GNU AFFERO General Public License (AGPL) and tested on Linux, Solaris, AIX, +FreeBSD, OpenBSD and Mac OS 10.x. Do you receive many e-mails and want to answer them with a team of agents? You're going to love Zammad! From 99b3201ccf5fe5288a7980a011119405205f4bea Mon Sep 17 00:00:00 2001 From: rkaldung Date: Wed, 14 Aug 2013 20:20:55 +0200 Subject: [PATCH 003/286] added initial spec for rpm --- extras/zammad.spec | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 extras/zammad.spec diff --git a/extras/zammad.spec b/extras/zammad.spec new file mode 100644 index 000000000000..a2b9e32d2e15 --- /dev/null +++ b/extras/zammad.spec @@ -0,0 +1,46 @@ +%define user zammad +%define group zammad +%define basedir /opt/zammad + +Summary: A request tracking tool. +Name: zammad +Version: 0.4 +Release: 1 +Copyright: AGPL +Group: Applications/Web +Source: ftp://ftp.gnomovision.com/pub/cdplayer/cdplayer-1.0.tgz +URL: http://zammad.org/documentation +Vendor: Zammad Foundation +Packager: Roy Kaldung +Requires: nginx >= 1.4 +Requires(pre): shadow-utils +Requires(post): chkconfig + +%description +Zammad is a web based open source helpdesk/ticket system +with many features to manage customer telephone calls and +e-mails. It is distributed under the GNU AFFERO General +Public License (AGPL) and tested on Linux, Solaris, AIX, +FreeBSD, OpenBSD and Mac OS 10.x. Do you receive many +e-mails and want to answer them with a team of agents? +You're going to love Zammad! + +%build + +%install +mkdir -p %{basedir} +ln -s /opt/zammad/config /etc/zammad + +%files +%doc /opt/zammad/doc/README +%doc /opt/zammad/doc/X-Headers.txt +/opt/zammad/doc/app +# symlink /opt/zammad/config to /etc/zammad +%config /opt/zammad/config +/opt/zammad/ + + +%pre +/usr/bin/getent group %{group} > /dev/null || /usr/sbin/groupadd -r %{group} +/usr/bin/getent passwd %{user} > /dev/null || /usr/sbin/useradd -M -n -g %{group}-r -d /opt/zammad -s /sbin/nologin %{user} + From 7b1ec4d17f1c41d3a74ae7bb55f59fb7bef6b8e7 Mon Sep 17 00:00:00 2001 From: rkaldung Date: Wed, 14 Aug 2013 20:26:25 +0200 Subject: [PATCH 004/286] modified install section --- extras/zammad.spec | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/extras/zammad.spec b/extras/zammad.spec index a2b9e32d2e15..374c8d983c57 100644 --- a/extras/zammad.spec +++ b/extras/zammad.spec @@ -5,10 +5,10 @@ Summary: A request tracking tool. Name: zammad Version: 0.4 -Release: 1 +Release: 1%{?dist}.zammad Copyright: AGPL Group: Applications/Web -Source: ftp://ftp.gnomovision.com/pub/cdplayer/cdplayer-1.0.tgz +Source: http://download.zammad.org/latest.tar.bz2 URL: http://zammad.org/documentation Vendor: Zammad Foundation Packager: Roy Kaldung @@ -28,8 +28,11 @@ You're going to love Zammad! %build %install -mkdir -p %{basedir} -ln -s /opt/zammad/config /etc/zammad +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT%{basedir} +mkdir -p $RPM_BUILD_ROOT/etc +cd $RPM_BUILD_ROOT/etc +ln -s $RPM_BUILD_ROOT%{basedir}/config etc/zammad %files %doc /opt/zammad/doc/README From 09d61ce4c822f15a4fc728b9c02f8ba37dd5040d Mon Sep 17 00:00:00 2001 From: rkaldung Date: Wed, 14 Aug 2013 20:38:09 +0200 Subject: [PATCH 005/286] added dependency --- extras/zammad.spec | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/extras/zammad.spec b/extras/zammad.spec index 374c8d983c57..a3f475d2735c 100644 --- a/extras/zammad.spec +++ b/extras/zammad.spec @@ -12,7 +12,7 @@ Source: http://download.zammad.org/latest.tar.bz2 URL: http://zammad.org/documentation Vendor: Zammad Foundation Packager: Roy Kaldung -Requires: nginx >= 1.4 +Requires: nginx >= 1.4, libv8 Requires(pre): shadow-utils Requires(post): chkconfig @@ -38,9 +38,8 @@ ln -s $RPM_BUILD_ROOT%{basedir}/config etc/zammad %doc /opt/zammad/doc/README %doc /opt/zammad/doc/X-Headers.txt /opt/zammad/doc/app -# symlink /opt/zammad/config to /etc/zammad -%config /opt/zammad/config /opt/zammad/ +%config /opt/zammad/config %pre From abeeb5e66dd7ca449c7d0830cb233cfb260bbcf9 Mon Sep 17 00:00:00 2001 From: Roy Kaldung Date: Fri, 23 Aug 2013 21:00:55 +0200 Subject: [PATCH 006/286] Updated Build Status image URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d2cc46aa2b33..d5446b49084b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](http://ci.zammad.org/job/ZammadUnittest-ruby-1.9.3-p362/badge/icon)](http://ci.zammad.org/job/ZammadUnittest-ruby-1.9.3-p362/) +![Build Status](http://ci.zammad.org/buildStatus/icon?job=ZammadUnittest-ruby-1.9.3-p429) Welcome to Zammad ================= From b46c390d30df6c9dbd94d5dd9e175933600858ce Mon Sep 17 00:00:00 2001 From: Roy Kaldung Date: Wed, 4 Dec 2013 18:22:21 +0100 Subject: [PATCH 007/286] minor change to test GitHub hook (automatic deploy) --- README_Install_Ubuntu.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README_Install_Ubuntu.md b/README_Install_Ubuntu.md index 622bb86c0a97..af37ec709b83 100644 --- a/README_Install_Ubuntu.md +++ b/README_Install_Ubuntu.md @@ -75,8 +75,8 @@ ### Get Zammad * cd /var/www/zammad -* wget http://zammad.org/zammad-1.0.1.tar.gz -* tar -xzf zammad-1.0.1.tar.gz +* wget http://zammad.org/zammad-latest.tar.gz +* tar -xzf zammad-latest.tar.gz ### Edit Gemfile * vi Gemfile From 2fbf4324a7a83ee37bef000826acc584750cf3a5 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 22 Feb 2014 14:46:25 +0100 Subject: [PATCH 008/286] Update Gemfile --- Gemfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Gemfile b/Gemfile index 271636bedf58..5690a0b8f03c 100644 --- a/Gemfile +++ b/Gemfile @@ -93,4 +93,3 @@ group :development, :test do end gem 'thin' -#gem 'puma' From 17d113ca20675c4d077fc2f565330aa6cdb9bec9 Mon Sep 17 00:00:00 2001 From: Roy Kaldung Date: Fri, 2 May 2014 12:47:18 +0200 Subject: [PATCH 009/286] removed old file --- extras/apr-util.spec | 213 ------------------------------------------- 1 file changed, 213 deletions(-) delete mode 100644 extras/apr-util.spec diff --git a/extras/apr-util.spec b/extras/apr-util.spec deleted file mode 100644 index 9c54f3117ee0..000000000000 --- a/extras/apr-util.spec +++ /dev/null @@ -1,213 +0,0 @@ -%define apuver 1 - -Summary: Apache Portable Runtime Utility library -Name: apr-util -Version: 1.5.1 -Release: 1%{?dist} -License: Apache Software License -Group: System Environment/Libraries -URL: http://apr.apache.org/ -Source0: http://www.apache.org/dist/apr/%{name}-%{version}.tar.bz2 -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -BuildRequires: autoconf, libtool, doxygen, apr-devel >= 1.4.0 -BuildRequires: expat-devel, libuuid-devel - -%description -The mission of the Apache Portable Runtime (APR) is to provide a -free library of C data structures and routines. This library -contains additional utility interfaces for APR; including support -for XML, LDAP, database interfaces, URI parsing and more. - -%package devel -Group: Development/Libraries -Summary: APR utility library development kit -Requires: apr-util = %{version}-%{release}, apr-devel -Requires: db4-devel, expat-devel - -%description devel -This package provides the support files which can be used to -build applications using the APR utility library. The mission -of the Apache Portable Runtime (APR) is to provide a free -library of C data structures and routines. - -%package dbm -Group: Development/Libraries -Summary: APR utility library DBM driver -BuildRequires: db4-devel -Requires: apr-util = %{version}-%{release} - -%description dbm -This package provides the DBM driver for the apr-util. - -%package pgsql -Group: Development/Libraries -Summary: APR utility library PostgreSQL DBD driver -BuildRequires: postgresql-devel -Requires: apr-util = %{version}-%{release} - -%description pgsql -This package provides the PostgreSQL driver for the apr-util -DBD (database abstraction) interface. - -%package mysql -Group: Development/Libraries -Summary: APR utility library MySQL DBD driver -BuildRequires: mysql-devel -Requires: apr-util = %{version}-%{release} - -%description mysql -This package provides the MySQL driver for the apr-util DBD -(database abstraction) interface. - -%package sqlite -Group: Development/Libraries -Summary: APR utility library SQLite DBD driver -BuildRequires: sqlite-devel >= 3.0.0 -Requires: apr-util = %{version}-%{release} - -%description sqlite -This package provides the SQLite driver for the apr-util DBD -(database abstraction) interface. - -%package freetds -Group: Development/Libraries -Summary: APR utility library FreeTDS DBD driver -BuildRequires: freetds-devel -Requires: apr-util = %{version}-%{release} - -%description freetds -This package provides the FreeTDS driver for the apr-util DBD -(database abstraction) interface. - -%package odbc -Group: Development/Libraries -Summary: APR utility library ODBC DBD driver -BuildRequires: unixODBC-devel -Requires: apr-util = %{version}-%{release} - -%description odbc -This package provides the ODBC driver for the apr-util DBD -(database abstraction) interface. - -%package ldap -Group: Development/Libraries -Summary: APR utility library LDAP support -BuildRequires: openldap-devel -Requires: apr-util = %{version}-%{release} - -%description ldap -This package provides the LDAP support for the apr-util. - -%package openssl -Group: Development/Libraries -Summary: APR utility library OpenSSL crypto support -BuildRequires: openssl-devel -Requires: apr-util = %{version}-%{release} - -%description openssl -This package provides crypto support for apr-util based on OpenSSL. - -%package nss -Group: Development/Libraries -Summary: APR utility library NSS crypto support -BuildRequires: nss-devel -Requires: apr-util = %{version}-%{release} - -%description nss -This package provides crypto support for apr-util based on Mozilla NSS. - -%prep -%setup -q - -%build -%configure --with-apr=%{_prefix} \ - --includedir=%{_includedir}/apr-%{apuver} \ - --with-ldap --without-gdbm \ - --with-sqlite3 --with-pgsql --with-mysql --with-freetds --with-odbc \ - --with-berkeley-db \ - --with-crypto --with-openssl --with-nss \ - --without-sqlite2 -make %{?_smp_mflags} && make dox - -%check -# Run non-interactive tests -pushd test -make %{?_smp_mflags} all CFLAGS=-fno-strict-aliasing -make check || exit 1 -popd - -%install -rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT - -# Documentation -mv docs/dox/html html - -# Unpackaged files -rm -f $RPM_BUILD_ROOT%{_libdir}/aprutil.exp - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - -%files -%defattr(-,root,root,-) -%doc CHANGES LICENSE NOTICE -%{_libdir}/libaprutil-%{apuver}.so.* -%dir %{_libdir}/apr-util-%{apuver} - -%files dbm -%defattr(-,root,root,-) -%{_libdir}/apr-util-%{apuver}/apr_dbm_db* - -%files pgsql -%defattr(-,root,root,-) -%{_libdir}/apr-util-%{apuver}/apr_dbd_pgsql* - -%files mysql -%defattr(-,root,root,-) -%{_libdir}/apr-util-%{apuver}/apr_dbd_mysql* - -%files sqlite -%defattr(-,root,root,-) -%{_libdir}/apr-util-%{apuver}/apr_dbd_sqlite* - -%files freetds -%defattr(-,root,root,-) -%{_libdir}/apr-util-%{apuver}/apr_dbd_freetds* - -%files odbc -%defattr(-,root,root,-) -%{_libdir}/apr-util-%{apuver}/apr_dbd_odbc* - -%files ldap -%defattr(-,root,root,-) -%{_libdir}/apr-util-%{apuver}/apr_ldap* - -%files openssl -%defattr(-,root,root,-) -%{_libdir}/apr-util-%{apuver}/apr_crypto_openssl* - -%files nss -%defattr(-,root,root,-) -%{_libdir}/apr-util-%{apuver}/apr_crypto_nss* - -%files devel -%defattr(-,root,root,-) -%{_bindir}/apu-%{apuver}-config -%{_libdir}/libaprutil-%{apuver}.*a -%{_libdir}/libaprutil-%{apuver}.so -%{_libdir}/pkgconfig/apr-util-%{apuver}.pc -%{_includedir}/apr-%{apuver}/*.h -%doc --parents html - -%changelog -* Tue Jun 22 2004 Graham Leggett 1.0.0-1 -- update to support v1.0.0 of APR - -* Tue Jun 22 2004 Graham Leggett 1.0.0-1 -- derived from Fedora Core apr.spec - From 99c88cde626e503646ac9fa7ec9903e6536fa52d Mon Sep 17 00:00:00 2001 From: Roy Kaldung Date: Fri, 2 May 2014 12:47:41 +0200 Subject: [PATCH 010/286] Delete apr.spec --- extras/apr.spec | 99 ------------------------------------------------- 1 file changed, 99 deletions(-) delete mode 100644 extras/apr.spec diff --git a/extras/apr.spec b/extras/apr.spec deleted file mode 100644 index 4266f31fd25d..000000000000 --- a/extras/apr.spec +++ /dev/null @@ -1,99 +0,0 @@ -%define aprver 1 - -Summary: Apache Portable Runtime library -Name: apr -Version: 1.4.6 -Release: 1%{?dist} -License: Apache Software License -Group: System Environment/Libraries -URL: http://apr.apache.org/ -Source0: http://www.apache.org/dist/apr/%{name}-%{version}.tar.bz2 -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -BuildRequires: autoconf, libtool, doxygen, python - -%description -The mission of the Apache Portable Runtime (APR) is to provide a -free library of C data structures and routines, forming a system -portability layer to as many operating systems as possible, -including Unices, MS Win32, BeOS and OS/2. - -%package devel -Group: Development/Libraries -Summary: APR library development kit -Requires: apr = %{version} - -%description devel -This package provides the support files which can be used to -build applications using the APR library. The mission of the -Apache Portable Runtime (APR) is to provide a free library of -C data structures and routines. - -%prep -%setup -q - -%build -# regenerate configure script etc. -./buildconf -%configure \ - --prefix=/usr \ - --includedir=%{_includedir}/apr-%{aprver} \ - --with-installbuilddir=%{_libdir}/apr/build-%{aprver} \ - --with-devrandom=/dev/urandom \ - CC=gcc CXX=g++ -make %{?_smp_mflags} && make dox - -%check -# Run non-interactive tests -pushd test -make %{?_smp_mflags} all CFLAGS=-fno-strict-aliasing -make check || exit 1 -popd - -%install -rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT - -# Move docs to more convenient location -mv docs/dox/html html - -# Unpackaged files: -rm -f $RPM_BUILD_ROOT%{_libdir}/apr.exp - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - -%files -%defattr(-,root,root,-) -%doc CHANGES LICENSE NOTICE -%{_libdir}/libapr-%{aprver}.so.* - -%files devel -%defattr(-,root,root,-) -%doc docs/APRDesign.html docs/canonical_filenames.html -%doc docs/incomplete_types docs/non_apr_programs -%doc --parents html -%{_bindir}/apr*config -%{_libdir}/libapr-%{aprver}.*a -%{_libdir}/libapr-%{aprver}.so -%dir %{_libdir}/apr -%dir %{_libdir}/apr/build-%{aprver} -%{_libdir}/apr/build-%{aprver}/* -%{_libdir}/pkgconfig/apr-%{aprver}.pc -%dir %{_includedir}/apr-%{aprver} -%{_includedir}/apr-%{aprver}/*.h - -%changelog -* Sat Aug 30 2008 Graham Leggett 1.3.3 -- update to depend on the bzip2 binary -- build depends on python - -* Tue Jun 22 2004 Graham Leggett 1.0.0-1 -- update to support v1.0.0 of APR - -* Tue Jun 22 2004 Graham Leggett 1.0.0-1 -- derived from Fedora Core apr.spec - From 80c54daa03d1ffd3fc246a52a96a3d340154afbd Mon Sep 17 00:00:00 2001 From: Roy Kaldung Date: Fri, 2 May 2014 12:47:51 +0200 Subject: [PATCH 011/286] Delete httpd.spec --- extras/httpd.spec | 500 ---------------------------------------------- 1 file changed, 500 deletions(-) delete mode 100644 extras/httpd.spec diff --git a/extras/httpd.spec b/extras/httpd.spec deleted file mode 100644 index 81f782c45e17..000000000000 --- a/extras/httpd.spec +++ /dev/null @@ -1,500 +0,0 @@ -%define contentdir /var/www -%define suexec_caller apache -%define mmn 20120211 - -Summary: Apache HTTP Server -Name: httpd -Version: 2.4.3 -Release: 1%{?dist} -URL: http://httpd.apache.org/ -Vendor: Apache Software Foundation -Source0: http://www.apache.org/dist/httpd/httpd-%{version}.tar.bz2 -License: Apache License, Version 2.0 -Group: System Environment/Daemons -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -BuildRequires: autoconf, perl, pkgconfig, findutils -BuildRequires: zlib-devel, libselinux-devel -BuildRequires: apr-devel >= 1.4.0, apr-util-devel >= 1.4.0, pcre-devel >= 5.0 -Requires: initscripts >= 8.36, /etc/mime.types -Obsoletes: httpd-suexec -Requires(pre): /usr/sbin/useradd -Requires(post): chkconfig -Provides: webserver -Provides: mod_dav = %{version}-%{release}, httpd-suexec = %{version}-%{release} -Provides: httpd-mmn = %{mmn} - -%description -Apache is a powerful, full-featured, efficient, and freely-available -Web server. Apache is also the most popular Web server on the -Internet. - -%package devel -Group: Development/Libraries -Summary: Development tools for the Apache HTTP server. -Obsoletes: secureweb-devel, apache-devel -Requires: apr-devel, apr-util-devel, pkgconfig, libtool -Requires: httpd = %{version}-%{release} - -%description devel -The httpd-devel package contains the APXS binary and other files -that you need to build Dynamic Shared Objects (DSOs) for the -Apache HTTP Server. - -If you are installing the Apache HTTP server and you want to be -able to compile or develop additional modules for Apache, you need -to install this package. - -%package manual -Group: Documentation -Summary: Documentation for the Apache HTTP server. -Requires: httpd = %{version}-%{release} -Obsoletes: secureweb-manual, apache-manual - -%description manual -The httpd-manual package contains the complete manual and -reference guide for the Apache HTTP server. The information can -also be found at http://httpd.apache.org/docs/. - -%package tools -Group: System Environment/Daemons -Summary: Tools for use with the Apache HTTP Server - -%description tools -The httpd-tools package contains tools which can be used with -the Apache HTTP Server. - -%package -n mod_authnz_ldap -Group: System Environment/Daemons -Summary: LDAP modules for the Apache HTTP server -BuildRequires: openldap-devel -Requires: httpd = %{version}-%{release}, httpd-mmn = %{mmn} - -%description -n mod_authnz_ldap -The mod_authnz_ldap module for the Apache HTTP server provides -authentication and authorization against an LDAP server, while -mod_ldap provides an LDAP cache. - -%package -n mod_lua -Group: System Environment/Daemons -Summary: Lua language module for the Apache HTTP server -BuildRequires: lua-devel -Requires: httpd = %{version}-%{release}, httpd-mmn = %{mmn} - -%description -n mod_lua -The mod_lua module for the Apache HTTP server allows the server to be -extended with scripts written in the Lua programming language. - -%package -n mod_proxy_html -Group: System Environment/Daemons -Summary: Proxy HTML filter modules for the Apache HTTP server -BuildRequires: libxml2-devel -Requires: httpd = %{version}-%{release}, httpd-mmn = %{mmn} - -%description -n mod_proxy_html -The mod_proxy_html module for the Apache HTTP server provides -a filter to rewrite HTML links within web content when used within -a reverse proxy environment. The mod_xml2enc module provides -enhanced charset/internationalisation support for mod_proxy_html. - -%package -n mod_socache_dc -Group: System Environment/Daemons -Summary: Distcache shared object cache module for the Apache HTTP server -BuildRequires: distcache-devel -Requires: httpd = %{version}-%{release}, httpd-mmn = %{mmn} - -%description -n mod_socache_dc -The mod_socache_dc module for the Apache HTTP server allows the shared -object cache to use the distcache shared caching mechanism. - -%package -n mod_ssl -Group: System Environment/Daemons -Summary: SSL/TLS module for the Apache HTTP server -BuildRequires: openssl-devel -Requires(post): openssl, /bin/cat -Requires(pre): httpd -Requires: httpd = %{version}-%{release}, httpd-mmn = %{mmn} - -%description -n mod_ssl -The mod_ssl module provides strong cryptography for the Apache Web -server via the Secure Sockets Layer (SSL) and Transport Layer -Security (TLS) protocols. - -%prep -%setup -q - -# Safety check: prevent build if defined MMN does not equal upstream MMN. -vmmn=`echo MODULE_MAGIC_NUMBER_MAJOR | cpp -include include/ap_mmn.h | sed -n ' -/^2/p'` -if test "x${vmmn}" != "x%{mmn}"; then - : Error: Upstream MMN is now ${vmmn}, packaged MMN is %{mmn}. - : Update the mmn macro and rebuild. - exit 1 -fi - -%build -# forcibly prevent use of bundled apr, apr-util, pcre -rm -rf srclib/{apr,apr-util,pcre} - -%configure \ - --enable-layout=RPM \ - --libdir=%{_libdir} \ - --sysconfdir=%{_sysconfdir}/httpd/conf \ - --includedir=%{_includedir}/httpd \ - --libexecdir=%{_libdir}/httpd/modules \ - --datadir=%{contentdir} \ - --with-installbuilddir=%{_libdir}/httpd/build \ - --enable-mpms-shared=all \ - --with-apr=%{_prefix} --with-apr-util=%{_prefix} \ - --enable-suexec --with-suexec \ - --with-suexec-caller=%{suexec_caller} \ - --with-suexec-docroot=%{contentdir} \ - --with-suexec-logfile=%{_localstatedir}/log/httpd/suexec.log \ - --with-suexec-bin=%{_sbindir}/suexec \ - --with-suexec-uidmin=500 --with-suexec-gidmin=100 \ - --enable-pie \ - --with-pcre \ - --enable-mods-shared=all \ - --enable-ssl --with-ssl --enable-socache-dc --enable-bucketeer \ - --enable-case-filter --enable-case-filter-in \ - --disable-imagemap - -make %{?_smp_mflags} - -%install -rm -rf $RPM_BUILD_ROOT -make DESTDIR=$RPM_BUILD_ROOT install - -# for holding mod_dav lock database -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/dav - -# create a prototype session cache -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/cache/mod_ssl -touch $RPM_BUILD_ROOT%{_localstatedir}/cache/mod_ssl/scache.{dir,pag,sem} - -# Make the MMN accessible to module packages -echo %{mmn} > $RPM_BUILD_ROOT%{_includedir}/httpd/.mmn - -# Set up /var directories -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/httpd -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/cache/httpd/cache-root - -# symlinks for /etc/httpd -ln -s ../..%{_localstatedir}/log/httpd $RPM_BUILD_ROOT/etc/httpd/logs -ln -s ../..%{_localstatedir}/run $RPM_BUILD_ROOT/etc/httpd/run -ln -s ../..%{_libdir}/httpd/modules $RPM_BUILD_ROOT/etc/httpd/modules -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d - -# install SYSV init stuff -mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d -install -m755 ./build/rpm/httpd.init \ - $RPM_BUILD_ROOT/etc/rc.d/init.d/httpd -install -m755 ./build/rpm/htcacheclean.init \ - $RPM_BUILD_ROOT/etc/rc.d/init.d/htcacheclean - -# install log rotation stuff -mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d -install -m644 ./build/rpm/httpd.logrotate \ - $RPM_BUILD_ROOT/etc/logrotate.d/httpd - -# Remove unpackaged files -rm -rf $RPM_BUILD_ROOT%{_libdir}/httpd/modules/*.exp \ - $RPM_BUILD_ROOT%{contentdir}/cgi-bin/* - -# Make suexec a+rw so it can be stripped. %%files lists real permissions -chmod 755 $RPM_BUILD_ROOT%{_sbindir}/suexec - -%pre -# Add the "apache" user -/usr/sbin/useradd -c "Apache" -u 48 \ - -s /sbin/nologin -r -d %{contentdir} apache 2> /dev/null || : - -%post -# Register the httpd service -/sbin/chkconfig --add httpd -/sbin/chkconfig --add htcacheclean - -%preun -if [ $1 = 0 ]; then - /sbin/service httpd stop > /dev/null 2>&1 - /sbin/service htcacheclean stop > /dev/null 2>&1 - /sbin/chkconfig --del httpd - /sbin/chkconfig --del htcacheclean -fi - -%post -n mod_ssl -umask 077 - -if [ ! -f %{_sysconfdir}/httpd/conf/server.key ] ; then -%{_bindir}/openssl genrsa -rand /proc/apm:/proc/cpuinfo:/proc/dma:/proc/filesystems:/proc/interrupts:/proc/ioports:/proc/pci:/proc/rtc:/proc/uptime 1024 > %{_sysconfdir}/httpd/conf/server.key 2> /dev/null -fi - -FQDN=`hostname` -if [ "x${FQDN}" = "x" ]; then - FQDN=localhost.localdomain -fi - -if [ ! -f %{_sysconfdir}/httpd/conf/server.crt ] ; then -cat << EOF | %{_bindir}/openssl req -new -key %{_sysconfdir}/httpd/conf/server.key -x509 -days 365 -out %{_sysconfdir}/httpd/conf/server.crt 2>/dev/null --- -SomeState -SomeCity -SomeOrganization -SomeOrganizationalUnit -${FQDN} -root@${FQDN} -EOF -fi - -%check -# Check the built modules are all PIC -if readelf -d $RPM_BUILD_ROOT%{_libdir}/httpd/modules/*.so | grep TEXTREL; then - : modules contain non-relocatable code - exit 1 -fi - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root) - -%doc ABOUT_APACHE README CHANGES LICENSE NOTICE - -%dir %{_sysconfdir}/httpd -%{_sysconfdir}/httpd/modules -%{_sysconfdir}/httpd/logs -%{_sysconfdir}/httpd/run -%dir %{_sysconfdir}/httpd/conf -%dir %{_sysconfdir}/httpd/conf.d -%config(noreplace) %{_sysconfdir}/httpd/conf/httpd.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/magic -%config(noreplace) %{_sysconfdir}/httpd/conf/mime.types -%config(noreplace) %{_sysconfdir}/httpd/conf/extra/httpd-autoindex.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/extra/httpd-dav.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/extra/httpd-default.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/extra/httpd-info.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/extra/httpd-languages.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/extra/httpd-manual.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/extra/httpd-mpm.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/extra/httpd-multilang-errordoc.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/extra/httpd-userdir.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/extra/httpd-vhosts.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/extra/proxy-html.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/original/extra/httpd-autoindex.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/original/extra/httpd-dav.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/original/extra/httpd-default.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/original/extra/httpd-info.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/original/extra/httpd-languages.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/original/extra/httpd-manual.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/original/extra/httpd-mpm.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/original/extra/httpd-multilang-errordoc.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/original/extra/httpd-userdir.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/original/extra/httpd-vhosts.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/original/extra/proxy-html.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/original/httpd.conf - -%config %{_sysconfdir}/logrotate.d/httpd -%config %{_sysconfdir}/rc.d/init.d/httpd -%config %{_sysconfdir}/rc.d/init.d/htcacheclean - -%{_sbindir}/fcgistarter -%{_sbindir}/htcacheclean -%{_sbindir}/httpd -%{_sbindir}/apachectl -%attr(4510,root,%{suexec_caller}) %{_sbindir}/suexec - -%dir %{_libdir}/httpd -%dir %{_libdir}/httpd/modules -%{_libdir}/httpd/modules/mod_access_compat.so -%{_libdir}/httpd/modules/mod_actions.so -%{_libdir}/httpd/modules/mod_alias.so -%{_libdir}/httpd/modules/mod_allowmethods.so -%{_libdir}/httpd/modules/mod_asis.so -%{_libdir}/httpd/modules/mod_auth_basic.so -%{_libdir}/httpd/modules/mod_auth_digest.so -%{_libdir}/httpd/modules/mod_auth_form.so -%{_libdir}/httpd/modules/mod_authn_anon.so -%{_libdir}/httpd/modules/mod_authn_core.so -%{_libdir}/httpd/modules/mod_authn_dbd.so -%{_libdir}/httpd/modules/mod_authn_dbm.so -%{_libdir}/httpd/modules/mod_authn_file.so -%{_libdir}/httpd/modules/mod_authn_socache.so -%{_libdir}/httpd/modules/mod_authz_core.so -%{_libdir}/httpd/modules/mod_authz_dbd.so -%{_libdir}/httpd/modules/mod_authz_dbm.so -%{_libdir}/httpd/modules/mod_authz_groupfile.so -%{_libdir}/httpd/modules/mod_authz_host.so -%{_libdir}/httpd/modules/mod_authz_owner.so -%{_libdir}/httpd/modules/mod_authz_user.so -%{_libdir}/httpd/modules/mod_autoindex.so -%{_libdir}/httpd/modules/mod_bucketeer.so -%{_libdir}/httpd/modules/mod_buffer.so -%{_libdir}/httpd/modules/mod_cache_disk.so -%{_libdir}/httpd/modules/mod_cache.so -%{_libdir}/httpd/modules/mod_case_filter.so -%{_libdir}/httpd/modules/mod_case_filter_in.so -%{_libdir}/httpd/modules/mod_cgid.so -%{_libdir}/httpd/modules/mod_charset_lite.so -%{_libdir}/httpd/modules/mod_data.so -%{_libdir}/httpd/modules/mod_dav_fs.so -%{_libdir}/httpd/modules/mod_dav_lock.so -%{_libdir}/httpd/modules/mod_dav.so -%{_libdir}/httpd/modules/mod_dbd.so -%{_libdir}/httpd/modules/mod_deflate.so -%{_libdir}/httpd/modules/mod_dialup.so -%{_libdir}/httpd/modules/mod_dir.so -%{_libdir}/httpd/modules/mod_dumpio.so -%{_libdir}/httpd/modules/mod_echo.so -%{_libdir}/httpd/modules/mod_env.so -%{_libdir}/httpd/modules/mod_expires.so -%{_libdir}/httpd/modules/mod_ext_filter.so -%{_libdir}/httpd/modules/mod_file_cache.so -%{_libdir}/httpd/modules/mod_filter.so -%{_libdir}/httpd/modules/mod_headers.so -%{_libdir}/httpd/modules/mod_heartbeat.so -%{_libdir}/httpd/modules/mod_heartmonitor.so -%{_libdir}/httpd/modules/mod_include.so -%{_libdir}/httpd/modules/mod_info.so -%{_libdir}/httpd/modules/mod_lbmethod_bybusyness.so -%{_libdir}/httpd/modules/mod_lbmethod_byrequests.so -%{_libdir}/httpd/modules/mod_lbmethod_bytraffic.so -%{_libdir}/httpd/modules/mod_lbmethod_heartbeat.so -%{_libdir}/httpd/modules/mod_log_config.so -%{_libdir}/httpd/modules/mod_log_debug.so -%{_libdir}/httpd/modules/mod_log_forensic.so -%{_libdir}/httpd/modules/mod_logio.so -%{_libdir}/httpd/modules/mod_mime_magic.so -%{_libdir}/httpd/modules/mod_mime.so -%{_libdir}/httpd/modules/mod_mpm_event.so -%{_libdir}/httpd/modules/mod_mpm_prefork.so -%{_libdir}/httpd/modules/mod_mpm_worker.so -%{_libdir}/httpd/modules/mod_negotiation.so -%{_libdir}/httpd/modules/mod_proxy_ajp.so -%{_libdir}/httpd/modules/mod_proxy_balancer.so -%{_libdir}/httpd/modules/mod_proxy_connect.so -%{_libdir}/httpd/modules/mod_proxy_express.so -%{_libdir}/httpd/modules/mod_proxy_fcgi.so -%{_libdir}/httpd/modules/mod_proxy_fdpass.so -%{_libdir}/httpd/modules/mod_proxy_ftp.so -%{_libdir}/httpd/modules/mod_proxy_http.so -%{_libdir}/httpd/modules/mod_proxy_scgi.so -%{_libdir}/httpd/modules/mod_proxy.so -%{_libdir}/httpd/modules/mod_ratelimit.so -%{_libdir}/httpd/modules/mod_reflector.so -%{_libdir}/httpd/modules/mod_remoteip.so -%{_libdir}/httpd/modules/mod_reqtimeout.so -%{_libdir}/httpd/modules/mod_request.so -%{_libdir}/httpd/modules/mod_rewrite.so -%{_libdir}/httpd/modules/mod_sed.so -%{_libdir}/httpd/modules/mod_session_cookie.so -%{_libdir}/httpd/modules/mod_session_crypto.so -%{_libdir}/httpd/modules/mod_session_dbd.so -%{_libdir}/httpd/modules/mod_session.so -%{_libdir}/httpd/modules/mod_setenvif.so -%{_libdir}/httpd/modules/mod_slotmem_plain.so -%{_libdir}/httpd/modules/mod_slotmem_shm.so -%{_libdir}/httpd/modules/mod_socache_dbm.so -%{_libdir}/httpd/modules/mod_socache_memcache.so -%{_libdir}/httpd/modules/mod_socache_shmcb.so -%{_libdir}/httpd/modules/mod_speling.so -%{_libdir}/httpd/modules/mod_status.so -%{_libdir}/httpd/modules/mod_substitute.so -%{_libdir}/httpd/modules/mod_suexec.so -%{_libdir}/httpd/modules/mod_unique_id.so -%{_libdir}/httpd/modules/mod_unixd.so -%{_libdir}/httpd/modules/mod_userdir.so -%{_libdir}/httpd/modules/mod_usertrack.so -%{_libdir}/httpd/modules/mod_version.so -%{_libdir}/httpd/modules/mod_vhost_alias.so -%{_libdir}/httpd/modules/mod_watchdog.so - -%dir %{contentdir} -%dir %{contentdir}/cgi-bin -%dir %{contentdir}/html -%dir %{contentdir}/icons -%dir %{contentdir}/error -%dir %{contentdir}/error/include -%{contentdir}/icons/* -%{contentdir}/error/README -%{contentdir}/html/index.html -%config(noreplace) %{contentdir}/error/*.var -%config(noreplace) %{contentdir}/error/include/*.html - -%attr(0700,root,root) %dir %{_localstatedir}/log/httpd - -%attr(0700,apache,apache) %dir %{_localstatedir}/lib/dav -%attr(0700,apache,apache) %dir %{_localstatedir}/cache/httpd/cache-root - -%{_mandir}/man1/* -%{_mandir}/man8/suexec* -%{_mandir}/man8/apachectl.8* -%{_mandir}/man8/httpd.8* -%{_mandir}/man8/htcacheclean.8* -%{_mandir}/man8/fcgistarter.8* - -%files manual -%defattr(-,root,root) -%{contentdir}/manual -%{contentdir}/error/README - -%files tools -%defattr(-,root,root) -%{_bindir}/ab -%{_bindir}/htdbm -%{_bindir}/htdigest -%{_bindir}/htpasswd -%{_bindir}/logresolve -%{_bindir}/httxt2dbm -%{_sbindir}/rotatelogs -%{_mandir}/man1/htdbm.1* -%{_mandir}/man1/htdigest.1* -%{_mandir}/man1/htpasswd.1* -%{_mandir}/man1/httxt2dbm.1* -%{_mandir}/man1/ab.1* -%{_mandir}/man1/logresolve.1* -%{_mandir}/man8/rotatelogs.8* -%doc LICENSE NOTICE - -%files -n mod_authnz_ldap -%defattr(-,root,root) -%{_libdir}/httpd/modules/mod_ldap.so -%{_libdir}/httpd/modules/mod_authnz_ldap.so - -%files -n mod_lua -%defattr(-,root,root) -%{_libdir}/httpd/modules/mod_lua.so - -%files -n mod_proxy_html -%defattr(-,root,root) -%{_libdir}/httpd/modules/mod_proxy_html.so -%{_libdir}/httpd/modules/mod_xml2enc.so - -%files -n mod_socache_dc -%defattr(-,root,root) -%{_libdir}/httpd/modules/mod_socache_dc.so - -%files -n mod_ssl -%defattr(-,root,root) -%{_libdir}/httpd/modules/mod_ssl.so -%config(noreplace) %{_sysconfdir}/httpd/conf/original/extra/httpd-ssl.conf -%config(noreplace) %{_sysconfdir}/httpd/conf/extra/httpd-ssl.conf -%attr(0700,apache,root) %dir %{_localstatedir}/cache/mod_ssl -%attr(0600,apache,root) %ghost %{_localstatedir}/cache/mod_ssl/scache.dir -%attr(0600,apache,root) %ghost %{_localstatedir}/cache/mod_ssl/scache.pag -%attr(0600,apache,root) %ghost %{_localstatedir}/cache/mod_ssl/scache.sem - -%files devel -%defattr(-,root,root) -%{_includedir}/httpd -%{_bindir}/apxs -%{_sbindir}/checkgid -%{_bindir}/dbmmanage -%{_sbindir}/envvars* -%{_mandir}/man1/dbmmanage.1* -%{_mandir}/man1/apxs.1* -%dir %{_libdir}/httpd/build -%{_libdir}/httpd/build/*.mk -%{_libdir}/httpd/build/instdso.sh -%{_libdir}/httpd/build/config.nice -%{_libdir}/httpd/build/mkdir.sh - From ef67be9170dbfe0394d3e611f1e7d539ecbb8755 Mon Sep 17 00:00:00 2001 From: Roy Kaldung Date: Thu, 6 Nov 2014 17:24:45 +0100 Subject: [PATCH 012/286] We like to know if it's starting or stopping --- script/websocket-server.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/websocket-server.rb b/script/websocket-server.rb index 9b5bb0ddcff3..2d92d82a9b0d 100755 --- a/script/websocket-server.rb +++ b/script/websocket-server.rb @@ -59,10 +59,9 @@ exit; end -puts "Starting websocket server on #{ @options[:b] }:#{ @options[:p] } (secure:#{ @options[:s].to_s },pid:#{@options[:i].to_s})" -#puts options.inspect - if ARGV[0] == 'stop' + puts "Stopping websocket server" + # read pid pid =File.open( @options[:i].to_s ).read @@ -72,6 +71,7 @@ Process.kill( 9, pid.to_i ) exit end +puts "Starting websocket server on #{ @options[:b] }:#{ @options[:p] } (secure:#{ @options[:s].to_s },pid:#{@options[:i].to_s})" if ARGV[0] == 'start' && @options[:d] Daemons.daemonize From 157991c33d8f0a6fea847727373292f03fd31801 Mon Sep 17 00:00:00 2001 From: Roy Kaldung Date: Mon, 12 Jan 2015 12:38:11 +0100 Subject: [PATCH 013/286] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 49859fec6157..1763e3ff088d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](http://ci.zammad.org/buildStatus/icon?job=ZammadUnittest-ruby-2.0.0-p195)](http://ci.zammad.org/job/ZammadUnittest-ruby-2.0.0-p195/) +[![Build Status](http://ci.zammad.org/buildStatus/icon?job=Zammad Unittest Develop)](http://ci.zammad.org/job/Zammad%20Unittest%20Develop/) Welcome to Zammad ================= From 6081a98279ea2d42e194827ccd07e8bf86b4bb84 Mon Sep 17 00:00:00 2001 From: Roy Kaldung Date: Mon, 12 Jan 2015 12:39:26 +0100 Subject: [PATCH 014/286] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1763e3ff088d..05cfcba6846e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](http://ci.zammad.org/buildStatus/icon?job=Zammad Unittest Develop)](http://ci.zammad.org/job/Zammad%20Unittest%20Develop/) +[![Build Status develop](http://ci.zammad.org/buildStatus/icon?job=Zammad Unittest Develop)](http://ci.zammad.org/job/Zammad%20Unittest%20Develop/) [![Build Status master](http://ci.zammad.org/buildStatus/icon?job=Zammad Unittest Master)](http://ci.zammad.org/job/Zammad%20Unittest%20Master/) Welcome to Zammad ================= From 1a1b661714b2fdfa2c8d8b97ace777193f98cadb Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Thu, 16 Jul 2015 09:50:18 +0200 Subject: [PATCH 015/286] Fixed typo. --- script/local_browser_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/local_browser_tests.sh b/script/local_browser_tests.sh index 53cfa6ca5f86..9b6768547944 100755 --- a/script/local_browser_tests.sh +++ b/script/local_browser_tests.sh @@ -1,7 +1,7 @@ #!/bin/bash while true; do - read -p "Do you wish to drop database ane execute all browser tests?" yn + read -p "Do you wish to drop the database and execute all browser tests?" yn case $yn in [Yy]* ) echo "Start tests..."; break;; [Nn]* ) exit;; From 1d476f163e716a30362843cacbd8651838ccb69e Mon Sep 17 00:00:00 2001 From: me Date: Fri, 21 Aug 2015 16:53:38 +0200 Subject: [PATCH 016/286] Use also mysql on test. --- config/database.yml.dist | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/config/database.yml.dist b/config/database.yml.dist index a86d68e41353..70dc993dcb53 100644 --- a/config/database.yml.dist +++ b/config/database.yml.dist @@ -21,14 +21,13 @@ development: # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. -# SQLite version 3.x -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' test: - adapter: sqlite3 - database: db/test.sqlite3 - timeout: 5000 + adapter: mysql2 + database: zammad_test pool: 50 + timeout: 5000 + encoding: utf8 + username: some_user + password: some_pass + host: 127.0.0.1 From 7aa3f6eaee14707a5f2930de1b56be4176e288c8 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 10 Dec 2015 09:44:16 +0100 Subject: [PATCH 017/286] Updated build url. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4a2865c9bc9c..17a6b0b2d54f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![build status](http://source.zammad.com/ci/projects/2/status.png?ref=develop)](http://source.zammad.com/ci/projects/2?ref=develop) +[![build status](http://source.zammad.com/ci/projects/2/status.png?ref=master)](http://source.zammad.com/ci/projects/2?ref=master) Welcome to Zammad ================= From 63770c9cbfd50dbc98f82787a04d5635904085f7 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Tue, 12 Jan 2016 10:58:46 +0100 Subject: [PATCH 018/286] update terminal start script --- .../Contents/Resources/Scripts/main.scpt | Bin 5214 -> 5192 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/contrib/mac_developer_scripts.app/Contents/Resources/Scripts/main.scpt b/contrib/mac_developer_scripts.app/Contents/Resources/Scripts/main.scpt index 343ced05ce9dd5f9cf7ce0205d343503a2044037..03f871f6ec9cc8219fb8d0c2b418ad4da9733851 100644 GIT binary patch delta 512 zcmcboaYAE55;M~&j>#MOyeBs>vrpc}ENGI$z{J4F>5-a~o}ZJLm%@MnF3nyV;h_x{ zw%~Hh%u7ivnrzQ+!O6hDv}nntbW_R6b^P*^W4J~1W>5D3DidVjU|_hEt`1bdz{tP@ zBrSm09Ei<;RvE)>n!JEpVe)@P6|xIsu)A)vC{I5V(;=AixF`SNJb}3+fDA0L^TF8MH&}<5J8ZaPN_XAnsK$G(B!0h6~d3tJR1FflN42j}NxrYHoLOMKsofNVwv9*`y= z&I000phc!g_Dr73;vp%)z|9cMkk63Akjaq3pa5i-0C{-~shfYXB(pNT0lU+IfuT6H zteAm`ks&cBvlwVH17ja4&Yt|9%aOgAebL2#|GuKT_2R!rSFyU)2Gy+!lXr02$l`P_ zgAjx6BgznV3#M!nc8$ZSn^`UfnFB9osN}-efI)NA`x7A20s<>;!bIyd7s~ zNoG!FNoFe0=K|p1MGESR|E?>6ozKAl)C&yeE}&h8$WA}Yk1v?D1eP+3XJLpF From 81883cae8fea0906c3f7bfa0bf766b37d3a55f72 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 12 Jan 2016 11:13:40 +0100 Subject: [PATCH 019/286] Revert "update terminal start script" This reverts commit 63770c9cbfd50dbc98f82787a04d5635904085f7. --- .../Contents/Resources/Scripts/main.scpt | Bin 5192 -> 5214 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/contrib/mac_developer_scripts.app/Contents/Resources/Scripts/main.scpt b/contrib/mac_developer_scripts.app/Contents/Resources/Scripts/main.scpt index 03f871f6ec9cc8219fb8d0c2b418ad4da9733851..343ced05ce9dd5f9cf7ce0205d343503a2044037 100644 GIT binary patch delta 562 zcmX@1aZh7I5;M~Uj>(B!0h6~d3tJR1FflN42j}NxrYHoLOMKsofNVwv9*`y= z&I000phc!g_Dr73;vp%)z|9cMkk63Akjaq3pa5i-0C{-~shfYXB(pNT0lU+IfuT6H zteAm`ks&cBvlwVH17ja4&Yt|9%aOgAebL2#|GuKT_2R!rSFyU)2Gy+!lXr02$l`P_ zgAjx6BgznV3#M!nc8$ZSn^`UfnFB9osN}-efI)NA`x7A20s<>;!bIyd7s~ zNoG!FNoFe0=K|p1MGESR|E?>6ozKAl)C&yeE}&h8$WA}Yk1v?D1eP+3XJLpF delta 512 zcmcboaYAE55;M~&j>#MOyeBs>vrpc}ENGI$z{J4F>5-a~o}ZJLm%@MnF3nyV;h_x{ zw%~Hh%u7ivnrzQ+!O6hDv}nntbW_R6b^P*^W4J~1W>5D3DidVjU|_hEt`1bdz{tP@ zBrSm09Ei<;RvE)>n!JEpVe)@P6|xIsu)A)vC{I5V(;=AixF`SNJb}3+fDA0L^TF8MH&}<5J8ZaPN_XAnsK$G Date: Tue, 26 Jan 2016 13:57:24 +0100 Subject: [PATCH 020/286] Updated build status url. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 17a6b0b2d54f..6de7b6264ba2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![build status](http://source.zammad.com/ci/projects/2/status.png?ref=master)](http://source.zammad.com/ci/projects/2?ref=master) +[![build status](https://git.znuny.com/ci/projects/508/status.png?ref=master)](https://git.znuny.com/ci/projects/508/status.png?ref=master) Welcome to Zammad ================= From 1894580ae6cbe14b03dfd71f8515d7a0288070f4 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 27 May 2016 17:28:26 +0200 Subject: [PATCH 021/286] Updated badge url. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index de0376741cd2..b71ce4a575ea 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![build status](https://git.znuny.com/ci/projects/508/status.png?ref=master)](https://git.znuny.com/ci/projects/508/status.png?ref=master) +[![build status](https://git.znuny.com/zammad/zammad/badges/master/build.svg)](https://git.znuny.com/zammad/zammad/builds) Welcome to Zammad ================= From 2d09e556d7389b188122555667d601b70a31d4e2 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 7 Sep 2016 15:27:17 +0200 Subject: [PATCH 022/286] Added deployment of archives. --- .gitlab-ci.yml | 10 ++++++++++ script/build/deploy_archives.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 script/build/deploy_archives.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 31dd9a050141..a667ceaf8931 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,6 +9,7 @@ stages: - pre - test - browser + - deploy pre:rubocop: stage: pre @@ -1001,3 +1002,12 @@ test:browser:integration:zendesk_chrome: - script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 - ruby -I test/ test/integration/zendesk_import_browser_test.rb || script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1 - script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 + +deploy:archives: + stage: deploy + tags: + - deploy + only: + - tags + script: + - script/build/deploy_archives.sh diff --git a/script/build/deploy_archives.sh b/script/build/deploy_archives.sh new file mode 100644 index 000000000000..a22818ab2d0f --- /dev/null +++ b/script/build/deploy_archives.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -ex + +if ! echo $CI_BUILD_REF_NAME | grep stable-; then + echo 'deploy archives only for stable branches' + exit 0 +fi + +# cleanup +contrib/cleanup.sh + +( find . -type d -name ".git" \ + && find . -name ".gitignore" \ + && find . -name ".gitkeep" \ + && find . -name ".gitmodules" ) | xargs rm -rf + +# tar.gz +tar -czf /tmp/zammad-${CI_BUILD_TAG}.tar.gz . + +# tar.bz2 +tar -cjf /tmp/zammad-${CI_BUILD_TAG}.tar.bz2 . + +# zip +zip /tmp/zammad-${CI_BUILD_TAG}.zip ./* + +# publish +scp /tmp/zammad-${CI_BUILD_TAG}.tar.* $ARCHIVE_SCP_TARGET +scp /tmp/zammad-${CI_BUILD_TAG}.zip $ARCHIVE_SCP_TARGET From e8ad3965d72aad5a8489476a2c6571050e6ea294 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 10 Sep 2016 16:47:33 +0200 Subject: [PATCH 023/286] Removed build badged. --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index c0b78da9245c..e373cdb2001c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -[![build status](https://git.znuny.com/zammad/zammad/badges/master/build.svg)](https://git.znuny.com/zammad/zammad/builds) - Welcome to Zammad ================= From 4901050d571ce0a65d896ee083567e3121ad1d04 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 19 Oct 2016 07:25:10 +0200 Subject: [PATCH 024/286] Working on issue not syncing to github correctly. --- script/build/sync_repo.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/script/build/sync_repo.sh b/script/build/sync_repo.sh index 273458f103bf..1a6ea4ed6716 100755 --- a/script/build/sync_repo.sh +++ b/script/build/sync_repo.sh @@ -10,7 +10,17 @@ if echo $CI_BUILD_REF_NAME | grep private; then fi git checkout $CI_BUILD_REF_NAME -git pull --rebase origin $CI_BUILD_REF_NAME -if git remote | grep github > /dev/null; then git remote rm github; fi +if [ "$CI_BUILD_REF_NAME" != "$CI_BUILD_TAG" ]; then + git pull --rebase origin $CI_BUILD_REF_NAME +fi + +if git remote | grep github > /dev/null; then + git remote rm github +fi git remote add github $GITHUB_DEST -git push github $CI_BUILD_REF_NAME + +if [ "$CI_BUILD_REF_NAME" != "$CI_BUILD_TAG" ]; then + git push github $CI_BUILD_REF_NAME +else + git push github --tags +fi From 5754fdccddef8fc05bf5ace873ce2635278faf32 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 19 Oct 2016 07:31:46 +0200 Subject: [PATCH 025/286] Working on CI tag/branch pushing, syncing, deployment issue. --- script/build/deploy_archives.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/build/deploy_archives.sh b/script/build/deploy_archives.sh index a22818ab2d0f..b4a73727f859 100644 --- a/script/build/deploy_archives.sh +++ b/script/build/deploy_archives.sh @@ -2,8 +2,8 @@ set -ex -if ! echo $CI_BUILD_REF_NAME | grep stable-; then - echo 'deploy archives only for stable branches' +if [ "$CI_BUILD_REF_NAME" != "$CI_BUILD_TAG" ]; then + echo 'deploy archives only for tag releases' exit 0 fi From ee5c58f53a94cf13c2e61a40f5e1f82726b5ac0f Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 19 Oct 2016 08:25:51 +0200 Subject: [PATCH 026/286] Fixed bug: Zip archive doesn't contain sub folder content. --- script/build/deploy_archives.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/build/deploy_archives.sh b/script/build/deploy_archives.sh index b4a73727f859..10b90440fa65 100644 --- a/script/build/deploy_archives.sh +++ b/script/build/deploy_archives.sh @@ -22,7 +22,7 @@ tar -czf /tmp/zammad-${CI_BUILD_TAG}.tar.gz . tar -cjf /tmp/zammad-${CI_BUILD_TAG}.tar.bz2 . # zip -zip /tmp/zammad-${CI_BUILD_TAG}.zip ./* +zip -r /tmp/zammad-${CI_BUILD_TAG}.zip ./* # publish scp /tmp/zammad-${CI_BUILD_TAG}.tar.* $ARCHIVE_SCP_TARGET From b13bb2fcaf6311ab0ab8470e797a101a260eaaa7 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 14 Nov 2016 08:37:51 +0100 Subject: [PATCH 027/286] Added change log. --- CHANGELOG.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000000..7e83ed9a2db7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,45 @@ +# Change Log + +## [1.0.1](https://github.com/zammad/zammad/tree/1.0.1) (2016-11-14) +[Full Changelog](https://github.com/zammad/zammad/compare/1.0.0...1.0.1) + +**Implemented enhancements:** + +- Missing translation/edit abilities \(Notification mails, contact form\) [\#388](https://github.com/zammad/zammad/issues/388) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] +- Automatically join users to organizations based on the email address [\#356](https://github.com/zammad/zammad/issues/356) [[feature](https://github.com/zammad/zammad/labels/feature)] +- Create emails via fetchmail / procmail [\#326](https://github.com/zammad/zammad/issues/326) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] +- Display origin url from tweet/facebook post [\#317](https://github.com/zammad/zammad/issues/317) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] +- Vagrant version [\#253](https://github.com/zammad/zammad/issues/253) [[feature](https://github.com/zammad/zammad/labels/feature)] +- Page posts from facebook and tweets from twitter as tickets [\#251](https://github.com/zammad/zammad/issues/251) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] + +**Fixed bugs:** + +- Some windows in the config area too wide in firefox [\#392](https://github.com/zammad/zammad/issues/392) [[bug](https://github.com/zammad/zammad/labels/bug)] +- \[Critical\] Short display of "Setup a new system" on public site while restarting Zammad! [\#389](https://github.com/zammad/zammad/issues/389) [[bug](https://github.com/zammad/zammad/labels/bug)] +- Mailresponse to customer not working at all after editing a "Trigger" event text [\#385](https://github.com/zammad/zammad/issues/385) [[bug](https://github.com/zammad/zammad/labels/bug)] +- Click on "Reports" leads to Error 500 [\#384](https://github.com/zammad/zammad/issues/384) [[bug](https://github.com/zammad/zammad/labels/bug)] +- TicketSelector in Overview or SLA not working with filter for ticket customer or owner [\#383](https://github.com/zammad/zammad/issues/383) [[bug](https://github.com/zammad/zammad/labels/bug)] +- Changelog generator breaks packager.io builds [\#379](https://github.com/zammad/zammad/issues/379) [[bug](https://github.com/zammad/zammad/labels/bug)] +- script/scheduler.rb crashes after recreation of Zammad database [\#374](https://github.com/zammad/zammad/issues/374) [[bug](https://github.com/zammad/zammad/labels/bug)] +- ticket search cache issue [\#349](https://github.com/zammad/zammad/issues/349) [[bug](https://github.com/zammad/zammad/labels/bug)] +- IMAP mail fetching stops because of broken spam email \(invalid Content-Transfer-Encoding header\) [\#348](https://github.com/zammad/zammad/issues/348) [[bug](https://github.com/zammad/zammad/labels/bug)] +- IMAP mail fetching stops working on spam mail and invalid email format [\#345](https://github.com/zammad/zammad/issues/345) [[bug](https://github.com/zammad/zammad/labels/bug)] +- Unable to create tickets [\#323](https://github.com/zammad/zammad/issues/323) [[bug](https://github.com/zammad/zammad/labels/bug)] +- Admin -\> Channels -\> Email -\> Filters not shown / no name shown [\#313](https://github.com/zammad/zammad/issues/313) [[bug](https://github.com/zammad/zammad/labels/bug)] +- In object manager, blank line in object deleted all values for selections [\#312](https://github.com/zammad/zammad/issues/312) [[bug](https://github.com/zammad/zammad/labels/bug)] +- triggers do not work? [\#306](https://github.com/zammad/zammad/issues/306) [[bug](https://github.com/zammad/zammad/labels/bug)] +- Answers from google mail shows complete quote [\#286](https://github.com/zammad/zammad/issues/286) [[minor bug](https://github.com/zammad/zammad/labels/minor%20bug)] +- Avatar in Chat not showing - wrong url [\#275](https://github.com/zammad/zammad/issues/275) [[bug](https://github.com/zammad/zammad/labels/bug)] +- chat not working / http 404 [\#274](https://github.com/zammad/zammad/issues/274) [[bug](https://github.com/zammad/zammad/labels/bug)] +- Zammad Docker container for rpi/ARM [\#271](https://github.com/zammad/zammad/issues/271) [[bug](https://github.com/zammad/zammad/labels/bug)] +- Zendesk: unknown article type fails import. [\#270](https://github.com/zammad/zammad/issues/270) [[bug](https://github.com/zammad/zammad/labels/bug)] +- No space at comment on ticket bulk action [\#268](https://github.com/zammad/zammad/issues/268) [[bug](https://github.com/zammad/zammad/labels/bug)] +- After adding a new attribute - zammad won't start [\#248](https://github.com/zammad/zammad/issues/248) [[bug](https://github.com/zammad/zammad/labels/bug)] +- Images/Avatars blank [\#217](https://github.com/zammad/zammad/issues/217) [[bug](https://github.com/zammad/zammad/labels/bug)] +- Docker/Ubuntu Not starting postgresql-9.6 service [\#213](https://github.com/zammad/zammad/issues/213) [[bug](https://github.com/zammad/zammad/labels/bug)] +- Can´t choose Organization for Customer [\#211](https://github.com/zammad/zammad/issues/211) [[bug](https://github.com/zammad/zammad/labels/bug)] +- CentOS 7 HTTPS Error 404 - Not Found [\#210](https://github.com/zammad/zammad/issues/210) [[bug](https://github.com/zammad/zammad/labels/bug)] + + + +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file From be3bbeba201d09992bf476b4fc7b86af1a24d887 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 18 Mar 2017 13:45:42 +0100 Subject: [PATCH 028/286] Merged develop into master. --- CHANGELOG.md | 26 ++++---------------------- VERSION | 2 +- lib/core_ext/string.rb | 3 ++- test/unit/aaa_string_test.rb | 26 ++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfeeafac4991..45082472714b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,33 +1,15 @@ # Change Log -## [1.4.0](https://github.com/zammad/zammad/tree/1.4.0) (2017-03-16) -[Full Changelog](https://github.com/zammad/zammad/compare/1.3.0...1.4.0) +## [1.5.0](https://github.com/zammad/zammad/tree/1.5.0) (2017-xx-xx) +[Full Changelog](https://github.com/zammad/zammad/compare/1.4.0...1.5.0) **Implemented enhancements:** -- Show images of incoming html inline images [\#343](https://github.com/zammad/zammad/issues/343) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] -- email filter issues - unable to set additional ticket attributes [\#394](https://github.com/zammad/zammad/issues/394) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] -- Auto-assign ticket owner on first reply [\#395](https://github.com/zammad/zammad/issues/395) [[feature](https://github.com/zammad/zammad/labels/feature)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] -- Stiked out text displayed as normal text [\#807](https://github.com/zammad/zammad/issues/807) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] -- New ticket object attributes won't disappear in Triggers and SLAs [\#436](https://github.com/zammad/zammad/issues/436) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] + **Fixed bugs:** -- Extended characters on AD users causes weird OTRS import issues [\#842](https://github.com/zammad/zammad/issues/842) [[bug](https://github.com/zammad/zammad/labels/bug)] -- Customer names are sometimes wrapped with quotes [\#763](https://github.com/zammad/zammad/issues/763) [[bug](https://github.com/zammad/zammad/labels/bug)] -- Unprocessable emails [\#795](https://github.com/zammad/zammad/issues/795) [[bug](https://github.com/zammad/zammad/labels/bug)] -- Overly exact gauge at re-opening rate [\#843](https://github.com/zammad/zammad/issues/843) [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] -- Wrong encoded string [\#438](https://github.com/zammad/zammad/issues/438) [[bug](https://github.com/zammad/zammad/labels/bug)] -- multiplication of the attachment-field in \#channels/form [\#833](https://github.com/zammad/zammad/issues/833) [[bug](https://github.com/zammad/zammad/labels/bug)] -- Disabled macros are still shown in ticket screen [\#838](https://github.com/zammad/zammad/issues/838) [[bug](https://github.com/zammad/zammad/labels/bug)] -- Can't select object with type date as filter for overviews [\#821](https://github.com/zammad/zammad/issues/821) [[bug](https://github.com/zammad/zammad/labels/bug)] -- Simple triggers resulting in error condition [\#779](https://github.com/zammad/zammad/issues/779) [[bug](https://github.com/zammad/zammad/labels/bug)] -- trigger "set to public" requested [\#298](https://github.com/zammad/zammad/issues/298) [[bug](https://github.com/zammad/zammad/labels/bug)] [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] [[trigger](https://github.com/zammad/zammad/labels/trigger)] -- User password reset doesn't work - user not able to login [\#791](https://github.com/zammad/zammad/issues/791) [[bug](https://github.com/zammad/zammad/labels/bug)] -- admin interface -\> time accounting setting will not be saved [\#677](https://github.com/zammad/zammad/issues/677) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] -- Checkboxes im merge dialog won't show until one clicks [\#786](https://github.com/zammad/zammad/issues/786) [[bug](https://github.com/zammad/zammad/labels/bug)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] -- Telegram: Open communication with only a picture [\#774](https://github.com/zammad/zammad/issues/774) [[bug](https://github.com/zammad/zammad/labels/bug)] -- Some adjustments with regard to \#698 [\#783](https://github.com/zammad/zammad/pull/783) [[enhancement](https://github.com/zammad/zammad/labels/enhancement)] [[UX/UI](https://github.com/zammad/zammad/labels/UX/UI)] ([johan12345](https://github.com/johan12345)) + \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/VERSION b/VERSION index 9370d0503ce2..97da80240111 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.x +1.4.x diff --git a/lib/core_ext/string.rb b/lib/core_ext/string.rb index d178875c8d36..7564c067c140 100644 --- a/lib/core_ext/string.rb +++ b/lib/core_ext/string.rb @@ -334,7 +334,8 @@ def signature_identify(type = 'text', force = false) '

[[:space:]]*(--|__)', '(|

|

)[[:space:]]*(Von|From|De|от|Z|Od|Ze|Fra|Van|Mistä|Από|Dal|から|Из|од|iz|Från|จาก|з|Từ):[[:space:]]*', '(
|
)[[:space:]]*
[[:space:]]*(Von|From|De|от|Z|Od|Ze|Fra|Van|Mistä|Από|Dal|から|Из|од|iz|Från|จาก|з|Từ):[[:space:]]+', - '[[:space:]]*
[[:space:]]*(On|Am)', + '[[:space:]]*
[[:space:]]*(On|Am|Le|El|Den|Dňa|W dniu|Il|Op|Dne|Dana)[[:space:]]', + '[[:space:]]*
[[:space:]]*(On|Am|Le|El|Den|Dňa|W dniu|Il|Op|Dne|Dana)[[:space:]].+?
' assert_equal(result, html.html2html_strict) + html = '
+
Am 17.03.2017 um 17:03 schrieb Martin Edenhofer via Zammad Helpdesk <support@example.com>:
+
+
' + result = '
+
Am 17.03.2017 um 17:03 schrieb Martin Edenhofer via Zammad Helpdesk <support@example.com>:
+
+
' + assert_equal(result, html.html2html_strict) + + html = '
+
Am 17.03.2017 um 17:03 schrieb Martin Edenhofer via Zammad Helpdesk <support@example.com>:
+
+
+ +
+
Dear Mr. Smith,
+
' + result = '
+
Am 17.03.2017 um 17:03 schrieb Martin Edenhofer via Zammad Helpdesk <support@example.com>:
+
+
+
Dear Mr. Smith,
+
+
' + assert_equal(result, html.html2html_strict) end end From 3d19bfdcf78f8886f71c901288761b9e6dc1ace7 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Fri, 21 Apr 2017 13:52:32 +0200 Subject: [PATCH 029/286] Fixed issue #912 - Long Twitter direct messages are shown as link after 140 chars. --- app/models/channel/driver/twitter.rb | 2 +- test/integration/twitter_test.rb | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/models/channel/driver/twitter.rb b/app/models/channel/driver/twitter.rb index 7549e0700e34..349b76031df5 100644 --- a/app/models/channel/driver/twitter.rb +++ b/app/models/channel/driver/twitter.rb @@ -324,7 +324,7 @@ def fetch_direct_messages Rails.logger.debug ' - searching for direct_messages' older_import = 0 older_import_max = 20 - @rest_client.client.direct_messages.each { |tweet| + @rest_client.client.direct_messages(full_text: 'true').each { |tweet| # ignore older messages if (@channel.created_at - 15.days) > tweet.created_at || older_import >= older_import_max diff --git a/test/integration/twitter_test.rb b/test/integration/twitter_test.rb index 1997aa796b7a..786cc2773af2 100644 --- a/test/integration/twitter_test.rb +++ b/test/integration/twitter_test.rb @@ -210,7 +210,7 @@ class TwitterTest < ActiveSupport::TestCase } assert(article, "Can't find tweet id #{tweet.id}/#{text}") assert_equal(customer_login, article.from, 'ticket article from') - assert_equal(nil, article.to, 'ticket article to') + assert_nil(article.to, 'ticket article to') ticket = article.ticket assert_equal('new', ticket.reload.state.name) @@ -307,7 +307,7 @@ class TwitterTest < ActiveSupport::TestCase client.destroy_direct_message(dm.id) } hash = "#citheo44 #{hash_gen}" - text = "How about #{rand_word} the details? #{hash}" + text = "How about #{rand_word} the details? #{hash} - #{'Long' * 50}" dm = client.create_direct_message( system_login_without_at, text, @@ -328,7 +328,7 @@ class TwitterTest < ActiveSupport::TestCase assert(article, "inbound article '#{text}' created") assert_equal(customer_login, article.from, 'ticket article from') - assert_equal(system_login, article.to, 'ticket article to') + assert_equal(text, article.body, 'ticket article body') ticket = article.ticket assert(ticket, 'ticket of inbound article exists') assert(ticket.articles, 'ticket.articles exists') @@ -504,7 +504,7 @@ class TwitterTest < ActiveSupport::TestCase sleep 10 } - assert_equal(nil, article, "retweet article '#{text}' not created") + assert_nil(article, "retweet article '#{text}' not created") end test 'f streaming test' do @@ -537,7 +537,7 @@ class TwitterTest < ActiveSupport::TestCase } assert(article, "article from customer with text '#{text}' message_id '#{tweet.id}' created") assert_equal(customer_login, article.from, 'ticket article from') - assert_equal(nil, article.to, 'ticket article to') + assert_nil(article.to, 'ticket article to') # new tweet II - by me_bauer client = Twitter::REST::Client.new do |config| @@ -562,7 +562,7 @@ class TwitterTest < ActiveSupport::TestCase } assert(article, "article from customer with text '#{text}' message_id '#{tweet.id}' created") assert_equal(customer_login, article.from, 'ticket article from') - assert_equal(nil, article.to, 'ticket article to') + assert_nil(article.to, 'ticket article to') # send reply reply_text = "RE #{text}" @@ -728,7 +728,7 @@ class TwitterTest < ActiveSupport::TestCase sleep 10 } - assert_equal(nil, article, "retweet article '#{text}' not created") + assert_nil(article, "retweet article '#{text}' not created") thread.exit thread.join From 7ad3c70311a9638918bd4cb420df1f1e1ee7f882 Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Mon, 24 Apr 2017 11:55:15 +0200 Subject: [PATCH 030/286] Fixed issue #975 - Exception in OTRS Import. --- app/models/user.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/user.rb b/app/models/user.rb index 66a53ad8c2e7..cd6aa9deb653 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -903,6 +903,8 @@ def validate_roles =end def last_admin_check(role) + return if Setting.get('import_mode') + ticket_admin_role_ids = Role.joins(:permissions).where(permissions: { name: ['admin', 'admin.user'] }).pluck(:id) count = User.joins(:roles).where(roles: { id: ticket_admin_role_ids }, users: { active: true }).count if ticket_admin_role_ids.include?(role.id) From 3c430b35ef1feefa0e61f4d91820d75513567109 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Mon, 24 Apr 2017 13:57:19 +0200 Subject: [PATCH 031/286] Fixed issue #906 - Doorkeeper tokens should be refreshable but aren't. --- config/initializers/doorkeeper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb index 4eeb378e440f..a1bc85d761f1 100644 --- a/config/initializers/doorkeeper.rb +++ b/config/initializers/doorkeeper.rb @@ -43,7 +43,7 @@ # reuse_access_token # Issue access tokens with refresh token (disabled by default) - # use_refresh_token + use_refresh_token # Provide support for an owner to be assigned to each registered application (disabled by default) # Optional parameter confirmation: true (default false) if you want to enforce ownership of From 1e5ed94799c880aac7a826d72ff98847f2fc0dbc Mon Sep 17 00:00:00 2001 From: alakril Date: Wed, 4 Apr 2018 17:10:52 +0300 Subject: [PATCH 032/286] Added console.logs for testing purpose only, start changing user.coffee --- .byebug_history | 89 +++++++++++++++++++ Gemfile | 2 +- Gemfile.lock | 4 +- .../_application_controller_form.coffee | 9 +- .../javascripts/app/controllers/users.coffee | 7 ++ app/assets/javascripts/app/models/user.coffee | 4 +- app/controllers/long_polling_controller.rb | 2 +- app/controllers/users_controller.rb | 3 +- .../application_model/can_associations.rb | 6 +- config/database.yml.pkgr | 8 -- db/seeds/object_manager_attributes.rb | 4 +- 11 files changed, 117 insertions(+), 21 deletions(-) create mode 100644 .byebug_history delete mode 100644 config/database.yml.pkgr diff --git a/.byebug_history b/.byebug_history new file mode 100644 index 000000000000..b950dc2c3ede --- /dev/null +++ b/.byebug_history @@ -0,0 +1,89 @@ +c +continue +finish +c +next +help +c +local_attributes +localhost +c +continue +c +organization_id +c +local_attributes['organization_ids'] +c +data +data[:Organization][1] +data[:Organization][2] +:Organization +data[:Organization] +c +self.organization_ids +self.organization_id +c +attributes_with_association_ids +local_attributes['role_ids'] +local_attributes +c +user +c +id +c +user.organizations +c +user.organizations +user +c +local_attributes['organization_ids'] +c +id +c +data[ app_model ][ id ] +data[ app_model ] +id +c +user +c +с +user +c +с +id +c +local_attributes['organization_ids'] +c +local_attributes +data[ app_model ][ id ] +id +c +local_attributes +c +user.id +c +cc +c + local_attributes['role_ids'] +local_attributes['organization_ids'] +c +local_attributes +c +assets +user +c +user.assets(assets) +assets +user.organizations +user +c +assets +c +assets +c +user_ids.uniq +assets +c +clean_params +c +params diff --git a/Gemfile b/Gemfile index da0becb45f92..490c93919e98 100644 --- a/Gemfile +++ b/Gemfile @@ -114,7 +114,7 @@ gem 'viewpoint' # Gems used only for develop/test and not required # in production environments by default. group :development, :test do - + gem 'byebug' # test frameworks gem 'rspec-rails' gem 'test-unit' diff --git a/Gemfile.lock b/Gemfile.lock index 43ae0074c4e3..463051ea4960 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,6 +77,7 @@ GEM browser (2.5.2) buftok (0.2.0) builder (3.2.3) + byebug (10.0.1) childprocess (0.9.0) ffi (~> 1.0, >= 1.0.11) clavius (1.0.3) @@ -473,6 +474,7 @@ DEPENDENCIES autoprefixer-rails biz browser + byebug clearbit coffee-rails coffee-script-source @@ -548,4 +550,4 @@ RUBY VERSION ruby 2.4.2p198 BUNDLED WITH - 1.16.0 + 1.16.1 diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.coffee index 9afbad5a1018..5aa744d03e57 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.coffee @@ -4,6 +4,7 @@ class App.ControllerForm extends App.Controller for key, value of params @[key] = value + console.log('Form',params) if !@handlers @handlers = [] @@ -14,7 +15,7 @@ class App.ControllerForm extends App.Controller @handlers.push @showHideToggle @handlers.push @requiredMandantoryToggle - + console.log('model', @model) if !@model @model = {} if !@attributes @@ -64,16 +65,18 @@ class App.ControllerForm extends App.Controller fieldset = @el else fieldset = $('
') - return fieldset if _.isEmpty(@model) - + console.log(this.model.configure_attributes) # collect form attributes @attributes = [] if @model.attributesGet + console.log('Attr yes', @model) attributesClean = @model.attributesGet(@screen) else + console.log('Attr no') attributesClean = App.Model.attributesGet(@screen, @model.configure_attributes) + console.log('Screen', @screen) for attributeName, attribute of attributesClean # ignore read only attributes diff --git a/app/assets/javascripts/app/controllers/users.coffee b/app/assets/javascripts/app/controllers/users.coffee index 27b464580b1f..0e2ef40827eb 100644 --- a/app/assets/javascripts/app/controllers/users.coffee +++ b/app/assets/javascripts/app/controllers/users.coffee @@ -67,6 +67,8 @@ class Index extends App.ControllerSubContent value switchTo = (id,e) => + + console.log('switch') e.preventDefault() e.stopPropagation() @disconnectClient() @@ -86,6 +88,8 @@ class Index extends App.ControllerSubContent ) edit = (id, e) => + + console.log('edit') e.preventDefault() item = App.User.find(id) @@ -132,6 +136,7 @@ class Index extends App.ControllerSubContent ) search: => + console.log('search') role_ids = [] @$('.tab.active').each( (i,d) -> role_ids.push $(d).data('id') @@ -155,6 +160,7 @@ class Index extends App.ControllerSubContent ) recent: => + console.log('recent') role_ids = [] @$('.tab.active').each( (i,d) -> role_ids.push $(d).data('id') @@ -178,6 +184,7 @@ class Index extends App.ControllerSubContent ) new: (e) -> + console.log('new') e.preventDefault() new App.ControllerGenericNew( pageData: diff --git a/app/assets/javascripts/app/models/user.coffee b/app/assets/javascripts/app/models/user.coffee index 9ee5ac0b5fd6..55cc1baccfb6 100644 --- a/app/assets/javascripts/app/models/user.coffee +++ b/app/assets/javascripts/app/models/user.coffee @@ -1,5 +1,5 @@ class App.User extends App.Model - @configure 'User', 'login', 'firstname', 'lastname', 'email', 'web', 'password', 'phone', 'fax', 'mobile', 'street', 'zip', 'city', 'country', 'organization_id', 'department', 'note', 'role_ids', 'group_ids', 'active', 'invite', 'signup', 'updated_at' + @configure 'User', 'login', 'firstname', 'lastname', 'email', 'web', 'password', 'phone', 'fax', 'mobile', 'street', 'zip', 'city', 'country', 'organization_ids', 'department', 'note', 'role_ids', 'group_ids', 'active', 'invite', 'signup', 'updated_at' @extend Spine.Model.Ajax @url: @apiPath + '/users' @@ -9,7 +9,7 @@ class App.User extends App.Model { name: 'firstname', display: 'Firstname', tag: 'input', type: 'text', limit: 100, null: false, signup: true, info: true, invite_agent: true, invite_customer: true }, { name: 'lastname', display: 'Lastname', tag: 'input', type: 'text', limit: 100, null: false, signup: true, info: true, invite_agent: true, invite_customer: true }, { name: 'email', display: 'Email', tag: 'input', type: 'email', limit: 100, null: false, signup: true, info: true, invite_agent: true, invite_customer: true }, - { name: 'organization_id', display: 'Organization', tag: 'select', multiple: false, nulloption: true, null: true, relation: 'Organization', signup: false, info: true, invite_customer: true }, + { name: 'organization_ids', display: 'Organization', tag: 'select', multiple: true, nulloption: true, null: true, relation: 'Organization', signup: false, info: true, invite_customer: true }, { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, { name: 'created_at', display: 'Created at', tag: 'datetime', readonly: 1 }, { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, diff --git a/app/controllers/long_polling_controller.rb b/app/controllers/long_polling_controller.rb index 294617ec6663..f5529f955604 100644 --- a/app/controllers/long_polling_controller.rb +++ b/app/controllers/long_polling_controller.rb @@ -81,7 +81,7 @@ def message_receive render json: queue return end - 8.times do + 28.times do sleep 0.25 end #sleep 2 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index fa8f9432e257..c91d90379d4a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -113,7 +113,6 @@ def show def create clean_params = User.association_name_to_id_convert(params) clean_params = User.param_cleanup(clean_params, true) - # check if it's first user, the admin user # inital admin account count = User.all.count @@ -509,10 +508,10 @@ def recent user_ids = [] assets = {} user_all.each do |user| + # byebug assets = user.assets(assets) user_ids.push user.id end - # return result render json: { assets: assets, diff --git a/app/models/application_model/can_associations.rb b/app/models/application_model/can_associations.rb index 19d40040a984..dbb8e841aa0c 100644 --- a/app/models/application_model/can_associations.rb +++ b/app/models/application_model/can_associations.rb @@ -106,9 +106,13 @@ def associations_from_param(params) =end def attributes_with_association_ids - + logger = Logger.new(STDOUT) key = "#{self.class}::aws::#{id}" cache = Cache.get(key) + logger.info "key" + logger.info key + logger.info "cache" + logger.info cache return cache if cache attributes = self.attributes diff --git a/config/database.yml.pkgr b/config/database.yml.pkgr deleted file mode 100644 index a4ce131f59b4..000000000000 --- a/config/database.yml.pkgr +++ /dev/null @@ -1,8 +0,0 @@ -production: - adapter: postgresql - database: zammad_production - pool: 50 - timeout: 5000 - encoding: utf8 - username: zammad - password: diff --git a/db/seeds/object_manager_attributes.rb b/db/seeds/object_manager_attributes.rb index 560b3a210ee3..b7f09857da35 100644 --- a/db/seeds/object_manager_attributes.rb +++ b/db/seeds/object_manager_attributes.rb @@ -789,11 +789,11 @@ ObjectManager::Attribute.add( force: true, object: 'User', - name: 'organization_id', + name: 'organization_ids', display: 'Organization', data_type: 'autocompletion_ajax', data_option: { - multiple: false, + multiple: true, nulloption: true, null: true, relation: 'Organization', From 7319664d86c58267d64f4a1cec759e5a899d6ded Mon Sep 17 00:00:00 2001 From: alakril Date: Thu, 5 Apr 2018 18:02:41 +0300 Subject: [PATCH 033/286] Create migration for removing organiztion_id from users --- .../20180405143215_remove_organiztion_id_from_user.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 db/migrate/20180405143215_remove_organiztion_id_from_user.rb diff --git a/db/migrate/20180405143215_remove_organiztion_id_from_user.rb b/db/migrate/20180405143215_remove_organiztion_id_from_user.rb new file mode 100644 index 000000000000..41546e349196 --- /dev/null +++ b/db/migrate/20180405143215_remove_organiztion_id_from_user.rb @@ -0,0 +1,9 @@ +class RemoveOrganiztionIdFromUser < ActiveRecord::Migration[5.1] + def up + remove_column :users, :organization_id + end + + def down + add_reference :users, :organization, index: true + end +end From 2e20a9154d670123c2def60de3c3d989bbbd31f2 Mon Sep 17 00:00:00 2001 From: alakril Date: Thu, 5 Apr 2018 18:05:53 +0300 Subject: [PATCH 034/286] Rework user.coffee organization_ids and User model --- app/assets/javascripts/app/models/user.coffee | 16 +++++++++++----- app/models/user.rb | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/app/models/user.coffee b/app/assets/javascripts/app/models/user.coffee index 55cc1baccfb6..670599e3dd87 100644 --- a/app/assets/javascripts/app/models/user.coffee +++ b/app/assets/javascripts/app/models/user.coffee @@ -9,7 +9,7 @@ class App.User extends App.Model { name: 'firstname', display: 'Firstname', tag: 'input', type: 'text', limit: 100, null: false, signup: true, info: true, invite_agent: true, invite_customer: true }, { name: 'lastname', display: 'Lastname', tag: 'input', type: 'text', limit: 100, null: false, signup: true, info: true, invite_agent: true, invite_customer: true }, { name: 'email', display: 'Email', tag: 'input', type: 'email', limit: 100, null: false, signup: true, info: true, invite_agent: true, invite_customer: true }, - { name: 'organization_ids', display: 'Organization', tag: 'select', multiple: true, nulloption: true, null: true, relation: 'Organization', signup: false, info: true, invite_customer: true }, + { name: 'organization_ids', display: 'Organization', tag: 'select', multiple: true, nulloption: true, null: true, relation: 'Organization', signup: false, info: true, invite_customer: true, screen: {edit: {null: true}}}, { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, { name: 'created_at', display: 'Created at', tag: 'datetime', readonly: 1 }, { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, @@ -17,7 +17,7 @@ class App.User extends App.Model ] @configure_overview = [ # 'login', 'firstname', 'lastname', 'email', 'updated_at', - 'login', 'firstname', 'lastname', 'organization' + 'login', 'firstname', 'lastname', 'organization_ids' ] uiUrl: -> @@ -126,7 +126,6 @@ class App.User extends App.Model @constructor.apiPath + '/users/image/' + @image @_fillUp: (data) -> - # set socal media links if data['accounts'] for account of data['accounts'] @@ -135,8 +134,8 @@ class App.User extends App.Model if account == 'facebook' data['accounts'][account]['link'] = 'https://www.facebook.com/profile.php?id=' + data['accounts'][account]['uid'] - if data.organization_id - data.organization = App.Organization.findNative(data.organization_id) +# if data.organization_id +# data.organization = App.Organization.findNative(data.organization_id) if data['role_ids'] data['roles'] = [] @@ -145,6 +144,13 @@ class App.User extends App.Model role = App.Role.findNative(role_id) data['roles'].push role + if data['organization_ids'] + data['organizations'] = [] + for organization_id in data['organization_ids'] + if App.Role.exists(organization_id) + organization = App.Organization.findNative(organization_id) + data['organizations'].push organization + if data['group_ids'] data['groups'] = [] for group_id in data['group_ids'] diff --git a/app/models/user.rb b/app/models/user.rb index 6d78906bb01c..a427e948a0dd 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -51,7 +51,7 @@ class User < ApplicationModel #has_many :permissions, class_name: 'Permission', through: :roles, class_name: 'Role' has_many :tokens, after_add: :cache_update, after_remove: :cache_update has_many :authorizations, after_add: :cache_update, after_remove: :cache_update - belongs_to :organization, class_name: 'Organization' + # belongs_to :organization, class_name: 'Organization' store :preferences From e631f4246e277c493449d385dfd1405e7e39b35d Mon Sep 17 00:00:00 2001 From: alakril Date: Fri, 6 Apr 2018 15:26:21 +0300 Subject: [PATCH 035/286] Change Organizations shown on user_profile page --- .../javascripts/app/controllers/user_profile.coffee | 12 +++++++----- .../javascripts/app/views/user_profile/index.jst.eco | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/app/controllers/user_profile.coffee b/app/assets/javascripts/app/controllers/user_profile.coffee index 3a2614c72eb8..ea3d2f69568e 100644 --- a/app/assets/javascripts/app/controllers/user_profile.coffee +++ b/app/assets/javascripts/app/controllers/user_profile.coffee @@ -32,6 +32,7 @@ class App.UserProfile extends App.Controller false render: (user) => + console.log('PROFILE') if !@doNotLog @doNotLog = 1 @@ -46,11 +47,12 @@ class App.UserProfile extends App.Controller el: elLocal.find('.js-name') ) - if user.organization_id - new Organization( - object_id: user.organization_id - el: elLocal.find('.js-organization') - ) + if user.organization_ids + for id in user.organization_ids + new Organization( + object_id: id + el: elLocal.find('.js-organization-' + id) + ) new Object( el: elLocal.find('.js-object-container') diff --git a/app/assets/javascripts/app/views/user_profile/index.jst.eco b/app/assets/javascripts/app/views/user_profile/index.jst.eco index 601eca945600..57a81f7424fe 100644 --- a/app/assets/javascripts/app/views/user_profile/index.jst.eco +++ b/app/assets/javascripts/app/views/user_profile/index.jst.eco @@ -4,9 +4,9 @@
<%- @user.avatar("80") %>

- <% if @user.organization: %> -
- <% end %> + <% for org in @user.organizations: %> +
+ <%= end %>
From 5a822b7900f288c7810bf2cda57fb61b554e633f Mon Sep 17 00:00:00 2001 From: alakril Date: Mon, 9 Apr 2018 10:06:53 +0300 Subject: [PATCH 036/286] Rework ref_object_touch organization -> organizations --- app/models/observer/user/ref_object_touch.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/models/observer/user/ref_object_touch.rb b/app/models/observer/user/ref_object_touch.rb index 07a380ec7686..25574ea6e403 100644 --- a/app/models/observer/user/ref_object_touch.rb +++ b/app/models/observer/user/ref_object_touch.rb @@ -22,6 +22,7 @@ def ref_object_touch(record) # touch old organization if changed member_ids = [] + organization_id_changed = record.saved_changes['organization_id'] if organization_id_changed && organization_id_changed[0] != organization_id_changed[1] if organization_id_changed[0] @@ -36,12 +37,14 @@ def ref_object_touch(record) end # touch new/current organization - if record.organization + if record.organizations # featrue used for different propose, do not touch references - if User.where(organization_id: record.organization_id).count < 100 - record.organization.touch # rubocop:disable Rails/SkipsModelValidations - member_ids += record.organization.member_ids + record.organizations.each do |org| + if User.where(organization_id: record.organization_id).count < 100 + org.touch # rubocop:disable Rails/SkipsModelValidations + member_ids += org.member_ids + end end end From 1947bceb2f44b4fdceaa6a7343c4a177d243a0bc Mon Sep 17 00:00:00 2001 From: alakril Date: Mon, 9 Apr 2018 16:04:36 +0300 Subject: [PATCH 037/286] Rework logic from organization to organiztionS in few files, added conditions and rework query --- .../_ui_element/autocompletion_ajax.coffee | 2 +- app/controllers/sessions/collection_base.rb | 4 +-- app/models/observer/user/ref_object_touch.rb | 25 +++++++++++-------- app/models/organization.rb | 2 +- app/models/organization/search.rb | 8 +++--- app/models/user.rb | 8 +++--- app/models/user/assets.rb | 12 +++++---- 7 files changed, 34 insertions(+), 27 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee index d6a15334dd39..515beb196e91 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee @@ -12,7 +12,7 @@ class App.UiElement.autocompletion_ajax value: params[attribute.name] || attribute.value valueName: valueName name: attribute.name - id: params.organization_id || attribute.value + id: params.organization_ids || attribute.value placeholder: App.i18n.translateInline('Search...') limit: 40 object: attribute.relation diff --git a/app/controllers/sessions/collection_base.rb b/app/controllers/sessions/collection_base.rb index 87464301a079..5eb225a0b304 100644 --- a/app/controllers/sessions/collection_base.rb +++ b/app/controllers/sessions/collection_base.rb @@ -37,8 +37,8 @@ def session( collections, assets, user ) end collections[ Organization.to_app_model ] = [] - if user.organization_id - Organization.where(id: user.organization_id).each do |item| + if user.organizations.any? + user.organizations.each do |item| assets = item.assets(assets) end end diff --git a/app/models/observer/user/ref_object_touch.rb b/app/models/observer/user/ref_object_touch.rb index 25574ea6e403..6f46dd4da454 100644 --- a/app/models/observer/user/ref_object_touch.rb +++ b/app/models/observer/user/ref_object_touch.rb @@ -23,25 +23,28 @@ def ref_object_touch(record) # touch old organization if changed member_ids = [] - organization_id_changed = record.saved_changes['organization_id'] - if organization_id_changed && organization_id_changed[0] != organization_id_changed[1] - if organization_id_changed[0] - - # featrue used for different propose, do not touch references - if User.where(organization_id: organization_id_changed[0]).count < 100 - organization = Organization.find(organization_id_changed[0]) - organization.touch # rubocop:disable Rails/SkipsModelValidations - member_ids = organization.member_ids + if record.saved_changes['organization_id'] + organization_id_changed = record.saved_changes['organization_id'] + if organization_id_changed && organization_id_changed[0] != organization_id_changed[1] + if organization_id_changed[0] + + # featrue used for different propose, do not touch references + if User.where(organization_id: organization_id_changed[0]).count < 100 + organization = Organization.find(organization_id_changed[0]) + organization.touch # rubocop:disable Rails/SkipsModelValidations + member_ids = organization.member_ids + end end end end - + byebug # touch new/current organization if record.organizations # featrue used for different propose, do not touch references record.organizations.each do |org| - if User.where(organization_id: record.organization_id).count < 100 + # if User.where(organization_id: record.organization_id).count < 100 + if org.members.count < 100 org.touch # rubocop:disable Rails/SkipsModelValidations member_ids += org.member_ids end diff --git a/app/models/organization.rb b/app/models/organization.rb index 93833ec63a9c..8f09b2baac4a 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -15,7 +15,7 @@ class Organization < ApplicationModel load 'organization/search_index.rb' include Organization::SearchIndex - has_many :members, class_name: 'User' + has_and_belongs_to_many :members, after_add: :cache_update, after_remove: :cache_update, class_name: 'User' validates :name, presence: true before_create :domain_cleanup diff --git a/app/models/organization/search.rb b/app/models/organization/search.rb index a87c1969cd9c..027cfbed2165 100644 --- a/app/models/organization/search.rb +++ b/app/models/organization/search.rb @@ -77,9 +77,11 @@ def search(params) # if only a few organizations are found, search for names of users if organizations.length <= 3 - organizations_by_user = Organization.select('DISTINCT(organizations.id), organizations.name').joins('LEFT OUTER JOIN users ON users.organization_id = organizations.id').where( - 'users.firstname LIKE ? or users.lastname LIKE ? or users.email LIKE ?', "%#{query}%", "%#{query}%", "%#{query}%" - ).order('organizations.name').limit(limit) + organizations_by_user = Organization.select('DISTINCT(organizations.id), organizations.name') + .joins(:members) + .where('users.firstname LIKE ? or users.lastname LIKE ? or users.email LIKE ?', "%#{query}%", "%#{query}%", "%#{query}%") + .order('organizations.name') + .limit(limit) organizations_by_user.each do |organization_by_user| organization_exists = false organizations.each do |organization| diff --git a/app/models/user.rb b/app/models/user.rb index a427e948a0dd..615403fc6713 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -142,8 +142,8 @@ def fullname def longname name = fullname - if organization_id - organization = Organization.lookup(id: organization_id) + if organization_ids.any? + organization = Organization.lookup(id: organization_ids[0]) if organization name += " (#{organization.name})" end @@ -1077,13 +1077,13 @@ def validate_agent_limit_by_role(role) def domain_based_assignment return true if !email - return true if organization_id + return true if organization_ids.any? begin domain = Mail::Address.new(email).domain return true if !domain organization = Organization.find_by(domain: domain.downcase, domain_assignment: true) return true if !organization - self.organization_id = organization.id + self.organization_ids = [organization.id] rescue return true end diff --git a/app/models/user/assets.rb b/app/models/user/assets.rb index 2be614b5fac6..42ab78e83cd4 100644 --- a/app/models/user/assets.rb +++ b/app/models/user/assets.rb @@ -82,11 +82,13 @@ def assets (data) end # add organization - if self.organization_id - if !data[:Organization] || !data[:Organization][self.organization_id] - organization = Organization.lookup(id: self.organization_id) - if organization - data = organization.assets(data) + if self.organization_ids.any? + self.organization_ids.each do |org| + if !data[:Organization] || !data[:Organization][org] + organization = Organization.lookup(id: org) + if organization + data = organization.assets(data) + end end end end From 0fbeed429e604574ae8e4d8543bb2a4ebdb9c929 Mon Sep 17 00:00:00 2001 From: alakril Date: Tue, 10 Apr 2018 17:30:32 +0300 Subject: [PATCH 038/286] Start working on ticket, change client ticket behavior --- .../app/controllers/customer_ticket_create.coffee | 11 +++++++++++ .../app/views/customer_ticket_create.jst.eco | 1 + app/models/observer/user/ref_object_touch.rb | 2 +- app/models/ticket.rb | 8 ++++---- app/models/ticket/overviews.rb | 7 ++++--- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/app/controllers/customer_ticket_create.coffee b/app/assets/javascripts/app/controllers/customer_ticket_create.coffee index 559c9da9a306..330e4905f8c3 100644 --- a/app/assets/javascripts/app/controllers/customer_ticket_create.coffee +++ b/app/assets/javascripts/app/controllers/customer_ticket_create.coffee @@ -70,6 +70,17 @@ class Index extends App.ControllerContent noFieldset: true handlersConfig: handlers ) + new App.ControllerForm( + el: @el.find('.ticket-form-organization') + form_id: @form_id + model: App.Ticket + screen: 'create_middle_organization' + filter: @formMeta.filter + formMeta: @formMeta + params: defaults + noFieldset: true + handlersConfig: handlers + ) if !_.isEmpty(App.Ticket.attributesGet('create_bottom', false, true)) new App.ControllerForm( el: @el.find('.ticket-form-bottom') diff --git a/app/assets/javascripts/app/views/customer_ticket_create.jst.eco b/app/assets/javascripts/app/views/customer_ticket_create.jst.eco index 2ab383135616..44788314d2f7 100644 --- a/app/assets/javascripts/app/views/customer_ticket_create.jst.eco +++ b/app/assets/javascripts/app/views/customer_ticket_create.jst.eco @@ -15,6 +15,7 @@
+
diff --git a/app/models/observer/user/ref_object_touch.rb b/app/models/observer/user/ref_object_touch.rb index 6f46dd4da454..f004db9a9373 100644 --- a/app/models/observer/user/ref_object_touch.rb +++ b/app/models/observer/user/ref_object_touch.rb @@ -37,7 +37,7 @@ def ref_object_touch(record) end end end - byebug + # touch new/current organization if record.organizations diff --git a/app/models/ticket.rb b/app/models/ticket.rb index 2d60d0cb43d9..39815b6ef0ea 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -89,10 +89,10 @@ class Ticket < ApplicationModel def self.access_condition(user, access) if user.permissions?('ticket.agent') ['group_id IN (?)', user.group_ids_access(access)] - elsif !user.organization || ( !user.organization.shared || user.organization.shared == false ) + elsif !user.organizations.any? ['tickets.customer_id = ?', user.id] else - ['(tickets.customer_id = ? OR tickets.organization_id = ?)', user.id, user.organization.id] + ['(tickets.customer_id = ? OR tickets.organization_id = ?', user.id, user.organizations.map { |org| org.id }] end end @@ -1164,8 +1164,8 @@ def check_defaults return true if !customer_id customer = User.find_by(id: customer_id) return true if !customer - return true if organization_id == customer.organization_id - self.organization_id = customer.organization_id + return true if customer.organization_ids.include? (organization_id) + self.organization_id = customer.organization_ids[0] true end diff --git a/app/models/ticket/overviews.rb b/app/models/ticket/overviews.rb index c6b62c5954a1..fa88f137682f 100644 --- a/app/models/ticket/overviews.rb +++ b/app/models/ticket/overviews.rb @@ -20,8 +20,10 @@ def self.all(data) role_ids = User.joins(:roles).where(users: { id: current_user.id, active: true }, roles: { active: true }).pluck('roles.id') if current_user.permissions?('ticket.customer') overview_filter = { active: true, organization_shared: false } - if current_user.organization_id && current_user.organization.shared - overview_filter.delete(:organization_shared) + if current_user.organization_ids.any? + current_user.organizations.each do |org| + overview_filter.delete(:organization_shared) if org.shared + end end overviews = Overview.joins(:roles).left_joins(:users).where(overviews_roles: { role_id: role_ids }, overviews_users: { user_id: nil }, overviews: overview_filter).or(Overview.joins(:roles).left_joins(:users).where(overviews_roles: { role_id: role_ids }, overviews_users: { user_id: current_user.id }, overviews: overview_filter)).distinct('overview.id').order(:prio) return overviews @@ -113,7 +115,6 @@ def self.index(user) order_by = "tickets.#{group_by}, #{order_by}" end end - ticket_result = Ticket.distinct .where(access_condition) .where(query_condition, *bind_condition) From f8cb0860e1df09630559735194edddbfffc581f1 Mon Sep 17 00:00:00 2001 From: alakril Date: Wed, 11 Apr 2018 17:07:11 +0300 Subject: [PATCH 039/286] Start creating custom select field for multiply values; implementing 2 fields of organizations for User --- .../app/lib/app_post/searchable_select.coffee | 15 +++++++++++++-- app/assets/javascripts/app/models/user.coffee | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee index 81092895423f..d0ee91648d68 100644 --- a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee @@ -224,8 +224,19 @@ class App.SearchableSelect extends Spine.Controller return if !event.currentTarget.textContent @input.val event.currentTarget.textContent.trim() @input.trigger('change') - @shadowInput.val event.currentTarget.getAttribute('data-value') - @shadowInput.trigger('change') + if @shadowInput.attr('name') == 'organization_ids' + if @shadowInput.length == 0 || @shadowInput.val() + newInput = @shadowInput.parent() + @shadowInput = @shadowInput.clone().appendTo( newInput ) + @shadowInput.val event.currentTarget.getAttribute('data-value') + @shadowInput.trigger('change') + @shadowInput.css('position','static') + $('.js-shadow').click -> + $(this).remove() + else + @shadowInput.val event.currentTarget.getAttribute('data-value') + @shadowInput.trigger('change') + navigateIn: (event) -> event.stopPropagation() diff --git a/app/assets/javascripts/app/models/user.coffee b/app/assets/javascripts/app/models/user.coffee index 670599e3dd87..3c0a105d19dd 100644 --- a/app/assets/javascripts/app/models/user.coffee +++ b/app/assets/javascripts/app/models/user.coffee @@ -9,7 +9,7 @@ class App.User extends App.Model { name: 'firstname', display: 'Firstname', tag: 'input', type: 'text', limit: 100, null: false, signup: true, info: true, invite_agent: true, invite_customer: true }, { name: 'lastname', display: 'Lastname', tag: 'input', type: 'text', limit: 100, null: false, signup: true, info: true, invite_agent: true, invite_customer: true }, { name: 'email', display: 'Email', tag: 'input', type: 'email', limit: 100, null: false, signup: true, info: true, invite_agent: true, invite_customer: true }, - { name: 'organization_ids', display: 'Organization', tag: 'select', multiple: true, nulloption: true, null: true, relation: 'Organization', signup: false, info: true, invite_customer: true, screen: {edit: {null: true}}}, + { name: 'organization_ids', display: 'Alternative Organization', tag: 'autocompletion_ajax', multiple: true, nulloption: true, null: true, relation: 'Organization', signup: false, info: true, invite_customer: true, item_class: 'formGroup--halfSize', screen: {edit: {null: true}}}, { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, { name: 'created_at', display: 'Created at', tag: 'datetime', readonly: 1 }, { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, From 87a29b57622cf292e3f49894fa1119da243eede9 Mon Sep 17 00:00:00 2001 From: alakril Date: Mon, 16 Apr 2018 17:10:54 +0300 Subject: [PATCH 040/286] Added organization field for tickets --- .../app/controllers/agent_ticket_create.coffee | 11 +++++++++++ .../app/controllers/customer_ticket_create.coffee | 3 ++- app/assets/javascripts/app/models/ticket.coffee | 2 +- .../javascripts/app/views/agent_ticket_create.jst.eco | 1 + .../app/views/customer_ticket_create.jst.eco | 2 +- app/controllers/tickets_controller.rb | 2 +- 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee index ee07ee65804c..8e11dba9fb28 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee @@ -301,6 +301,17 @@ class App.TicketCreate extends App.Controller noFieldset: true taskKey: @taskKey ) + new App.ControllerForm( + el: @$('.ticket-form-organization') + form_id: @formId + model: App.Ticket + screen: 'create_middle_org' + filter: @formMeta.filter + formMeta: @formMeta + params: params + noFieldset: true + handlersConfig: handlers + ) new App.ControllerForm( el: @$('.ticket-form-bottom') form_id: @formId diff --git a/app/assets/javascripts/app/controllers/customer_ticket_create.coffee b/app/assets/javascripts/app/controllers/customer_ticket_create.coffee index 330e4905f8c3..cbaaef5e55cb 100644 --- a/app/assets/javascripts/app/controllers/customer_ticket_create.coffee +++ b/app/assets/javascripts/app/controllers/customer_ticket_create.coffee @@ -74,7 +74,7 @@ class Index extends App.ControllerContent el: @el.find('.ticket-form-organization') form_id: @form_id model: App.Ticket - screen: 'create_middle_organization' + screen: 'create_middle_org' filter: @formMeta.filter formMeta: @formMeta params: defaults @@ -146,6 +146,7 @@ class Index extends App.ControllerContent sender_id: sender.id form_id: @form_id content_type: 'text/html' + organization_id: +params.organization_id } ticket.load(params) diff --git a/app/assets/javascripts/app/models/ticket.coffee b/app/assets/javascripts/app/models/ticket.coffee index 90e56db84cff..ff96ad58bbca 100644 --- a/app/assets/javascripts/app/models/ticket.coffee +++ b/app/assets/javascripts/app/models/ticket.coffee @@ -6,7 +6,7 @@ class App.Ticket extends App.Model { name: 'number', display: '#', tag: 'input', type: 'text', limit: 100, null: true, readonly: 1, width: '68px' }, { name: 'title', display: 'Title', tag: 'input', type: 'text', limit: 100, null: false }, { name: 'customer_id', display: 'Customer', tag: 'input', type: 'text', limit: 100, null: false, autocapitalize: false, relation: 'User' }, - { name: 'organization_id', display: 'Organization', tag: 'select', relation: 'Organization', readonly: 1 }, +# { name: 'organization_id', display: 'Organization', tag: 'select', relation: 'Organization', readonly: 1 }, { name: 'group_id', display: 'Group', tag: 'select', multiple: false, limit: 100, null: false, relation: 'Group', width: '10%', edit: true }, { name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, limit: 100, null: true, relation: 'User', width: '12%', edit: true }, { name: 'state_id', display: 'State', tag: 'select', multiple: false, null: false, relation: 'TicketState', default: 'new', width: '12%', edit: true, customer: true }, diff --git a/app/assets/javascripts/app/views/agent_ticket_create.jst.eco b/app/assets/javascripts/app/views/agent_ticket_create.jst.eco index 669cca9fee2c..fb9d71d86276 100644 --- a/app/assets/javascripts/app/views/agent_ticket_create.jst.eco +++ b/app/assets/javascripts/app/views/agent_ticket_create.jst.eco @@ -37,6 +37,7 @@
+
diff --git a/app/assets/javascripts/app/views/customer_ticket_create.jst.eco b/app/assets/javascripts/app/views/customer_ticket_create.jst.eco index 44788314d2f7..142d751a41c3 100644 --- a/app/assets/javascripts/app/views/customer_ticket_create.jst.eco +++ b/app/assets/javascripts/app/views/customer_ticket_create.jst.eco @@ -15,7 +15,7 @@
-
+
diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index cab614ae5314..43466ef062a4 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -89,7 +89,7 @@ def create # overwrite params if !current_user.permissions?('ticket.agent') - %i[owner owner_id customer customer_id organization organization_id preferences].each do |key| + %i[owner owner_id customer customer_id organization preferences].each do |key| clean_params.delete(key) end clean_params[:customer_id] = current_user.id From f167e6085e70513c1b90ea8ca31022ae975b144c Mon Sep 17 00:00:00 2001 From: alakril Date: Wed, 18 Apr 2018 17:42:50 +0300 Subject: [PATCH 041/286] Rework options for organization_id; Set default to Primary Organization; Add migration --- .../_application_controller_form.coffee | 17 ++++--- .../app/controllers/_ui_element/select.coffee | 3 ++ .../app/views/customer_ticket_create.jst.eco | 6 ++- app/models/ticket.rb | 8 +++- ...5143215_remove_organiztion_id_from_user.rb | 9 ---- ...180418140353_add_input_to_ticket_create.rb | 45 +++++++++++++++++++ 6 files changed, 68 insertions(+), 20 deletions(-) delete mode 100644 db/migrate/20180405143215_remove_organiztion_id_from_user.rb create mode 100644 db/migrate/20180418140353_add_input_to_ticket_create.rb diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.coffee index 5aa744d03e57..d0cb662deb08 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.coffee @@ -1,10 +1,16 @@ class App.ControllerForm extends App.Controller constructor: (params) -> super + if params['screen'] == 'create_middle_org' + @user = App.User.find(App.Session.get('id')) + @organizations = [] + if @user.organization_id + @organizations.push @user.organization_id + if @user.organization_ids + @organizations = @organizations.concat @user.organization_ids + params['filter']['organization_id'] = @organizations for key, value of params @[key] = value - - console.log('Form',params) if !@handlers @handlers = [] @@ -15,7 +21,6 @@ class App.ControllerForm extends App.Controller @handlers.push @showHideToggle @handlers.push @requiredMandantoryToggle - console.log('model', @model) if !@model @model = {} if !@attributes @@ -66,17 +71,13 @@ class App.ControllerForm extends App.Controller else fieldset = $('
') return fieldset if _.isEmpty(@model) - console.log(this.model.configure_attributes) # collect form attributes @attributes = [] if @model.attributesGet - console.log('Attr yes', @model) attributesClean = @model.attributesGet(@screen) else - console.log('Attr no') attributesClean = App.Model.attributesGet(@screen, @model.configure_attributes) - console.log('Screen', @screen) for attributeName, attribute of attributesClean # ignore read only attributes @@ -93,6 +94,8 @@ class App.ControllerForm extends App.Controller className = @model.className + '_' + Math.floor( Math.random() * 999999 ).toString() for attribute in @attributes + if attribute['name'] == 'organization_id' + console.log("LOOK AT ME, SIR",attribute) attribute_count = attribute_count + 1 if @isDisabled == true diff --git a/app/assets/javascripts/app/controllers/_ui_element/select.coffee b/app/assets/javascripts/app/controllers/_ui_element/select.coffee index da812722e4fb..3dc7565abbc0 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/select.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/select.coffee @@ -20,6 +20,9 @@ class App.UiElement.select extends App.UiElement.ApplicationUiElement # sort attribute.options @sortOptions(attribute, params) + if attribute['name'] == 'organization_id' && attribute['default'] + attribute['default'] = attribute['filter'][0] + # finde selected/checked item of list @selectedOptions(attribute, params) diff --git a/app/assets/javascripts/app/views/customer_ticket_create.jst.eco b/app/assets/javascripts/app/views/customer_ticket_create.jst.eco index 142d751a41c3..97451dfeebca 100644 --- a/app/assets/javascripts/app/views/customer_ticket_create.jst.eco +++ b/app/assets/javascripts/app/views/customer_ticket_create.jst.eco @@ -14,8 +14,10 @@
-
-
+
+
+
+
diff --git a/app/models/ticket.rb b/app/models/ticket.rb index 39815b6ef0ea..d08429c85c05 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -1164,8 +1164,12 @@ def check_defaults return true if !customer_id customer = User.find_by(id: customer_id) return true if !customer - return true if customer.organization_ids.include? (organization_id) - self.organization_id = customer.organization_ids[0] + return true if (customer.organization_ids.include?(organization_id) || customer.organization_id == organization_id) + if customer.organization_id + self.organization_id = customer.organization_id + else + customer.organization_ids[0] + end true end diff --git a/db/migrate/20180405143215_remove_organiztion_id_from_user.rb b/db/migrate/20180405143215_remove_organiztion_id_from_user.rb deleted file mode 100644 index 41546e349196..000000000000 --- a/db/migrate/20180405143215_remove_organiztion_id_from_user.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RemoveOrganiztionIdFromUser < ActiveRecord::Migration[5.1] - def up - remove_column :users, :organization_id - end - - def down - add_reference :users, :organization, index: true - end -end diff --git a/db/migrate/20180418140353_add_input_to_ticket_create.rb b/db/migrate/20180418140353_add_input_to_ticket_create.rb new file mode 100644 index 000000000000..cd887ea47007 --- /dev/null +++ b/db/migrate/20180418140353_add_input_to_ticket_create.rb @@ -0,0 +1,45 @@ +class AddInputToTicketCreate < ActiveRecord::Migration[5.1] + def up + # return if it's a new setup + return if !Setting.find_by(name: 'system_init_done') + + ObjectManager::Attribute.add( + force: true, + object: 'Ticket', + name: 'organization_id', + display: 'Organization', + data_type: 'select', + data_option: { + relation: 'Organization', + nulloption: false, + multiple: false, + null: false, + default: 0, + translate: true + }, + editable: false, + active: true, + + screens: { + create_middle_org: { + 'ticket.agent' => { + null: false, + item_class: 'column' + }, + }, + 'ticket.customer' => { + null: false, + item_class: 'column' + }, + }, + to_create: false, + to_migrate: false, + to_delete: false, + position: 45, + updated_by_id: 1, + created_by_id: 1, + ) + + Cache.clear + end +end From a15869718e602c3087082ce7da9cd9b5d8faf015 Mon Sep 17 00:00:00 2001 From: alakril Date: Thu, 19 Apr 2018 10:23:18 +0300 Subject: [PATCH 042/286] Small fix in migration issue and default --- .../app/controllers/_ui_element/select.coffee | 2 +- .../20180418140353_add_input_to_ticket_create.rb | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_ui_element/select.coffee b/app/assets/javascripts/app/controllers/_ui_element/select.coffee index 3dc7565abbc0..16334620f8a4 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/select.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/select.coffee @@ -20,7 +20,7 @@ class App.UiElement.select extends App.UiElement.ApplicationUiElement # sort attribute.options @sortOptions(attribute, params) - if attribute['name'] == 'organization_id' && attribute['default'] + if attribute['name'] == 'organization_id' && attribute['default'] == 0 attribute['default'] = attribute['filter'][0] # finde selected/checked item of list diff --git a/db/migrate/20180418140353_add_input_to_ticket_create.rb b/db/migrate/20180418140353_add_input_to_ticket_create.rb index cd887ea47007..bd61d0d864af 100644 --- a/db/migrate/20180418140353_add_input_to_ticket_create.rb +++ b/db/migrate/20180418140353_add_input_to_ticket_create.rb @@ -22,15 +22,17 @@ def up screens: { create_middle_org: { - 'ticket.agent' => { - null: false, - item_class: 'column' - }, + 'ticket.agent' => { + null: false, + default: 0, + item_class: 'column' }, - 'ticket.customer' => { - null: false, - item_class: 'column' + 'ticket.customer' => { + null: false, + default: 0, + item_class: 'two-columns' }, + }, }, to_create: false, to_migrate: false, From ee5dbac10650b7ff05578e2b52de8c6ee01c3fb7 Mon Sep 17 00:00:00 2001 From: alakril Date: Fri, 20 Apr 2018 17:44:47 +0300 Subject: [PATCH 043/286] Rework check_defaults and access_condition for Tickets --- app/models/ticket.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/models/ticket.rb b/app/models/ticket.rb index d08429c85c05..2e23236c9045 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -89,10 +89,12 @@ class Ticket < ApplicationModel def self.access_condition(user, access) if user.permissions?('ticket.agent') ['group_id IN (?)', user.group_ids_access(access)] - elsif !user.organizations.any? - ['tickets.customer_id = ?', user.id] + elsif user.organization && user.organization.shared + ['(tickets.customer_id = ? OR tickets.organization_id = ?)', user.id, user.organization.id] + elsif user.organizations.any? + ['(tickets.customer_id = ? OR tickets.organization_id IN (?))', user.id, user.organizations.map { |org| org.id }] else - ['(tickets.customer_id = ? OR tickets.organization_id = ?', user.id, user.organizations.map { |org| org.id }] + ['tickets.customer_id = ?', user.id] end end @@ -1165,11 +1167,8 @@ def check_defaults customer = User.find_by(id: customer_id) return true if !customer return true if (customer.organization_ids.include?(organization_id) || customer.organization_id == organization_id) - if customer.organization_id - self.organization_id = customer.organization_id - else - customer.organization_ids[0] - end + return true if organization_id + self.organization_id = customer.organization_id ? customer.organization_id : customer.organization_ids[0] true end From a47d629bf432f2599713aff9c5c6fa28b7bacb79 Mon Sep 17 00:00:00 2001 From: alakril Date: Fri, 20 Apr 2018 17:47:18 +0300 Subject: [PATCH 044/286] Add new organization_id field for Ticket in seed (ObjectManager) --- db/seeds/object_manager_attributes.rb | 40 ++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/db/seeds/object_manager_attributes.rb b/db/seeds/object_manager_attributes.rb index b7f09857da35..f41bc261ca74 100644 --- a/db/seeds/object_manager_attributes.rb +++ b/db/seeds/object_manager_attributes.rb @@ -196,7 +196,6 @@ filter: Ticket::State.by_category(:viewable_agent_new).pluck(:id), }, 'ticket.customer' => { - item_class: 'column', nulloption: false, null: true, filter: Ticket::State.by_category(:viewable_customer_new).pluck(:id), @@ -323,6 +322,45 @@ position: 900, ) +ObjectManager::Attribute.add( + force: true, + object: 'Ticket', + name: 'organization_id', + display: 'Organization', + data_type: 'select', + data_option: { + relation: 'Organization', + nulloption: false, + multiple: false, + null: false, + default: 0, + translate: true + }, + editable: false, + active: true, + + screens: { + create_middle_org: { + 'ticket.agent' => { + null: false, + default: 0, + item_class: 'column' + }, + 'ticket.customer' => { + null: false, + default: 0, + item_class: 'two-columns' + }, + }, + }, + to_create: false, + to_migrate: false, + to_delete: false, + position: 45, + updated_by_id: 1, + created_by_id: 1, +) + ObjectManager::Attribute.add( force: true, object: 'TicketArticle', From 34058779d670720f9ff6d1223a32f6882f82ea77 Mon Sep 17 00:00:00 2001 From: alakril Date: Thu, 26 Apr 2018 11:36:10 +0300 Subject: [PATCH 045/286] Rework User create/page for multiple organizations --- .../_ui_element/autocompletion_ajax.coffee | 15 +++-- .../app/lib/app_post/searchable_select.coffee | 58 +++++++++++++------ .../app/lib/bootstrap/transition.js | 1 + .../views/generic/searchable_select.jst.eco | 22 ++++--- app/assets/stylesheets/zammad.scss | 7 ++- 5 files changed, 71 insertions(+), 32 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee index 515beb196e91..605a807d5f52 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee @@ -1,10 +1,17 @@ # coffeelint: disable=camel_case_classes class App.UiElement.autocompletion_ajax @render: (attribute, params = {}) -> - - if params[attribute.name] || attribute.value - object = App[attribute.relation].find(params[attribute.name] || attribute.value) - valueName = object.displayName() + id = attribute.value + if attribute.name == 'organization_ids' + if params[attribute.name]?.length > 0 || attribute.value?.length > 0 + object = App[attribute.relation].find(params[attribute.name] || attribute.value) + valueName = 'Alternative Organizations' + id = params.organization_ids[0] || attribute.value + else + if params[attribute.name] || attribute.value + object = App[attribute.relation].find(params[attribute.name] || attribute.value) + valueName = object.displayName() + id = params.organization_id || attribute.value # selectable search searchableAjaxSelectObject = new App.SearchableAjaxSelect( diff --git a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee index d0ee91648d68..8cc47cec7349 100644 --- a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee @@ -36,15 +36,23 @@ class App.SearchableSelect extends Spine.Controller render: -> firstSelected = _.find @attribute.options, (option) -> option.selected - - if firstSelected - @attribute.valueName = firstSelected.name - @attribute.value = firstSelected.value - else if @attribute.unknown && @attribute.value - @attribute.valueName = @attribute.value - else if @hasSubmenu @attribute.options - @attribute.valueName = @getName @attribute.value, @attribute.options - + if @attribute.name == 'organization_ids' + @attribute.valueName = '' + organizations = '' + for value in @attribute.value + organizations += "
" + + "#{value}" + + "" + + "
" + @attribute.organizations = organizations + else + if firstSelected + @attribute.valueName = firstSelected.name + @attribute.value = firstSelected.value + else if @attribute.unknown && @attribute.value + @attribute.valueName = @attribute.value + else if @hasSubmenu @attribute.options + @attribute.valueName = @getName @attribute.value, @attribute.options @html App.view('generic/searchable_select') attribute: @attribute options: @renderAllOptions '', @attribute.options, 0 @@ -224,18 +232,30 @@ class App.SearchableSelect extends Spine.Controller return if !event.currentTarget.textContent @input.val event.currentTarget.textContent.trim() @input.trigger('change') - if @shadowInput.attr('name') == 'organization_ids' - if @shadowInput.length == 0 || @shadowInput.val() - newInput = @shadowInput.parent() - @shadowInput = @shadowInput.clone().appendTo( newInput ) - @shadowInput.val event.currentTarget.getAttribute('data-value') - @shadowInput.trigger('change') - @shadowInput.css('position','static') - $('.js-shadow').click -> - $(this).remove() + data_value = event.currentTarget.getAttribute('data-value') + if @shadowInput.length == 0 + @input.val '' + js_shadow_ids = $('.js-shadow-ids') + ids = [] + if js_shadow_ids.length > 0 + js_shadow_ids.each( -> ids.push $(this).val() ) + if !ids.includes(data_value) && $(".js-shadow[name='organization_id']").val() != data_value + newInput = @input.closest('.searchableSelect').find('div.items') + input = "" + wrapper = $("
").appendTo(newInput) + @span = $("#{event.currentTarget.getAttribute('title')}").appendTo( wrapper ) + @input = $(input).appendTo( wrapper ) + @input.val data_value + @input.trigger('change') + $('span.selected_organization').click -> + $(this).closest('div').remove() else - @shadowInput.val event.currentTarget.getAttribute('data-value') + @shadowInput.val data_value @shadowInput.trigger('change') + $(".js-shadow-ids").each( -> + if $(this).val() == data_value + $(this).closest('div').remove() + ) navigateIn: (event) -> diff --git a/app/assets/javascripts/app/lib/bootstrap/transition.js b/app/assets/javascripts/app/lib/bootstrap/transition.js index 68c2bd60bf28..c724bfd0c602 100644 --- a/app/assets/javascripts/app/lib/bootstrap/transition.js +++ b/app/assets/javascripts/app/lib/bootstrap/transition.js @@ -38,6 +38,7 @@ var $el = this $(this).one('bsTransitionEnd', function () { called = true }) var callback = function () { if (!called) $($el).trigger($.support.transition.end) } + $('span.selected_organization').click(function () { $(this).closest('div').remove() }) setTimeout(callback, duration) return this } diff --git a/app/assets/javascripts/app/views/generic/searchable_select.jst.eco b/app/assets/javascripts/app/views/generic/searchable_select.jst.eco index 70139147ef4f..d216e0a50452 100644 --- a/app/assets/javascripts/app/views/generic/searchable_select.jst.eco +++ b/app/assets/javascripts/app/views/generic/searchable_select.jst.eco @@ -1,12 +1,4 @@ +
+ <% if @attribute.name != 'organization_ids': %> + + <%= @attribute.autofocus %> + value="<%= @attribute.value %>" + > + <% else: %> + <%- @attribute.organizations %> + <% end %>
\ No newline at end of file diff --git a/app/assets/stylesheets/zammad.scss b/app/assets/stylesheets/zammad.scss index 3fc62e7d1634..f929a7160613 100644 --- a/app/assets/stylesheets/zammad.scss +++ b/app/assets/stylesheets/zammad.scss @@ -8064,6 +8064,11 @@ output { .searchableSelect { position: relative; + .selected_organization { + cursor: pointer; + padding-left: 10px; + } + .form-control { padding-right: 37px; @include bidi-style(padding-right, 37px, padding-left, 12px); @@ -8085,8 +8090,8 @@ output { } .dropdown-menu { - margin-top: -3px; max-width: 100%; + top: 39px; } &-option-text { From 8ca61d413b16a2c18dee2ac3d9b61b51b44890a0 Mon Sep 17 00:00:00 2001 From: alakril Date: Thu, 26 Apr 2018 15:40:19 +0300 Subject: [PATCH 046/286] Small fix of user create page; add migrations --- .../_application_controller_form.coffee | 2 - .../app/lib/app_post/searchable_select.coffee | 13 +-- app/assets/javascripts/app/models/user.coffee | 6 +- .../application_model/can_associations.rb | 6 +- app/models/organization.rb | 1 + app/models/user.rb | 9 +- app/models/user/assets.rb | 9 ++ ...111843_change_object_manager_attributes.rb | 88 +++++++++++++++++++ db/seeds/object_manager_attributes.rb | 42 ++++++++- 9 files changed, 157 insertions(+), 19 deletions(-) create mode 100644 db/migrate/20180426111843_change_object_manager_attributes.rb diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.coffee index d0cb662deb08..6981b49e9ad4 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.coffee @@ -94,8 +94,6 @@ class App.ControllerForm extends App.Controller className = @model.className + '_' + Math.floor( Math.random() * 999999 ).toString() for attribute in @attributes - if attribute['name'] == 'organization_id' - console.log("LOOK AT ME, SIR",attribute) attribute_count = attribute_count + 1 if @isDisabled == true diff --git a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee index 8cc47cec7349..4df20e1c26ac 100644 --- a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee @@ -39,12 +39,13 @@ class App.SearchableSelect extends Spine.Controller if @attribute.name == 'organization_ids' @attribute.valueName = '' organizations = '' - for value in @attribute.value - organizations += "
" + - "#{value}" + - "" + - "
" - @attribute.organizations = organizations + if @attribute.value + for value in @attribute.value + organizations += "
" + + "#{App.Organization.findNative(value).name}" + + "" + + "
" + @attribute.organizations = organizations else if firstSelected @attribute.valueName = firstSelected.name diff --git a/app/assets/javascripts/app/models/user.coffee b/app/assets/javascripts/app/models/user.coffee index 3c0a105d19dd..4859675b6148 100644 --- a/app/assets/javascripts/app/models/user.coffee +++ b/app/assets/javascripts/app/models/user.coffee @@ -1,5 +1,5 @@ class App.User extends App.Model - @configure 'User', 'login', 'firstname', 'lastname', 'email', 'web', 'password', 'phone', 'fax', 'mobile', 'street', 'zip', 'city', 'country', 'organization_ids', 'department', 'note', 'role_ids', 'group_ids', 'active', 'invite', 'signup', 'updated_at' + @configure 'User', 'login', 'firstname', 'lastname', 'email', 'web', 'password', 'phone', 'fax', 'mobile', 'street', 'zip', 'city', 'country', 'organization_id', 'organization_ids', 'department', 'note', 'role_ids', 'group_ids', 'active', 'invite', 'signup', 'updated_at' @extend Spine.Model.Ajax @url: @apiPath + '/users' @@ -9,7 +9,7 @@ class App.User extends App.Model { name: 'firstname', display: 'Firstname', tag: 'input', type: 'text', limit: 100, null: false, signup: true, info: true, invite_agent: true, invite_customer: true }, { name: 'lastname', display: 'Lastname', tag: 'input', type: 'text', limit: 100, null: false, signup: true, info: true, invite_agent: true, invite_customer: true }, { name: 'email', display: 'Email', tag: 'input', type: 'email', limit: 100, null: false, signup: true, info: true, invite_agent: true, invite_customer: true }, - { name: 'organization_ids', display: 'Alternative Organization', tag: 'autocompletion_ajax', multiple: true, nulloption: true, null: true, relation: 'Organization', signup: false, info: true, invite_customer: true, item_class: 'formGroup--halfSize', screen: {edit: {null: true}}}, + { name: 'organization_ids', display: 'Alternative Organization', tag: 'autocompletion_ajax', multiple: true, nulloption: true, null: true, relation: 'Organization', signup: false, info: true, invite_customer: true}, { name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 }, { name: 'created_at', display: 'Created at', tag: 'datetime', readonly: 1 }, { name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 }, @@ -17,7 +17,7 @@ class App.User extends App.Model ] @configure_overview = [ # 'login', 'firstname', 'lastname', 'email', 'updated_at', - 'login', 'firstname', 'lastname', 'organization_ids' + 'login', 'firstname', 'lastname', 'organization_id', 'organization_ids' ] uiUrl: -> diff --git a/app/models/application_model/can_associations.rb b/app/models/application_model/can_associations.rb index dbb8e841aa0c..19d40040a984 100644 --- a/app/models/application_model/can_associations.rb +++ b/app/models/application_model/can_associations.rb @@ -106,13 +106,9 @@ def associations_from_param(params) =end def attributes_with_association_ids - logger = Logger.new(STDOUT) + key = "#{self.class}::aws::#{id}" cache = Cache.get(key) - logger.info "key" - logger.info key - logger.info "cache" - logger.info cache return cache if cache attributes = self.attributes diff --git a/app/models/organization.rb b/app/models/organization.rb index 8f09b2baac4a..4eda96068c78 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -15,6 +15,7 @@ class Organization < ApplicationModel load 'organization/search_index.rb' include Organization::SearchIndex + has_many :members, class_name: 'User' has_and_belongs_to_many :members, after_add: :cache_update, after_remove: :cache_update, class_name: 'User' validates :name, presence: true diff --git a/app/models/user.rb b/app/models/user.rb index 615403fc6713..35d75776b8e4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -51,7 +51,7 @@ class User < ApplicationModel #has_many :permissions, class_name: 'Permission', through: :roles, class_name: 'Role' has_many :tokens, after_add: :cache_update, after_remove: :cache_update has_many :authorizations, after_add: :cache_update, after_remove: :cache_update - # belongs_to :organization, class_name: 'Organization' + belongs_to :organization, class_name: 'Organization' store :preferences @@ -142,7 +142,12 @@ def fullname def longname name = fullname - if organization_ids.any? + if organization_id + organization = Organization.lookup(id: organization_id) + if organization + name += " (#{organization.name})" + end + elsif organization_ids.any? organization = Organization.lookup(id: organization_ids[0]) if organization name += " (#{organization.name})" diff --git a/app/models/user/assets.rb b/app/models/user/assets.rb index 42ab78e83cd4..a5b5434da852 100644 --- a/app/models/user/assets.rb +++ b/app/models/user/assets.rb @@ -78,6 +78,15 @@ def assets (data) data = organization.assets(data) end + if local_attributes['organization_id'] + unless data[:Organization] || data[:Organization]&[local_attributes['organization_id']] + organization = Organization.lookup(id: local_attributes['organization_id']) + if organization + data = organization.assets(data) + end + end + end + data[ app_model ][ id ] = local_attributes end diff --git a/db/migrate/20180426111843_change_object_manager_attributes.rb b/db/migrate/20180426111843_change_object_manager_attributes.rb new file mode 100644 index 000000000000..aa881cd7ffb2 --- /dev/null +++ b/db/migrate/20180426111843_change_object_manager_attributes.rb @@ -0,0 +1,88 @@ +class ChangeObjectManagerAttributes < ActiveRecord::Migration[5.1] + def change + return if !Setting.find_by(name: 'system_init_done') + + UserInfo.current_user_id = 1 + + ObjectManager::Attribute.add( + force: true, + object: 'User', + name: 'organization_id', + display: 'Primary Organization', + data_type: 'autocompletion_ajax', + data_option: { + multiple: false, + nulloption: true, + null: true, + relation: 'Organization', + item_class: 'formGroup--halfSize', + }, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + invite_customer: { + '-all-' => { + null: true, + }, + }, + edit: { + '-all-' => { + null: true, + }, + }, + view: { + '-all-' => { + shown: true, + }, + }, + }, + to_create: false, + to_migrate: false, + to_delete: false, + position: 900, + ) + + ObjectManager::Attribute.add( + force: true, + object: 'User', + name: 'organization_ids', + display: 'Alternative Organizations', + data_type: 'autocompletion_ajax', + data_option: { + multiple: true, + nulloption: true, + null: true, + relation: 'Organization', + item_class: 'formGroup--halfSize', + }, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + invite_customer: { + '-all-' => { + null: true, + }, + }, + edit: { + '-all-' => { + null: true, + }, + }, + view: { + '-all-' => { + shown: true, + }, + }, + }, + to_create: false, + to_migrate: false, + to_delete: false, + position: 900, + ) + + end +end diff --git a/db/seeds/object_manager_attributes.rb b/db/seeds/object_manager_attributes.rb index f41bc261ca74..8e7e24a275ec 100644 --- a/db/seeds/object_manager_attributes.rb +++ b/db/seeds/object_manager_attributes.rb @@ -828,7 +828,7 @@ force: true, object: 'User', name: 'organization_ids', - display: 'Organization', + display: 'Alternative Organizations', data_type: 'autocompletion_ajax', data_option: { multiple: true, @@ -864,6 +864,46 @@ position: 900, ) +ObjectManager::Attribute.add( + force: true, + object: 'User', + name: 'organization_id', + display: 'Primary Organization', + data_type: 'autocompletion_ajax', + data_option: { + multiple: false, + nulloption: true, + null: true, + relation: 'Organization', + item_class: 'formGroup--halfSize', + }, + editable: false, + active: true, + screens: { + signup: {}, + invite_agent: {}, + invite_customer: { + '-all-' => { + null: true, + }, + }, + edit: { + '-all-' => { + null: true, + }, + }, + view: { + '-all-' => { + shown: true, + }, + }, + }, + to_create: false, + to_migrate: false, + to_delete: false, + position: 900, +) + ObjectManager::Attribute.add( force: true, object: 'User', From 52d0fe1abf8e65d9e9c41c9a8cdac55f9fd169d1 Mon Sep 17 00:00:00 2001 From: alakril Date: Thu, 26 Apr 2018 17:58:06 +0300 Subject: [PATCH 047/286] Make all organization link showed on user profile page --- .../javascripts/app/controllers/user_profile.coffee | 10 +++++++++- .../javascripts/app/views/user_profile/index.jst.eco | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/controllers/user_profile.coffee b/app/assets/javascripts/app/controllers/user_profile.coffee index ea3d2f69568e..835968dfdd61 100644 --- a/app/assets/javascripts/app/controllers/user_profile.coffee +++ b/app/assets/javascripts/app/controllers/user_profile.coffee @@ -47,12 +47,20 @@ class App.UserProfile extends App.Controller el: elLocal.find('.js-name') ) + if user.organization_id + new Organization( + object_id: user.organization_id + el: elLocal.find('.js-organization') + ) + if user.organization_ids for id in user.organization_ids - new Organization( + console.log(id) + a = new Organization( object_id: id el: elLocal.find('.js-organization-' + id) ) + console.log(a) new Object( el: elLocal.find('.js-object-container') diff --git a/app/assets/javascripts/app/views/user_profile/index.jst.eco b/app/assets/javascripts/app/views/user_profile/index.jst.eco index 57a81f7424fe..8ee5b2572b20 100644 --- a/app/assets/javascripts/app/views/user_profile/index.jst.eco +++ b/app/assets/javascripts/app/views/user_profile/index.jst.eco @@ -4,9 +4,12 @@
<%- @user.avatar("80") %>

+ <% if @user.organization_id: %> +
+ <% end %> <% for org in @user.organizations: %>
- <%= end %> + <% end %>
From df9dd582e2790c1054e9bf8ee77387161f7e60ae Mon Sep 17 00:00:00 2001 From: alakril Date: Thu, 26 Apr 2018 17:58:47 +0300 Subject: [PATCH 048/286] Rework ticket's model methods --- app/models/ticket.rb | 45 ++++++++++++++++++++-------------- app/models/ticket/overviews.rb | 5 +++- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/app/models/ticket.rb b/app/models/ticket.rb index 2e23236c9045..2b76974f277e 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -519,23 +519,24 @@ def self.selector2sql(selectors, current_user = nil) if query != '' query += ' AND ' end - if selector[0] == 'customer' - tables += ', users customers' - query += 'tickets.customer_id = customers.id' - elsif selector[0] == 'organization' - tables += ', organizations' - query += 'tickets.organization_id = organizations.id' - elsif selector[0] == 'owner' - tables += ', users owners' - query += 'tickets.owner_id = owners.id' - elsif selector[0] == 'article' - tables += ', ticket_articles articles' - query += 'tickets.id = articles.ticket_id' - elsif selector[0] == 'ticket_state' - tables += ', ticket_states' - query += 'tickets.state_id = ticket_states.id' - else - raise "invalid selector #{attribute.inspect}->#{selector.inspect}" + case selector[0] + when 'customer' + tables += ', users customers' + query += 'tickets.customer_id = customers.id' + when 'organization' + tables += ', organizations' + query += 'tickets.organization_id = organizations.id' + when 'owner' + tables += ', users owners' + query += 'tickets.owner_id = owners.id' + when 'article' + tables += ', ticket_articles articles' + query += 'tickets.id = articles.ticket_id' + when 'ticket_state' + tables += ', ticket_states' + query += 'tickets.state_id = ticket_states.id' + else + raise "invalid selector #{attribute.inspect}->#{selector.inspect}" end end @@ -595,7 +596,10 @@ def self.selector2sql(selectors, current_user = nil) raise "Use current_user.id in selector, but no current_user is set #{selector.inspect}" if !current_user_id query += "#{attribute} IN (?)" user = User.lookup(id: current_user_id) - bind_params.push user.organization_id + organizations = [] + organizations.push user.organization_id if user.organization_id + organizations.concat user.organization_ids if user.organization_ids&.any? + bind_params.push organizations else # rubocop:disable Style/IfInsideElse if selector['value'].nil? @@ -628,7 +632,10 @@ def self.selector2sql(selectors, current_user = nil) elsif selector['pre_condition'] == 'current_user.organization_id' query += "#{attribute} NOT IN (?)" user = User.lookup(id: current_user_id) - bind_params.push user.organization_id + organizations = [] + organizations.push user.organization_id if user.organization_id + organizations.concat user.organization_ids if user.organization_ids&.any? + bind_params.push organizations else # rubocop:disable Style/IfInsideElse if selector['value'].nil? diff --git a/app/models/ticket/overviews.rb b/app/models/ticket/overviews.rb index fa88f137682f..a6d5225b0e94 100644 --- a/app/models/ticket/overviews.rb +++ b/app/models/ticket/overviews.rb @@ -20,7 +20,10 @@ def self.all(data) role_ids = User.joins(:roles).where(users: { id: current_user.id, active: true }, roles: { active: true }).pluck('roles.id') if current_user.permissions?('ticket.customer') overview_filter = { active: true, organization_shared: false } - if current_user.organization_ids.any? + if current_user.organization_id && current_user.organization.shared + overview_filter.delete(:organization_shared) + end + if overview_filter.key?(:organization_shared) && current_user.organization_ids.any? current_user.organizations.each do |org| overview_filter.delete(:organization_shared) if org.shared end From f5cdad0d613ba6d418978daf322458d203dd9ea4 Mon Sep 17 00:00:00 2001 From: alakril Date: Thu, 26 Apr 2018 18:03:08 +0300 Subject: [PATCH 049/286] Remove console logs --- .../javascripts/app/controllers/user_profile.coffee | 3 --- app/assets/javascripts/app/controllers/users.coffee | 8 +++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/app/controllers/user_profile.coffee b/app/assets/javascripts/app/controllers/user_profile.coffee index 835968dfdd61..e22fa9618ca9 100644 --- a/app/assets/javascripts/app/controllers/user_profile.coffee +++ b/app/assets/javascripts/app/controllers/user_profile.coffee @@ -32,7 +32,6 @@ class App.UserProfile extends App.Controller false render: (user) => - console.log('PROFILE') if !@doNotLog @doNotLog = 1 @@ -55,12 +54,10 @@ class App.UserProfile extends App.Controller if user.organization_ids for id in user.organization_ids - console.log(id) a = new Organization( object_id: id el: elLocal.find('.js-organization-' + id) ) - console.log(a) new Object( el: elLocal.find('.js-object-container') diff --git a/app/assets/javascripts/app/controllers/users.coffee b/app/assets/javascripts/app/controllers/users.coffee index 0e2ef40827eb..3a9adde88384 100644 --- a/app/assets/javascripts/app/controllers/users.coffee +++ b/app/assets/javascripts/app/controllers/users.coffee @@ -68,7 +68,6 @@ class Index extends App.ControllerSubContent switchTo = (id,e) => - console.log('switch') e.preventDefault() e.stopPropagation() @disconnectClient() @@ -89,7 +88,6 @@ class Index extends App.ControllerSubContent edit = (id, e) => - console.log('edit') e.preventDefault() item = App.User.find(id) @@ -136,7 +134,7 @@ class Index extends App.ControllerSubContent ) search: => - console.log('search') + role_ids = [] @$('.tab.active').each( (i,d) -> role_ids.push $(d).data('id') @@ -160,7 +158,7 @@ class Index extends App.ControllerSubContent ) recent: => - console.log('recent') + role_ids = [] @$('.tab.active').each( (i,d) -> role_ids.push $(d).data('id') @@ -184,7 +182,7 @@ class Index extends App.ControllerSubContent ) new: (e) -> - console.log('new') + e.preventDefault() new App.ControllerGenericNew( pageData: From c3aaba4af4b24b221c3ff00e28088f1e8f40af61 Mon Sep 17 00:00:00 2001 From: alakril Date: Tue, 8 May 2018 14:43:51 +0300 Subject: [PATCH 050/286] Clearing and small fixes --- .../_ui_element/autocompletion_ajax.coffee | 15 ++++----------- .../autocompletion_multiple_ajax.coffee | 19 +++++++++++++++++++ .../app/controllers/_ui_element/select.coffee | 3 --- .../_ui_element/select_organization.coffee | 5 +++++ .../javascripts/app/controllers/users.coffee | 5 ----- .../javascripts/app/models/ticket.coffee | 2 +- app/controllers/long_polling_controller.rb | 2 +- app/controllers/tickets_controller.rb | 2 +- app/controllers/users_controller.rb | 3 ++- 9 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 app/assets/javascripts/app/controllers/_ui_element/autocompletion_multiple_ajax.coffee create mode 100644 app/assets/javascripts/app/controllers/_ui_element/select_organization.coffee diff --git a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee index 605a807d5f52..515beb196e91 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee @@ -1,17 +1,10 @@ # coffeelint: disable=camel_case_classes class App.UiElement.autocompletion_ajax @render: (attribute, params = {}) -> - id = attribute.value - if attribute.name == 'organization_ids' - if params[attribute.name]?.length > 0 || attribute.value?.length > 0 - object = App[attribute.relation].find(params[attribute.name] || attribute.value) - valueName = 'Alternative Organizations' - id = params.organization_ids[0] || attribute.value - else - if params[attribute.name] || attribute.value - object = App[attribute.relation].find(params[attribute.name] || attribute.value) - valueName = object.displayName() - id = params.organization_id || attribute.value + + if params[attribute.name] || attribute.value + object = App[attribute.relation].find(params[attribute.name] || attribute.value) + valueName = object.displayName() # selectable search searchableAjaxSelectObject = new App.SearchableAjaxSelect( diff --git a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_multiple_ajax.coffee b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_multiple_ajax.coffee new file mode 100644 index 000000000000..f699bdb7ccb4 --- /dev/null +++ b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_multiple_ajax.coffee @@ -0,0 +1,19 @@ +class App.UiElement.autocompletion_multiple_ajax + @render: (attribute, params = {}) -> + if params[attribute.name]?.length > 0 || attribute.value?.length > 0 + object = App[attribute.relation].find(params[attribute.name] || attribute.value) + valueName = object.displayName() + + # selectable search + searchableAjaxSelectObject = new App.SearchableAjaxSelect( + attribute: + value: params[attribute.name] || attribute.value + valueName: valueName + name: attribute.name + id: attribute.value + placeholder: App.i18n.translateInline('Search...') + limit: 40 + object: attribute.relation + ajax: true + ) + searchableAjaxSelectObject.element() \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/_ui_element/select.coffee b/app/assets/javascripts/app/controllers/_ui_element/select.coffee index 16334620f8a4..da812722e4fb 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/select.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/select.coffee @@ -20,9 +20,6 @@ class App.UiElement.select extends App.UiElement.ApplicationUiElement # sort attribute.options @sortOptions(attribute, params) - if attribute['name'] == 'organization_id' && attribute['default'] == 0 - attribute['default'] = attribute['filter'][0] - # finde selected/checked item of list @selectedOptions(attribute, params) diff --git a/app/assets/javascripts/app/controllers/_ui_element/select_organization.coffee b/app/assets/javascripts/app/controllers/_ui_element/select_organization.coffee new file mode 100644 index 000000000000..59ffc7d8c6cd --- /dev/null +++ b/app/assets/javascripts/app/controllers/_ui_element/select_organization.coffee @@ -0,0 +1,5 @@ +class App.UiElement.select_organization extends App.UiElement.select + @render: (attribute, params) -> + if attribute['name'] == 'organization_id' && attribute['default'] == 0 + attribute['default'] = attribute['filter'][0] + super(attribute, params) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/users.coffee b/app/assets/javascripts/app/controllers/users.coffee index 3a9adde88384..27b464580b1f 100644 --- a/app/assets/javascripts/app/controllers/users.coffee +++ b/app/assets/javascripts/app/controllers/users.coffee @@ -67,7 +67,6 @@ class Index extends App.ControllerSubContent value switchTo = (id,e) => - e.preventDefault() e.stopPropagation() @disconnectClient() @@ -87,7 +86,6 @@ class Index extends App.ControllerSubContent ) edit = (id, e) => - e.preventDefault() item = App.User.find(id) @@ -134,7 +132,6 @@ class Index extends App.ControllerSubContent ) search: => - role_ids = [] @$('.tab.active').each( (i,d) -> role_ids.push $(d).data('id') @@ -158,7 +155,6 @@ class Index extends App.ControllerSubContent ) recent: => - role_ids = [] @$('.tab.active').each( (i,d) -> role_ids.push $(d).data('id') @@ -182,7 +178,6 @@ class Index extends App.ControllerSubContent ) new: (e) -> - e.preventDefault() new App.ControllerGenericNew( pageData: diff --git a/app/assets/javascripts/app/models/ticket.coffee b/app/assets/javascripts/app/models/ticket.coffee index ff96ad58bbca..927894736a51 100644 --- a/app/assets/javascripts/app/models/ticket.coffee +++ b/app/assets/javascripts/app/models/ticket.coffee @@ -6,7 +6,7 @@ class App.Ticket extends App.Model { name: 'number', display: '#', tag: 'input', type: 'text', limit: 100, null: true, readonly: 1, width: '68px' }, { name: 'title', display: 'Title', tag: 'input', type: 'text', limit: 100, null: false }, { name: 'customer_id', display: 'Customer', tag: 'input', type: 'text', limit: 100, null: false, autocapitalize: false, relation: 'User' }, -# { name: 'organization_id', display: 'Organization', tag: 'select', relation: 'Organization', readonly: 1 }, + { name: 'organization_id', display: 'Organization', tag: 'select', relation: 'Organization' }, { name: 'group_id', display: 'Group', tag: 'select', multiple: false, limit: 100, null: false, relation: 'Group', width: '10%', edit: true }, { name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, limit: 100, null: true, relation: 'User', width: '12%', edit: true }, { name: 'state_id', display: 'State', tag: 'select', multiple: false, null: false, relation: 'TicketState', default: 'new', width: '12%', edit: true, customer: true }, diff --git a/app/controllers/long_polling_controller.rb b/app/controllers/long_polling_controller.rb index f5529f955604..294617ec6663 100644 --- a/app/controllers/long_polling_controller.rb +++ b/app/controllers/long_polling_controller.rb @@ -81,7 +81,7 @@ def message_receive render json: queue return end - 28.times do + 8.times do sleep 0.25 end #sleep 2 diff --git a/app/controllers/tickets_controller.rb b/app/controllers/tickets_controller.rb index 43466ef062a4..cab614ae5314 100644 --- a/app/controllers/tickets_controller.rb +++ b/app/controllers/tickets_controller.rb @@ -89,7 +89,7 @@ def create # overwrite params if !current_user.permissions?('ticket.agent') - %i[owner owner_id customer customer_id organization preferences].each do |key| + %i[owner owner_id customer customer_id organization organization_id preferences].each do |key| clean_params.delete(key) end clean_params[:customer_id] = current_user.id diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c91d90379d4a..fa8f9432e257 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -113,6 +113,7 @@ def show def create clean_params = User.association_name_to_id_convert(params) clean_params = User.param_cleanup(clean_params, true) + # check if it's first user, the admin user # inital admin account count = User.all.count @@ -508,10 +509,10 @@ def recent user_ids = [] assets = {} user_all.each do |user| - # byebug assets = user.assets(assets) user_ids.push user.id end + # return result render json: { assets: assets, From d38c6509c17006467b86591aeca728fb4282e21f Mon Sep 17 00:00:00 2001 From: Alexander <34770177+egorovdunice@users.noreply.github.com> Date: Tue, 8 May 2018 14:48:49 +0300 Subject: [PATCH 051/286] Update autocompletion_ajax.coffee --- .../app/controllers/_ui_element/autocompletion_ajax.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee index 515beb196e91..d6a15334dd39 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.coffee @@ -12,7 +12,7 @@ class App.UiElement.autocompletion_ajax value: params[attribute.name] || attribute.value valueName: valueName name: attribute.name - id: params.organization_ids || attribute.value + id: params.organization_id || attribute.value placeholder: App.i18n.translateInline('Search...') limit: 40 object: attribute.relation From 652ce572bcd73f2f3e8a0309660805023dfa06bb Mon Sep 17 00:00:00 2001 From: Alexander <34770177+egorovdunice@users.noreply.github.com> Date: Tue, 8 May 2018 14:49:43 +0300 Subject: [PATCH 052/286] Update customer_ticket_create.coffee --- .../javascripts/app/controllers/customer_ticket_create.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/controllers/customer_ticket_create.coffee b/app/assets/javascripts/app/controllers/customer_ticket_create.coffee index cbaaef5e55cb..ec30df9aa3c7 100644 --- a/app/assets/javascripts/app/controllers/customer_ticket_create.coffee +++ b/app/assets/javascripts/app/controllers/customer_ticket_create.coffee @@ -146,7 +146,7 @@ class Index extends App.ControllerContent sender_id: sender.id form_id: @form_id content_type: 'text/html' - organization_id: +params.organization_id + organization_id: params.organization_id } ticket.load(params) From 284daf39bf6f2fd097d57084aa756e774cc70659 Mon Sep 17 00:00:00 2001 From: alakril Date: Tue, 8 May 2018 15:37:09 +0300 Subject: [PATCH 053/286] Remove byebug --- .byebug_history | 89 ------------------- Gemfile | 2 +- Gemfile.lock | 2 - .../autocompletion_multiple_ajax.coffee | 2 +- 4 files changed, 2 insertions(+), 93 deletions(-) delete mode 100644 .byebug_history diff --git a/.byebug_history b/.byebug_history deleted file mode 100644 index b950dc2c3ede..000000000000 --- a/.byebug_history +++ /dev/null @@ -1,89 +0,0 @@ -c -continue -finish -c -next -help -c -local_attributes -localhost -c -continue -c -organization_id -c -local_attributes['organization_ids'] -c -data -data[:Organization][1] -data[:Organization][2] -:Organization -data[:Organization] -c -self.organization_ids -self.organization_id -c -attributes_with_association_ids -local_attributes['role_ids'] -local_attributes -c -user -c -id -c -user.organizations -c -user.organizations -user -c -local_attributes['organization_ids'] -c -id -c -data[ app_model ][ id ] -data[ app_model ] -id -c -user -c -с -user -c -с -id -c -local_attributes['organization_ids'] -c -local_attributes -data[ app_model ][ id ] -id -c -local_attributes -c -user.id -c -cc -c - local_attributes['role_ids'] -local_attributes['organization_ids'] -c -local_attributes -c -assets -user -c -user.assets(assets) -assets -user.organizations -user -c -assets -c -assets -c -user_ids.uniq -assets -c -clean_params -c -params diff --git a/Gemfile b/Gemfile index 490c93919e98..da0becb45f92 100644 --- a/Gemfile +++ b/Gemfile @@ -114,7 +114,7 @@ gem 'viewpoint' # Gems used only for develop/test and not required # in production environments by default. group :development, :test do - gem 'byebug' + # test frameworks gem 'rspec-rails' gem 'test-unit' diff --git a/Gemfile.lock b/Gemfile.lock index 463051ea4960..ab6b0c2cdca6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,7 +77,6 @@ GEM browser (2.5.2) buftok (0.2.0) builder (3.2.3) - byebug (10.0.1) childprocess (0.9.0) ffi (~> 1.0, >= 1.0.11) clavius (1.0.3) @@ -474,7 +473,6 @@ DEPENDENCIES autoprefixer-rails biz browser - byebug clearbit coffee-rails coffee-script-source diff --git a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_multiple_ajax.coffee b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_multiple_ajax.coffee index f699bdb7ccb4..ab8f709fa7fb 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_multiple_ajax.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_multiple_ajax.coffee @@ -1,7 +1,7 @@ class App.UiElement.autocompletion_multiple_ajax @render: (attribute, params = {}) -> if params[attribute.name]?.length > 0 || attribute.value?.length > 0 - object = App[attribute.relation].find(params[attribute.name] || attribute.value) + object = App[attribute.relation].find(params[attribute.name][0] || attribute.value[0]) valueName = object.displayName() # selectable search From 2dd45fa0eab31e94de56341d1dedd87d7a6a28ae Mon Sep 17 00:00:00 2001 From: alakril Date: Tue, 8 May 2018 15:56:35 +0300 Subject: [PATCH 054/286] Change migrations and seed --- db/migrate/20180418140353_add_input_to_ticket_create.rb | 2 +- db/migrate/20180426111843_change_object_manager_attributes.rb | 2 +- db/seeds/object_manager_attributes.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/db/migrate/20180418140353_add_input_to_ticket_create.rb b/db/migrate/20180418140353_add_input_to_ticket_create.rb index bd61d0d864af..56437d2cd116 100644 --- a/db/migrate/20180418140353_add_input_to_ticket_create.rb +++ b/db/migrate/20180418140353_add_input_to_ticket_create.rb @@ -8,7 +8,7 @@ def up object: 'Ticket', name: 'organization_id', display: 'Organization', - data_type: 'select', + data_type: 'select_organization', data_option: { relation: 'Organization', nulloption: false, diff --git a/db/migrate/20180426111843_change_object_manager_attributes.rb b/db/migrate/20180426111843_change_object_manager_attributes.rb index aa881cd7ffb2..6592b31b35b8 100644 --- a/db/migrate/20180426111843_change_object_manager_attributes.rb +++ b/db/migrate/20180426111843_change_object_manager_attributes.rb @@ -49,7 +49,7 @@ def change object: 'User', name: 'organization_ids', display: 'Alternative Organizations', - data_type: 'autocompletion_ajax', + data_type: 'autocompletion_multiple_ajax', data_option: { multiple: true, nulloption: true, diff --git a/db/seeds/object_manager_attributes.rb b/db/seeds/object_manager_attributes.rb index 8e7e24a275ec..13fed0322d5a 100644 --- a/db/seeds/object_manager_attributes.rb +++ b/db/seeds/object_manager_attributes.rb @@ -327,7 +327,7 @@ object: 'Ticket', name: 'organization_id', display: 'Organization', - data_type: 'select', + data_type: 'select_organization', data_option: { relation: 'Organization', nulloption: false, @@ -829,7 +829,7 @@ object: 'User', name: 'organization_ids', display: 'Alternative Organizations', - data_type: 'autocompletion_ajax', + data_type: 'autocompletion_multiple_ajax', data_option: { multiple: true, nulloption: true, From 528af399a49aec14f6f68817c849501f09a5301d Mon Sep 17 00:00:00 2001 From: alakril Date: Fri, 11 May 2018 12:58:09 +0300 Subject: [PATCH 055/286] Put multiple_select in a separate class --- .../autocompletion_multiple_ajax.coffee | 2 +- .../app/lib/app_post/searchable_select.coffee | 53 ++++--------------- .../z_searchable_multiple_select.coffee | 49 +++++++++++++++++ .../views/generic/searchable_select.jst.eco | 22 +++----- .../searchable_select_multiply.jst.eco | 24 +++++++++ 5 files changed, 93 insertions(+), 57 deletions(-) create mode 100644 app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee create mode 100644 app/assets/javascripts/app/views/generic/searchable_select_multiply.jst.eco diff --git a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_multiple_ajax.coffee b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_multiple_ajax.coffee index ab8f709fa7fb..48ec08a4dbbd 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_multiple_ajax.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_multiple_ajax.coffee @@ -5,7 +5,7 @@ class App.UiElement.autocompletion_multiple_ajax valueName = object.displayName() # selectable search - searchableAjaxSelectObject = new App.SearchableAjaxSelect( + searchableAjaxSelectObject = new App.SearchableMultipleSelect( attribute: value: params[attribute.name] || attribute.value valueName: valueName diff --git a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee index 4df20e1c26ac..842f4531ac66 100644 --- a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee @@ -36,24 +36,15 @@ class App.SearchableSelect extends Spine.Controller render: -> firstSelected = _.find @attribute.options, (option) -> option.selected - if @attribute.name == 'organization_ids' - @attribute.valueName = '' - organizations = '' - if @attribute.value - for value in @attribute.value - organizations += "
" + - "#{App.Organization.findNative(value).name}" + - "" + - "
" - @attribute.organizations = organizations - else - if firstSelected - @attribute.valueName = firstSelected.name - @attribute.value = firstSelected.value - else if @attribute.unknown && @attribute.value - @attribute.valueName = @attribute.value - else if @hasSubmenu @attribute.options - @attribute.valueName = @getName @attribute.value, @attribute.options + + if firstSelected + @attribute.valueName = firstSelected.name + @attribute.value = firstSelected.value + else if @attribute.unknown && @attribute.value + @attribute.valueName = @attribute.value + else if @hasSubmenu @attribute.options + @attribute.valueName = @getName @attribute.value, @attribute.options + @html App.view('generic/searchable_select') attribute: @attribute options: @renderAllOptions '', @attribute.options, 0 @@ -233,30 +224,8 @@ class App.SearchableSelect extends Spine.Controller return if !event.currentTarget.textContent @input.val event.currentTarget.textContent.trim() @input.trigger('change') - data_value = event.currentTarget.getAttribute('data-value') - if @shadowInput.length == 0 - @input.val '' - js_shadow_ids = $('.js-shadow-ids') - ids = [] - if js_shadow_ids.length > 0 - js_shadow_ids.each( -> ids.push $(this).val() ) - if !ids.includes(data_value) && $(".js-shadow[name='organization_id']").val() != data_value - newInput = @input.closest('.searchableSelect').find('div.items') - input = "" - wrapper = $("
").appendTo(newInput) - @span = $("#{event.currentTarget.getAttribute('title')}").appendTo( wrapper ) - @input = $(input).appendTo( wrapper ) - @input.val data_value - @input.trigger('change') - $('span.selected_organization').click -> - $(this).closest('div').remove() - else - @shadowInput.val data_value - @shadowInput.trigger('change') - $(".js-shadow-ids").each( -> - if $(this).val() == data_value - $(this).closest('div').remove() - ) + @shadowInput.val event.currentTarget.getAttribute('data-value') + @shadowInput.trigger('change') navigateIn: (event) -> diff --git a/app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee b/app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee new file mode 100644 index 000000000000..e211e33f64f4 --- /dev/null +++ b/app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee @@ -0,0 +1,49 @@ +class App.SearchableMultipleSelect extends App.SearchableAjaxSelect + + render: -> + @attribute.valueName = '' + organizations = '' + if @attribute.value + for value in @attribute.value + organizations += "
" + + "#{App.Organization.findNative(value).name}" + + ""+"
" + @attribute.organizations = organizations + + @html App.view('generic/searchable_select_multiply') + attribute: @attribute + options: @renderAllOptions '', @attribute.options, 0 + submenus: @renderSubmenus @attribute.options + + # initial data + @currentMenu = @findMenuContainingValue @attribute.value + @level = @getIndex @currentMenu + + selectItem: (event) -> + return if !event.currentTarget.textContent + @input.val event.currentTarget.textContent.trim() + @input.trigger('change') + data_value = event.currentTarget.getAttribute('data-value') + if @shadowInput.length == 0 + @input.val '' + js_shadow_ids = $('.js-shadow-ids') + ids = [] + if js_shadow_ids.length > 0 + js_shadow_ids.each( -> ids.push $(this).val() ) + if !ids.includes(data_value) && $(".js-shadow[name='organization_id']").val() != data_value + newInput = @input.closest('.searchableSelect').find('div.items') + input = "" + wrapper = $("
").appendTo(newInput) + @span = $("#{event.currentTarget.getAttribute('title')}").appendTo( wrapper ) + @input = $(input).appendTo( wrapper ) + @input.val data_value + @input.trigger('change') + $('span.selected_organization').click -> + $(this).closest('div').remove() + else + @shadowInput.val data_value + @shadowInput.trigger('change') + $(".js-shadow-ids").each( -> + if $(this).val() == data_value + $(this).closest('div').remove() + ) \ No newline at end of file diff --git a/app/assets/javascripts/app/views/generic/searchable_select.jst.eco b/app/assets/javascripts/app/views/generic/searchable_select.jst.eco index d216e0a50452..70139147ef4f 100644 --- a/app/assets/javascripts/app/views/generic/searchable_select.jst.eco +++ b/app/assets/javascripts/app/views/generic/searchable_select.jst.eco @@ -1,4 +1,12 @@ -
- <% if @attribute.name != 'organization_ids': %> - - <%= @attribute.autofocus %> - value="<%= @attribute.value %>" - > - <% else: %> - <%- @attribute.organizations %> - <% end %>
\ No newline at end of file diff --git a/app/assets/javascripts/app/views/generic/searchable_select_multiply.jst.eco b/app/assets/javascripts/app/views/generic/searchable_select_multiply.jst.eco new file mode 100644 index 000000000000..de872f627dbd --- /dev/null +++ b/app/assets/javascripts/app/views/generic/searchable_select_multiply.jst.eco @@ -0,0 +1,24 @@ + + +
+ <%- @attribute.organizations %> +
\ No newline at end of file From e0b4044d13f7fe8dd52e94e4cf890690fe1e5e16 Mon Sep 17 00:00:00 2001 From: alakril Date: Fri, 11 May 2018 14:37:47 +0300 Subject: [PATCH 056/286] Move template to new file --- .../lib/app_post/z_searchable_multiple_select.coffee | 7 ------- .../views/generic/searchable_select_multiply.jst.eco | 11 ++++++++++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee b/app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee index e211e33f64f4..edfcbba69b48 100644 --- a/app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee @@ -2,13 +2,6 @@ class App.SearchableMultipleSelect extends App.SearchableAjaxSelect render: -> @attribute.valueName = '' - organizations = '' - if @attribute.value - for value in @attribute.value - organizations += "
" + - "#{App.Organization.findNative(value).name}" + - ""+"
" - @attribute.organizations = organizations @html App.view('generic/searchable_select_multiply') attribute: @attribute diff --git a/app/assets/javascripts/app/views/generic/searchable_select_multiply.jst.eco b/app/assets/javascripts/app/views/generic/searchable_select_multiply.jst.eco index de872f627dbd..22594471804f 100644 --- a/app/assets/javascripts/app/views/generic/searchable_select_multiply.jst.eco +++ b/app/assets/javascripts/app/views/generic/searchable_select_multiply.jst.eco @@ -20,5 +20,14 @@ <%- @submenus %>
- <%- @attribute.organizations %> + <% if @attribute.value: %> + <% for value in @attribute.value: %> +
+ + <%- App.Organization.findNative(value).name %> + + +
+ <% end %> + <% end %>
\ No newline at end of file From a84d5ad189ff703259df73e4898ffecbb9a7388c Mon Sep 17 00:00:00 2001 From: alakril Date: Fri, 11 May 2018 15:19:34 +0300 Subject: [PATCH 057/286] Return database.yml.pkgr file --- config/database.yml.pkgr | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 config/database.yml.pkgr diff --git a/config/database.yml.pkgr b/config/database.yml.pkgr new file mode 100644 index 000000000000..2bb152a1e1cf --- /dev/null +++ b/config/database.yml.pkgr @@ -0,0 +1,8 @@ +production: + adapter: postgresql + database: zammad_production + pool: 50 + timeout: 5000 + encoding: utf8 + username: zammad + password: \ No newline at end of file From bbf52eea7f0ac72555a7ab7e869a47074526a235 Mon Sep 17 00:00:00 2001 From: alakril Date: Wed, 23 May 2018 17:06:57 +0300 Subject: [PATCH 058/286] Began to correct what was stated in the review --- .../controllers/_application_controller_form.coffee | 8 -------- .../_application_controller_form_organization.coffee | 10 ++++++++++ .../controllers/_ui_element/select_organization.coffee | 4 ++-- .../app/controllers/agent_ticket_create.coffee | 2 +- .../app/controllers/customer_ticket_create.coffee | 2 +- .../app/lib/app_post/searchable_select.coffee | 3 --- .../lib/app_post/z_searchable_multiple_select.coffee | 2 +- app/assets/javascripts/app/lib/bootstrap/transition.js | 1 - app/assets/javascripts/app/models/user.coffee | 4 ---- ...iply.jst.eco => searchable_multiple_select.jst.eco} | 2 +- config/database.yml.pkgr | 2 +- 11 files changed, 17 insertions(+), 23 deletions(-) create mode 100644 app/assets/javascripts/app/controllers/_application_controller_form_organization.coffee rename app/assets/javascripts/app/views/generic/{searchable_select_multiply.jst.eco => searchable_multiple_select.jst.eco} (93%) diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.coffee index 6981b49e9ad4..bba324f5d52e 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.coffee @@ -1,14 +1,6 @@ class App.ControllerForm extends App.Controller constructor: (params) -> super - if params['screen'] == 'create_middle_org' - @user = App.User.find(App.Session.get('id')) - @organizations = [] - if @user.organization_id - @organizations.push @user.organization_id - if @user.organization_ids - @organizations = @organizations.concat @user.organization_ids - params['filter']['organization_id'] = @organizations for key, value of params @[key] = value if !@handlers diff --git a/app/assets/javascripts/app/controllers/_application_controller_form_organization.coffee b/app/assets/javascripts/app/controllers/_application_controller_form_organization.coffee new file mode 100644 index 000000000000..2415a2cbb74f --- /dev/null +++ b/app/assets/javascripts/app/controllers/_application_controller_form_organization.coffee @@ -0,0 +1,10 @@ +class App.ControllerFormOrganization extends App.ControllerForm + constructor: (params) -> + @user = App.User.find(App.Session.get('id')) + @organizations = [] + if @user.organization_id + @organizations.push @user.organization_id + if @user.organization_ids + @organizations = @organizations.concat @user.organization_ids + params['filter']['organization_id'] = @organizations + super \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/_ui_element/select_organization.coffee b/app/assets/javascripts/app/controllers/_ui_element/select_organization.coffee index 59ffc7d8c6cd..6f8f4ea760ee 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/select_organization.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/select_organization.coffee @@ -1,5 +1,5 @@ class App.UiElement.select_organization extends App.UiElement.select @render: (attribute, params) -> - if attribute['name'] == 'organization_id' && attribute['default'] == 0 - attribute['default'] = attribute['filter'][0] + if attribute['default'] == 0 + attribute['default'] = attribute['filter']&[0] super(attribute, params) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee index 8e11dba9fb28..5adb29288ad3 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee @@ -301,7 +301,7 @@ class App.TicketCreate extends App.Controller noFieldset: true taskKey: @taskKey ) - new App.ControllerForm( + new App.ControllerFormOrganization( el: @$('.ticket-form-organization') form_id: @formId model: App.Ticket diff --git a/app/assets/javascripts/app/controllers/customer_ticket_create.coffee b/app/assets/javascripts/app/controllers/customer_ticket_create.coffee index ec30df9aa3c7..a3b1ff20033b 100644 --- a/app/assets/javascripts/app/controllers/customer_ticket_create.coffee +++ b/app/assets/javascripts/app/controllers/customer_ticket_create.coffee @@ -70,7 +70,7 @@ class Index extends App.ControllerContent noFieldset: true handlersConfig: handlers ) - new App.ControllerForm( + new App.ControllerFormOrganization( el: @el.find('.ticket-form-organization') form_id: @form_id model: App.Ticket diff --git a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee index 842f4531ac66..6865421be0d5 100644 --- a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee @@ -36,7 +36,6 @@ class App.SearchableSelect extends Spine.Controller render: -> firstSelected = _.find @attribute.options, (option) -> option.selected - if firstSelected @attribute.valueName = firstSelected.name @attribute.value = firstSelected.value @@ -44,7 +43,6 @@ class App.SearchableSelect extends Spine.Controller @attribute.valueName = @attribute.value else if @hasSubmenu @attribute.options @attribute.valueName = @getName @attribute.value, @attribute.options - @html App.view('generic/searchable_select') attribute: @attribute options: @renderAllOptions '', @attribute.options, 0 @@ -227,7 +225,6 @@ class App.SearchableSelect extends Spine.Controller @shadowInput.val event.currentTarget.getAttribute('data-value') @shadowInput.trigger('change') - navigateIn: (event) -> event.stopPropagation() @selectItem(event) diff --git a/app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee b/app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee index edfcbba69b48..0262da864af6 100644 --- a/app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee @@ -3,7 +3,7 @@ class App.SearchableMultipleSelect extends App.SearchableAjaxSelect render: -> @attribute.valueName = '' - @html App.view('generic/searchable_select_multiply') + @html App.view('generic/searchable_multiple_select') attribute: @attribute options: @renderAllOptions '', @attribute.options, 0 submenus: @renderSubmenus @attribute.options diff --git a/app/assets/javascripts/app/lib/bootstrap/transition.js b/app/assets/javascripts/app/lib/bootstrap/transition.js index c724bfd0c602..68c2bd60bf28 100644 --- a/app/assets/javascripts/app/lib/bootstrap/transition.js +++ b/app/assets/javascripts/app/lib/bootstrap/transition.js @@ -38,7 +38,6 @@ var $el = this $(this).one('bsTransitionEnd', function () { called = true }) var callback = function () { if (!called) $($el).trigger($.support.transition.end) } - $('span.selected_organization').click(function () { $(this).closest('div').remove() }) setTimeout(callback, duration) return this } diff --git a/app/assets/javascripts/app/models/user.coffee b/app/assets/javascripts/app/models/user.coffee index 4859675b6148..788a724dd618 100644 --- a/app/assets/javascripts/app/models/user.coffee +++ b/app/assets/javascripts/app/models/user.coffee @@ -16,7 +16,6 @@ class App.User extends App.Model { name: 'updated_at', display: 'Updated at', tag: 'datetime', readonly: 1 }, ] @configure_overview = [ -# 'login', 'firstname', 'lastname', 'email', 'updated_at', 'login', 'firstname', 'lastname', 'organization_id', 'organization_ids' ] @@ -134,9 +133,6 @@ class App.User extends App.Model if account == 'facebook' data['accounts'][account]['link'] = 'https://www.facebook.com/profile.php?id=' + data['accounts'][account]['uid'] -# if data.organization_id -# data.organization = App.Organization.findNative(data.organization_id) - if data['role_ids'] data['roles'] = [] for role_id in data['role_ids'] diff --git a/app/assets/javascripts/app/views/generic/searchable_select_multiply.jst.eco b/app/assets/javascripts/app/views/generic/searchable_multiple_select.jst.eco similarity index 93% rename from app/assets/javascripts/app/views/generic/searchable_select_multiply.jst.eco rename to app/assets/javascripts/app/views/generic/searchable_multiple_select.jst.eco index 22594471804f..632bd91674d2 100644 --- a/app/assets/javascripts/app/views/generic/searchable_select_multiply.jst.eco +++ b/app/assets/javascripts/app/views/generic/searchable_multiple_select.jst.eco @@ -23,7 +23,7 @@ <% if @attribute.value: %> <% for value in @attribute.value: %>
- + <%- App.Organization.findNative(value).name %> diff --git a/config/database.yml.pkgr b/config/database.yml.pkgr index 2bb152a1e1cf..a4ce131f59b4 100644 --- a/config/database.yml.pkgr +++ b/config/database.yml.pkgr @@ -5,4 +5,4 @@ production: timeout: 5000 encoding: utf8 username: zammad - password: \ No newline at end of file + password: From 50a828da135aa39ea4e43c7122aa661693310a82 Mon Sep 17 00:00:00 2001 From: alakril Date: Thu, 24 May 2018 15:17:43 +0300 Subject: [PATCH 059/286] Add class for multiple select with css. Create template and small rework select logic --- .../app/lib/app_post/searchable_select.coffee | 2 ++ .../z_searchable_multiple_select.coffee | 33 ++++++------------- .../searchable_multiple_select.jst.eco | 2 +- .../searchable_multiple_select_item.jst.eco | 4 +++ app/assets/stylesheets/zammad.scss | 4 +++ 5 files changed, 21 insertions(+), 24 deletions(-) create mode 100644 app/assets/javascripts/app/views/generic/searchable_multiple_select_item.jst.eco diff --git a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee index 6865421be0d5..17b44998b200 100644 --- a/app/assets/javascripts/app/lib/app_post/searchable_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/searchable_select.coffee @@ -21,6 +21,7 @@ class App.SearchableSelect extends Spine.Controller '.js-input': 'input' '.js-shadow': 'shadowInput' '.js-optionsList': 'optionsList' + '.items': 'itemList' '.js-optionsSubmenu': 'optionsSubmenu' '.js-autocomplete-invisible': 'invisiblePart' '.js-autocomplete-visible': 'visiblePart' @@ -224,6 +225,7 @@ class App.SearchableSelect extends Spine.Controller @input.trigger('change') @shadowInput.val event.currentTarget.getAttribute('data-value') @shadowInput.trigger('change') + $(".js-shadow-ids[value=#{event.currentTarget.getAttribute('data-value')}]").closest('div').remove() navigateIn: (event) -> event.stopPropagation() diff --git a/app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee b/app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee index 0262da864af6..128bd60fd64f 100644 --- a/app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/z_searchable_multiple_select.coffee @@ -17,26 +17,13 @@ class App.SearchableMultipleSelect extends App.SearchableAjaxSelect @input.val event.currentTarget.textContent.trim() @input.trigger('change') data_value = event.currentTarget.getAttribute('data-value') - if @shadowInput.length == 0 - @input.val '' - js_shadow_ids = $('.js-shadow-ids') - ids = [] - if js_shadow_ids.length > 0 - js_shadow_ids.each( -> ids.push $(this).val() ) - if !ids.includes(data_value) && $(".js-shadow[name='organization_id']").val() != data_value - newInput = @input.closest('.searchableSelect').find('div.items') - input = "" - wrapper = $("
").appendTo(newInput) - @span = $("#{event.currentTarget.getAttribute('title')}").appendTo( wrapper ) - @input = $(input).appendTo( wrapper ) - @input.val data_value - @input.trigger('change') - $('span.selected_organization').click -> - $(this).closest('div').remove() - else - @shadowInput.val data_value - @shadowInput.trigger('change') - $(".js-shadow-ids").each( -> - if $(this).val() == data_value - $(this).closest('div').remove() - ) \ No newline at end of file + @input.val '' + js_shadow_ids = $('.js-shadow-ids') + ids = [] + if js_shadow_ids.length > 0 + js_shadow_ids.each( -> ids.push $(this).val() ) + unless ids.includes(data_value) || $(".js-shadow[name='organization_id']").val() == data_value + html = App.view('generic/searchable_multiple_select_item') + title: event.currentTarget.getAttribute('title') + data_value: parseInt(data_value) + @itemList.append html \ No newline at end of file diff --git a/app/assets/javascripts/app/views/generic/searchable_multiple_select.jst.eco b/app/assets/javascripts/app/views/generic/searchable_multiple_select.jst.eco index 632bd91674d2..24a13e784348 100644 --- a/app/assets/javascripts/app/views/generic/searchable_multiple_select.jst.eco +++ b/app/assets/javascripts/app/views/generic/searchable_multiple_select.jst.eco @@ -13,7 +13,7 @@ <% if !@attribute.ajax: %><%- @Icon('arrow-down', 'dropdown-arrow') %><% end %>
-