[Rt-commit] [rtir] 01/01: remove hardcoded queue names from top of lib/RT/IR.pm and change custom field lookup to use new method of DB queue name lookup
Dustin Graves
dustin at bestpractical.com
Mon Dec 7 18:47:56 EST 2015
This is an automated email from the git hooks/post-receive script.
dustin pushed a commit to branch 3.4/remove-hardcoded-queue-names
in repository rtir.
commit c5184f5935e231bc5fc129c2424b4f94044dae28
Author: Dustin Graves <dustin at bestpractical.com>
Date: Mon Dec 7 23:40:25 2015 +0000
remove hardcoded queue names from top of lib/RT/IR.pm
and change custom field lookup to use new method of DB queue name lookup
Fixes: T#31258
---
lib/RT/IR.pm | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 565de18..0bfffd4 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -74,8 +74,6 @@ sub lifecycle_countermeasure {'blocks'}
my @LIFECYCLES = (RT::IR->lifecycle_incident, RT::IR->lifecycle_report, RT::IR->lifecycle_investigation, RT::IR->lifecycle_countermeasure);
-my @QUEUES = ('Incidents', 'Incident Reports', 'Investigations', 'Blocks');
-my %QUEUES = map { lc($_) => $_ } @QUEUES;
my %TYPE = (
'incidents' => 'Incident',
'incident reports' => 'Report',
@@ -241,7 +239,18 @@ Returns a list of the core RTIR Queue names
=cut
sub Queues {
- return @QUEUES;
+ my $queues = RT::Queues->new($session{'CurrentUser'});
+ $queues->Limit(
+ FIELD => 'Lifecycle',
+ OPERATOR => 'IN',
+ VALUES => [lifecycle_report(), lifecycle_incident(), lifecycle_investigation(), lifecycle_countermeasure()],
+ );
+
+ my @rtir_queues;
+ while (my $queue = $queues->Next) {
+ push @rtir_queues, $queue->Name;
+ }
+ return @rtir_queues;
}
=head2 Lifecycles
@@ -654,7 +663,7 @@ sub CustomFields {
);
unless ( keys %cache ) {
- foreach my $qname ( @QUEUES ) {
+ foreach my $qname ( Queues() ) {
my $type = TicketType( Queue => $qname );
$cache{$type} = [];
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list