Anzahl offene Tickets im Zoom anzeigen

English! place to talk about development, programming and coding
Post Reply
Invader
Znuny newbie
Posts: 28
Joined: 04 Mar 2009, 16:16
Znuny Version: 2.34

Anzahl offene Tickets im Zoom anzeigen

Post by Invader »

Ich möchte gerne folgendes realisieren:

Wenn man in ein Ticket zoomed soll die Anzahl aller offenen Tickets (dieser Email-Adresse) angezeigt werden. Wir verwerden die gesamten Customer-Geschichten nicht. Wenn es keine Performanceprobleme gibt würde ich das auch gerne in die Queue-Ansicht einbauen.

Wie kann ich denn jetzt das erforderliche SQL-Query einbauen und dann ausgeben? Kann mir da jemand einen Hint geben?
maxbacks
Znuny wizard
Posts: 326
Joined: 30 Jan 2008, 14:59
Znuny Version: 6.0.19
Real Name: Max Hendrik Backs

Anzahl offene Tickets im Zoom anzeigen

Post by maxbacks »

welche version setzt du ein? wäre hilfreich, wenn du deine signatur bearbeitest.

soweit ich weiß ist dies nur mit einem "echten" Kunden in der Datenbank möglich. wenn du es trotzdem haben willst, musst du dir das Modul anpassen, welches dir die Ansicht generiert. Musst dir dann die daten aus der datenbank per select holen. alles was du suchst findest du in der tabelle "Ticket"
Ticket-System
Ubuntu 18.04
OTRS 6.0.19
Invader
Znuny newbie
Posts: 28
Joined: 04 Mar 2009, 16:16
Znuny Version: 2.34

Anzahl offene Tickets im Zoom anzeigen

Post by Invader »

Ich benutze die Version OTRS 2.3.4. Die Customer Sachen verwenden wir überhaupt nicht, ich muss es also selber einbinden.
In dem entsprechenden Modul will ich ein SQL-Select ausführen und das dan in der DTL-Datei ausgeben. Mein Perl Kenntnisse
sind leider ziemlich minimal - wie konfiguriere ich denn meine Varialble (enthält eine Integer Zahl -> Anzahl der offenen Tickets
pro Email-Adresse), dass ich sie dann auch in der DTL-Datei verwenden kann?
maxbacks
Znuny wizard
Posts: 326
Joined: 30 Jan 2008, 14:59
Znuny Version: 6.0.19
Real Name: Max Hendrik Backs

Anzahl offene Tickets im Zoom anzeigen

Post by maxbacks »

Schau dir das Thema mal an:
http://www.otrs-forum.de/viewtopic.php?f=19&t=2789

Vielleicht hilft dir das auf die schnelle weiter.
Ticket-System
Ubuntu 18.04
OTRS 6.0.19
Invader
Znuny newbie
Posts: 28
Joined: 04 Mar 2009, 16:16
Znuny Version: 2.34

Anzahl offene Tickets im Zoom anzeigen

Post by Invader »

Super - ja das hat mir geholfen. Ich habe jetzt folgendes gemacht:
/opt/otrs/Kernel/Modules/AgentTicketQueue.pm

Code: Select all

# <!-- manuelle Änderung -->
# get open tickets
my $SQL = "SELECT count(customer_id) FROM ticket WHERE ticket_state_id <> 3 AND customer_id = '$Article{CustomerID}'";
my $OpenTickets;
$Self->{DBObject}->Prepare(SQL => $SQL, Limit => 1);
$OpenTickets = ($Self->{DBObject}->FetchrowArray())[0];

$Self->{LayoutObject}->Block(
    Name => 'OpenTickets',
    Data => {
        Key   => 'OpenTickets',
        Value => $OpenTickets,
    },
);
# <-- manuelle Änderung--!>
Um das neue Feld anzuzeigen muss in der entsprechenden dtl Datei noch die Anzeige eingebaut werden:

/opt/otrs/Kernel/Output/HTML/CipSoft/AgentTicketQueueTicketView.dtl

Code: Select all

# <!-- manuelle Änderung-->
# Added output for open tickets
<!-- dtl:block:OpenTickets -->
          <tr valing="top">
            <td><b>$Text{"Open Tickets"}:</b></td>
            <td><font color="black"><div title="$QData{"Value"}">$QData{"Value","80"}</div></font></td>
          </tr><br>
<!-- dtl:block:OpenTickets -->
# <-- manuelle Änderung--!>
Jetzt wird in der QueueView die Anzahl der offenen Tickets pro Email-Adresse angezeigt *freu*
RayBaretto
Znuny newbie
Posts: 4
Joined: 08 May 2009, 18:16
Znuny Version: 2.3.4

