1 package RT::Action::SetPriority;
3 no warnings 'redefine';
5 # Extension to allow relative priority changes:
6 # if Argument is "R" followed by a value, it's
7 # relative to current priority.
11 my $arg = $self->Argument;
13 ($rel, $val) = ( $arg =~ /^(r?)(-?\d+)$/i );
15 warn "Bad argument to SetPriority: '$arg'\n";
20 my %Rules = $self->Rules;
21 $rel = length($Rules{'inc'}) ? 1 : 0;
22 $val = $Rules{'inc'} || $Rules{'set'};
23 if ($val !~ /^[+-]?\d+$/) {
24 warn "Bad argument to SetPriority: '$val'\n";
28 $val += $self->TicketObj->Priority if $rel;
29 $self->TicketObj->SetPriority($val);
36 'label' => 'Set to value',
41 'label' => 'Increment by',