Skip to content

Commit

Permalink
Removed support for ticket zoom as redirection URL because it always …
Browse files Browse the repository at this point in the history
…would automatically mark the selected article as seen again.
  • Loading branch information
jepf committed Jan 31, 2024
1 parent 362ddbc commit 7e5bdae
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 20 deletions.
6 changes: 0 additions & 6 deletions Kernel/Config/Files/XML/ZnunyMarkTicketSeenUnseen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<Item Key="Action=AgentTicketQueue" Translatable="1">Queue view</Item>
<Item Key="Action=AgentTicketEscalationView" Translatable="1">Escalation view</Item>
<Item Key="Action=AgentTicketStatusView" Translatable="1">Status view</Item>
<Item Key="Action=AgentTicketZoom;TicketID=###TicketID####1" Translatable="1">Ticket Zoom</Item>
<Item Key="LastScreenView" Translatable="1">Last viewed screen</Item>
<Item Key="LastScreenOverview" Translatable="1">Last viewed overview</Item>
</Hash>
</Item>
Expand All @@ -62,8 +60,6 @@
<Item ValueType="Option" Value="Action=AgentTicketQueue" Translatable="1">Queue view</Item>
<Item ValueType="Option" Value="Action=AgentTicketEscalationView" Translatable="1">Escalation view</Item>
<Item ValueType="Option" Value="Action=AgentTicketStatusView" Translatable="1">Status view</Item>
<Item ValueType="Option" Value="Action=AgentTicketZoom;TicketID=###TicketID####1" Translatable="1">Ticket Zoom</Item>
<Item ValueType="Option" Value="LastScreenView" Translatable="1">Last viewed screen</Item>
<Item ValueType="Option" Value="LastScreenOverview" Translatable="1">Last viewed overview</Item>
</Item>
</Value>
Expand All @@ -86,7 +82,6 @@
<Item Key="Action=AgentTicketQueue" Translatable="1">Queue view</Item>
<Item Key="Action=AgentTicketEscalationView" Translatable="1">Escalation view</Item>
<Item Key="Action=AgentTicketStatusView" Translatable="1">Status view</Item>
<Item Key="Action=AgentTicketZoom;TicketID=###TicketID####1" Translatable="1">Ticket Zoom</Item>
<Item Key="LastScreenView" Translatable="1">Last viewed screen</Item>
<Item Key="LastScreenOverview" Translatable="1">Last viewed overview</Item>
</Hash>
Expand All @@ -109,7 +104,6 @@
<Item ValueType="Option" Value="Action=AgentTicketQueue" Translatable="1">Queue view</Item>
<Item ValueType="Option" Value="Action=AgentTicketEscalationView" Translatable="1">Escalation view</Item>
<Item ValueType="Option" Value="Action=AgentTicketStatusView" Translatable="1">Status view</Item>
<Item ValueType="Option" Value="Action=AgentTicketZoom;TicketID=###TicketID####1" Translatable="1">Ticket Zoom</Item>
<Item ValueType="Option" Value="LastScreenView" Translatable="1">Last viewed screen</Item>
<Item ValueType="Option" Value="LastScreenOverview" Translatable="1">Last viewed overview</Item>
</Item>
Expand Down
6 changes: 5 additions & 1 deletion Kernel/Modules/AgentTicketMarkSeenUnseen.pm
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,12 @@ sub Run {
);

my $RedirectURL = $UserPreferences{ 'UserMarkTicket' . $GetParam{Subaction} . 'RedirectURL' };

# Fix for removed option "TicketZoom" for redirection. See issue #11.
$RedirectURL = undef if $RedirectURL =~ m{TicketZoom};

$RedirectURL ||= $ConfigObject->Get( 'MarkTicket' . $GetParam{Subaction} . 'RedirectDefaultURL' );
$RedirectURL ||= 'Action=AgentTicketZoom;TicketID=###TicketID###';
$RedirectURL ||= 'LastScreenOverview';

