diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..28475a0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +# Editor swap files +*.swn +*.swp +*.swo +*~ + +# TidyAll used for the hook .git/hooks/pre-commit +TidyAll diff --git a/FAQ.sopm b/FAQ.sopm index 0a7a8cc..6acc2a2 100644 --- a/FAQ.sopm +++ b/FAQ.sopm @@ -303,8 +303,6 @@ $Kernel::OM->Get($CodeModule)->CodeReinstall(); - - diff --git a/Kernel/Config/Files/XML/FAQ.xml b/Kernel/Config/Files/XML/FAQ.xml index ea78283..5c2907d 100644 --- a/Kernel/Config/Files/XML/FAQ.xml +++ b/Kernel/Config/Files/XML/FAQ.xml @@ -272,7 +272,7 @@ Your OTOBO Notification Master - Definition of FAQ item free text field. + Definition of FAQ item free text field. Possible values for 'Show' are e.g. an empty string, 'public' and 'internal'. Core::FAQ::Item @@ -283,7 +283,7 @@ Your OTOBO Notification Master - Definition of FAQ item free text field. + Definition of FAQ item free text field. Possible values for 'Show' are e.g. an empty string, 'public' and 'internal'. Core::FAQ::Item @@ -294,7 +294,7 @@ Your OTOBO Notification Master - Definition of FAQ item free text field. + Definition of FAQ item free text field. Possible values for 'Show' are e.g. an empty string, 'public' and 'internal'. Core::FAQ::Item @@ -305,7 +305,7 @@ Your OTOBO Notification Master - Definition of FAQ item free text field. + Definition of FAQ item free text field. Possible values for 'Show' are e.g. an empty string, 'public' and 'internal'. Core::FAQ::Item @@ -316,7 +316,7 @@ Your OTOBO Notification Master - Definition of FAQ item free text field. + Definition of FAQ item free text field. Possible values for 'Show' are e.g. an empty string, 'public' and 'internal'. Core::FAQ::Item @@ -327,7 +327,7 @@ Your OTOBO Notification Master - Definition of FAQ item free text field. + Definition of FAQ item free text field. Possible values for 'Show' are e.g. an empty string, 'public' and 'internal'. Core::FAQ::Item diff --git a/Kernel/Modules/CustomerFAQExplorer.pm b/Kernel/Modules/CustomerFAQExplorer.pm index fab6884..d84c1c8 100644 --- a/Kernel/Modules/CustomerFAQExplorer.pm +++ b/Kernel/Modules/CustomerFAQExplorer.pm @@ -2,7 +2,7 @@ # OTOBO is a web-based ticketing system for service organisations. # -- # Copyright (C) 2001-2019 OTRS AG, https://otrs.com/ -# Copyright (C) 2019-2020 Rother OSS GmbH, https://otobo.de/ +# Copyright (C) 2019-2022 Rother OSS GmbH, https://otobo.de/ # -- # This program is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software @@ -16,8 +16,15 @@ package Kernel::Modules::CustomerFAQExplorer; +use v5.24; use strict; use warnings; + +# core modules + +# CPAN modules + +# OTOBO modules use Kernel::Language qw(Translatable); our $ObjectManagerDisabled = 1; @@ -26,10 +33,7 @@ sub new { my ( $Type, %Param ) = @_; # allocate new hash for object - my $Self = {%Param}; - bless( $Self, $Type ); - - return $Self; + return bless {%Param}, $Type; } sub Run { @@ -44,7 +48,7 @@ sub Run { # get config data my $StartHit = int( $ParamObject->GetParam( Param => 'StartHit' ) || 1 ); - my $SearchLimit = $Config->{SearchLimit} || 200; + my $SearchLimit = $Config->{SearchLimit} || 200; my $SearchPageShown = $Config->{SearchPageShown} || 3; my $SortBy = $ParamObject->GetParam( Param => 'SortBy' ) || $Config->{'SortBy::Default'} @@ -121,7 +125,7 @@ sub Run { ); # AddJSData for ES - my $ESActive = $ConfigObject->Get( 'Elasticsearch::Active' ); + my $ESActive = $ConfigObject->Get('Elasticsearch::Active'); $LayoutObject->AddJSData( Key => 'ESActive', @@ -136,14 +140,14 @@ sub Run { # show search results if ( $Self->{Subaction} && $Self->{Subaction} eq 'Search' ) { - my $SearchName = Translatable("Search").":"; - for my $Mode ( qw/Keyword What/ ) { + my $SearchName = Translatable("Search") . ":"; + for my $Mode (qw/Keyword What/) { my $String = $ParamObject->GetParam( Param => $Mode ); - if ( $String ) { - $Search{ $Mode } = $String; - $FAQSearch{ $Mode } = "*$String*"; + if ($String) { + $Search{$Mode} = $String; + $FAQSearch{$Mode} = "*$String*"; my $ModeName = $Mode eq 'What' ? 'Fulltext' : $Mode; - $SearchName .= " ".Translatable($ModeName)." \"$String\";"; + $SearchName .= " " . Translatable($ModeName) . " \"$String\";"; } } @@ -155,11 +159,12 @@ sub Run { CategoryID => 0, }, ); + # output search information $LayoutObject->Block( Name => 'FAQPathCategoryElementNoLink', Data => { - Name => $SearchName, + Name => $SearchName, }, ); @@ -168,7 +173,7 @@ sub Run { } # no search ( standard mode ) - else { + else { # show FAQ path $LayoutObject->FAQPathShow( FAQObject => $FAQObject, @@ -241,15 +246,24 @@ sub Run { UserID => $Self->{UserID}, ); - # include Category if not in base Category (0), or search mode + # use given category, or limit to the categories that are available for the customer if ( $CategoryID > 0 ) { - $FAQSearch{CategoryIDs} = [$CategoryID], + $FAQSearch{CategoryIDs} = [$CategoryID]; + } + else { + # Need GetSubCategories => 1, so cannot use $CategoryIDsRef + $FAQSearch{CategoryIDs} = $FAQObject->CustomerCategorySearch( + CustomerUser => $Self->{UserLogin}, + GetSubCategories => 1, + Mode => 'Customer', + UserID => $Self->{UserID}, + ); } # get the latest articles for the root category (else empty) - elsif ( !%Search ) { - $SortBy = 'Changed'; - $OrderBy = 'Down'; + if ( $CategoryID <= 0 && !%Search ) { + $SortBy = 'Changed'; + $OrderBy = 'Down'; $SearchLimit = 10; } @@ -366,14 +380,14 @@ sub Run { $Link .= 'Order=' . $LayoutObject->LinkEncode($OrderBy) . ';'; my $ActionString; - if ( %Search ) { + if (%Search) { $ActionString = "Action=CustomerFAQExplorer;Subaction=Search;"; - if ( $FAQSearch{CategoryIDs} ) { - $ActionString .= "CategoryID=$CategoryID;"; - } - for my $Mode ( keys %Search ) { - $ActionString .= "$Mode=$Search{ $Mode };"; - } + if ( $FAQSearch{CategoryIDs} ) { + $ActionString .= "CategoryID=$CategoryID;"; + } + for my $Mode ( keys %Search ) { + $ActionString .= "$Mode=$Search{ $Mode };"; + } } else { $ActionString = "Action=CustomerFAQExplorer;CategoryID=$CategoryID"; diff --git a/Kernel/Output/HTML/Templates/Standard/AgentFAQLanguage.tt.save b/Kernel/Output/HTML/Templates/Standard/AgentFAQLanguage.tt.save deleted file mode 100644 index 8ad3267..0000000 --- a/Kernel/Output/HTML/Templates/Standard/AgentFAQLanguage.tt.save +++ /dev/null @@ -1,214 +0,0 @@ -# -- -# OTOBO is a web-based ticketing system for service organisations. -# -- -# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/ -# Copyright (C) 2019-2020 Rother OSS GmbH, https://otobo.de/ -# -- -# This program is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later version. -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -- - -[% RenderBlockStart("Overview") %] -
-

