AW: [Rt-devel] Interesting Reset ticket On Queue Change

Joby Walker joby at u.washington.edu
Fri Jul 20 12:33:51 EDT 2007


We use two scrips:

1) change the status to new on queue change:

Condition: "On Queue Change"
Action: "User Defined"
Template: "Global Template: Blank"

Custom Action prep code:
  return 1;
Custom Action cleanup code:
  $self->TicketObj()->setStatus('new');
  return 1;

2) Dropping the owner if they do not have permission to own the ticket
in the new queue:

Condition: "On Queue Change"
Action: "User Defined"
Template: "Global Template: Blank"

Custom Action prep code:
  my $t = $self->TicketObj;

  if ($t->HasRight( Right => 'OwnTicket', Principal => $t->OwnerObj)) {
      return 0;
  } else {
       return 1;
  }
Custom Action cleanup code:
  my ($status, $msg) = $self->TicketObj->SetOwner('Nobody', 'Force');
  unless ($status) {
      $RT::Logger->error($msg);
  }
  return $status;

Joby Walker
C&C SSG, University of Washington


Ham MI-ID, Torsten Brumm wrote:
> 
> 
> Hi steven,
> I'm fighting with the same at the moment, but I think this is a normal
> rt way of acting, because you can only change the owner of the ticket if
> it is unowned or you are the owner and I think this action is done by
> the rt system user.
> 
> Torsten
> 
> -----Original Message-----
> From: rt-devel-bounces at lists.bestpractical.com
> <rt-devel-bounces at lists.bestpractical.com>
> To: rt-devel at lists.bestpractical.com <rt-devel at lists.bestpractical.com>
> Sent: Fri Jul 20 11:14:57 2007
> Subject: [Rt-devel] Interesting Reset ticket On Queue Change
> 
> 
> Hi all,
> 
> I have a UI scrip that reset ticket's status to 'new' and owner to 'nobody'
> based on condition 'On Queue Change'.
> let's say, userA has the both rights to own tickets in the original queue
> and new queue,
> userA go to an "opened&taken" ticket modify page, and ONLY change the ticket
> to a new queue,
> at the same time, the status keep "open (unchanged)" and the owner shown is
> still "userA",
> after userA 'save changes', the scrip run but the owner keep back!!
> Does anyone know why? or I miss something important?
> 
> here are history:
> 
> Fri Jul 20 08:25:48 2007 RT_System - Status changed from 'open' to 'new'
> Fri Jul 20 08:25:48 2007 RT_System - Owner forcibly changed from userA to
> Nobody
> Fri Jul 20 08:25:48 2007 userA - Given to userA
> 
> 
> here are scrip codes, you may have a try
> 
> ##--------------------------------------------------------------------------
> -##
> 
> my ($status)= $self->TicketObj->SetStatus("new");
> unless( $status ) {
>   $RT::Logger->warning( "Impossible to reset the ticket to New" );
>   return undef;
> }
> 
> my $Actor = $self->TransactionObj->Creator;
> return 1 if $Actor == $RT::SystemUser->id;
> return 1 if $self->TicketObj->Owner == RT::Nobody->id;
> 
> my ($status)= $self->TicketObj->SetOwner(RT::Nobody->id ,"Force");
> unless( $status ) {
>   $RT::Logger->warning( "Impossible to reset the ticket to Nobody" );
>   return undef;
> }
> return 1;
> 
> ##-------------------------------------------------------------------------#
> #
> 
> 
> 
> Best Regards,
> Steven Liu
> HKG RI-CI
> 
> Tel: +852 2823 4396
> Email: yanfat.liu at kuehne-nagel.com
> 
> 
> _______________________________________________
> List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel


More information about the Rt-devel mailing list