[Rt-commit] r18352 - rt/3.8/trunk/lib/RT

ruz at bestpractical.com ruz at bestpractical.com
Thu Feb 12 16:23:29 EST 2009


Author: ruz
Date: Thu Feb 12 16:23:29 2009
New Revision: 18352

Modified:
   rt/3.8/trunk/lib/RT/CustomFields_Overlay.pm

Log:
* pass context object from a collection of CFs to CF records

Modified: rt/3.8/trunk/lib/RT/CustomFields_Overlay.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/CustomFields_Overlay.pm	(original)
+++ rt/3.8/trunk/lib/RT/CustomFields_Overlay.pm	Thu Feb 12 16:23:29 2009
@@ -182,25 +182,32 @@
 sub Next {
     my $self = shift;
     
-    
     my $CF = $self->SUPER::Next();
-    if ((defined($CF)) and (ref($CF))) {
+    return $CF unless $CF;
 
-	if ($CF->CurrentUserHasRight('SeeCustomField')) {
-	    return($CF);
-	}
-	
-	#If the user doesn't have the right to show this queue
-	else {	
-	    return($self->Next());
-	}
-    }
-    #if there never was any queue
-    else {
-	return(undef);
-    }	
-    
+    $CF->SetContextOject( $self->ContextObject );
+
+    return $self->Next unless $CF->CurrentUserHasRight('SeeCustomField');
+    return $CF;
+}
+
+sub SetContextObject {
+    my $self = shift;
+    return $self->{'context_object'} = shift;
+}
+  
+sub ContextObject {
+    my $self = shift;
+    return $self->{'context_object'};
+}
+
+sub NewItem {
+    my $self = shift;
+    my $res = RT::CustomField->new($self->CurrentUser);
+    $res->SetContextObject($self->ContextObject);
+    return $res;
 }
+
 # }}}
 
 sub LimitToLookupType  {
@@ -255,6 +262,6 @@
     #$self->OrderBy( ALIAS => $class_cfs , FIELD => "SortOrder", ORDER => 'ASC');
 
 }
-  
+
 1;
 


More information about the Rt-commit mailing list