Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoOpenInactive bugfix and action prepare return values #361

Open
wants to merge 2 commits into
base: 5.0-trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/RT/Action/AutoOpen.pm
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ sub Prepare {

my $ticket = $self->TicketObj;
my $next = $ticket->FirstActiveStatus;
return 1 unless defined $next;
return 0 unless defined $next;

# no change if the ticket is in initial status and the message is a mail
# from a requestor
return 1 if $ticket->LifecycleObj->IsInitial($ticket->Status)
return 0 if $ticket->LifecycleObj->IsInitial($ticket->Status)
&& $self->TransactionObj->IsInbound;

if ( my $msg = $self->TransactionObj->Message->First ) {
return 1 if ($msg->GetHeader('RT-Control') || '') =~ /\bno-autoopen\b/i;
return 0 if ($msg->GetHeader('RT-Control') || '') =~ /\bno-autoopen\b/i;
}

$self->{'set_status_to'} = $next;
Expand Down
2 changes: 1 addition & 1 deletion lib/RT/Action/AutoOpenInactive.pm
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ sub Prepare {
my $self = shift;

my $ticket = $self->TicketObj;
return 0 if $ticket->LifecycleObj->IsActive( $ticket->Status );
return 0 unless $ticket->LifecycleObj->IsInactive( $ticket->Status );

if ( my $msg = $self->TransactionObj->Message->First ) {
return 0
Expand Down
10 changes: 5 additions & 5 deletions lib/RT/Action/LinearEscalate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -157,22 +157,22 @@ sub Prepare {

unless ( $ticket->DueObj->IsSet ) {
$RT::Logger->debug('Due is not set. Not escalating.');
return 1;
return 0;
}

my $priority_range = ($ticket->FinalPriority ||0) - ($ticket->InitialPriority ||0);
unless ( $priority_range ) {
$RT::Logger->debug('Final and Initial priorities are equal. Not escalating.');
return 1;
return 0;
}

if ( $ticket->Priority >= $ticket->FinalPriority && $priority_range > 0 ) {
$RT::Logger->debug('Current priority is greater than final. Not escalating.');
return 1;
return 0;
}
elsif ( $ticket->Priority <= $ticket->FinalPriority && $priority_range < 0 ) {
$RT::Logger->debug('Current priority is lower than final. Not escalating.');
return 1;
return 0;
}

# TODO: compute the number of business days until the ticket is due
Expand All @@ -186,7 +186,7 @@ sub Prepare {
# do nothing if we didn't reach starts or created date
if ( $starts > $now ) {
$RT::Logger->debug('Starts(Created) is in future. Not escalating.');
return 1;
return 0;
}

my $due = $ticket->DueObj->Unix;
Expand Down
4 changes: 2 additions & 2 deletions lib/RT/Action/SetStatus.pm
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ sub Prepare {
($next) = grep $lifecycle->$method($_), $lifecycle->Transitions($status);
unless ( $next ) {
$RT::Logger->info("No transition from '$status' to $argument set");
return 1;
return 0;
}
}
elsif ( $lifecycle->IsValid( $argument ) ) {
unless ( $lifecycle->IsTransition( $status => $argument ) ) {
$RT::Logger->warning("Transition '$status -> $argument' is not valid");
return 1;
return 0;
}
$next = $argument;
}
Expand Down