diff options
Diffstat (limited to 'rt/lib/RT/Scrip_Overlay.pm')
-rw-r--r-- | rt/lib/RT/Scrip_Overlay.pm | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/rt/lib/RT/Scrip_Overlay.pm b/rt/lib/RT/Scrip_Overlay.pm index ae2782a..1e1854a 100644 --- a/rt/lib/RT/Scrip_Overlay.pm +++ b/rt/lib/RT/Scrip_Overlay.pm @@ -1,8 +1,8 @@ -# BEGIN BPS TAGGED BLOCK {{{ +# {{{ BEGIN BPS TAGGED BLOCK # # COPYRIGHT: # -# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC # <jesse@bestpractical.com> # # (Except where explicitly superseded by other copyright notices) @@ -42,8 +42,7 @@ # works based on those contributions, and sublicense and distribute # those contributions and any derivatives thereof. # -# END BPS TAGGED BLOCK }}} - +# }}} END BPS TAGGED BLOCK =head1 NAME RT::Scrip - an RT Scrip object @@ -99,9 +98,6 @@ ok ($ticket2->Priority != '87', "Ticket priority is set right"); =cut - -package RT::Scrip; - use strict; no warnings qw(redefine); @@ -269,7 +265,7 @@ sub ActionObj { $self->{'ScripActionObj'} = RT::ScripAction->new( $self->CurrentUser ); #TODO: why are we loading Actions with templates like this. - # two separate methods might make more sense + # two seperate methods might make more sense $self->{'ScripActionObj'}->Load( $self->ScripAction, $self->Template ); } return ( $self->{'ScripActionObj'} ); @@ -340,9 +336,6 @@ should be loaded by the SuperUser role =cut -# XXX TODO : This code appears to be obsoleted in favor of similar code in Scrips->Apply. -# Why is this here? Is it still called? - sub Apply { my $self = shift; my %args = ( TicketObj => undef, @@ -424,19 +417,16 @@ sub IsApplicable { $RT::Logger->error( "Unknown Scrip stage:" . $self->Stage ); return (undef); } - my $ConditionObj = $self->ConditionObj; + foreach my $TransactionObj ( @Transactions ) { - # in TxnBatch stage we can select scrips that are not applicable to all txns - my $txn_type = $TransactionObj->Type; - next unless( $ConditionObj->ApplicableTransTypes =~ /(?:^|,)(?:Any|\Q$txn_type\E)(?:,|$)/i ); # Load the scrip's Condition object - $ConditionObj->LoadCondition( + $self->ConditionObj->LoadCondition( ScripObj => $self, TicketObj => $args{'TicketObj'}, TransactionObj => $TransactionObj, ); - if ( $ConditionObj->IsApplicable() ) { + if ( $self->ConditionObj->IsApplicable() ) { # We found an application Transaction -- return it $return = $TransactionObj; last; @@ -512,7 +502,7 @@ sub Commit { $args{'TicketObj'}->Load( $args{'TicketObj'}->Id ); if ($@) { - $RT::Logger->error( "Scrip Commit " . $self->Id . " died. - " . $@ ); + $RT::Logger->error( "Scrip IsApplicable " . $self->Id . " died. - " . $@ ); return (undef); } |