[rt-users] Filtering out Templates by Name

Kevin Falcone falcone at bestpractical.com
Thu Mar 4 16:07:16 EST 2010


On Thu, Mar 04, 2010 at 02:46:29PM -0500, Kevin Squire wrote:
> I am currently revisiting the "Canned-Reply" idea.
> http://wiki.bestpractical.com/view/CannedReplies

Is there a reason to use this rather than the RTFM extension?

If you must use this, you can read the DBIx::SearchBuilder
documentation for the Limit command and the STARTSWITH option

-kevin

> Those directions make a call to /Admin/Elements/SelectTemplate to get
> the canned replys.  Up to now, I have simply named all our
> templates that will be used for Canned Replys as "CR - $NAME", and
> given the description of "Canned Reply for $DESCRIPTION".
> 
> Well, now our templates and our Canned Replys are getting numerous
> enough (combined with the need for canned Replyes with some non-techy
> users) that I would like to find a way to filter out the templates.
> 
> I copied the original /Admin/Elements/SelectTemplate over to
> <LOCAL>/Admin/Elements/SelectCannedReply  and adjusted my Update.html
> callback.  It is calling my new "SelectCannedReply" correctly.  But now
> I don't know how to do the filtering (I don't know perl)
> 
> From the SelectTemplate script:
>   my $PrimaryTemplates = RT::Templates->new($session{'CurrentUser'});
>   if ($Queue != 0) {
>   $PrimaryTemplates->LimitToQueue($Queue);
>   $PrimaryTemplates->OrderBy(FIELD => 'Name');
>   }
> 
>   my $OtherTemplates = RT::Templates->new($session{'CurrentUser'});
>   $OtherTemplates->LimitToGlobal($DefaultQueue);
>   $OtherTemplates->OrderBy(FIELD => 'Name');
> 
> I am thinking I can modify/add something to/before/after the
> "OrderBy(FIELD =>" line that would be on the lines of:
> 
>    IF (FIELD => 'Name') starts with "CR -"
> 
> but as noted, since I don't know perl, I really don't even know where
> to start on this one.  
> 
> Could someone help get me started?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20100304/ecc035b0/attachment.sig>


More information about the rt-users mailing list