X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Flib%2FRT%2FSavedSearch.pm;h=4dd869bf2492ae48ae5e98545d3aded0431d10c2;hp=f7695d6f04aac83351ce0a6a965876a863a8a061;hb=919e930aa9279b3c5cd12b593889cd6de79d67bf;hpb=f3c4966ed1f6ec3db7accd6dcdd3a5a3821d72a7 diff --git a/rt/lib/RT/SavedSearch.pm b/rt/lib/RT/SavedSearch.pm index f7695d6f0..4dd869bf2 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-2015 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/(?new($CurrentUser); $groups->LimitToUserDefinedGroups; - $groups->WithMember( PrincipalId => $CurrentUser->Id, - Recursively => 1 ); + $groups->WithCurrentUser; if ($has_attr) { my $attrs = $groups->Join( ALIAS1 => 'main',