[rt-users] AutoTake - where?

Phil Homewood pdh at snapgear.com
Sat Jun 1 07:39:27 EDT 2002


Bruce Campbell wrote:
> There is a problem with AutoTake in that when it fires when the action was
> triggered from the WebUI, the WebUI resets the owner information back to
> what it was.  This problem does not occur from the mail interface, which
> is our primary usage of the ScripAction.

I posted a patch to webrt/Ticket/Update.pm to rt-devel on
April 25; I subsequently decided it was Too Damn Ugly and
rewrote it. See attached.

(This will make the WebUI default the owner to the current
user if said user has the right to own the ticket, and the
ticket was previously owned by Nobody.)
-------------- next part --------------
Index: Update.html
===================================================================
RCS file: /cvs/local/rt/webrt/Ticket/Update.html,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 Update.html
--- Update.html	23 Jan 2002 00:47:58 -0000	1.1.1.3
+++ Update.html	1 Jun 2002 11:31:46 -0000
 <td>
 <& /Elements/SelectStatus, Name=>"Status", Default => $DefaultStatus &>
 Owner:  
-<& /Elements/SelectOwner, Name=>"Owner", Default => $Ticket->OwnerObj->Id(), QueueObj => $Ticket->QueueObj, TicketObj => $Ticket &>
+<& /Elements/SelectOwner, Name=>"Owner", Default => $DefaultOwner, QueueObj => $Ticket->QueueObj, TicketObj => $Ticket &>
 Worked: <input size=4 name="UpdateTimeWorked"> minutes</td></tr>
 <tr><td align=right>Update Type:</td>
 <td><select name="UpdateType">
@@ -73,6 +72,7 @@
 my $CanRespond = 0;
 my $CanComment = 0;
 my $title;
+my $DefaultOwner;
 
 my $Ticket = LoadTicket($id);
 
@@ -91,6 +91,16 @@
 my $ResponseDefault=$Action eq "Respond" ? "SELECTED" : "";
 
 $DefaultStatus = $Ticket->Status() unless ($DefaultStatus);
+
+if ($Ticket->OwnerObj->Id == $RT::Nobody->Id() &&
+	$session{'CurrentUser'}->HasQueueRight(Right => 'OwnTicket',
+						QueueObj => $Ticket->QueueObj,
+						TicketObj => $Ticket)) {
+	$DefaultOwner=$session{'CurrentUser'}->Id;
+} else {
+	$DefaultOwner=$Ticket->OwnerObj->Id();
+	
+}
 
 $CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
                      $Ticket->CurrentUserHasRight('ModifyTicket') ); 


More information about the rt-users mailing list