[rt-users] Action to delay the Due Date

Andrea Zimmerli mangialatorre at gmail.com
Mon Mar 17 07:02:18 EDT 2014


Due date delay works!
However, when I change the status from Stalled to Open, the due date
becomes again the original one. Is there a way to avoid it?

Cheers Andy


2014-03-05 11:23 GMT+01:00 Pablo Fernandez <pablo.fernandez at cscs.ch>:

>  Thanks for the hint... I was able to do what I needed.
> I post here the contents of the local/lib/RT/Action/DelayDue.pm script,
> for others that may need it:
>
> ----
> package RT::Action::DelayDue;
> use base 'RT::Action';
>
> use strict;
>
> #Do what we need to do and send it out.
>
> #What does this type of Action does
>
> # {{{ sub Describe
> sub Describe  {
>   my $self = shift;
>   return (ref $self . " will increase the ticket Due Date to the argument
> provided in minutes.");
> }
> # }}}
>
>
> # {{{ sub Prepare
> sub Prepare  {
>     # nothing to prepare
>     return 1;
> }
> # }}}
>
> sub Commit {
>     my $self = shift;
>     my $due = $self->TicketObj->DueObj();
>     if ($due->Unix() > 1) {
>         $due->AddSeconds( $self->Argument * 60 );
>         $self->TicketObj->SetDue($due->ISO);
>     }
> }
>
> RT::Base->_ImportOverlays();
>
> 1;
> ----
>
>
> And a nice crontool that runs every hour:
>
> /opt/rt3/bin/rt-crontool --search RT::Search::FromSQL --search-arg "Queue
> = 'z1-rt' AND Status = 'stalled'" --action RT::Action::DelayDue
> --action-arg 60 --verbose
>
>
> Hope it helps! Thanks again for the help!
> BR/Pablo
>
>
>
>
> On 03/04/2014 08:40 PM, Kevin Falcone wrote:
>
> On Mon, Mar 03, 2014 at 09:55:08PM +0000, Fernandez  Pablo wrote:
>
>  On Mar 3, 2014 8:40 PM, Kevin Falcone <falcone at bestpractical.com> <falcone at bestpractical.com> wrote:
> On Fri, Feb 28, 2014 at 11:58:27AM +0100, Pablo Fernandez wrote:
>
>  I was wondering... is there a way I can delay (a fixed amount of time)
> the Due Date on all tickets that match some criteria (like being in
> stalled state)?
> I was thinking of using rt-crontool for that task as a sort of way to
> "park" tickets (a cron job that runs every hour and delays 1 hour all
> stalled tickets).
>
>  Sounds like you want rt-crontool?http://bestpractical.com/docs/rt/latest/rt-crontool.htmlhttp://bestpractical.com/docs/rt/latest/automating_rt.html
>
>  But among the actions, I did not find any to change the due date (and neither in the two links )
> Any hints on how to do that?
>
>  You'll have to provide your own action in
> local/lib/RT/Action/CustomDueMunging.pm
>
> Likely you want a Prepare of { return 1}; and then you'll have your
> real logic in Commit.
>
> -kevin
>
>
>
>
>
> --
> RT Training London, March 19-20 and Dallas May 20-21
> http://bestpractical.com/training
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140317/fab95a4f/attachment.htm>


More information about the rt-users mailing list