[Rt-commit] [rtir] 03/05: Replace wrap with RT::Ticket subroutine override

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 30323902d9de549f46ee24be2ec53cb544bf6f53
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Mar 21 14:56:44 2014 -0400

    Replace wrap with RT::Ticket subroutine override
    
    The previous wrap pre had a check to only run on ticket
    custom fields, so create an override for _AddCustomFieldValue
    in RT::Ticket.
---
 lib/RT/IR.pm            |  7 -------
 lib/RT/Ticket_Vendor.pm | 14 ++++++++++++++
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 725c37a..49ff4c1 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -623,13 +623,6 @@ if ( RT::IR->HasConstituency ) {
         %RT::IR::HasNoQueueCache = ();
     };
 
-    require RT::Record;
-    # flush constituency cache on update of the custom field value for a ticket
-    wrap 'RT::Record::_AddCustomFieldValue', pre => sub {
-        return unless UNIVERSAL::isa($_[0] => 'RT::Ticket');
-        $RT::IR::ConstituencyCache{$_[0]->id}  = undef;
-    };
-
     require RT::Ticket;
     wrap 'RT::Ticket::ACLEquivalenceObjects', pre => sub {
         my $self = shift;
diff --git a/lib/RT/Ticket_Vendor.pm b/lib/RT/Ticket_Vendor.pm
new file mode 100644
index 0000000..9dc7f78
--- /dev/null
+++ b/lib/RT/Ticket_Vendor.pm
@@ -0,0 +1,14 @@
+package RT::Ticket;
+
+use strict;
+use warnings;
+no warnings 'redefine';
+
+# flush constituency cache on update of the custom field value for a ticket
+sub _AddCustomFieldValue {
+    my $self = shift;
+    $RT::IR::ConstituencyCache{$self->id}  = undef;
+    return $self->SUPER::_AddCustomFieldValue(@_);
+}
+
+1;

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


More information about the rt-commit mailing list