[Rt-commit] [rtir] 01/01: Make IP custom field link to Lookup page

Jim Brandt jbrandt at bestpractical.com
Fri Apr 26 17:11:50 EDT 2013


This is an automated email from the git hooks/post-receive script.

jbrandt pushed a commit to branch 2.9/lookup-link-for-ip-cf
in repository rtir.

commit 0fd3959a88b6f8bfdf2ae6f6b2dee36b72977cb9
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Wed Apr 24 10:09:30 2013 -0400

    Make IP custom field link to Lookup page
---
 etc/initialdata              | 15 +++++++++++++++
 etc/upgrade/3.0.0rc2/content | 25 +++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/etc/initialdata b/etc/initialdata
index 9589984..388dd5a 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -666,5 +666,20 @@ for my $cf (@CustomFields) {
     $group->PrincipalObj->GrantRight( Right => $_, Object => $class )
       for qw/AdminClass AdminTopics CreateArticle ModifyArticle ModifyArticleTopics SeeClass ShowArticle ShowArticleHistory DeleteArticle/;
 
+    $RT::Logger->debug("Going to make IP custom fields link to Lookup");
+    my $ip_cf = RT::CustomField->new(RT->SystemUser);
+    my ($ok, $msg) = $ip_cf->Load('IP');
+    if ( $ip_cf->Id ) {
+        if ( $ip_cf->LinkValueTo ){
+            $RT::Logger->warning("IP custom field link value already set, skipping");
+        }
+        else{
+            $ip_cf->SetLinkValueTo('/RTIR/Tools/Lookup.html?type=ip&q=__CustomField__&ticket=__id__');
+        }
+    }
+    else{
+        $RT::Logger->error("IP custom field not found: $msg");
+    }
+
 } );
 
diff --git a/etc/upgrade/3.0.0rc2/content b/etc/upgrade/3.0.0rc2/content
new file mode 100644
index 0000000..fef7572
--- /dev/null
+++ b/etc/upgrade/3.0.0rc2/content
@@ -0,0 +1,25 @@
+use strict;
+use warnings;
+
+our @Final = (
+
+    sub {
+        $RT::Logger->debug("Going to make IP custom fields link to Lookup");
+        my $ip_cf = RT::CustomField->new(RT->SystemUser);
+        my ($ok, $msg) = $ip_cf->Load('IP');
+        if ( $ip_cf->Id ) {
+            if ( $ip_cf->LinkValueTo ){
+                $RT::Logger->warning("IP custom field link value already set, skipping");
+            }
+            else{
+                $ip_cf->SetLinkValueTo('/RTIR/Tools/Lookup.html?type=ip&q=__CustomField__&ticket=__id__');
+            }
+        }
+        else{
+            $RT::Logger->error("IP custom field not found: $msg");
+        }
+    },
+
+);
+
+1;

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


More information about the Rt-commit mailing list