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

Kevin Falcone falcone at bestpractical.com
Mon Feb 9 13:17:16 EST 2009


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

> 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



More information about the Rt-devel mailing list