[Rt-commit] r6310 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Fri Oct 27 01:40:25 EDT 2006


Author: ruz
Date: Fri Oct 27 01:39:53 2006
New Revision: 6310

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm

Log:
 r4048 at cubic-pc:  cubic | 2006-10-27 02:59:01 +0400
 ::Transaction->_Value
 * we have to use SUPER::_Value( $field ) to get correct results if
   once we'd get this method in a parent class
 * cache type of the transaction in a variable


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Transaction_Overlay.pm	Fri Oct 27 01:39:53 2006
@@ -873,43 +873,38 @@
 =cut
 
 sub _Value {
-
     my $self  = shift;
     my $field = shift;
 
     #if the field is public, return it.
     if ( $self->_Accessible( $field, 'public' ) ) {
-        return ( $self->__Value($field) );
-
+        return $self->SUPER::_Value( $field );
     }
 
     #If it's a comment, we need to be extra special careful
-    if ( $self->__Value('Type') eq 'Comment' ) {
+    my $type = $self->__Value('Type');
+    if ( $type eq 'Comment' ) {
         unless ( $self->CurrentUserHasRight('ShowTicketComments') ) {
             return (undef);
         }
     }
-    elsif ( $self->__Value('Type') eq 'CommentEmailRecord' ) {
+    elsif ( $type eq 'CommentEmailRecord' ) {
         unless ( $self->CurrentUserHasRight('ShowTicketComments')
             && $self->CurrentUserHasRight('ShowOutgoingEmail') ) {
             return (undef);
         }
-
     }
-    elsif ( $self->__Value('Type') eq 'EmailRecord' ) {
+    elsif ( $type eq 'EmailRecord' ) {
         unless ( $self->CurrentUserHasRight('ShowOutgoingEmail')) {
             return (undef);
         }
-
     }
     # Make sure the user can see the custom field before showing that it changed
-    elsif ( ( $self->__Value('Type') eq 'CustomField' ) && $self->__Value('Field') ) {
+    elsif ( $type eq 'CustomField' and my $cf_id = $self->__Value('Field') ) {
         my $cf = RT::CustomField->new( $self->CurrentUser );
-        $cf->Load( $self->__Value('Field') );
-        return (undef) unless ( $cf->CurrentUserHasRight('SeeCustomField') );
+        $cf->Load( $cf_id );
+        return undef unless $cf->CurrentUserHasRight('SeeCustomField');
     }
-
-
     #if they ain't got rights to see, don't let em
     elsif ($self->__Value('ObjectType') eq "RT::Ticket") {
         unless ( $self->CurrentUserHasRight('ShowTicket') ) {
@@ -917,8 +912,7 @@
         }
     }
 
-    return ( $self->__Value($field) );
-
+    return $self->SUPER::_Value( $field );
 }
 
 # }}}
@@ -1015,7 +1009,6 @@
     # value "ARGSRef", which was a reference to a hash of arguments.
     # This was insane. The next few lines of code preserve that API
     # while giving us something saner.
-       
 
     # TODO: 3.6: DEPRECATE OLD API
 


More information about the Rt-commit mailing list