[Rt-commit] rt branch, 4.4/reports, created. rt-4.4.1-327-gb91f4d4

Dave Goehrig dave at bestpractical.com
Wed May 3 13:44:12 EDT 2017


The branch, 4.4/reports has been created
        at  b91f4d4533c42a7e6fa91d11997dab930ea4a4a3 (commit)

- Log -----------------------------------------------------------------
commit b91f4d4533c42a7e6fa91d11997dab930ea4a4a3
Author: Dave Goehrig <dave at bestpractical.com>
Date:   Tue Mar 28 11:59:50 2017 -0400

    Add Reports back to RT 4.4
    
    This commit adds the reports from 3.8 back to RT 4.4.
    The reports are added under Tools >> Reports and
    there are currently the 3 reports from 3.8.
    
    The menus have been updated to 4.4 standard, and
    the tabs have been updated to match the new search
    link style.  Current GD based charts are working,
    and the existing search and chart elements are used
    throughout.

diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index d2951f4..65bf446 100644
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -598,6 +598,27 @@ my $build_main_nav = sub {
     $search->child( assets => title => loc("Assets"), path => "/Asset/Search/" )
         if $session{CurrentUser}->HasRight( Right => 'ShowAssetsMenu', Object => RT->System );
 
+    my $reports = Menu->child( reports =>
+        title       => loc('Reports'),
+        description => loc('Reports summarizing ticket resolution and status'),
+        path        => loc('/Reports'),
+    );
+    $reports->child( resolvedbyowner =>
+        title       => loc('Resolved by owner'),
+        path        => '/Reports/ResolvedByOwner.html',
+        description => loc('Examine tickets resolved in a queue, grouped by owner'),
+    );
+    $reports->child( resolvedindaterange =>
+        title       => loc('Resolved in date range'),
+        path        => '/Reports/ResolvedByDates.html',
+        description => loc('Examine tickets resolved in a queue between two dates'),
+    );
+    $reports->child( createdindaterange =>
+        title       => loc('Created in a date range'),
+        path        => '/Reports/CreatedByDates.html',
+        description => loc('Examine tickets created in a queue between two dates'),
+    );
+
     if ($session{CurrentUser}->HasRight( Right => 'ShowArticlesMenu', Object => RT->System )) {
         my $articles = Menu->child( articles => title => loc('Articles'), path => "/Articles/index.html");
         $articles->child( articles => title => loc('Overview'), path => "/Articles/index.html" );
@@ -1203,9 +1224,6 @@ if ( $request_path !~ m{^/SelfService/} ) {
     $build_selfservice_nav->();
 }
 
-
-
-
 </%INIT>
 <%ARGS>
 $show_menu => 1
diff --git a/share/html/Reports/CreatedByDates.html b/share/html/Reports/CreatedByDates.html
new file mode 100644
index 0000000..4060f23
--- /dev/null
+++ b/share/html/Reports/CreatedByDates.html
@@ -0,0 +1,96 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
+%#                                          <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%args>
+$Queue => undef
+$CreatedBefore => undef
+$CreatedAfter => undef
+</%args>
+<%init>
+my $title = loc("Created tickets in period, grouped by status");
+my $q = RT::Queue->new($session{'CurrentUser'});
+my $before = RT::Date->new($session{'CurrentUser'});
+my $after = RT::Date->new($session{'CurrentUser'});
+my $query = 'Status != "deleted" ';
+
+
+if ($CreatedAfter) {
+    $after->Set(Format => 'unknown', Value => $CreatedAfter);
+    $CreatedAfter = $after->AsString;
+}
+if ($CreatedBefore) {
+    $before->Set(Format => 'unknown', Value => $CreatedBefore);
+    $CreatedBefore = $before->AsString;
+}
+
+
+$q->LoadByCols(Name => $Queue);
+</%init>
+<& /Elements/Header, Title => $title &>
+% if ($Queue|| $CreatedBefore ||$CreatedAfter) {
+% # if we have a queue, do the search
+% if ($Queue) { $query .= " AND Queue = '$Queue'"}
+% if ($CreatedBefore) { $query .= " AND Created < '".$before->ISO(Timezone => 'user') ."'"; }
+% if ($CreatedAfter) { $query .= " AND Created > '".$after->ISO(Timezone => 'user')."'"}
+% }
+<& /Reports/Elements/Tabs, Query => $query &>
+<form method="post" action="CreatedByDates.html">
+% if ($Queue|| $CreatedBefore ||$CreatedAfter) {
+% my $groupby = 'Status';
+<& /Search/Elements/Chart, Query => $query, GroupBy => $groupby &>
+% }
+
+<hr />
+
+<br /><&|/l&>Queue</&>: <& /Elements/SelectQueue, Name => 'Queue', NamedValues => 1, Default => $q->id &>
+<br /><&|/l&>Tickets created after</&>: 
+<& /Elements/SelectDate, Name => 'CreatedAfter', Default => ($CreatedAfter) ?  $after->ISO(Timezone => 'user') : ''&>
+<br /><&|/l&>Tickets created before</&>: 
+<& /Elements/SelectDate, Name => 'CreatedBefore', Default => ($CreatedBefore) ? $before->ISO(Timezone => 'user') : ''&>
+
+<& /Elements/Submit&>
+</form>
diff --git a/share/html/Reports/Elements/Tabs b/share/html/Reports/Elements/Tabs
new file mode 100644
index 0000000..1ce08c6
--- /dev/null
+++ b/share/html/Reports/Elements/Tabs
@@ -0,0 +1,66 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
+%#                                          <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /Elements/Tabs &>
+<%INIT>
+
+if ($Query) {
+    my $querystr = $m->comp('/Elements/QueryString', Query => $Query);
+    PageMenu->child( editsearch => title => loc('Edit Search'), path => '/Search/Build.html?' . $querystr);
+    PageMenu->child( advanced => title => loc('Advanced'), path => '/Search/Edit.html?' . $querystr);
+    PageMenu->child( results => title => loc('Show Results'), path => '/Search/Results.html?' . $querystr);
+
+} else {
+    # nothing heru
+}
+
+
+</%INIT>
+<%ARGS>
+$Title => undef
+$Query => undef
+</%ARGS>
diff --git a/share/html/Reports/ResolvedByDates.html b/share/html/Reports/ResolvedByDates.html
new file mode 100644
index 0000000..0045388
--- /dev/null
+++ b/share/html/Reports/ResolvedByDates.html
@@ -0,0 +1,98 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
+%#                                          <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%args>
+$Queue => undef
+$ResolvedBefore => undef
+$ResolvedAfter => undef
+</%args>
+<%init>
+my $title = loc("Resolved tickets in period, grouped by owner");
+my $q = RT::Queue->new($session{'CurrentUser'});
+my $before = RT::Date->new($session{'CurrentUser'});
+my $after = RT::Date->new($session{'CurrentUser'});
+my $query = '';
+
+
+if ($ResolvedAfter) {
+    $after->Set(Format => 'unknown', Value => $ResolvedAfter);
+    $ResolvedAfter = $after->AsString;
+}
+if ($ResolvedBefore) {
+    $before->Set(Format => 'unknown', Value => $ResolvedBefore);
+    $ResolvedBefore = $before->AsString;
+}
+
+
+$q->LoadByCols(Name => $Queue);
+</%init>
+<& /Elements/Header, Title => $title &>
+% if ($Queue|| $ResolvedBefore ||$ResolvedAfter) {
+% # if we have a queue, do the search
+% $query = "Status = 'resolved'";
+% if ($Queue) { $query .= " AND Queue = '$Queue'"}
+% if ($ResolvedBefore) { $query .= " AND Resolved < '".$before->ISO(Timezone => 'user')."'"; }
+% if ($ResolvedAfter) { $query .= " AND Resolved > '".$after->ISO(Timezone => 'user')."'"}
+% }
+<& /Reports/Elements/Tabs, Query => $query &>
+<form method="post" action="ResolvedByDates.html">
+% if ($Queue|| $ResolvedBefore ||$ResolvedAfter) {
+% # if we have a queue, do the search
+% my $groupby = 'Owner.Name';
+<& /Search/Elements/Chart, Query => $query, GroupBy => $groupby &>
+% }
+
+<hr />
+
+<br /><&|/l&>Queue</&>: <& /Elements/SelectQueue, Name => 'Queue', NamedValues => 1, Default => $q->id &>
+<br /><&|/l&>Tickets resolved after</&>: 
+<& /Elements/SelectDate, Name => 'ResolvedAfter', Default => ($ResolvedAfter) ? $after->ISO(Timezone => 'user') : ''&>
+<br /><&|/l&>Tickets resolved before</&>: 
+<& /Elements/SelectDate, Name => 'ResolvedBefore', Default => ($ResolvedBefore) ? $before->ISO(Timezone => 'user') : ''&>
+
+<& /Elements/Submit&>
+</form>
diff --git a/share/html/Reports/ResolvedByOwner.html b/share/html/Reports/ResolvedByOwner.html
new file mode 100644
index 0000000..f59edb2
--- /dev/null
+++ b/share/html/Reports/ResolvedByOwner.html
@@ -0,0 +1,69 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
+%#                                          <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%args>
+$Queue => undef
+</%args>
+<%init>
+my $title = loc("Resolved tickets, grouped by owner");
+my $q = RT::Queue->new($session{'CurrentUser'});
+$q->LoadByCols(Name => $Queue);
+</%init>
+<& /Elements/Header, Title => $title &>
+% my $query = $Queue ? "Status = 'resolved' AND Queue = '$Queue'" : "";
+<& /Reports/Elements/Tabs, Query => $query &>
+<form method="post" action="ResolvedByOwner.html">
+% if ($Queue) {
+% my $groupby = 'Owner.Name';
+<& /Search/Elements/Chart, Query => $query, GroupBy => $groupby &>
+% }
+
+<hr />
+
+<&|/l&>Queue</&>: <& /Elements/SelectQueue, Name => 'Queue', NamedValues => 1, Default => $q->id &>
+<& /Elements/Submit&>
+</form>
diff --git a/share/html/Reports/index.html b/share/html/Reports/index.html
new file mode 100644
index 0000000..e54b0b2
--- /dev/null
+++ b/share/html/Reports/index.html
@@ -0,0 +1,75 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
+%#                                          <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /Elements/Header, Title => loc('Reports') &>
+<& /Reports/Elements/Tabs  &>
+<& /Elements/ListMenu, menu => $reports &>
+% $m->callback;
+<%init>
+my $reports = PageMenu->child( reports => title => loc('Reports'), path => '/Reports/index.html' );
+$reports->child( resolvedbyowner =>
+    title       => loc('Resolved by owner'),
+    path        => '/Reports/ResolvedByOwner.html',
+    description => loc('Examine tickets resolved in a queue, grouped by owner'),
+);
+$reports->child( resolvedindaterange => 
+    title       => loc('Resolved in date range'),
+    path        => '/Reports/ResolvedByDates.html',
+    description => loc('Examine tickets resolved in a queue between two dates'),
+);
+$reports->child( createdindaterange => 
+    title       => loc('Created in a date range'),
+    path        => '/Reports/CreatedByDates.html',
+    description => loc('Examine tickets created in a queue between two dates'),
+);
+
+#$m->callback( CallbackName => 'ListReports', %ARGS, tabs => $reports );
+$m->callback;
+
+</%init>
+<%args>
+</%args>

-----------------------------------------------------------------------


More information about the rt-commit mailing list