X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FRule.pm;h=47c26f1361c66748fc2120979ac2f5daf1b508c1;hb=44dd00a3ff974a17999e86e64488e996edc71e3c;hp=071f5394c7c7bce0798a818c492d9b65fab205be;hpb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c;p=freeside.git diff --git a/rt/lib/RT/Rule.pm b/rt/lib/RT/Rule.pm index 071f5394c..47c26f136 100644 --- a/rt/lib/RT/Rule.pm +++ b/rt/lib/RT/Rule.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2019 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -49,15 +49,24 @@ package RT::Rule; use strict; use warnings; + use base 'RT::Action'; use constant _Stage => 'TransactionCreate'; use constant _Queue => undef; + + sub Prepare { my $self = shift; - return (0) if $self->_Queue && $self->TicketObj->QueueObj->Name ne $self->_Queue; - return 1; + if ( $self->_Queue ) { + my $queue = RT::Queue->new( RT->SystemUser ); + $queue->Load( $self->TicketObj->__Value('Queue') ); + if ( $queue->Name ne $self->_Queue ) { + return (0); + } + return 1; + } } sub Commit { @@ -94,25 +103,16 @@ sub RunScripAction { my $action = $ScripAction->LoadAction( TransactionObj => $self->TransactionObj, TicketObj => $self->TicketObj, + TemplateObj => $template, %args, ); - # XXX: fix template to allow additional arguments to be passed from here - $action->{'TemplateObj'} = $template; $action->{'ScripObj'} = RT::Scrip->new($self->CurrentUser); # Stub. sendemail action really wants a scripobj available $action->Prepare or return; $action->Commit; } -eval "require RT::Rule_Vendor"; -if ($@ && $@ !~ qr{^Can't locate RT/Rule_Vendor.pm}) { - die $@; -}; - -eval "require RT::Rule_Local"; -if ($@ && $@ !~ qr{^Can't locate RT/Rule_Local.pm}) { - die $@; -}; +RT::Base->_ImportOverlays(); 1;