import rt 3.4.6
[freeside.git] / rt / lib / RT / Links_Overlay.pm
index 156193f..e1927f8 100644 (file)
@@ -1,8 +1,8 @@
-# {{{ BEGIN BPS TAGGED BLOCK
+# BEGIN BPS TAGGED BLOCK {{{
 # 
 # COPYRIGHT:
 #  
-# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC 
 #                                          <jesse@bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
@@ -42,7 +42,8 @@
 # works based on those contributions, and sublicense and distribute
 # those contributions and any derivatives thereof.
 # 
-# }}} END BPS TAGGED BLOCK
+# END BPS TAGGED BLOCK }}}
+
 =head1 NAME
 
   RT::Links - A collection of Link objects
@@ -66,6 +67,9 @@ ok (require RT::Links);
 
 =cut
 
+
+package RT::Links;
+
 use strict;
 no warnings qw(redefine);
 use RT::URI;
@@ -150,19 +154,17 @@ sub Next {
     my $self = shift;
        
     my $Link = $self->SUPER::Next();
-    if ((defined($Link)) and (ref($Link))) {
-        # Skip links to local objects thast are deleted
-        if      ($Link->TargetURI->IsLocal and UNIVERSAL::isa($Link->TargetObj,"RT::Ticket")
-                 and $Link->TargetObj->__Value('status') eq "deleted") {
-            return $self->Next;
-        } elsif ($Link->BaseURI->IsLocal   and UNIVERSAL::isa($Link->BaseObj,"RT::Ticket")
-                 and $Link->BaseObj->__Value('status') eq "deleted") {
-            return $self->Next;
-        } else {
-            return $Link;
-        }
+    return $Link unless $Link && ref $Link;
+
+    # Skip links to local objects thast are deleted
+    if ( $Link->TargetURI->IsLocal and UNIVERSAL::isa($Link->TargetObj,"RT::Ticket")
+             and $Link->TargetObj->__Value('status') eq "deleted") {
+        return $self->Next;
+    } elsif ($Link->BaseURI->IsLocal   and UNIVERSAL::isa($Link->BaseObj,"RT::Ticket")
+             and $Link->BaseObj->__Value('status') eq "deleted") {
+        return $self->Next;
     } else {
-        return undef;
+        return $Link;
     }
 }