[Rt-commit] [rtir] 02/03: Properly skip Constituency on Create

Kevin Falcone falcone at bestpractical.com
Fri Apr 18 21:20:07 EDT 2014


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

falcone pushed a commit to branch master
in repository rtir.

commit 4cfbe4675f8cd78d5ae65ddc29276fe64deb20c9
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Apr 18 13:32:02 2014 -0400

    Properly skip Constituency on Create
    
    This code worked on Editing, but on Create, the Object we get is an
    empty ticket, which means no Queue yet.  Since the CustomFields object
    we're passed was created from $Queue->TicketCustomFields, it'll have a
    ContextObject set that we can use to assume what Queue this ticket is
    being created in.
    
    This avoids the other alternative, which is to just *always*
    exclude CFs named Constituency, even in non-RTIR queues.
---
 .../RTIR/Elements/EditCustomFields/MassageCustomFields        | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/html/Callbacks/RTIR/Elements/EditCustomFields/MassageCustomFields b/html/Callbacks/RTIR/Elements/EditCustomFields/MassageCustomFields
index d03fb07..0da4d80 100644
--- a/html/Callbacks/RTIR/Elements/EditCustomFields/MassageCustomFields
+++ b/html/Callbacks/RTIR/Elements/EditCustomFields/MassageCustomFields
@@ -51,7 +51,16 @@ $Object => undef
 </%args>
 <%init>
 return unless $Object->isa('RT::Ticket');
-my $queue = $Object->QueueObj;
+my $queue;
+if ($Object->Id) {
+    $queue = $Object->QueueObj;
+} else {
+    # during ticket creation, we get an id'less ticket
+    # but the CustomFields object was created from Queue->TicketCustomFields
+    # so we can find the relevant Queue from that
+    $queue = $CustomFields->ContextObject;
+    return unless ($queue && $queue->isa('RT::Queue'));
+}
 return unless RT::IR->OurQueue( $queue );
 
 # We never want to see the RTIR's custom field Constituency in the edity ui

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


More information about the rt-commit mailing list