[Rt-commit] rt branch, 4.0/transaction-batch-twice, created. rt-4.0.2-138-g1d6bfed
Kevin Falcone
falcone at bestpractical.com
Fri Sep 30 17:26:41 EDT 2011
The branch, 4.0/transaction-batch-twice has been created
at 1d6bfed3ad9e2e33a5af38e70cc067b169d01500 (commit)
- Log -----------------------------------------------------------------
commit 1d6bfed3ad9e2e33a5af38e70cc067b169d01500
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Fri Sep 30 17:23:20 2011 -0400
TransactionBatch scrips are triggered twice
As a result of 2338cd19ed7a7f4c1e94f639ab2789d6586d01f3
we now clone the TicketObj and end up with two tickets being DESTROYed
and firing TransactionBatch. If your condition is clever, you may not
have noticed (this is why Approvals weren't affected)
We probably need to fix this clone to skip _TransactionBatch, although
we aren't sure why we're cloning rather than a simple second load
anyway.
We also need tests for mail notifications from TransactionBatch
It would also be nice if changes to a ticket on Modify.html that were
done by a TransactionBatch scrip were displayed in the UI without
reloading the Basics page. This behavior was changed in
b5aedb8db1cfcd46162785587002ecf8c27b1335
diff --git a/t/web/transaction_batch.t b/t/web/transaction_batch.t
new file mode 100644
index 0000000..8c032d2
--- /dev/null
+++ b/t/web/transaction_batch.t
@@ -0,0 +1,36 @@
+use strict;
+use warnings;
+use RT;
+use RT::Test tests => 7;
+
+
+my $q = RT::Test->load_or_create_queue ( Name => 'General' );
+
+my $s1 = RT::Scrip->new(RT->SystemUser);
+my ($val, $msg) =$s1->Create( Queue => $q->Id,
+ ScripCondition => 'User Defined',
+ ScripAction => 'User Defined',
+ CustomIsApplicableCode => 'return $self->TransactionObj->Field eq "TimeEstimated"',
+ CustomPrepareCode => 'return 1',
+ CustomCommitCode => '$self->TicketObj->SetPriority($self->TicketObj->Priority + 2); return 1;',
+ Template => 'Blank',
+ Stage => 'TransactionBatch',
+ );
+ok($val,$msg);
+
+my $ticket = RT::Ticket->new(RT->SystemUser);
+my ($tv,$ttv,$tm) = $ticket->Create(Queue => $q->Id,
+ Subject => "hair on fire",
+ );
+ok($tv, $tm);
+
+my ($baseurl, $m) = RT::Test->started_ok;
+$m->login;
+$m->get_ok("$baseurl/Ticket/Modify.html?id=".$ticket->Id);
+ $m->submit_form( form_name => 'TicketModify',
+ fields => { TimeEstimated => 5 }
+ );
+
+
+$ticket->Load($ticket->Id);
+is ($ticket->Priority , '2', "Ticket priority is set right");
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list