[rt-devel] Contrib: AutoAssign (RT2.0.x)

Phil Homewood pdh at snapgear.com
Thu Apr 25 01:42:12 EDT 2002

A while back, Bruce Campbell wrote:
> The attached RT::Action and insert script will automatically change the
> ownership of a ticket if the following conditions are met:


> Caveats - the WebUI puts in a SetOwner, meaning that you will see a quick
> series of 'RT_System gives ticket to Joe', then 'Joe gives ticket to
> Nobody', with the final Owner undefined, but predominately Nobody.  The
> current way of fixing this would be to patch
> WebRT/html/Ticket/Elements/EditPeople to default to the current user if it
> is currently Nobody.  Ughity.

The attached patch takes care of this. (It's actually to
Ticket/Update.html.) Ughity indeed; the logic is starting
to become hard to understand. ;)

This patch also has a caveat: it applies equally to Comment
transactions done via the WebUI as to Correspondence. While
it would be possible to trigger only on correspond, this
adds more hard to follow (IMO) conditional bits and just
isn't worth the hassle for me. Someone else might want to
do it, though.
-------------- next part --------------
Index: Update.html
RCS file: /cvs/local/rt/webrt/Ticket/Update.html,v
retrieving revision 1.4
diff -u -r1.4 Update.html
--- Update.html	23 Jan 2002 04:47:32 -0000	1.4
+++ Update.html	25 Apr 2002 05:28:18 -0000
@@ -32,7 +32,7 @@
 <& /Elements/SelectStatus, Name=>"Status", Default => $DefaultStatus &>
-<& /Elements/SelectOwner, Name=>"Owner", Default => $Ticket->OwnerObj->Id(), QueueObj => $Ticket->QueueObj, TicketObj => $Ticket &>
+<& /Elements/SelectOwner, Name=>"Owner", Default => (($Ticket->OwnerObj->Id == $RT::Nobody->Id() && $session{'CurrentUser'}->HasQueueRight(Right => 'OwnTicket', QueueObj => $Ticket->QueueObj, TicketObj => $Ticket)) && $session{'CurrentUser'}->Id || $Ticket->OwnerObj->Id()), 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">

More information about the Rt-devel mailing list