[Bps-public-commit] rt-extension-excelfeed branch master updated. 0.09-5-ge30335f

BPS Git Server git at git.bestpractical.com
Tue Jan 16 17:20:36 UTC 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt-extension-excelfeed".

The branch, master has been updated
       via  e30335f8d89031451e04a8abb5f0cba54949a7e6 (commit)
       via  46515d55f6211c0fffd962e6069fe1d2aa2a058e (commit)
       via  925506cc06790b38deb6b823df7174d27e9835c8 (commit)
       via  135f1e202a3b28ca5812eada9b8e4ecbbc79be46 (commit)
      from  69b0218c8d98a2bde443109fe27816ec87635216 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e30335f8d89031451e04a8abb5f0cba54949a7e6
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Jan 16 11:37:35 2024 -0500

    Prep 0.10

diff --git a/Changes b/Changes
index a58bc50..efca026 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+0.10 2024-01-16
+ - Support to download search results for more collections(transactions and assets)
+ - Support transaction and asset charts
+ - Support txn/asset/chart excel attachments for dashboard emails
+
 0.09 2023-11-15
  - Add option to hide Download as Microsoft Excel Spreadsheet from Charts
 
diff --git a/META.yml b/META.yml
index b3a68c8..2eb4721 100644
--- a/META.yml
+++ b/META.yml
@@ -23,7 +23,7 @@ requires:
   perl: 5.10.1
 resources:
   license: http://opensource.org/licenses/gpl-license.php
-version: '0.09'
+version: '0.10'
 x_module_install_rtx_version: '0.43'
 x_requires_rt: 4.4.5
 x_rt_too_new: 5.2.0
diff --git a/README b/README
index a6304ef..7cc8cf3 100644
--- a/README
+++ b/README
@@ -50,7 +50,7 @@ BUGS
         L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-ExcelFeed>.
 
 LICENSE AND COPYRIGHT
-    This software is Copyright (c) 2015-2020 by Best Practical Solutions,
+    This software is Copyright (c) 2015-2024 by Best Practical Solutions,
     LLC
 
     This is free software, licensed under:
diff --git a/lib/RT/Extension/ExcelFeed.pm b/lib/RT/Extension/ExcelFeed.pm
index fdc8b82..b204e36 100644
--- a/lib/RT/Extension/ExcelFeed.pm
+++ b/lib/RT/Extension/ExcelFeed.pm
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 package RT::Extension::ExcelFeed;
 
-our $VERSION = '0.09';
+our $VERSION = '0.10';
 
 =head1 NAME
 
@@ -78,7 +78,7 @@ or via the web at
 
 =head1 LICENSE AND COPYRIGHT
 
-This software is Copyright (c) 2015-2020 by Best Practical Solutions, LLC
+This software is Copyright (c) 2015-2024 by Best Practical Solutions, LLC
 
 This is free software, licensed under:
 

commit 46515d55f6211c0fffd962e6069fe1d2aa2a058e
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Jan 16 12:15:06 2024 -0500

    Support txn/asset/chart excel attachments for dashboard emails