Anzahl offene Tickets im Zoom anzeigen

Post by RayBaretto »

Darf ich einmal fragen wo zum Teufel man das in die .dtl Datei einfügen muß, damit das geht?
Ebenso in AgentTicketQueue.pm.

Vielen Dank!!
maxbacks
Znuny wizard
Posts: 326
Joined: 30 Jan 2008, 14:59
Znuny Version: 6.0.19
Real Name: Max Hendrik Backs

Anzahl offene Tickets im Zoom anzeigen

Post by maxbacks »

Wenn der Teufel freundlich fragt, wird er bestimmt eine Antwort bekommen.
Noch antworten hier alle noch freiwillig und kostenlos auf Fragen...
Ticket-System
Ubuntu 18.04
OTRS 6.0.19
Invader
Znuny newbie
Posts: 28
Joined: 04 Mar 2009, 16:16
Znuny Version: 2.34

Anzahl offene Tickets im Zoom anzeigen

Post by Invader »

Ich hab Dir jetzt die darüber liegenden Codeteile hinzugefügt... damit solltest Du die richtige Stelle finden :)

/opt/otrs/Kernel/Modules/AgentTicketQueue.pm

Code: Select all

...
# customer info
    my %CustomerData = ();
    if ( $Self->{ConfigObject}->Get('Ticket::Frontend::CustomerInfoQueue') ) {
        if ( $Article{CustomerUserID} ) {
            %CustomerData = $Self->{CustomerUserObject}->CustomerUserDataGet(
                User => $Article{CustomerUserID},
            );
        }
        elsif ( $Article{CustomerID} ) {
            %CustomerData = $Self->{CustomerUserObject}->CustomerUserDataGet(
                CustomerID => $Article{CustomerID},
            );
        }
    }

    # <!-- manuelle Änderung -->
    # get open tickets
    my $SQL = "SELECT count(customer_id) FROM ticket WHERE ticket_state_id in (1,4,6,7,8,9,10) AND customer_id = '$Article{CustomerID}'";
    my $OpenTickets;
    $Self->{DBObject}->Prepare(SQL => $SQL, Limit => 1);
    $OpenTickets = ($Self->{DBObject}->FetchrowArray())[0];

    # if more than 1 ticket is open, mark it red
    my $Marker;
    if ( $OpenTickets ge 2 ){
        $Marker = 'blink';
    }
    if ( $OpenTickets lt 2  ){
        $Marker = 'b';
    }

    $Self->{LayoutObject}->Block(
        Name => 'OpenTickets',
        Data => {
            Key   => $Article{CustomerID},
            Value => $OpenTickets,
            Name  => $Marker,
        },
    );
    # <-- manuelle Änderung --!>

    # build ticket view
...
und /opt/otrs/Kernel/Output/HTML/Standard/AgentTicketQueueTicketView.dtl

Code: Select all

...
<!-- dtl:block:ArticleOption-->
        <dtl if ($Data{"Successful"} eq "0") { $Data{"StartFont"} = "<font color="red">"; }>
        <dtl if ($Data{"Successful"} eq "0") { $Data{"StopFont"} = "</font>"; }>
        <dtl if ($Data{"Successful"} eq "1") { $Data{"StartFont"} = "<font color="green">"; }>
        <dtl if ($Data{"Successful"} eq "1") { $Data{"StopFont"} = "</font>"; }>
        <tr>
          <td valign="top" width="15%"><b>$Text{"$Data{"Key"}"}:</b></td>
          <td width="85%"> <div title="$QData{"Value"}">$Data{"StartFont"}$QData{"Value","80"}$Data{"StopFont"}</div></div></td>
        </tr>
<!-- dtl:block:ArticleOption -->
      </table>
$Data{"BodyNote"}
      <div class="message">
$Data{"Body"}
      </div>
    </td>
    <td width="25%" align="left" valign="top" class="PriorityID-$Data{"PriorityID"}">
      <p>
        <table border="0" cellspacing="0" cellpadding="1">
<!-- dtl:block:Type -->
          <tr valign="top">
            <td><b>$Text{"Type"}:</b></td>
            <td><div title="$QData{"Type"}">$QData{"Type","18"}</div></td>
          </tr>
<!-- dtl:block:Type -->
# <!-- manuelle Änderung -->
# Added output for open tickets
<!-- dtl:block:OpenTickets -->
          <tr valing="top">
            <td><$QData{"Name"}><a href="$Env{"Baselink"}Action=AgentTicketSearch&Subaction=Search&From=$QData{"Key"}&State=Open&SortBy=State&Order=Down">Open Tickets ($QData{"Value","80"})</a></$QData{"Name"}></td>
            <td></td>
          </tr>
