blob: efaadc961a7cf03699bfad71c33c72d8922d0a40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package RT::Action::SetPriority;
use strict;
no warnings 'redefine';
# Extension to allow relative priority changes:
# if Argument is "R" followed by a value, it's
# relative to current priority.
sub Commit {
my $self = shift;
my ($rel, $val);
my $arg = $self->Argument;
if ( $arg ) {
($rel, $val) = ( $arg =~ /^(r?)(-?\d+)$/i );
if (!length($val)) {
warn "Bad argument to SetPriority: '$arg'\n";
return 0;
}
}
else {
my %Rules = $self->Rules;
$rel = length($Rules{'inc'}) ? 1 : 0;
$val = $Rules{'inc'} || $Rules{'set'};
if ($val !~ /^[+-]?\d+$/) {
warn "Bad argument to SetPriority: '$val'\n";
return 0;
}
}
$val += $self->TicketObj->Priority if $rel;
$self->TicketObj->SetPriority($val);
}
sub Options {
(
{
'name' => 'set',
'label' => 'Set to value',
'type' => 'text',
},
{
'name' => 'inc',
'label' => 'Increment by',
'type' => 'text',
},
)
}
1;
|