[Rt-commit] r2040 - in rt/branches/3.4-RELEASE: . lib/RT

jesse at bestpractical.com jesse at bestpractical.com
Tue Jan 4 00:18:07 EST 2005


Author: jesse
Date: Tue Jan  4 00:18:06 2005
New Revision: 2040

Modified:
   rt/branches/3.4-RELEASE/   (props changed)
   rt/branches/3.4-RELEASE/lib/RT/Ticket_Overlay.pm
Log:
 r2530 at hualien:  jesse | 2005-01-04T05:15:35.757280Z
 a couple fixes for better handling ticket links on merge


Modified: rt/branches/3.4-RELEASE/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/Ticket_Overlay.pm	(original)
+++ rt/branches/3.4-RELEASE/lib/RT/Ticket_Overlay.pm	Tue Jan  4 00:18:06 2005
@@ -2712,11 +2712,17 @@
     my $old_links_to = RT::Links->new($self->CurrentUser);
     $old_links_to->Limit(FIELD => 'Target', VALUE => $self->URI);
 
+    my %old_seen;
     while (my $link = $old_links_to->Next) {
-        if ($link->Base eq $MergeInto->URI) {
+        if (exists $old_seen{$link->Base."-".$link->Type}) {
+            $link->Delete;
+        }   
+        elsif ($link->Base eq $MergeInto->URI) {
             $link->Delete;
         } else {
             $link->SetTarget($MergeInto->URI);
+            $link->SetLocalTarget($MergeInto->id);
+            $old_seen{$link->Base."-".$link->Type} =1;
         }
 
     }
@@ -2725,10 +2731,15 @@
     $old_links_from->Limit(FIELD => 'Base', VALUE => $self->URI);
 
     while (my $link = $old_links_from->Next) {
+        if (exists $old_seen{$link->Type."-".$link->Target}) {
+            $link->Delete;
+        }   
         if ($link->Target eq $MergeInto->URI) {
             $link->Delete;
         } else {
             $link->SetBase($MergeInto->URI);
+            $link->SetLocalBase($MergeInto->id);
+             $old_seen{$link->Type."-".$link->Target} =1;
         }
 
     }


More information about the Rt-commit mailing list