[Rt-commit] [rtir] 02/06: Update RT::IR->ConstituencyFor to also work for queue objects

Jesse Vincent jesse at bestpractical.com
Wed Mar 25 03:34:14 EDT 2015


This is an automated email from the git hooks/post-receive script.

jesse pushed a commit to branch 3.4/remove_old_constituencies
in repository rtir.

commit 526bcb1bf4dc6eeab6f9b5bd537a3a5fd576840d
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Mar 24 23:49:43 2015 -0700

    Update RT::IR->ConstituencyFor to also work for queue objects
---
 lib/RT/IR.pm | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index cb715af..f20e794 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -807,21 +807,25 @@ XXX TODO
 
 =cut
 
-=head2 ConstituencyFor $Ticket
+=head2 ConstituencyFor $Ticket|$Queue
 
-Returns the textual constituency name for any RTIR ticket.
-Returns undef for non-RTIR tickets.
+Returns the textual constituency name for any RTIR ticket or queue
+Returns undef for non-RTIR tickets and queues.
 
-Dies if handed something that's not a ticket
+Dies if handed something that's not a ticket or queue
 
 =cut
 
 
 sub ConstituencyFor {
     my $self = shift;
-    my $ticket = shift;
-    die "$ticket is not a ticket object" unless ref($ticket) && $ticket->isa('RT::Ticket');
-    return $ticket->QueueObj->FirstCustomFieldValue('RTIR Constituency');
+    my $object = shift;
+    if ($object->isa('RT::Queue')) {
+        return $object->FirstCustomFieldValue('RTIR Constituency');
+    }
+
+    die "$object is not a ticket object" unless ref($object) && $object->isa('RT::Ticket');
+    return $object->QueueObj->FirstCustomFieldValue('RTIR Constituency');
 }
 
 sub IsReportQueue {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list