OPAR - OPM Package ARchive

Browseable collection of plugins for the popular ticket system software Znuny and ((OTRS)) Community Edition.


GenericDashboardStats

Version
6.0.6
Other Versions
0.0.1, 3.3.2, 4.0.1, 5.0.2,
Uploaded by/on
reneeb on 04 Sep 2020
Framework
6.0.x
Links
Download Website
Description
A more generic Dashboard stats widget.

Rate/comment this package

NAME

GenericDashboardStats

DESCRIPTION

As of today (Aug 2012) the 7 day statistic widget for the dashboard knows only two stats: closed tickets and created tickets.

This is not enough and to add new stats to that widget or change the current ones you need programming skills.

GenericDashboardStats allows to add/change stats easily with new configuration files for the SysConfig. So you can show the stats you want.

CREATE NEW STATS

To create new stats you have to add only your own configuration file. The subsequent sections show different types of stats.

The "standard" closed ticket graph

Create a file $OTRS_HOME/Kernel/Config/Files/XML/AnyName.xml where "AnyName" can be whatever you want. Though I recommend to name it the same way you want to name the graph.

The XML file has this content:

  <?xml version="1.0" encoding="utf-8"?>
  <otrs_config version="2.0" init="Application">
      <Setting Name="DashboardBackend###256-GenericStats" Required="0" Valid="1">
          <Description Translatable="1">...</Description>
          <Navigation>Frontend::Agent::View::Dashboard</Navigation>
          <Value>
              <Hash>
                  <Item Key="Module">Kernel::Output::HTML::Dashboard::TicketStatsGeneric</Item>
                  <Item Key="SysConfigBase">GenericDashboardStats</Item>
                  <Item Key="Title">Generic Ticket Stats</Item>
                  <Item Key="Created">1</Item>
                  <Item Key="Closed">1</Item>
                  <Item Key="Permission">rw</Item>
                  <Item Key="Block">ContentSmall</Item>
                  <Item Key="Group"></Item>
                  <Item Key="Default">1</Item>
                  <Item Key="CacheTTL">30</Item>
                  <Item Key="Mandatory">0</Item>
              </Hash>
          </Value>
      </Setting>
  </otrs_config>

After you've saved the file, run perl bin/otrs.Console.pl Maint::Config::Rebuild.

That's it! Nothing more. That will give you the standard 7 days statistics. It defines a new Dashboard widget. What settings can use use (beside the standard ones used for the 7 days statistics)?

  • SysConfigBase

    This will be clear in the next section

  • UseDate

    In stock OTRS Community Edition, you'll see the weekday abbreviations on the X-axis. If you want to see the dates, you can set UseDate to 1 and then you'll see them.

  • DateFormat

    By default the dates shown use this format: %Y-%m-%d which means dates are shown as YYYY-MM-DD. If you want an other format, you can define it here.

  • ReduceXTicks

    You are going to show a longer history? Then the labels on the X-axis are overlapping and you can't read them. Then set this to 1.

But you want more, right?

You can define your own statistics. To define which statistics is shown in one widget, you have to define what string is used to "group" the settings in the system configuration. It's GenericDashboardStats in this case. So to add a statistics with tickets that escalated, define a new setting:

    <Setting Name="GenericDashboardStats::Stats###001-Created-Junk" Required="0" Valid="1">
        <Description Translatable="1">How many tickets were created the day in the queue Junk</Description>
        <Navigation>Stats</Navigation>
        <Value>
            <Hash>
                <Item Key="OptionKey">CreatedJunkStats</Item>
                <Item Key="type">TicketCreate</Item>
                <Item Key="label">created in Junk</Item>
            </Hash>
        </Value>
    </Setting>

Now, what does the settings mean?

  • OptionKey

    The OptionKey is just a unique key for this graph. This is used to define the name of an other SysConfig option that defines more search parameters (see second example below).

  • type

    Define what time-parameter is used for the ticket search. You can use the following values:

    • TicketCreate

      Tickets created on the given day.

    • TicketClose

      Tickets closed on the given day.

    • TicketChange

      Tickets changed on the given day.

    • TicketPending

    • TicketEscalation

    • TicketEscalationUpdate

    • TicketEscalationResponse

    • TicketEscalationSolution

    • ArticleCreate

      articles with create time after ... (article newer than this date).

  • color

    Color of the graph.

  • label

    Mouse over label for the graph.

An other example: Show graph of ticket that were created in queue "Junk"

    <Setting Name="GenericDashboardStats::Stats###001-Created-Junk" Required="0" Valid="1">
        <Description Translatable="1">How many tickets were created the day in the queue Junk</Description>
        <Navigation>Stats</Navigation>
        <Value>
            <Hash>
                <Item Key="OptionKey">CreatedJunkStats</Item>
                <Item Key="type">TicketCreate</Item>
                <Item Key="label">created in Junk</Item>
            </Hash>
        </Value>
    </Setting>
    <Setting Name="CreatedJunkStats###Queues" Required="0" Valid="1">
        <Description Translatable="1">Define the Queues the CreatedJunkStats stat is for</Description>
        <Navigation>CreatedJunkStats</Navigation>
        <Value>
            <Array>
                <Item>Junk</Item>
            </Array>
        </Value>
    </Setting>

The first ConfigItem part is described above. The second one adds more search paramters. The name of the item is created by the value of OptionKey in the first config option then "###" and the last part of the name is the search option. At http://otrs.perl-services.de/docs/otrs/rel-3_3/kernel_system_ticketsearch.html you can see all the options for the ticket search.

REPOSITORY & BUGS

The code repository and a bugtracker are available at http://github.com/reneeb/otrs-GenericDashboardStats

AUTHOR AND LICENCE

  License: AGPL

Renee Baecker info@perl-services.de

Comments