29 lines
706 B
Perl
29 lines
706 B
Perl
package RT::Condition::CheckTransactionFlags;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use base qw(RT::Condition);
|
|
|
|
sub IsApplicable {
|
|
my $self = shift;
|
|
my $txn = $self->TransactionObj;
|
|
my @flags = split(" ", $self->Argument || "");
|
|
foreach my $flag (@flags) {
|
|
unless ($flag =~ /^(!?)(\w+)$/) {
|
|
$RT::Logger->Error("Argument '$flag' is malformed");
|
|
return 0;
|
|
}
|
|
my $method = $txn->can($2);
|
|
unless (defined($method)) {
|
|
$RT::Logger->Error("Argument '$flag' refers to nonexistent transaction method");
|
|
return 0;
|
|
}
|
|
return 0 unless (!!$txn->$method == !$1);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
RT::Base->_ImportOverlays();
|
|
|
|
1;
|