Skip to content

Commit

Permalink
Synchronization between otrs5 and otrs6. Special thanks goes to: @rsn…
Browse files Browse the repository at this point in the history
  • Loading branch information
dennykorsukewitz committed Sep 3, 2020
1 parent aed017e commit f8f662f
Show file tree
Hide file tree
Showing 10 changed files with 357 additions and 64 deletions.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: 'Bug report'
labels: ''
assignees: ''
---

### Expected behavior
A clear and concise description of what you expected to happen.

### Actual behavior
A clear and concise description of what happened (the issue/bug/problem).

### How to reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

### Screenshots
If applicable, add screenshots to help explain your problem.

### Environment
- OS: [e.g. Windows, MacOS, Linux]
- Browser: [e. g. Chrome, Firefox, Safari]
- OTRS version [e. g. 6.0.15]

### Additional information
Add any other information about the problem here.
121 changes: 120 additions & 1 deletion Kernel/Config/Files/XML/Znuny4OTRSQuickClose.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
<Item ValueType="String" ValueRegex="">Ticket was closed</Item>
</Value>
</Setting>

<Setting Name="Znuny4OTRS::QuickClose::State" Required="0" Valid="1">
<Description Translatable="1">Defines the close state for quick close.</Description>
<Navigation>Core::Znuny4OTRS::QuickClose</Navigation>
Expand All @@ -89,6 +88,66 @@
</Hash>
</Value>
</Setting>
<Setting Name="Ticket::Frontend::MenuModule###452-QuickClose" Required="0" Valid="1">
<Description Translatable="1">Shows a link in the menu to quick close a ticket in the ticket zoom view of the agent interface.</Description>
<Navigation>Frontend::Agent::View::TicketZoom::MenuModule</Navigation>
<Value>
<Hash>
<Item Key="Module">Kernel::Output::HTML::TicketMenu::Generic</Item>
<Item Key="Name" Translatable="1">Quick Close</Item>
<Item Key="Description" Translatable="1">Close this ticket</Item>
<Item Key="Action">AgentTicketZnuny4OTRSQuickClose</Item>
<Item Key="Link">Action=AgentTicketZnuny4OTRSQuickClose;TicketID=[% Data.TicketID | html %]</Item>
<Item Key="Target"></Item>
<Item Key="PopupType"></Item>
</Hash>
</Value>
</Setting>
<Setting Name="Ticket::Frontend::MenuModule###453-QuickClose" Required="0" Valid="1">
<Description Translatable="1">Shows a link in the menu to quick close a ticket in the ticket zoom view of the agent interface.</Description>
<Navigation>Frontend::Agent::View::TicketZoom::MenuModule</Navigation>
<Value>
<Hash>
<Item Key="Module">Kernel::Output::HTML::TicketMenu::Generic</Item>
<Item Key="Name" Translatable="1">Quick Close</Item>
<Item Key="Description" Translatable="1">Close this ticket</Item>
<Item Key="Action">AgentTicketZnuny4OTRSQuickClose</Item>
<Item Key="Link">Action=AgentTicketZnuny4OTRSQuickClose;TicketID=[% Data.TicketID | html %]</Item>
<Item Key="Target"></Item>
<Item Key="PopupType"></Item>
</Hash>
</Value>
</Setting>
<Setting Name="Ticket::Frontend::MenuModule###454-QuickClose" Required="0" Valid="1">
<Description Translatable="1">Shows a link in the menu to quick close a ticket in the ticket zoom view of the agent interface.</Description>
<Navigation>Frontend::Agent::View::TicketZoom::MenuModule</Navigation>
<Value>
<Hash>
<Item Key="Module">Kernel::Output::HTML::TicketMenu::Generic</Item>
<Item Key="Name" Translatable="1">Quick Close</Item>
<Item Key="Description" Translatable="1">Close this ticket</Item>
<Item Key="Action">AgentTicketZnuny4OTRSQuickClose</Item>
<Item Key="Link">Action=AgentTicketZnuny4OTRSQuickClose;TicketID=[% Data.TicketID | html %]</Item>
<Item Key="Target"></Item>
<Item Key="PopupType"></Item>
</Hash>
</Value>
</Setting>
<Setting Name="Ticket::Frontend::MenuModule###455-QuickClose" Required="0" Valid="1">
<Description Translatable="1">Shows a link in the menu to quick close a ticket in the ticket zoom view of the agent interface.</Description>
<Navigation>Frontend::Agent::View::TicketZoom::MenuModule</Navigation>
<Value>
<Hash>
<Item Key="Module">Kernel::Output::HTML::TicketMenu::Generic</Item>
<Item Key="Name" Translatable="1">Quick Close</Item>
<Item Key="Description" Translatable="1">Close this ticket</Item>
<Item Key="Action">AgentTicketZnuny4OTRSQuickClose</Item>
<Item Key="Link">Action=AgentTicketZnuny4OTRSQuickClose;TicketID=[% Data.TicketID | html %]</Item>
<Item Key="Target"></Item>
<Item Key="PopupType"></Item>
</Hash>
</Value>
</Setting>
<Setting Name="Ticket::Frontend::PreMenuModule###441-QuickClose" Required="0" Valid="1">
<Description Translatable="1">Shows a link in the menu to quick close a ticket in every ticket overview of the agent interface.</Description>
<Navigation>Frontend::Agent::TicketOverview::MenuModule</Navigation>
Expand All @@ -104,6 +163,66 @@
</Hash>
</Value>
</Setting>
<Setting Name="Ticket::Frontend::PreMenuModule###442-QuickClose" Required="0" Valid="1">
<Description Translatable="1">Shows a link in the menu to quick close a ticket in every ticket overview of the agent interface.</Description>
<Navigation>Frontend::Agent::TicketOverview::MenuModule</Navigation>
<Value>
<Hash>
<Item Key="Module">Kernel::Output::HTML::TicketMenu::Generic</Item>
<Item Key="Name" Translatable="1">Quick Close</Item>
<Item Key="Description" Translatable="1">Close this ticket</Item>
<Item Key="Action">AgentTicketZnuny4OTRSQuickClose</Item>
<Item Key="Link">Action=AgentTicketZnuny4OTRSQuickClose;TicketID=[% Data.TicketID | html %]</Item>
<Item Key="Target"></Item>
<Item Key="PopupType"></Item>
</Hash>
</Value>
</Setting>
<Setting Name="Ticket::Frontend::PreMenuModule###443-QuickClose" Required="0" Valid="1">
<Description Translatable="1">Shows a link in the menu to quick close a ticket in every ticket overview of the agent interface.</Description>
<Navigation>Frontend::Agent::TicketOverview::MenuModule</Navigation>
<Value>
<Hash>
<Item Key="Module">Kernel::Output::HTML::TicketMenu::Generic</Item>
<Item Key="Name" Translatable="1">Quick Close</Item>
<Item Key="Description" Translatable="1">Close this ticket</Item>
<Item Key="Action">AgentTicketZnuny4OTRSQuickClose</Item>
<Item Key="Link">Action=AgentTicketZnuny4OTRSQuickClose;TicketID=[% Data.TicketID | html %]</Item>
<Item Key="Target"></Item>
<Item Key="PopupType"></Item>
</Hash>
</Value>
</Setting>
<Setting Name="Ticket::Frontend::PreMenuModule###444-QuickClose" Required="0" Valid="1">
<Description Translatable="1">Shows a link in the menu to quick close a ticket in every ticket overview of the agent interface.</Description>
<Navigation>Frontend::Agent::TicketOverview::MenuModule</Navigation>
<Value>
<Hash>
<Item Key="Module">Kernel::Output::HTML::TicketMenu::Generic</Item>
<Item Key="Name" Translatable="1">Quick Close</Item>
<Item Key="Description" Translatable="1">Close this ticket</Item>
<Item Key="Action">AgentTicketZnuny4OTRSQuickClose</Item>
<Item Key="Link">Action=AgentTicketZnuny4OTRSQuickClose;TicketID=[% Data.TicketID | html %]</Item>
<Item Key="Target"></Item>
<Item Key="PopupType"></Item>
</Hash>
</Value>
</Setting>
<Setting Name="Ticket::Frontend::PreMenuModule###445-QuickClose" Required="0" Valid="1">
<Description Translatable="1">Shows a link in the menu to quick close a ticket in every ticket overview of the agent interface.</Description>
<Navigation>Frontend::Agent::TicketOverview::MenuModule</Navigation>
<Value>
<Hash>
<Item Key="Module">Kernel::Output::HTML::TicketMenu::Generic</Item>
<Item Key="Name" Translatable="1">Quick Close</Item>
<Item Key="Description" Translatable="1">Close this ticket</Item>
<Item Key="Action">AgentTicketZnuny4OTRSQuickClose</Item>
<Item Key="Link">Action=AgentTicketZnuny4OTRSQuickClose;TicketID=[% Data.TicketID | html %]</Item>
<Item Key="Target"></Item>
<Item Key="PopupType"></Item>
</Hash>
</Value>
</Setting>
<Setting Name="Frontend::Module###AgentTicketZnuny4OTRSQuickClose" Required="0" Valid="1">
<Description Translatable="1">Frontend module registration for the agent interface.</Description>
<Navigation>Frontend::Agent::ModuleRegistration</Navigation>
Expand Down
10 changes: 6 additions & 4 deletions Kernel/Language/de_Znuny4OTRSQuickClose.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# --
# Kernel/Language/de_Znuny4OTRSQuickClose.pm - the german translation of the texts of Znuny4OTRS-QuickClose
# Copyright (C) 2012-2020 Znuny GmbH, http://znuny.com/
# Copyright (C) (2014) (Denny Bresch) (dennybresch@gmail.com) (https://github.com/dennybresch)
# Copyright (C) (2014) (Denny Korsukéwitz) (dennykorsukewitz@gmail.com) (https://github.com/dennykorsukewitz)
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
Expand Down Expand Up @@ -33,14 +32,17 @@ sub Data {
$Self->{Translation}->{'Defines the content type for the quick close action, which gets used for ticket history in the agent interface.'} = 'Definiert den Content-Typ für die Schnellschließaktion, der für die Tickethistorie in der Agentenoberfläche verwendet wird.';
$Self->{Translation}->{'Defines the history type for the quick close action, which gets used for ticket history in the agent interface.'} = 'Definiert den History-Typ für die Schnellschließaktion, der für die Tickethistorie in der Agentenoberfläche verwendet wird.';
$Self->{Translation}->{'Defines the history comment for the quick close action, which gets used for ticket history in the agent interface.'} = 'Definiert den History-Kommentar für die Schnellschließaktion, der für die Ticket-Historie in der Agentenoberfläche verwendet wird.';
$Self->{Translation}->{'Defines the close state for quick close.'} = 'Definiert den Schließ-Status für die Schnellschließaktion.';

$Self->{Translation}->{'Shows a link in the menu to quick close a ticket in the ticket zoom view of the agent interface.'} = 'Zeigt in der Ticket-Zoom-Ansicht der Agentenoberfläche einen Link im Menü an, um ein Ticket schnell zu schließen.';
$Self->{Translation}->{'Shows a link in the menu to quick close a ticket in every ticket overview of the agent interface.'} = 'Zeigt in jeder Ticket-Übersicht der Agentenschnittstelle einen Link im Menü zum schnellen Schließen eines Tickets an.';

# Frontend
$Self->{Translation}->{'Quick Close'} = 'sofort schließen';
$Self->{Translation}->{'Ticket closed'} = 'Ticket geschlossen';
$Self->{Translation}->{'Ticket Close'} = 'Ticket schließen';
$Self->{Translation}->{'Ticket was closed'} = 'Ticket wurde geschlossen';



return 1;
}

