[Rt-commit] rt branch, 4.0/rules-currentuser, created. rt-4.0.2-94-gc53b164
Thomas Sibley
trs at bestpractical.com
Fri Sep 16 10:00:56 EDT 2011
The branch, 4.0/rules-currentuser has been created
at c53b164d6fb5cebe24d23b22e52de9ee05b7ead2 (commit)
- Log -----------------------------------------------------------------
commit c53b164d6fb5cebe24d23b22e52de9ee05b7ead2
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Sep 16 09:52:02 2011 -0400
Give rules a transaction object with an RT system CurrentUser
This is how scrips are run and avoids visibility problems within rules.
A particular nasty bug this caused was the failure of expected rules to
run when the CurrentUser couldn't read the transaction's Type.
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index b032481..94e46e3 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -186,11 +186,14 @@ sub Create {
# Entry point of the rule system
my $ticket = RT::Ticket->new(RT->SystemUser);
$ticket->Load($args{'ObjectId'});
+ my $txn = RT::Transaction->new($RT::SystemUser);
+ $txn->Load($self->id);
+
my $rules = $self->{rules} = RT::Ruleset->FindAllRules(
Stage => 'TransactionCreate',
Type => $args{'Type'},
TicketObj => $ticket,
- TransactionObj => $self,
+ TransactionObj => $txn,
);
if ($args{'CommitScrips'} ) {
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list