[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
Thu Feb 4 19:37:45 EST 2016
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 c8887b3f3c0f00885f737101dd83d709506a8484
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 | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 565de18..485f0b7 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,19 @@ Returns a list of the core RTIR Queue names
=cut
sub Queues {
- return @QUEUES;
+ my $queues = RT::Queues->new( RT->SystemUser );
+
+ $queues->Limit(
+ FIELD => 'Lifecycle',
+ OPERATOR => 'IN',
+ VALUE => \@LIFECYCLES,
+ );
+
+ my @rtir_queues;
+ while (my $queue = $queues->Next) {
+ push @rtir_queues, $queue->Name;
+ }
+ return @rtir_queues;
}
=head2 Lifecycles
@@ -654,7 +664,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