[Rt-commit] [rtir] 04/04: Add support for per-queue RTIR default whois servers

Jesse Vincent jesse at bestpractical.com
Thu Mar 19 02:51:03 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 9ae425ea44d1ced4c17b4070534349208ace80b8
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Wed Mar 18 23:42:42 2015 -0700

    Add support for per-queue RTIR default whois servers
---
 bin/add_constituency.in                | 11 +++++++++++
 etc/initialdata                        |  8 ++++++++
 html/RTIR/Tools/Elements/ToolFormWhois |  9 +++++++++
 3 files changed, 28 insertions(+)

diff --git a/bin/add_constituency.in b/bin/add_constituency.in
index d71db06..14a3188 100755
--- a/bin/add_constituency.in
+++ b/bin/add_constituency.in
@@ -158,6 +158,15 @@ if ( exists $opt{'rename'} ) {
 
 $RT::Handle->BeginTransaction;
 
+my $whois_cf = RT::CustomField->new( RT->SystemUser );
+$whois_cf->LoadByName(
+    Name       => 'RTIR default WHOIS server',
+    LookupType => 'RT::Queue'
+);
+die "Couldn't find 'RTIR default WHOIS server' custom field"
+    unless ( $whois_cf->id );
+
+
 my $exist = cf_value_exists( $constituency );
 
 print "\nIf you continue then we'll...\n";
@@ -417,6 +426,8 @@ sub create_or_load_queue {
     }
 
     $queue->AddCustomFieldValue(Field => $constituency_cf->id, Value => $constituency);
+    $constituency_cf->AddToObject($queue);
+    $whois_cf->AddToObject($queue);
     die "Failed to create queue $name." unless $queue->id;
 
     return $queue;
diff --git a/etc/initialdata b/etc/initialdata
index aeea5b5..d541796 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -54,6 +54,14 @@
         ]
     },
     {
+        Name        => 'RTIR default WHOIS server',
+        Type        => 'FreeformSingle',
+        Disabled    => 0,
+        LookupType  => 'RT::Queue',
+        Description => 'If set, defines the default WHOIS server for an RTIR Queue',
+        ApplyTo     => [map {$_->{Name}} @Queues]
+    },
+    {
         Name        => 'Description',
         Type        => 'FreeformSingle',
         Queue       => 'Incidents',
diff --git a/html/RTIR/Tools/Elements/ToolFormWhois b/html/RTIR/Tools/Elements/ToolFormWhois
index fc39da7..8ca911b 100644
--- a/html/RTIR/Tools/Elements/ToolFormWhois
+++ b/html/RTIR/Tools/Elements/ToolFormWhois
@@ -64,6 +64,15 @@ $TicketObj => undef
 @PassArguments => ()
 </%args>
 <%INIT>
+my $queue_whois;
+if ($TicketObj) {
+    if ($queue_whois = $TicketObj->QueueObj->FirstCustomFieldValue('RTIR default WHOIS server')) {
+        $server = $queue_whois;
+    }
+}
+
+
 $WhoisServer = $server unless defined $WhoisServer;
 $WhoisServer ||= '';
+
 </%INIT>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list