[Rt-commit] rtir branch, 5.0/rt-create-ticket-link, created. 4.0.1rc1-148-g9677e071
? sunnavy
sunnavy at bestpractical.com
Fri May 29 14:54:16 EDT 2020
The branch, 5.0/rt-create-ticket-link has been created
at 9677e0712ea88f979bec8647d4e01127ed25489a (commit)
- Log -----------------------------------------------------------------
commit 9677e0712ea88f979bec8647d4e01127ed25489a
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri May 29 22:49:33 2020 +0800
Link to RT ticket create on RTIR create pages when necessary
It's possible that users couldn't access RT ticket create page, when
their default queue is an RTIR one, in which case RT will redirect to
RTIR create pages automatically.
This commit adds a link to RT ticket create page with a non-RTIR queue
specified, to get around this edge issue.
diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index 7532e80d..eca3cdd3 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -543,4 +543,24 @@ PageWidgets()->child('simple_search')->raw_html( $m->scomp(
Placeholder => 'Search Incidents'
) );
PageWidgets()->child( create_ticket => raw_html => $HTML::Mason::Commands::m->scomp('/Elements/CreateTicket', SendTo => '/RTIR/Create.html?Queue=' . RT::IR::GetRTIRDefaultQueue()) );
+
+if ( $request_path =~ m{$re_rtir_path(?:Incident/)?Create\.html} ) {
+ my $default_queue = GetDefaultQueue();
+ if ( $default_queue && RT::IR->OurQueue($default_queue) ) {
+
+ # Find the first non-RTIR queue current user can create
+ my $cache_key = SetObjectSessionCache(
+ ObjectType => 'Queue',
+ CheckRight => 'CreateTicket',
+ CacheNeedsUpdate => RT->System->QueueCacheNeedsUpdate,
+ );
+ my ($queue) = map { $_->{Id} } grep { !RT::IR->OurQueue( $_->{Id} ) } @{ $session{$cache_key}{objects} };
+ if ($queue) {
+ PageMenu()->child(
+ rt_create_ticket => title => loc('RT Create Ticket'),
+ path => "/Ticket/Create.html?Queue=$queue",
+ );
+ }
+ }
+}
</%INIT>
-----------------------------------------------------------------------
More information about the rt-commit
mailing list