[Rt-commit] [rtir] 02/05: Replace wrap with monkey patch to store ticket id on queue obj

Jim Brandt jbrandt at bestpractical.com
Fri Mar 21 17:18:35 EDT 2014


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

jbrandt pushed a commit to branch 3.2/remove-lexwrap
in repository rtir.

commit a3f47c35295812ea8fc8b8ffd3e0b1a86ecb0193
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Mar 21 14:30:07 2014 -0400

    Replace wrap with monkey patch to store ticket id on queue obj
---
 lib/RT/IR.pm | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index bf80ca9..725c37a 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -691,12 +691,13 @@ require RT::Action::AutoOpen;
 if ( RT::IR->HasConstituency ) {
     # Queue {Comment,Correspond}Address for multiple constituencies
 
-    wrap 'RT::Ticket::QueueObj', pre => sub {
-        my $queue = RT::Queue->new($_[0]->CurrentUser);
-        $queue->Load($_[0]->__Value('Queue'));
-        $queue->{'_for_ticket'} = $_[0]->id;
-        $_[-1] = $queue;
-        return;
+    no warnings 'redefine';
+    my $orig_QueueObj = RT::Ticket->can('QueueObj');
+    *RT::Ticket::QueueObj = sub {
+        my $self = shift;
+        my $queue_obj = $orig_QueueObj->( $self );
+        $queue_obj->{'_for_ticket'} = $self->id if $queue_obj;
+        return $queue_obj;
     };
 
     require RT::Queue;

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


More information about the rt-commit mailing list