diff --git a/lib/RT/Dashboard/Mailer_Vendor.pm b/lib/RT/Dashboard/Mailer_Vendor.pm
index 1221775..dd1dd51 100644
--- a/lib/RT/Dashboard/Mailer_Vendor.pm
+++ b/lib/RT/Dashboard/Mailer_Vendor.pm
@@ -132,14 +132,28 @@ SUMMARY
         # Run each search and push the resulting file into the @attachments array
         foreach my $search (@searches){
             my $search_content = $search->{'Attribute'}->Content;
-
-            my $xlsx = RunComponent(
-                '/Search/Results.xlsx',
-                'Query'   => $search_content->{'Query'} || '',
-                'Order'   => $search_content->{'Order'} || '',
-                'OrderBy' => $search_content->{'OrderBy'} || '',
-                'Format'  => $search_content->{'Format'} || '',
-            );
+            my $xlsx;
+
+            if ( ( $search_content->{SearchType} // '' ) eq 'Chart' ) {
+                $xlsx = RunComponent(
+                    '/Search/Chart.xlsx',
+                    'Query'         => $search_content->{'Query'}         || '',
+                    'GroupBy'       => $search_content->{'GroupBy'}       || '',
+                    'ChartFunction' => $search_content->{'ChartFunction'} || '',
+                    'Class'         => $search_content->{'Class'}         || 'RT::Tickets',
+                );
+            }
+            else {
+                $xlsx = RunComponent(
+                    '/Search/Results.xlsx',
+                    'Query'      => $search_content->{'Query'}   || '',
+                    'Order'      => $search_content->{'Order'}   || '',
+                    'OrderBy'    => $search_content->{'OrderBy'} || '',
+                    'Format'     => $search_content->{'Format'}  || '',
+                    'Class'      => 'RT::' . ( $search_content->{'SearchType'} || 'Ticket' ) . 's',
+                    'ObjectType' => $search_content->{'ObjectType'} || '',
+                );
+            }
 
             # Grab Name for RT System saved searches
             my $search_name = $search->{'Attribute'}->Name;

commit 925506cc06790b38deb6b823df7174d27e9835c8
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Jan 16 11:36:15 2024 -0500

    Support to download search results for more collections(transactions and assets)

diff --git a/html/Callbacks/RT-Extension-ExcelFeed/Elements/Tabs/Privileged b/html/Callbacks/RT-Extension-ExcelFeed/Elements/Tabs/Privileged
index 4514e04..7c8e736 100644
--- a/html/Callbacks/RT-Extension-ExcelFeed/Elements/Tabs/Privileged
+++ b/html/Callbacks/RT-Extension-ExcelFeed/Elements/Tabs/Privileged
@@ -10,7 +10,7 @@ if ( $Has_Query ) {
     my $current_search_menu;
     if ( $Path =~ m{^/Ticket} ) {
         $current_search_menu = $search->child('current_search');
-    } elsif ( $Path =~ m{^/Search/} && ( !$DECODED_ARGS->{Class} || $DECODED_ARGS->{Class} eq 'RT::Tickets' ) ) {
+    } elsif ( $Path =~ m{^/Search/} ) {
         $current_search_menu = PageMenu();
     }
 
diff --git a/html/Search/Results.xlsx b/html/Search/Results.xlsx
index f317736..f4c5d27 100644
--- a/html/Search/Results.xlsx
+++ b/html/Search/Results.xlsx
@@ -51,22 +51,49 @@ $Query => ''
 $OrderBy => 'id'
 $Order => 'ASC'
 $PreserveNewLines => 0
+$Class => 'RT::Tickets'
+$ObjectType => $Class eq 'RT::Transactions' ? 'RT::Ticket' : ''
 </%ARGS>
 <%INIT>
-my $Tickets = RT::Tickets->new( $session{'CurrentUser'} );
-$Tickets->FromSQL( $Query );
+my $collection = $Class->new( $session{'CurrentUser'} );
+
+if ( $Class eq 'RT::Transactions' ) {
+    $Query = PreprocessTransactionSearchQuery( Query => $Query, ObjectType => $ObjectType );
+}
+
+if ( $Query ) {
+    $collection->FromSQL( $Query );
+}
+elsif ( $Class eq 'RT::Assets' ) {
+    my $catalog_obj = LoadDefaultCatalog($ARGS{'Catalog'} || '');
+    $ARGS{'Catalog'} = $catalog_obj->Id;
+    ProcessAssetsSearchArguments(
+        Assets => $collection, Catalog => $catalog_obj, ARGSRef => \%ARGS,
+    );
+}
+
 if ( $OrderBy =~ /\|/ ) {
     # Multiple Sorts
     my @OrderBy = split /\|/, $OrderBy;
     my @Order   = split /\|/, $Order;
-    $Tickets->OrderByCols(
+    $collection->OrderByCols(
         map { { FIELD => $OrderBy[$_], ORDER => $Order[$_] } }
         ( 0 .. $#OrderBy )
     );
 }
 else {
-    $Tickets->OrderBy( FIELD => $OrderBy, ORDER => $Order );
+    $collection->OrderBy( FIELD => $OrderBy, ORDER => $Order );
+}
+
+if ( $Class eq 'RT::Assets' && !$Format ) {
+    $Format = q|id, Name, Description, Status, Catalog, |;
+    $Format .= "$_, " for RT::Asset->Roles;
+    my $catalog_obj = LoadDefaultCatalog($ARGS{'Catalog'} || '');
+    my $CFs = RT::CustomFields->new( $session{CurrentUser} );
+    $CFs->LimitToCatalog( $catalog_obj->Id );
+    $CFs->LimitToObjectId( 0 ); # LimitToGlobal but no LookupType restriction
+    $Format .= "'__CF.{$_}__/TITLE:$_', " for map {$_ = $_->Name; s/['\\]/\\$1/g; $_} @{$CFs->ItemsArrayRef};
 }
 
-$m->comp( "/Elements/XLSXExport", Collection => $Tickets, Format => $Format, PreserveNewLines => $PreserveNewLines );
+$m->comp( "/Elements/XLSXExport", Collection => $collection, Format => $Format, PreserveNewLines => $PreserveNewLines );
 </%INIT>

commit 135f1e202a3b28ca5812eada9b8e4ecbbc79be46
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Jan 16 09:35:48 2024 -0500

    Support old versions of RT that lacks ReportClass method(<5.0.6)

diff --git a/html/Search/Chart.xlsx b/html/Search/Chart.xlsx
index 5a2702b..7163062 100644
--- a/html/Search/Chart.xlsx
+++ b/html/Search/Chart.xlsx
@@ -1,10 +1,19 @@
 <%INIT>
 use Excel::Writer::XLSX;
 
-my $report_class = ( $Class || 'RT::Tickets' )->ReportClass
-    or Abort( loc( "Couldn't find ReportClass for [_1]", $Class || 'RT::Tickets' ) );
-RT::StaticUtil::RequireModule($report_class) or Abort( loc("Couldn't load [_1]", $report_class) );
-my $report = $report_class->new( $session{'CurrentUser'} );
+
+my $report;
+
+if ( ( $Class || 'RT::Tickets' )->can('ReportClass') ) {
+    my $report_class = ( $Class || 'RT::Tickets' )->ReportClass
+        or Abort( loc( "Couldn't find ReportClass for [_1]", $Class || 'RT::Tickets' ) );
+    RT::StaticUtil::RequireModule($report_class) or Abort( loc( "Couldn't load [_1]", $report_class ) );
+    $report = $report_class->new( $session{'CurrentUser'} );
+}
+else {
+    require RT::Report::Tickets;
+    $report = RT::Report::Tickets->new( $session{CurrentUser} );
+}
 
 my %columns = $report->SetupGroupings(
     Query => $Query,

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

Summary of changes:
 Changes                                            |  5 +++
 META.yml                                           |  2 +-
 README                                             |  2 +-
 .../Elements/Tabs/Privileged                       |  2 +-
 html/Search/Chart.xlsx                             | 17 +++++++---
 html/Search/Results.xlsx                           | 37 +++++++++++++++++++---
 lib/RT/Dashboard/Mailer_Vendor.pm                  | 30 +++++++++++++-----
 lib/RT/Extension/ExcelFeed.pm                      |  4 +--
 8 files changed, 77 insertions(+), 22 deletions(-)


hooks/post-receive
-- 
rt-extension-excelfeed


More information about the Bps-public-commit mailing list