[Rt-commit] rt branch, 4.2/default-scrip-stage-in-initialdata, created. rt-4.2.2-13-gdf18958
Jim Brandt
jbrandt at bestpractical.com
Mon Feb 10 10:33:00 EST 2014
The branch, 4.2/default-scrip-stage-in-initialdata has been created
at df18958a6c4da89ff107b49ddd48ae63b757d016 (commit)
- Log -----------------------------------------------------------------
commit d7d03e1f153f85eb496eada2d803353a7fa56df8
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Mon Feb 3 15:40:09 2014 -0500
Tests showing initialdata failure on Queue create with no Stage
diff --git a/t/api/initialdata.t b/t/api/initialdata.t
new file mode 100644
index 0000000..5856528
--- /dev/null
+++ b/t/api/initialdata.t
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+
+use RT::Test tests => 'no_declare';
+
+# This test script processes the sample initialdata file in
+# ../data/initialdata/initialdata
+# To add initialdata tests, add the data to the initialdata file and it
+# will be processed by this script.
+
+my $initialdata = RT::Test::get_relocatable_file("initialdata" => "..", "data", "initialdata");
+my ($rv, $msg) = RT->DatabaseHandle->InsertData( $initialdata, undef, disconnect_after => 0 );
+ok($rv, "Inserted test data from $initialdata")
+ or diag "Error: $msg";
+
+done_testing();
\ No newline at end of file
diff --git a/t/data/initialdata/initialdata b/t/data/initialdata/initialdata
new file mode 100644
index 0000000..355ddb5
--- /dev/null
+++ b/t/data/initialdata/initialdata
@@ -0,0 +1,46 @@
+# Samples of all things we support in initialdata
+
+ at Queues = (
+ {
+ Name => 'Test Queue',
+ CorrespondAddress => 'help at example.com',
+ CommentAddress => 'help-comment at example.com',
+ }
+);
+
+ at Scrips = (
+ {
+ Description => 'Test Without Stage',
+ ScripCondition => 'On Resolve',
+ ScripAction => 'Notify Requestors',
+ Template => 'Correspondence in HTML',
+ },
+ {
+ Queue => 'General',
+ Description => 'Test Without Stage and One Queue',
+ ScripCondition => 'On Resolve',
+ ScripAction => 'Notify Requestors',
+ Template => 'Correspondence in HTML',
+ },
+ {
+ Queue => ['General', 'Test Queue'],
+ Description => 'Test Without Stage and Two Queues',
+ ScripCondition => 'On Resolve',
+ ScripAction => 'Notify Requestors',
+ Template => 'Correspondence in HTML',
+ },
+ {
+ Description => 'Test TransactionCreate',
+ ScripCondition => 'On Resolve',
+ ScripAction => 'Notify Requestors',
+ Template => 'Correspondence in HTML',
+ Stage => 'TransactionCreate',
+ },
+ {
+ Description => 'Test TransactionBatch',
+ ScripCondition => 'On Resolve',
+ ScripAction => 'Notify Requestors',
+ Template => 'Correspondence in HTML',
+ Stage => 'TransactionBatch',
+ },
+);
commit 83ef0decec4d8d254c04df87c09200dcd84fa4a9
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Mon Feb 10 09:56:49 2014 -0500
Default scrip Stage to TransactionCreate
diff --git a/lib/RT/Scrip.pm b/lib/RT/Scrip.pm
index 14df0c9..4671cc4 100644
--- a/lib/RT/Scrip.pm
+++ b/lib/RT/Scrip.pm
@@ -262,6 +262,10 @@ sub AddToObject {
my $self = shift;
my %args = @_%2? (ObjectId => @_) : (@_);
+ # Default Stage explicitly rather than in %args assignment to handle
+ # Stage coming in set to undef.
+ $args{'Stage'} //= 'TransactionCreate';
+
my $queue;
if ( $args{'ObjectId'} ) {
$queue = RT::Queue->new( $self->CurrentUser );
commit df18958a6c4da89ff107b49ddd48ae63b757d016
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Mon Feb 10 10:31:53 2014 -0500
Docs for AddToObject and RemoveFromObject
diff --git a/lib/RT/Scrip.pm b/lib/RT/Scrip.pm
index 4671cc4..259a9c6 100644
--- a/lib/RT/Scrip.pm
+++ b/lib/RT/Scrip.pm
@@ -258,6 +258,27 @@ sub NotAddedTo {
->NotAddedTo( Scrip => $self );
}
+=head2 AddToObject
+
+Adds (applies) the current scrip to the provided queue (ObjectId).
+
+Accepts a param hash of:
+
+ObjectId => Queue name or id. 0 makes the scrip global.
+
+Stage => Stage to run in. Valid stages are TransactionCreate or
+TransactionBatch. Defaults to TransactionCreate. As of RT 4.2, Disabled is no
+longer a stage.
+
+Template => Name of global or queue-specific template for the scrip. Use
+'Blank' for non-notification scrips.
+
+SortOrder => Number indicating the relative order the scrip should run in.
+
+Returns (val, message). If val is false, the message contains an error message.
+
+=cut
+
sub AddToObject {
my $self = shift;
my %args = @_%2? (ObjectId => @_) : (@_);
@@ -297,6 +318,18 @@ sub AddToObject {
return $rec->Add( %args, Scrip => $self );
}
+=head2 RemoveFromObject
+
+Removes the current scrip to the provided queue (ObjectId).
+
+Accepts a param hash of:
+
+ObjectId => Queue name or id. 0 makes the scrip global.
+
+Returns (val, message). If val is false, the message contains an error message.
+
+=cut
+
sub RemoveFromObject {
my $self = shift;
my %args = @_%2? (ObjectId => @_) : (@_);
-----------------------------------------------------------------------
More information about the rt-commit
mailing list