[Rt-commit] [rtir] 05/07: Add quotes around new CF values in searches

Jim Brandt jbrandt at bestpractical.com
Tue Jul 2 15:25:59 EDT 2013


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

jbrandt pushed a commit to branch 2.9/update-2.5.1-update-saved-search
in repository rtir.

commit 97d902f09ab57e9aabc7bd84876c843318cd7ea2
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Tue Jul 2 14:45:06 2013 -0400

    Add quotes around new CF values in searches
    
    Previous RTIR CFs had no spaces, so saved searches containing
    them won't have quotes around the CF. Add quotes for replaced
    CFs that now have spaces.
---
 etc/upgrade/2.5.1/update_saved_searches.pl.in | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/etc/upgrade/2.5.1/update_saved_searches.pl.in b/etc/upgrade/2.5.1/update_saved_searches.pl.in
index 0075c83..797edc9 100644
--- a/etc/upgrade/2.5.1/update_saved_searches.pl.in
+++ b/etc/upgrade/2.5.1/update_saved_searches.pl.in
@@ -70,12 +70,16 @@ while ( my $s = $saved_searches->Next ) {
     my $old_query  = $content->{Query};
     my $old_format = $content->{Format};
     my $special = join '|', keys %special_rename;
+    my $cf_values = join '|', values %special_rename;
     foreach ( $content->{Query}, $content->{Format} ) {
         s/(?<=CF\.{)_RTIR_//ig;
         s/(?<=CustomField\.{)_RTIR_//ig;
         s/(?<=CF\.{)_RTIR_//ig;
         s/(?<=CustomField\.{)_RTIR_//ig;
         s/\b($special)\b/$special_rename{lc($1)}/ige;
+
+        # Add quotes to handle new CFs with spaces
+        s/\s((CF|CustomField)\.{($cf_values)})\s/ '$1' /g;
     }
 
     if ( $old_query ne $content->{Query} || $old_format ne $content->{Format} )

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


More information about the Rt-commit mailing list