[Rt-devel] [PATCH] Redirect to ticket display on quick create

Ivan Kohler ivan-rt-devel at 420.am
Wed Nov 17 21:31:45 EST 2010


On Mon, Nov 15, 2010 at 03:57:12PM -0500, Jesse Vincent wrote:
> 
> On Wed 10.Nov'10 at 15:12:11 -0800, Ivan Kohler wrote:
> > Hi,
> > 
> > This small patch adds a config/preference to allow redirection to ticket 
> > display on Quick ticket creation, instead of back to RT at a glance.
> 
> Hiya Ivan,
> 
> Thanks for the patch.  With some tweaks, I'd be happy to have this in 
> 3.9.

Attached is a patch for 3.9 that incorporates your requested changes, 
and just in case, an updated patch for 3.8 too.  If you need any other 
tweaks, let me know.

-- 
Ivan Kohler, President and Head Geek, Freeside Internet Services, Inc.
Open-source billing, ticketing and provisioning - http://www.freeside.biz/
-------------- next part --------------
diff -ur rt-3.9.6.DIST//lib/RT/Config.pm rt-3.9.6/lib/RT/Config.pm
--- rt-3.9.6.DIST//lib/RT/Config.pm	2010-11-14 22:33:39.000000000 -0800
+++ rt-3.9.6/lib/RT/Config.pm	2010-11-17 18:01:50.000000000 -0800
@@ -403,6 +403,16 @@
             Description => q|Show simplified recipient list on ticket update|,                #loc
         },
     },
+    DisplayAfterQuickCreate => {
+        Section         => 'Ticket display',
+        Overridable     => 1,
+        SortOrder       => 6,
+        Widget          => '/Widgets/Form/Boolean',
+        WidgetArguments => {
+            Description => 'On Quick Create, redirect to ticket display', #loc
+            #Hints => '', #loc
+        },
+    },
 
     # User overridable locale options
     DateTimeFormat => {
diff -ur rt-3.9.6.DIST//share/html/index.html rt-3.9.6/share/html/index.html
--- rt-3.9.6.DIST//share/html/index.html	2010-11-14 22:33:39.000000000 -0800
+++ rt-3.9.6/share/html/index.html	2010-11-17 18:23:57.000000000 -0800
@@ -115,6 +115,16 @@
                         Content => $ARGS{'Content'},
                         Subject => $ARGS{'Subject'});
         push @results, $msg;
+
+        if ( $t && $t->Id && RT->Config->Get('DisplayAfterQuickCreate', $session{'CurrentUser'}) ) {
+            $m->comp(
+                '/Elements/MaybeRedirectForResults',
+                'Actions' => \@results,
+                'Path'    => 'Ticket/Display.html',
+                'id'      => $t->Id,
+            );
+        }
+
     }
     elsif ( !$ValidCFs ) {
         push @results, "can't quickly create ticket in queue " .
-------------- next part --------------
Index: lib/RT/Config.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Config.pm,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 Config.pm
--- lib/RT/Config.pm	18 May 2010 18:40:41 -0000	1.1.1.2
+++ lib/RT/Config.pm	18 Nov 2010 01:49:08 -0000
@@ -313,6 +313,16 @@
             Hints => 'Use css rules to display text monospaced and with formatting preserved, but wrap as needed.  This does not work well with IE6 and you should use the previous option', #loc
         },
     },
+    DisplayAfterQuickCreate => {
+        Section         => 'Ticket display',
+        Overridable     => 1,
+        SortOrder       => 6,
+        Widget          => '/Widgets/Form/Boolean',
+        WidgetArguments => {
+            Description => 'On Quick Create, redirect to ticket display', #loc
+            #Hints => '', #loc
+        },
+    },
 
     # User overridable locale options
     DateTimeFormat => {
Index: share/html/index.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/share/html/index.html,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 index.html
--- share/html/index.html	31 Dec 2009 13:14:14 -0000	1.1.1.1
+++ share/html/index.html	18 Nov 2010 01:49:09 -0000
@@ -115,7 +115,11 @@
                         From => $session{'CurrentUser'}->EmailAddress,
                         Content => $ARGS{'Content'},
                         Subject => $ARGS{'Subject'});
-        push @results, $msg;
+        if ( $t && $t->Id && RT->Config->Get('DisplayAfterQuickCreate', $session{'CurrentUser'}) ) {
+          RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Ticket/Display.html?id=". $t->Id);
+        } else {
+          push @results, $msg;
+        }
     }
     elsif ( !$ValidCFs ) {
         push @results, "can't quickly create ticket in queue " .


More information about the rt-devel mailing list