[Rt-commit] [rtir] 02/02: Update "add constituency" tool to copy custom fields from base 'template' queues
Jesse Vincent
jesse at bestpractical.com
Thu Mar 19 04:18:26 EDT 2015
This is an automated email from the git hooks/post-receive script.
jesse pushed a commit to branch 3.4/remove_old_constituencies
in repository rtir.
commit 36edcb43ada8dc560d3e57c3fe857185db3e0597
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Thu Mar 19 01:17:57 2015 -0700
Update "add constituency" tool to copy custom fields from base 'template' queues
---
bin/add_constituency.in | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/bin/add_constituency.in b/bin/add_constituency.in
index 459b37f..f2ccb80 100755
--- a/bin/add_constituency.in
+++ b/bin/add_constituency.in
@@ -394,7 +394,12 @@ sub create_or_load_queue {
my $name = shift;
my $lifecycle = shift;
my $constituency_cf = shift;
-
+
+
+ my $basequeue = RT::Queue->new(RT->SystemUser);
+
+ $basequeue->LoadByCols(Name => RT::IR::FriendlyLifecycle($lifecycle));
+
my $queue = RT::Queue->new( $RT::SystemUser );
$queue->LoadByCols( Name => $name );
unless ( $queue->id ) {
@@ -425,6 +430,28 @@ sub create_or_load_queue {
}
}
+ my $basecfs = RT::CustomFields->new( RT->SystemUser);
+ $basecfs->SetContextObject( $basequeue );
+ $basecfs->LimitToObjectId( $basequeue->id );
+ $basecfs->LimitToLookupType( 'RT::Queue-RT::Ticket' );
+
+
+ while (my $basecf = $basecfs->Next) {
+ debug "Adding Ticket CustomField ".$basecf->Name." to queue ".$queue->Name;
+ $basecf->AddToObject($queue);
+ }
+
+ my $base_txncfs = RT::CustomFields->new( RT->SystemUser);
+ $base_txncfs->SetContextObject( $basequeue );
+ $base_txncfs->LimitToObjectId( $basequeue->id );
+ $base_txncfs->LimitToLookupType( 'RT::Queue-RT::Ticket-RT::Transaction');
+
+ while (my $base_txncf = $base_txncfs->Next) {
+ debug "Adding Ticket Transaction CustomField ".$base_txncf->Name." to queue ".$queue->Name;
+ $base_txncf->AddToObject($queue);
+ }
+
+
$queue->AddCustomFieldValue(Field => $constituency_cf->id, Value => $constituency);
$constituency_cf->AddToObject($queue);
$whois_cf->AddToObject($queue);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list