<!-- dtl:block:OpenTickets -->
# <-- manuelle Änderung --!>
...
RayBaretto
Znuny newbie
Posts: 4
Joined: 08 May 2009, 18:16
Znuny Version: 2.3.4

Anzahl offene Tickets im Zoom anzeigen

Post by RayBaretto »

YEAH, das geht gut! 8)

Vielleicht ist das eine ziemliche dämliche Frage eines DAUs, aber was muß ich tun, damit es auch im TicketZoom angezeigt wird?
Ich meine, die Ansicht, wenn man auf "Inhalt" eines Tickets klickt?
RayBaretto
Znuny newbie
Posts: 4
Joined: 08 May 2009, 18:16
Znuny Version: 2.3.4

Anzahl offene Tickets im Zoom anzeigen

Post by RayBaretto »

RayBaretto wrote:YEAH, das geht gut! 8)

Vielleicht ist das eine ziemliche dämliche Frage eines DAUs, aber was muß ich tun, damit es auch im TicketZoom angezeigt wird?
Ich meine, die Ansicht, wenn man auf "Inhalt" eines Tickets klickt?
Nach laaaangem Try and Error und wo ich eigentlich nicht wußte, was ich da überhaupt tat habe ich es auch geschafft es in den Ticketzoom einzubauen:
8)

AgentTicketZoom.dtl schaut nun so aus:

Code: Select all

<!-- dtl:block:Type -->
        <tr valign="top">
          <td><b>$Text{"Type"}:</b></td>
          <td>
            <div title="$QData{"Type"}">$QData{"Type","18"}</div>
          </td>
        </tr>
<!-- dtl:block:Type -->
<!-- dtl:block:OpenTickets -->
<$QData{"Name"}><a href="$Env{"Baselink"}Action=AgentTicketSearch&Subaction=Search&From=$QData{"Key"}&State=Open&SortBy=State&Order=Down">Open Tickets ($QData{"Value","80"})</a></$QData{"Name"}>
<!-- dtl:block:OpenTickets -->
  <tr valign="top">
          <td><b>$Text{"State"}:</b></td>
          <td>
            <font color="red">
            <div title="$Quote{"$Text{"$Data{"State"}"}"}">$Quote{"$Text{"$Data{"State"}"}","18"}</div>
            </font>
          </td>
        </tr>
und AgentTicketZoom.pm

Code: Select all


            # customer info string
            if ( $Self->{ConfigObject}->Get('Ticket::Frontend::CustomerInfoZoom') ) {
                $Param{CustomerTable} = $Self->{LayoutObject}->AgentCustomerViewTable(
                    Data   => $Param{CustomerData},
                    Ticket => \%Param,
                    Max => $Self->{ConfigObject}->Get('Ticket::Frontend::CustomerInfoZoomMaxSize'),
                );
                $Self->{LayoutObject}->Block(
                    Name => 'CustomerTable',
                    Data => \%Param,
                );
            }

    # get open tickets
    my $SQL = "SELECT count(customer_id) FROM ticket WHERE ticket_state_id in (1,4,6,7,8,9,10) AND customer_id = '$Param{CustomerID}'";
    my $OpenTickets;
    $Self->{DBObject}->Prepare(SQL => $SQL, Limit => 1);
    $OpenTickets = ($Self->{DBObject}->FetchrowArray())[0];

    # if more than 1 ticket is open, mark it red
    my $Marker;
    if ( $OpenTickets ge 2 ){
        $Marker = 'blink';
    }
    if ( $OpenTickets lt 2  ){
        $Marker = 'b';
    }

    $Self->{LayoutObject}->Block(
        Name => 'OpenTickets',
        Data => {
            Key   => $Param{CustomerID},
            Value => $OpenTickets,
            Name  => $Marker,
        },
    );

            $Self->{LayoutObject}->Block(
                Name => 'Owner',
                Data => { %Param, %UserInfo, %AclAction },
            );
            if ( $Self->{ConfigObject}->Get('Ticket::Responsible') ) {
                $Self->{LayoutObject}->Block(
                    Name => 'Responsible',
                    Data => { %Param, %ResponsibleInfo, %AclAction },

RayBaretto
Znuny newbie
Posts: 4
Joined: 08 May 2009, 18:16
Znuny Version: 2.3.4

Anzahl offene Tickets im Zoom anzeigen

Post by RayBaretto »

Huhu!
Hat das jemand vielleicht auch für die Version 2.4.5? :D
Post Reply