[Rt-commit] rtir branch, 5.0-select-queue, created. 4.0.1rc1-113-gcf2be079
Michel Rodriguez
michel at bestpractical.com
Wed Apr 1 09:49:28 EDT 2020
The branch, 5.0-select-queue has been created
at cf2be079c23c8e2c92a6cc7b70cd277265c3d571 (commit)
- Log -----------------------------------------------------------------
commit cf2be079c23c8e2c92a6cc7b70cd277265c3d571
Author: michel <michel at bestpractical.com>
Date: Thu Mar 26 00:02:20 2020 +0100
Choose queue on ticket create page.
diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index 78a7f648..54e6a07a 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -64,8 +64,8 @@
<form action="<%RT::IR->HREFTo("Split.html") %>" method="post" enctype="multipart/form-data" name="TicketCreate">
% }
<input type="hidden" name="id" value="new" />
-<input type="hidden" class="hidden" name="Queue" value="<% $QueueObj->Id %>" />
<input type="hidden" class="hidden" name="Token" value="<% $ARGS{'Token'} %>" />
+<input type="hidden" name="QueueChanged" value="0" />
% if ( $Split ) {
<input type="hidden" name="Split" value="<% $SplitObj->id %>" />
% }
@@ -98,16 +98,17 @@
Default => \@Incident,
SplitObj => $SplitObj,
&>
-
<& /Ticket/Elements/EditBasics,
InTable => 1,
QueueObj => $QueueObj,
fields => [
{ name => 'Queue',
- comp => '/Ticket/Elements/ShowQueue',
+ comp => '/RTIR/Elements/SelectRTIRQueue',
args => {
- QueueObj => $QueueObj,
- Wrap => 1,
+ Name => 'Queue',
+ Default => $Queue,
+ ShowNullOption => 0,
+ AutoSubmit => 1,
},
},
{
@@ -406,6 +407,22 @@ $m->callback(
ARGSRef => \%ARGS,
);
+# Use default queue from config site or user prefs if none provided
+unless ($Queue) {
+ $Queue = GetDefaultQueue();
+}
+
+# pick first in list in normal order unless queue provided from form/url/defaults
+unless ($Queue) {
+ my $cache_key = SetObjectSessionCache(
+ ObjectType => 'Queue',
+ CheckRight => 'CreateTicket',
+ CacheNeedsUpdate => RT->System->QueueCacheNeedsUpdate,
+ );
+
+ $Queue = $session{$cache_key}{objects}[0]->{Id};
+}
+
my $QueueObj = RT::Queue->new( $session{'CurrentUser'} );
$QueueObj->Load( $Queue );
diff --git a/html/RTIR/Elements/SelectRTIRQueue b/html/RTIR/Elements/SelectRTIRQueue
index 44e37724..1b5da53b 100644
--- a/html/RTIR/Elements/SelectRTIRQueue
+++ b/html/RTIR/Elements/SelectRTIRQueue
@@ -71,6 +71,7 @@ $CacheNeedsUpdate => RT->System->QueueCacheNeedsUpdate
$Lifecycle => ''
$LimitToConstituency => 0
$Constituency => undef
+$AutoSubmit => 0
</%args>
<%init>
my $Class = "select-rtir-queue-".$Lifecycle;
@@ -148,4 +149,6 @@ if ( not defined $session{$cache_key} ) {
}
$session{$cache_key}{lastupdated} = time();
}
+$OnChange = "jQuery(this).closest('form').find('input[name=QueueChanged]').val(1);";
+$OnChange .= "jQuery(this).closest('form').submit();" if $AutoSubmit;
</%init>
diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index 0a711e8c..d3456e60 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -71,8 +71,8 @@ if ( $ChildObj && $ChildObj->id && !$ChildObj->CurrentUserHasRight('ModifyTicket
% }
<input type="hidden" name="id" value="new" />
-<input type="hidden" class="hidden" name="Queue" value="<% $QueueObj->Id %>" />
<input type="hidden" class="hidden" name="Token" value="<% $ARGS{'Token'} %>" />
+<input type="hidden" name="QueueChanged" value="0" />
% if ( $ChildObj ) {
<input type="hidden" name="Child" value="<% $Child %>" />
% }
@@ -130,7 +130,7 @@ if ( $ChildObj && $ChildObj->id && !$ChildObj->CurrentUserHasRight('ModifyTicket
<&|/l&>Queue</&>:
</div>
<div class="value col-md-9">
- <span class="current-value form-control"><& /Ticket/Elements/ShowQueue, QueueObj => $QueueObj &></span>
+ <& /RTIR/Elements/SelectRTIRQueue, Name => "Queue", Default => $ARGS{Queue}, QueueObj => $QueueObj, AutoSubmit => 1, ShowNullOption => 0 &>
</div>
</div>
<div class="form-row">
-----------------------------------------------------------------------
More information about the rt-commit
mailing list