Difference between revisions of "OnQueueChangeFixReminders"

From Request Tracker Wiki
Jump to navigation Jump to search
m (3 revisions imported)
m
 
Line 15: Line 15:
 
* Custom action cleanup code:
 
* Custom action cleanup code:
  
 +
<pre>
 
  my $tickets = new RT::Tickets(RT-&gt;SystemUser)
 
  my $tickets = new RT::Tickets(RT-&gt;SystemUser)
 
  my $id = $self-&gt;TicketObj-&gt;id;
 
  my $id = $self-&gt;TicketObj-&gt;id;
Line 28: Line 29:
 
   
 
   
 
  return 1;
 
  return 1;
 +
 +
</pre>

Latest revision as of 20:18, 13 August 2016

This is a strange bug as it seems like reminders just lose their permission to be deleted. Actually what is happening is the reminder ticket objects are not being moved along with the tickets.

(confirmed by this post http://lists.bestpractical.com/pipermail/rt-users/2008-January/049480.html )

Edit: MarkR reports that this fix does not seem to be necessary in RT 3.8.x

  • Description: ''Fix reminders on queue change''
  • Condition: ''On Queue Change''
  • Action: ''User Defined''
  • Template: ''Global template: Blank''
  • Stage: ''TransactionCreate''
  • Custom condition: (blank)
  • Custom action preparation code: (blank)
  • Custom action cleanup code:
 my $tickets = new RT::Tickets(RT->SystemUser)
 my $id = $self->TicketObj->id;
 my $queue = $self->TicketObj->QueueObj->Name;
 
 return 1 unless (defined($id)); # Can this be undefined?
 
 $tickets->FromSQL('Type = "reminder" AND RefersTo="'.$id.'"');
 while (my $ticket = $tickets->Next) {
   $RT::Logger->info("Moving associated reminder ticket '".$ticket->id."' to queue '$queue'");
   $ticket->SetQueue($queue);
 }
 
 return 1;