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

Kevin Falcone falcone at bestpractical.com
Mon Aug 11 17:09:56 EDT 2014


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

falcone pushed a commit to branch master
in repository rtir.

commit 943ebfc5abdfa4410bedf2671d6a0ebb95a817b8
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Mon Aug 11 16:58:23 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  |  8 ++++++++
 etc/RTIR_Config.pm  | 14 +++++++++-----
 lib/RT/IR/Config.pm |  6 +++---
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/docs/UPGRADING-3.2 b/docs/UPGRADING-3.2
index 331d8ba..010c625 100644
--- a/docs/UPGRADING-3.2
+++ b/docs/UPGRADING-3.2
@@ -21,3 +21,11 @@ but the arguments passed have changed. If you have bookmarks pointing to
 It is now possible to edit the Due date of Incidents manually, however
 editing a child's Due Date will disable this (and Incident Due dates are
 not copied down to Children).
+
+=head2 C<$RTIRSearchResultFormats> now C<%RTIRSearchResultFormats>
+
+If you've copied $RTIRSearchResultFormats to your RTIR_SiteConfig.pm,
+you should switch to using %RTIRSearchResultFormats.  You no longer need
+to copy the entire configuration option just to change one or two of the
+formats (documented in RTIR_SiteConfig.pm) so you can merge your
+customizations together with our new entries and avoid copying defaults.
diff --git a/etc/RTIR_Config.pm b/etc/RTIR_Config.pm
index f2f3424..3efd09e 100644
--- a/etc/RTIR_Config.pm
+++ b/etc/RTIR_Config.pm
@@ -322,13 +322,19 @@ Lookup.html to run a query.
 
 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',
@@ -354,7 +360,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',
@@ -363,7 +368,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',
@@ -443,7 +447,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