blob: 09d3448a8f7105d452d48b1fa64673d147a8a3c2 (
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# This Action will stall the BASE if a dependency or membership link
# (according to argument) is created and if BASE is open.
# TODO: Rename this .pm
package RT::Action::StallDependent;
require RT::Action::Generic;
@ISA=qw|RT::Action::Generic|;
# {{{ sub Describe
sub Describe {
my $self = shift;
return (ref $self . " will stall a [local] BASE if it's dependent [or member] of a linked up request.");
}
# }}}
# {{{ sub Prepare
sub Prepare {
# nothing to prepare
return 1;
}
# }}}
sub Commit {
my $self = shift;
# Find all Dependent
my $arg=$self->Argument || "DependsOn";
unless ($self->TransactionObj->Data =~ /^([^ ]+) $arg /) {
warn; return 0;
}
my $base_id=$1;
my $base;
if ($1 eq "THIS") {
$base=$self->TicketObj;
} else {
$base_id=&RT::Link::_IsLocal(undef, $base_id) || return 0;
$base=RT::Ticket->new($self->TicketObj->CurrentUser);
$base->Load($base_id);
}
$base->Stall if $base->Status eq 'open';
return 0;
}
# {{{ sub IsApplicable
# Only applicable if:
# 1. the link action is a dependency
# 2. BASE is a local ticket
sub IsApplicable {
my $self = shift;
my $arg=$self->Argument || "DependsOn";
# 1:
$self->TransactionObj->Data =~ /^([^ ]*) $arg / || return 0;
# 2:
# (dirty!)
&RT::Link::_IsLocal(undef,$1) || return 0;
return 1;
}
# }}}
1;
|