[Rt-commit] rt branch, 4.6/queue-input-in-ticket-create, updated. rt-4.4.4-728-g012f62539c
Jim Brandt
jbrandt at bestpractical.com
Wed Feb 12 15:19:48 EST 2020
The branch, 4.6/queue-input-in-ticket-create has been updated
via 012f62539c4409c174b57df885ec050777da8ba9 (commit)
from f72a29438c449616b8cf932a2bf9074ce39e062e (commit)
Summary of changes:
lib/RT/Interface/Web.pm | 23 +++++++++++++++++++++++
share/html/Elements/SelectNewTicketQueue | 8 +-------
share/html/Ticket/Create.html | 7 +------
3 files changed, 25 insertions(+), 13 deletions(-)
- Log -----------------------------------------------------------------
commit 012f62539c4409c174b57df885ec050777da8ba9
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Wed Feb 12 15:06:08 2020 -0500
Move default queue logic to a function
There are several features in RT to set or remember the default
queue to set when building queue dropdowns. Capture the rules
in a single place.
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index b334f22ae3..cc03798744 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -4589,6 +4589,29 @@ sub LoadTransaction {
return $Transaction;
}
+=head2 GetDefaultQueue
+
+Processes global and user-level configuration options to find the default
+queue for the current user.
+
+Accepts no arguments, returns the ID of the default queue, if found, or undef.
+
+=cut
+
+sub GetDefaultQueue {
+ my $queue;
+
+ # RememberDefaultQueue tracks the last queue used by this user, if set.
+ if ( $session{'DefaultQueue'} && RT->Config->Get( "RememberDefaultQueue", $session{'CurrentUser'} ) ) {
+ $queue = $session{'DefaultQueue'};
+ }
+ else {
+ $queue = RT->Config->Get( "DefaultQueue", $session{'CurrentUser'} );
+ }
+
+ return $queue;
+}
+
package RT::Interface::Web;
RT::Base->_ImportOverlays();
diff --git a/share/html/Elements/SelectNewTicketQueue b/share/html/Elements/SelectNewTicketQueue
index 7a09867cb4..fd47f7b3c3 100644
--- a/share/html/Elements/SelectNewTicketQueue
+++ b/share/html/Elements/SelectNewTicketQueue
@@ -51,13 +51,7 @@
<%INIT>
my $queue = delete $ARGS{Default};
if ( !$queue ) {
- $queue = RT->Config->Get("DefaultQueue", $session{'CurrentUser'});
-
- if (RT->Config->Get("RememberDefaultQueue", $session{'CurrentUser'})) {
- if (my $session_default = $session{'DefaultQueue'}) {
- $queue = $session_default;
- }
- }
+ $queue = GetDefaultQueue();
}
$m->callback(Queue => \$queue, CallbackName => 'DefaultQueue');
diff --git a/share/html/Ticket/Create.html b/share/html/Ticket/Create.html
index 992f4af435..f2e03be800 100644
--- a/share/html/Ticket/Create.html
+++ b/share/html/Ticket/Create.html
@@ -331,12 +331,7 @@ my $Queue = $ARGS{Queue};
# Use default queue from config site or user prefs if none provided
unless ($Queue) {
- if ( $session{'DefaultQueue'} && RT->Config->Get( "RememberDefaultQueue", $session{'CurrentUser'} ) ) {
- $Queue = $session{'DefaultQueue'};
- }
- else {
- $Queue = RT->Config->Get( "DefaultQueue", $session{'CurrentUser'} );
- }
+ $Queue = GetDefaultQueue();
}
# pick first in list in normal order unless queue provided from form/url/defaults
-----------------------------------------------------------------------
More information about the rt-commit
mailing list