if ( $RedirectURL =~ m{LastScreenView|LastScreenOverview}i ) {
my %SessionData = $SessionObject->GetSessionIDData(
Expand Down
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
![Znuny logo](https://www.znuny.com/assets/images/logo_small.png)

![Build status](https://badge.proxy.znuny.com/Znuny4OTRS-MarkTicketSeenUnseen/rel-7_0)
Znuny-MarkTicketSeenUnseen
==========================

Mark tickets as seen and unseen
=================
With this extension you will be able to mark whole tickets as seen or unseen and articles as unseen again. It's possible to mark single tickets or multiple tickets via the bulk action.

**Prerequisites**
Expand All @@ -12,22 +11,17 @@ With this extension you will be able to mark whole tickets as seen or unseen and

**Installation**

Install it via the package manager from the Znuny Open Source Add-ons or download the [package](https://addons.znuny.com/api/addon_repos/public/2394/latest) and upload/install it via admin interface -> package manager.
Use the online repository **Znuny Open Source Add-ons** from the package manager to install the add-on. From the command line use this command: `bin/znuny.Console.pl Admin::Package::Install https://addons.znuny.com/public/:Znuny-MarkTicketSeenUnseen`

**Configuration**

No further configuration required.

**Download**

Download the [latest version](https://addons.znuny.com/api/addon_repos/public/2394/latest).

**Commercial Support**

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

Enjoy!

Your Znuny Team!

[www.znuny.com](https://www.znuny.com)
[https://www.znuny.com](https://www.znuny.com)
2 changes: 1 addition & 1 deletion doc/de/feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Tickets als gelesen/ungelesen markieren

In Znuny ist es nicht möglich, Tickets (also alle Artikel eines Tickets) als gelesen oder ungelesen zu markieren. Dieses Paket ergänzt Znuny um diese Funktionalität.
Dieses Paket ergänzt Znuny um die Möglichkeit, Tickets (also alle Artikel eines Tickets) als gelesen oder ungelesen zu markieren.

Im Ticket- und Artikel-Menü stehen entsprechende Links zur Verfügung, um ein Ticket oder dessen Artikel als gelesen oder ungelesen zu markieren. Im Artikel-Menü steht nur der "ungelesen markieren"-Link zur Verfügung, da der Artikel beim Lesen bereits automatisch als gelesen markiert wird.

Expand Down
2 changes: 1 addition & 1 deletion doc/en/feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Mark tickets as read/unread

In Znuny it is not possible to mark tickets (all articles of a ticket) as read or unread. This package adds this functionality to Znuny.
This package adds the possibility to mark tickets (all articles of a ticket) as read or unread.

In the ticket and article menu, appropriate links are available to mark a ticket or its articles as read or unread. Only the "mark unread" link is available in the article menu, since the article is automatically marked as read when it is read.

Expand Down
47 changes: 47 additions & 0 deletions var/packagesetup/ZnunyMarkTicketSeenUnseen.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ use utf8;

our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::Cache',
'Kernel::System::DB',
'Kernel::System::Log',
'Kernel::System::ZnunyHelper',
);
Expand Down Expand Up @@ -78,6 +80,8 @@ sub CodeInstall {
return;
}

return if !$Self->_RemoveDeprecatedUserPreferences(%Param);

return 1;
}

Expand Down Expand Up @@ -166,6 +170,49 @@ sub _ArticleActionsGet {
return $ArticleActions;
}

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

my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
my $CacheObject = $Kernel::OM->Get('Kernel::System::Cache');

my %PreferencesToRemove = (
MarkTicketUnseenRedirectURL => [
'Action=AgentTicketZoom;TicketID=###TicketID####1',
'LastScreenView',
],
MarkTicketSeenRedirectURL => [
'Action=AgentTicketZoom;TicketID=###TicketID####1',
],
);

my $SQL = '
DELETE FROM user_preferences
WHERE preferences_key = ?
AND preferences_value = ?
';

for my $PreferenceKey ( sort keys %PreferencesToRemove ) {
for my $PreferenceValue ( @{ $PreferencesToRemove{$PreferenceKey} } ) {
my @Bind = (
\$PreferenceKey,
\$PreferenceValue,
);

return if !$DBObject->Do(
SQL => $SQL,
Bind => \@Bind,
);
}
}

$CacheObject->CleanUp(
Type => 'User',
);

return 1;
}

1;

=back

0 comments on commit 7e5bdae

Please sign in to comment.