[Rt-devel] [Patch] Set a default update type per queue

Chad Granum chad at opensourcery.com
Mon Feb 9 13:25:29 EST 2009


Kevin Falcone wrote:
> On Feb 9, 2009, at 12:40 PM, Chad Granum wrote:
>
>   
>> I have attached a patch that allows you to specify the default update
>> type per queue. This really only effects which option (reply or  
>> comment)
>> is pre-selected for you on jumbo edit.
>>
>> It adds a select to the queue editing page to set the option for the
>> queue. The Ticket ModifyAll page then defaults to the selected option
>> for that queue. This is useful because we have a few queues where we
>> never want to comment,
>>     
>
> Hi Chad
>
> I'm curious if this is "never want to comment" or "must never comment"
> (if the latter, I'd just take away the right to comment and RT would  
> do the
> right thing).  I'm not sure I would take this into core since I think  
> it would
> make a nice plugin.
>
> -kevin
>
>   
In our case it is a 'there is no need to comment', the requester is
automatically stripped for the queues in question.

But to go deeper I realized that both internally and through clients we
have gotten requests to make some queues default to one or the other.
Sometimes they want Queue A to default to replies while Queue B defaults
to comments.

Initially I was going to make it a plugin, but I thought if we were
getting this many requests for it that it might be worth a patch.
Additionally it is much easier to implement as a patch, I am not sure
how the HTML callbacks and overlays would work for doing this specific
functionality.

(I have done other plugins that toucht he view layer, but the
callbacks/overrides were much easier to identify)

-Chad
>> and always want to reply, but people keep
>> forgetting to switch options. We have other queues however where  
>> that is
>> not the case, so a mass change was not an option.
>>
>> -Chad Granum
>> (OpenSourcery)
>>
>> Index: share/html/Ticket/ModifyAll.html
>> ===================================================================
>> --- share/html/Ticket/ModifyAll.html	(revision 275)
>> +++ share/html/Ticket/ModifyAll.html	(working copy)
>> @@ -91,12 +91,20 @@
>>     <td class="entry">
>>       <select name="UpdateType">
>> % if ($CanComment) {
>> -        <option value="private" ><&|/l&>Comments (Not sent to  
>> requestors)</&></option>
>> +        <option value="private"
>> +%          if ( $Ticket->QueueObj->DefaultUpdateType ne  
>> 'response' ) {
>> +               selected="selected"
>> +%          }
>> +        ><&|/l&>Comments (Not sent to requestors)</&></option>
>> % }
>> % if ($CanRespond) {
>> -        <option value="response"><&|/l&>Reply to requestors</&></ 
>> option>
>> +        <option value="response"
>> +%          if ( $Ticket->QueueObj->DefaultUpdateType eq  
>> 'response' ) {
>> +               selected="selected"
>> +%          }
>> +        ><&|/l&>Reply to requestors</&></option>
>> % }
>> -      </select>
>> +      </select>
>>     </td>
>>   </tr>
>>   <tr>
>> Index: share/html/Admin/Queues/Modify.html
>> ===================================================================
>> --- share/html/Admin/Queues/Modify.html	(revision 275)
>> +++ share/html/Admin/Queues/Modify.html	(working copy)
>> @@ -89,6 +89,24 @@
>> <td colspan="3"><input name="DefaultDueIn" value="<% ($Create) ?  
>> "" : $QueueObj->DefaultDueIn%>" /> <&|/l&>days</&>.</td>
>> </tr>
>>
>> +<tr>
>> +    <td align="right"><&|/l&>Default update type</&>:</td>
>> +    <td colspan="3">
>> +        <select Name="DefaultUpdateType">
>> +            <option value="private"
>> +%               if ( $QueueObj->DefaultUpdateType ne 'response' ) {
>> +                    selected="selected"
>> +%               }
>> +            ><&|/l&>Comments (Not sent to requestors)</&></option>
>> +            <option value="response"
>> +%               if ( $QueueObj->DefaultUpdateType eq 'response' ) {
>> +                    selected="selected"
>> +%               }
>> +            ><&|/l&>Reply to requestors</&></option>
>> +        </select>
>> +    </td>
>> +</tr>
>> +
>> % my $CFs = $QueueObj->CustomFields;
>> % while (my $CF = $CFs->Next) {
>> <tr valign="top"><td align="right">
>> @@ -175,6 +193,8 @@
>>
>>     $EnabledChecked = "" if $QueueObj->Disabled;
>>
>> +    $QueueObj->SetDefaultUpdateType( $DefaultUpdateType ) if  
>> $DefaultUpdateType;
>> +
>>     my @linkresults;
>>     $m->callback(
>>         results      => \@linkresults,
>> @@ -201,4 +221,5 @@
>> $DefaultDueIn => undef
>> $SetEnabled => undef
>> $Enabled => undef
>> +$DefaultUpdateType => undef
>> </%ARGS>
>> Index: lib/RT/Queue_Overlay.pm
>> ===================================================================
>> --- lib/RT/Queue_Overlay.pm	(revision 275)
>> +++ lib/RT/Queue_Overlay.pm	(working copy)
>> @@ -539,6 +539,23 @@
>>     ))
>> }
>>
>> +sub DefaultUpdateType {
>> +    my $self = shift;
>> +    my $default = 'private';
>> +    my $attribute = $self->FirstAttribute( 'DefaultUpdateType' );
>> +    return $attribute->Content if $attribute and $attribute->id;
>> +    return $default;
>> +}
>> +
>> +sub SetDefaultUpdateType {
>> +    my $self = shift;
>> +    my ( $value ) = @_;
>> +    $self->SetAttribute(
>> +        Name => 'DefaultUpdateType',
>> +        Content => $value,
>> +    );
>> +}
>> +
>> # {{{ sub Templates
>>
>> =head2 Templates
>> _______________________________________________
>> List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
>>     
>
> _______________________________________________
> List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
>   


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.bestpractical.com/pipermail/rt-devel/attachments/20090209/cfbff75a/attachment-0001.pgp 


More information about the Rt-devel mailing list