Expand Down
103 changes: 65 additions & 38 deletions Kernel/Modules/AgentTicketZnuny4OTRSQuickClose.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# --
# Copyright (C) 2012-2020 Znuny GmbH, http://znuny.com/
# Copyright (C) (2014) (Denny Bresch) (dennybresch@gmail.com) (https://github.com/dennybresch)
# Copyright (C) (2014) (Denny Korsukéwitz) (dennykorsukewitz@gmail.com) (https://github.com/dennykorsukewitz)
# Copyright (C) (2020) (rsnakin) (https://github.com/rsnakin)

# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
Expand All @@ -9,20 +11,24 @@

package Kernel::Modules::AgentTicketZnuny4OTRSQuickClose;

use Kernel::System::VariableCheck qw(:all);

use strict;
use warnings;

our @ObjectDependencies = (
'Kernel::Config',
'Kernel::Output::HTML::Layout',
'Kernel::System::DynamicField',
'Kernel::System::DynamicField::Backend',
'Kernel::System::Ticket',
'Kernel::System::Ticket::Article',
'Kernel::System::Web::Request',
);

sub new {
my ( $Type, %Param ) = @_;

# allocate new hash for object
my $Self = {%Param};
bless( $Self, $Type );

Expand All @@ -32,38 +38,86 @@ sub new {
sub Run {
my ( $Self, %Param ) = @_;

my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
my $ArticleObject = $Kernel::OM->Get('Kernel::System::Ticket::Article');
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
my $ArticleObject = $Kernel::OM->Get('Kernel::System::Ticket::Article');
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
my $ParamObject = $Kernel::OM->Get('Kernel::System::Web::Request');
my $DynamicFieldObject = $Kernel::OM->Get('Kernel::System::DynamicField');
my $DynamicFieldBackendObject = $Kernel::OM->Get('Kernel::System::DynamicField::Backend');

my @ParamNames = $ParamObject->GetParamNames();

my %GetParam;
for my $Param (@ParamNames) {
$GetParam{$Param} = $ParamObject->GetParam( Param => $Param ) || '';
}

# check needed stuff
if ( !$Self->{TicketID} ) {
return $LayoutObject->ErrorScreen(
Message => 'No TicketID is given!',
Comment => 'Please contact the admin.',
);
}

# check permissions
my $Access = $TicketObject->TicketPermission(
Type => 'close',
TicketID => $Self->{TicketID},
UserID => $Self->{UserID}
);

# error screen, don't show ticket
if ( !$Access ) {
return $LayoutObject->NoPermission(
Message => "You need $Self->{Config}->{Permission} permissions!",
WithHeader => 'yes',
);
}

$Self->_SetState();

my $Config = $ConfigObject->Get('Znuny4OTRSQuickClose');

my $DynamicField = $DynamicFieldObject->DynamicFieldListGet(
Valid => 1,
ObjectType => 'Ticket',
);

GETPARAM:
for my $Param ( sort keys %GetParam ) {

# set dynamic fields values via url / link (DynamicField_NAME=ZnunyRocks;)
next GETPARAM if $Param !~ m{^DynamicField_(.*)}xms;
if ( $Param =~ m{^DynamicField_(.*)}xms ) {

my $Value = $GetParam{$Param} || '';
my $DynamicFieldName = $1;
my $DynamicFieldConfig = ( grep { $_->{Name} eq $DynamicFieldName } @{$DynamicField} )[0];

next GETPARAM if !defined $Value || !IsHashRefWithData($DynamicFieldConfig);

$DynamicFieldBackendObject->ValueSet(
DynamicFieldConfig => $DynamicFieldConfig,
ObjectID => $Self->{TicketID},
Value => $Value,
UserID => $Self->{UserID},
);
}
}

my $State = $GetParam{State} || $ConfigObject->Get('Znuny4OTRS::QuickClose::State');
if ($State) {
my $Success = $TicketObject->TicketStateSet(
State => $State,
TicketID => $Self->{TicketID},
UserID => $Self->{UserID},
);
if ($Success) {
$TicketObject->TicketLockSet(
TicketID => $Self->{TicketID},
Lock => 'unlock',
UserID => $Self->{UserID},
);
}
}

return $LayoutObject->Redirect( OP => $Self->{LastScreenOverview} ) if !$Config->{Article};

my $ArticleID = $ArticleObject->ArticleCreate(
Expand All @@ -83,31 +137,4 @@ sub Run {
return $LayoutObject->Redirect( OP => $Self->{LastScreenOverview} );
}

sub _SetState {
my ( $Self, %Param ) = @_;

my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');

my $State = $ConfigObject->Get('Znuny4OTRS::QuickClose::State');

return if !$State;

my $Success = $TicketObject->TicketStateSet(
State => $State,
TicketID => $Self->{TicketID},
UserID => $Self->{UserID},
);

return if !$Success;

$TicketObject->TicketLockSet(
TicketID => $Self->{TicketID},
Lock => 'unlock',
UserID => $Self->{UserID},
);

return 1;
}

1;
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@ The action `AgentTicketZnuny4OTRSQuickClose` is available for ACLs.

**Download**

Download the [latest version](https://addons.znuny.com/api/addon_repos/public/1074/latest).
For download see [https://www.znuny.com/#!/znuny4otrs](https://www.znuny.com/#!/znuny4otrs)

**Contributors**
- Thanks @sjoerddebruin for the dutch translation!
- Thanks @rsnakin for synchronization between otrs5 and otrs6!

**Commercial Support**

For this add-on and for OTRS in general visit [www.znuny.com](https://www.znuny.com). Looking forward to hear from you!
For this extension and for OTRS in general visit [www.znuny.com](https://www.znuny.com). Looking forward to hear from you!

Enjoy!

Your Znuny Team!

[https://www.znuny.com](https://www.znuny.com)
[www.znuny.com](https://www.znuny.com)
Loading

0 comments on commit f8f662f

Please sign in to comment.