[% Translate("FAQ Language Management") | html %]

- - [% BreadcrumbPath = [ - { - Name => Translate('FAQ Language Management'), - Link => Env("Action"), - }, - ] - %] - - [% SWITCH Data.Action %] - [% CASE 'Add' %] - [% BreadcrumbPath.push({ Name => Translate("Add FAQ Language"),}) %] - [% CASE 'Change' %] - [% USE EditTitle = String(Translate("Edit FAQ Language")) %] - [% BreadcrumbPath.push({ Name => EditTitle.append( ': ', Data.Name ) }) %] - [% END %] - - [% INCLUDE "Breadcrumb.tt" Path = BreadcrumbPath Type = "Agent" %] - -
- -[% RenderBlockStart("Disabled") %] -
-
-

[% Translate("Notice") | html %]

-
-
-
- - - -

[% Translate("This feature is disabled!") | html %]

-
-

- [% Translate("Use this feature if you want to work with multiple languages.") | html %] -

-
- -
-
-
-
-
-
-[% RenderBlockEnd("Disabled") %] - -[% RenderBlockStart("ActionList") %] -
- -
-

[% Translate("Actions") | html %]

-
-
- -
-
-[% RenderBlockEnd("ActionList") %] -
-[% RenderBlockStart("OverviewResult") %] -
-
-
-

