[Rt-commit] [rtir] 01/02: Rename $RTIRSearchResultFormats to %RTIRSearchResultFormats

Kevin Falcone falcone at bestpractical.com
Fri Jul 25 22:56:03 EDT 2014


This is an automated email from the git hooks/post-receive script.

falcone pushed a commit to branch 3.2/hashify-rtirsearchresultsformats
in repository rtir.

commit 4020d04e1268460d76b316b1ba13571ec261a398
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Jul 25 22:17:36 2014 -0400

    Rename $RTIRSearchResultFormats to %RTIRSearchResultFormats
    
    Now you can actually use RT Config's built in hash merging of top level
    keys, rather than copying the whole hashref and having problems when we
    update the defaults that you didn't change or when we add new keys.
---
 docs/UPGRADING-3.2  |  7 +++++++
 etc/RTIR_Config.pm  | 14 +++++++++-----
 lib/RT/IR/Config.pm |  6 +++---
 3 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/docs/UPGRADING-3.2 b/docs/UPGRADING-3.2
index 4d116d7..b838e7a 100644
--- a/docs/UPGRADING-3.2
+++ b/docs/UPGRADING-3.2
@@ -9,3 +9,10 @@ for previous versions.
 
 The F<add_constituency> script has been moved from F<etc> to the standard
 F<bin> directory.
+
+=head2 C<$RTIRSearchResultFormats> now C<%RTIRSearchResultFormats>
+
+If you've copied $RTIRSearchResultFormats to your RTIR_SiteConfig.pm,
+you will want to update with the changes, and only copy the entries that
+you change.  You no longer need to copy the entire configuration option
+just to change one or two of the formats.
diff --git a/etc/RTIR_Config.pm b/etc/RTIR_Config.pm
index 634a76b..33efd8b 100644
--- a/etc/RTIR_Config.pm
+++ b/etc/RTIR_Config.pm
@@ -321,13 +321,19 @@ because the current implementation has poor performance.
 
 Set($RTIR_OldestRelatedTickets, 60);
 
-=item C<$RTIRSearchResultFormats>
+=item C<%RTIRSearchResultFormats>
 
 Default formats for RTIR search results
 
+If you only want to override one entry, you can copy only part of this,
+which will protect you during upgrades because other entries will be
+merged from this configuration.  To change just the Investigation list you would do:
+
+    Set(%RTIRSearchResultFormats, InvestigationDefault => 'modified configuration');
+
 =cut
 
-Set($RTIRSearchResultFormats, {
+Set(%RTIRSearchResultFormats,
     Default =>
         q{'<b><a HREF="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></b>/TITLE:#',
           '<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></b>/TITLE:Subject',
@@ -353,7 +359,6 @@ Set($RTIRSearchResultFormats, {
           __CreatedRelative__,
           __NEWLINE__,
           '', __Requestors__, __OwnerName__, __ToldRelative__, __DueRelative__, __TimeLeft__},
-
     BlockDefault =>
         q{'<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></b>/TITLE:#',
           '<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></b>/TITLE:Subject',
@@ -362,7 +367,6 @@ Set($RTIRSearchResultFormats, {
           __CreatedRelative__,
           __NEWLINE__,
           '', __Requestors__, __OwnerName__, __ToldRelative__, __DueRelative__, __TimeLeft__},
-
     IncidentDefault =>
         q{'<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></b>/TITLE:#',
           '<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></b>/TITLE:Subject',
@@ -442,7 +446,7 @@ Set($RTIRSearchResultFormats, {
           __Status__,
           __Priority__},
 
-} );
+);
 
 =item C<$DisplayAfterEdit>
 
diff --git a/lib/RT/IR/Config.pm b/lib/RT/IR/Config.pm
index c369f32..03dae8b 100644
--- a/lib/RT/IR/Config.pm
+++ b/lib/RT/IR/Config.pm
@@ -73,9 +73,9 @@ sub Init {
     # should go here.
     $RT::Config::META{RTIRSearchResultFormats}{PostLoadCheck} =
         sub {
-            my ($self, $value) = @_;
-            foreach my $format ( keys %{$value} ){
-                CheckObsoleteCFSyntax($value->{$format},
+            my ($self, %value) = @_;
+            foreach my $format ( keys %value ){
+                CheckObsoleteCFSyntax($value{$format},
                     $RT::Config::META{RTIRSearchResultFormats}{Source}{File});
             }
         };

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list