[rt-users] Managerial reports

Loos, Christian CLoos at netcologne.de
Wed May 7 16:24:40 EDT 2014


This isn't necessary as RT search supports relative dates:
https://metacpan.org/pod/Time::ParseDate#Relative-date-formats

Chris


Christian Loos
Smallworld GIS Operations
_________________________________________________________________________
NETCOLOGNE Gesellschaft für Telekommunikation mbH
Am Coloneum 9 | 50829 Köln
Tel: 0221 2222-276 | Fax: 0221 2222-7276 | Mobil: 0177 8888276

www.netcologne.de <http://www.netcologne.de/>

[NetCologneGmbH]          Geschäftsführung:
  Jost Hermanns
  Mario Wilhelm
  Vorsitzender des Aufsichtsrates:
  Dr. Andreas Cerbe
  HRB 25580, AG Köln


Diese Nachricht (inklusive aller Anhänge) ist vertraulich. Sollten Sie diese Nachricht versehentlich erhalten haben,
bitten wir, den Absender (durch Antwort-E-Mail) hiervon unverzüglich zu informieren und die Nachricht zu löschen.
Die E-Mail darf in diesem Fall weder vervielfältigt noch in anderer Weise verwendet werden.


-----Original Message-----
From: Justin Killen [jkillen at allamericanasphalt.com<mailto:jkillen at allamericanasphalt.com>]
Sent: Wednesday, May 07, 2014 09:42 PM Mitteleuropäische Zeit
To: Loos, Christian; rt-users at lists.bestpractical.com
Subject: RE: Managerial reports


After thinking about this for a bit, I figured the query is in the database somewhere and it's probably easy enough to update via a script/cron job, so I wrote one (Perl):




#!/usr/bin/perl

use strict;
use warnings;
use MIME::Base64;
use DateTime;
use DBI;


my $date = DateTime->now();
my $desired_dow = 6;
$date->subtract(days => ($date->day_of_week - $desired_dow) % 7);

my $to_date_string = $date->ymd;

$date->subtract(days => 6);

my $from_date_string = $date->ymd;

#open(FH, '>', 'attributes.dmp') or die("Unable to open dump file: $!");
#binmode FH;

my $dbh = DBI->connect("DBI:mysql:database=rt4;", "rt_user", "PASSWORDHERE");

my $sth = $dbh->prepare("SELECT * FROM Attributes WHERE id = 33");

my $upSth = $dbh->prepare("UPDATE Attributes SET Content = ? WHERE id = 33");

$sth->execute;

while(my $ref = $sth->fetchrow_hashref()) {
        my $content = decode_base64($ref->{'Content'});

#       print FH "$content\n\n";

        if($content =~ /(.*Resolved >= ')(\d{1,4}-\d{1,2}-\d{1,2})(' AND Resolved <= ')(\d{1,4}-\d{1,2}-\d{1,2})('.*)/s) {
                my ($pre, $date1, $mid, $date2, $post) = ($1, $2, $3, $4, $5);

                if($date1 ne $from_date_string || $date2 ne $to_date_string) {
                        my $new_content = $pre . $from_date_string . $mid . $to_date_string . $post;

                        my $encoded_value = encode_base64($new_content);

#                       print FH $encoded_value;

                        $upSth->execute($encoded_value);
                }
        }
}

close FH;


It will update my saved search (id# 33) to always been sun-sat of last week.  It'd admittedly a bit of a hack; it would be nice if altering an existing search was an option within the REST API.

-Justin
> -----Original Message-----
> From: Christian Loos [mailto:cloos at netcologne.de]
> Sent: Wednesday, May 07, 2014 12:00 AM
> To: Justin Killen; rt-users at lists.bestpractical.com
> Subject: Re: Managerial reports
>
> Am 05.05.2014 20:39, schrieb Justin Killen:
> > Often times in IT, issues will come into support staff and resolved
> > without management ever knowing about it.  I have been tasked with
> > providing management with a report that would show tickets closed within
> > a certain date range, preferably restricted to a specific user.
> >
> >
> >
> > Are there any existing extensions/reports that would fit this need?  I
> > tried Activity Reports, but the Activity Detail report has quite a lot
> > of static in it, and the ticket Title doesn't appear anywhere.  I think
> > RTx::Statistics might works as well, but it doesn't seem to be supported
> > within RT 4.2 yet.
> >
> >
> >
> > Any suggestions?
> >
> >
> >
> > -Justin
>
>
> http://bestpractical.com/docs/rt/4.2/dashboards.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140507/b9644b03/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LOGO80.GIF
Type: image/jpeg
Size: 1850 bytes
Desc: LOGO80.GIF
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140507/b9644b03/attachment.jpe>


More information about the rt-users mailing list