X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Flib%2FRT%2FSavedSearch.pm;h=3e0e928eb90440e957096c4859f5ab94f1c0aa45;hp=f7695d6f04aac83351ce0a6a965876a863a8a061;hb=e9e0cf0989259b94d9758eceff448666a2e5a5cc;hpb=85e677b86fc37c54e6de2b06340351a28f5a5916 diff --git a/rt/lib/RT/SavedSearch.pm b/rt/lib/RT/SavedSearch.pm index f7695d6f0..3e0e928eb 100644 --- a/rt/lib/RT/SavedSearch.pm +++ b/rt/lib/RT/SavedSearch.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -77,7 +77,7 @@ An object of this class is called "search" =cut -sub ObjectName { "search" } +sub ObjectName { "search" } # loc sub PostLoad { my $self = shift; @@ -115,6 +115,28 @@ sub UpdateAttribute { return ($status, $msg); } +=head2 RT::SavedSearch->EscapeDescription STRING + +This is a class method because system-level saved searches aren't true +C objects but direct C objects. + +Returns C with all square brackets except those in C<[_1]> escaped, +ready for passing as the first argument to C. + +=cut + +sub EscapeDescription { + my $self = shift; + my $desc = shift; + if ($desc) { + # We only use [_1] in saved search descriptions, so let's escape other "[" + # and "]" unless they are escaped already. + $desc =~ s/(?