OPAR - OTRS Package ARchive

Browseable collection of plugins for the popular OTRS software.


TicketOverviewHooked

Version
6.0.1
Other Versions
0.0.1, 3.1.2, 3.2.1, 3.3.4, 4.0.4, 5.0.6,
Uploaded by/on
reneeb on 08 Dec 2017
Framework
6.0.x
Links
Download Website
Description
Show rows in ticket overview (small) with different background colors.

Rate/comment this package

NAME

TicketOverviewHooked - provide a simple mechnism to colorize rows in small ticket overview and in the agents' dashboard

DESCRIPTION

Sometimes it is necessary to identify "special" tickets very quickly. "special" can mean everything - maybe tickets that are in some way incomplete, tickets that represent orders of your goods or maybe tickets from VIPs.

To identify these tickets in the ticket overview (status view or queue view) it would be great to have the rows of these tickets colorized.

This package provides a simple mechanism to achieve this.

HOW IT WORKS

It is really simple: For every row a so called "hook" is called with the ticket id as a parameter. If the ticket meets some criteria, the hook as to return a color code (the hex code as used in HTML).

What happens if a ticket matches several hooks?

The hooks are prioritized (via SysConfig) and the hooks are called in priority order and as soon as one hook matches, the other hooks are not called. This is to ensure that the row is colorized with the most important color.

CONFIGURATION

There is only one config option that is really needed: TicketOverview::Hooks (Group Ticket, Subgroup TicketOverview). This is a hash where the keys represent the priority. The lower the priority the more important is the hook. The value is the module name that implements the hook.

This package comes with one sample hook that identifies tickets in the queue "Junk".

OWN HOOKS

To write own hooks is really easy for everyone who knows a bit of Perl and OTRS. A hook is a Perl module that meets some requirements:

  • Object oriented

    The hook needs to be implemented with object orientation and a method named new (that is the constructor). Everybody who has written some OTRS modules yet, should know this.

  • Run()

    The Run method gets the ticket ID as a parameter and this method has to return the hex value of the color if the ticket meets the criteria - undef otherwise.

Example

  sub Run {
      my ( $Self, %Param ) = @_;
  
      # check needed stuff
      for my $Needed (qw(TicketID)) {
          if ( !$Param{$Needed} ) {
              $Self->{LogObject}->Log(
                  Priority => 'error',
                  Message  => "Need $Needed!",
              );
              return;
          }
      }
  
      my %TicketData = $Self->{TicketObject}->TicketGet(
          TicketID => $Param{TicketID},
      );
  
      return if $TicketData{Queue} ne 'Junk';
      return $Self->{ConfigObject}->Get('Hook::Junk'); # cdcdcd
  }

LICENSE AND AUTHOR

Author: Renee Baecker <opar@perl-services.de> License: AGPL 3

Comments

MoBIoS on 11 Jul 2016 about version 5.0.1

Hallo Renée, du hattest das Modul und die Möglichkeiten so toll präsentiert. Ich scheine jedoch noch etwas zu übersehen, da das Modul bei mir so noch nicht greift. Im Log wird nichts gemeldet. Cache habe ich vorsorglich geleert und Apache noch einmal durch gestartet. Die Umgebung: > OTRS 5.0.10 > KIX4OTRS 8.0.5 > ITSMConfigurationManagement 5.0.11 Nach der Installation, sind Junk und Misc Queue bereits unter Ticket → TicketOverview Hook::Queues definert, und die Junk Queue nochmal unter Hook::Junk definert. Doch leider kann ich keine farbliche Kennzeichnung der Tickets fest stellen. Was ist der Unterschied zwischen dem Konfiguration-Elementen: Hook::Junk return if $Param{Queue} ne 'Junk'; return $ConfigObject->Get('Hook::Junk'); Hook::Queues my $ConfigObject = $Kernel::OM->Get('Kernel::Config'); my $Colors = $ConfigObject->Get('Hook::Queues') || {}; return $Colors->{ $Param{Queue} }; beide basieren doch auf einer Queue in der ein Ticket liegt, nur das bei Hook:Queue die definierten Queues aus der Konfiguration gelesen werden, habe ich das falsch interpretiert? ## Weiter würde ich gerne auf der Grundlage deines Scripts Hooks für z.B. Status und Type definieren können. Im OTRS Ordner /opt/otrs/Kernel/System/TicketOverview/Hooks befinden sich die 2 Dateien Junk.pm und Queues.pm Hier habe ich eine Datei State.pm angelegt und das ConfigItem noch in der TicketOverviewHooked.xml angemeldet, jedoch ohne Erfolg. Meine Datei State.pm package Kernel::System::TicketOverview::Hooks::State; use strict; use warnings; our $VERSION = 0.02; our @ObjectDependencies = qw( Kernel::Config Kernel::System::Ticket ); sub new { my ( $Type, %Param ) = @_; # allocate new hash for object my $Self = {}; bless( $Self, $Type ); return $Self; } sub Run { my ( $Self, %Param ) = @_; # check needed stuff for my $Needed (qw(State)) { if ( !$Param{$Needed} ) { $Self->{LogObject}->Log( Priority => 'error', Message => "Need $Needed!", ); return; } } my $ConfigObject = $Kernel::OM->Get('Kernel::Config'); my $Colors = $ConfigObject->Get('Hook::State') || {}; return $Colors->{ $Param{State} }; } 1;

Simon (guest) on 09 Nov 2016 about version 5.0.2

Appears to have broken with OTRS 5.0.14