[Rt-commit] rtir branch, 5.0/rt-create-ticket-link, created. 4.0.1rc1-141-gca962852
? sunnavy
sunnavy at bestpractical.com
Fri May 29 11:19:32 EDT 2020
The branch, 5.0/rt-create-ticket-link has been created
at ca962852bd14469f8d7e6cb998b38806cf3edcd5 (commit)
- Log -----------------------------------------------------------------
commit ca962852bd14469f8d7e6cb998b38806cf3edcd5
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 2349d71a..02618fbf 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/Incident/Create.html?Lifecycle='.RT::IR->lifecycle_incident) );
+
+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