[Rt-commit] r6192 - in rt/branches/3.7-EXPERIMENTAL: .
ruz at bestpractical.com
ruz at bestpractical.com
Thu Oct 12 14:38:58 EDT 2006
Author: ruz
Date: Thu Oct 12 14:38:57 2006
New Revision: 6192
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/AutoOpen.pm
Log:
r3939 at cubic-pc: cubic | 2006-10-12 19:41:25 +0400
::Action::AutoOpen
* refactoring
* drop uninit warning
* add POD
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/AutoOpen.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/AutoOpen.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Action/AutoOpen.pm Thu Oct 12 14:38:57 2006
@@ -44,62 +44,54 @@
#
# END BPS TAGGED BLOCK }}}
# This Action will open the BASE if a dependent is resolved.
-
package RT::Action::AutoOpen;
-require RT::Action::Generic;
use strict;
-use vars qw/@ISA/;
- at ISA=qw(RT::Action::Generic);
+use warnings;
-#Do what we need to do and send it out.
+use base qw(RT::Action::Generic);
-#What does this type of Action does
+=head1 DESCRIPTION
-# {{{ sub Describe
-sub Describe {
- my $self = shift;
- return (ref $self );
-}
-# }}}
+Opens a ticket unless it's allready open, but only unless transaction
+L<RT::Transaction/IsInbound is inbound>.
+Doesn't open a ticket if message's head has field C<RT-Control> with
+C<no-autoopen> substring.
+
+=cut
-# {{{ sub Prepare
sub Prepare {
my $self = shift;
# if the ticket is already open or the ticket is new and the message is more mail from the
# requestor, don't reopen it.
- if ( ( $self->TicketObj->Status eq 'open' )
- || ( ( $self->TicketObj->Status eq 'new' )
- && $self->TransactionObj->IsInbound )
- || ( defined $self->TransactionObj->Message->First
- && $self->TransactionObj->Message->First->GetHeader('RT-Control') =~ /\bno-autoopen\b/i )
- ) {
-
- return undef;
- }
- else {
- return (1);
- }
+ return undef if $self->TicketObj->Status eq 'open';
+ return undef if $self->TicketObj->Status eq 'new'
+ && $self->TransactionObj->IsInbound;
+
+ my $first = $self->TransactionObj->Message->First;
+ return undef if $first
+ && ($first->GetHeader('RT-Control') || '') =~ /\bno-autoopen\b/i;
+
+ return 1;
}
-# }}}
sub Commit {
my $self = shift;
- my $oldstatus = $self->TicketObj->Status();
- $self->TicketObj->__Set( Field => 'Status', Value => 'open' );
- $self->TicketObj->_NewTransaction(
- Type => 'Status',
- Field => 'Status',
- OldValue => $oldstatus,
- NewValue => 'open',
- Data => 'Ticket auto-opened on incoming correspondence'
- );
+ my $oldstatus = $self->TicketObj->Status;
+ $self->TicketObj->__Set( Field => 'Status', Value => 'open' );
+ $self->TicketObj->_NewTransaction(
+ Type => 'Status',
+ Field => 'Status',
+ OldValue => $oldstatus,
+ NewValue => 'open',
+ Data => 'Ticket auto-opened on incoming correspondence'
+ );
- return(1);
+ return 1;
}
eval "require RT::Action::AutoOpen_Vendor";
More information about the Rt-commit
mailing list