[Bps-public-commit] rt-extension-changemanagement branch master updated. fcf580b97e4701d03de93ad6080532795c31f9b2

BPS Git Server git at git.bestpractical.com
Tue Apr 19 21:23:34 UTC 2022


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-changemanagement".

The branch, master has been updated
       via  fcf580b97e4701d03de93ad6080532795c31f9b2 (commit)
      from  aeeae090d1a5a4b7b8d5263db650390da2c4f118 (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 fcf580b97e4701d03de93ad6080532795c31f9b2
Author: Jason Crome <jcrome at bestpractical.com>
Date:   Tue Apr 19 17:19:42 2022 -0400

    Make saved searches show in query builder Load menu
    
    Saved searches need to have an attribute name of SavedSearch; the
    description should be the actual name of the search, otherwise the Load
    menu in the query builder doesn't know to include them in the list of
    selections.
    
    An upgrade script is needed to correct this for any installed instances
    of the change management extension.

diff --git a/etc/initialdata b/etc/initialdata
index b703ed6..e1d0804 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -188,8 +188,8 @@ push @ACL,
     };
 
 our @Attributes = (
-    { Name => 'Search - Changes Scheduled, Next 7 Days',
-      Description => 'Change management requests due in the next 7 days', # loc
+    { Name => 'SavedSearch',
+      Description => 'Changes Scheduled, Next 7 Days', # loc
       Content     =>
       { Format =>  q{'<a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a>/TITLE:#',}
                  . q{'<a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a>/TITLE:Subject',}
@@ -198,8 +198,8 @@ our @Attributes = (
         OrderBy  => 'due ASC',
       },
     },
-    { Name => 'Search - Changes Deployed, Last 30 Days',
-      Description => 'Change management requests completed in the last 30 days', # loc
+    { Name => 'SavedSearch',
+      Description => 'Changes Deployed, Last 30 Days', # loc
       Content     =>
       { Format =>  q{'<a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a>/TITLE:#',}
                  . q{'<a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a>/TITLE:Subject',}
@@ -256,21 +256,24 @@ our @Final = sub {
 
     if ($ret) {
         my @searches;
-        for my $search_name ( 'Changes Scheduled, Next 7 Days', 'Changes Deployed, Last 30 Days' ) {
-            my ($search) = RT::System->new( RT->SystemUser )->Attributes->Named( 'Search - ' . $search_name );
-            if ($search) {
+        for my $search_desc ( 'Changes Scheduled, Next 7 Days', 'Changes Deployed, Last 30 Days' ) {
+            my $search = RT::Attribute->new( RT->SystemUser );
+            ( $ret, $msg ) = $search->LoadByCols(
+                Name        => 'SavedSearch',
+                Description => $search_desc,
+            );
+            if ($search && $ret) {
                 push @searches,
                     {
                     pane         => 'body',
                     portlet_type => 'search',
                     id           => $search->Id,
-                    description  => "Saved Search: $search_name",
+                    description  => "Saved Search: $search_desc",
                     privacy      => join( '-', ref( RT->System ), RT->System->Id ),
                     };
-            }
-            else {
-                RT->Logger->error("Couldn't find search $search_name");
-            }
+                } else {
+                    RT->Logger->error( "Could not load saved search '$search_desc': $msg" );
+                }
         }
 
         my $panes = {
@@ -280,7 +283,7 @@ our @Final = sub {
         };
 
         # fill content
-        my ( $ret, $msg ) = $dashboard->Update( Panes => $panes );
+        ( $ret, $msg ) = $dashboard->Update( Panes => $panes );
         if ( !$ret ) {
             RT->Logger->error("Couldn't update content for dashboard Change Management: $msg");
         }
-----------------------------------------------------------------------

Summary of changes:
 etc/initialdata | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
rt-extension-changemanagement


More information about the Bps-public-commit mailing list