[% Translate("List") | html %]

-
-
- - - - - - - - - -[% RenderBlockStart("NoDataFoundMsg") %] - - - -[% RenderBlockEnd("NoDataFoundMsg") %] -[% RenderBlockStart("OverviewResultRow") %] - - - - -[% RenderBlockEnd("OverviewResultRow") %] - -
[% Translate("Name") | html %][% Translate("Delete") | html %]
- [% Translate("No data found.") | html %] -
[% Data.Name | html %] - - - [% Translate("Delete") | html %]: [% Data.Name | html %] - -
-
-[% RenderBlockEnd("OverviewResult") %] - -[% RenderBlockStart("OverviewUpdate") %] -
-
-
-[% RenderBlockStart("HeaderAdd") %] -

[% Translate("Add Language") | html %]

-[% RenderBlockEnd("HeaderAdd") %] -[% RenderBlockStart("HeaderEdit") %] -

[% Translate("Edit Language") | html %]

-[% RenderBlockEnd("HeaderEdit") %] -
-
-
- - - -
- -
- -
-

[% Translate("This field is required.") | html %]

-
-
-

[% Translate(Data.NameServerErrorMessage) | html %]

-
-
- -
- - [% Translate("or") | html %] - [% Translate("Cancel") | html %] -
-
-
-
-
-
-
-[% RenderBlockEnd("OverviewUpdate") %] -
-
-
-
-[% RenderBlockEnd("Overview") %] - -[% RenderBlockStart("Delete") %] -[% RenderBlockStart("NoAffectedItems") %] -
- -

- [% Data.Name | html %] -

-
-
-

- [% Translate("Do you really want to delete this language?") | html %] -

-[% RenderBlockEnd("NoAffectedItems") %] - -[% RenderBlockStart("AffectedItems") %] -

- [% Translate("You can not delete this language. It is used in at least one FAQ article!") | html %] -

-

- [% Translate("This language is used in the following FAQ Article(s)") | html %]: -

- - - -[% RenderBlockEnd("AffectedItems") %] -[% RenderBlockEnd("Delete") %] diff --git a/Kernel/Output/HTML/Templates/Standard/CustomerFAQRelatedArticles.tt b/Kernel/Output/HTML/Templates/Standard/CustomerFAQRelatedArticles.tt index 4848400..4e8b401 100644 --- a/Kernel/Output/HTML/Templates/Standard/CustomerFAQRelatedArticles.tt +++ b/Kernel/Output/HTML/Templates/Standard/CustomerFAQRelatedArticles.tt @@ -15,7 +15,7 @@ # -- -
+

[% Translate("This might be helpful") | html %]

diff --git a/bin/cgi-bin/faq.pl b/bin/cgi-bin/faq.pl deleted file mode 100644 index 58d2d57..0000000 --- a/bin/cgi-bin/faq.pl +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/perl -# -- -# OTOBO is a web-based ticketing system for service organisations. -# -- -# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/ -# Copyright (C) 2019-2020 Rother OSS GmbH, https://otobo.de/ -# -- -# This program is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later version. -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -- - -use strict; -use warnings; - -# Use ../../ as lib location. -use FindBin qw($Bin); -use lib "$Bin/../.."; -use lib "$Bin/../../Kernel/cpan-lib"; -use lib "$Bin/../../Custom"; - -# 0=off;1=on; -my $Debug = 0; - -print "location: public.pl?Action=PublicFAQExplorer\n"; -print "\n"; -print "moved\n"; diff --git a/bin/fcgi-bin/faq.fpl b/bin/fcgi-bin/faq.fpl deleted file mode 100644 index 90b3115..0000000 --- a/bin/fcgi-bin/faq.fpl +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/perl -# -- -# faq.pl - the global CGI handle file for OTOBO -# Copyright (C) 2001-2012 Rother OSS GmbH, http://otobo.org/ -# -- -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU AFFERO General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# or see http://www.gnu.org/licenses/agpl.txt. -# -- - -use strict; -use warnings; - -# Use ../../ as lib location. -use FindBin qw($Bin); -use lib "$Bin/../.."; -use lib "$Bin/../../Kernel/cpan-lib"; -use lib "$Bin/../../Custom"; - -use vars qw(@INC); - -# 0=off;1=on; -my $Debug = 0; - -# Check @INC for mod_perl (add lib path for "require module"!). -push (@INC, "$Bin/../..", "$Bin/../../Kernel/cpan-lib"); - -print "location: public.fpl?Action=PublicFAQExplorer\n"; -print "\n"; -print "moved\n";