[Rt-devel] Re: Bug in RT::Tickets::LimitMemberOf (3.0.12 & 3.2.3)

Ruediger Riediger ruediger.riediger at sun.com
Tue May 10 05:32:37 EDT 2005


Ruediger Riediger wrote:
>>Does 3.4 behave better?

RT 3.4 is not affected. It sets both, LocalTarget and Target (same for
Base). Actually, the code change below is already the fix (after
s/$MergeInto/$NewTicket/ :-)

***************
*** 2894,2905 ****
      my $old_links_to = RT::Links->new($self->CurrentUser);
      $old_links_to->Limit(FIELD => 'Target', VALUE => $self->URI);

      while (my $link = $old_links_to->Next) {
!         if ($link->Base eq $NewTicket->URI) {
              $link->Delete;
          } else {
!             $link->SetTarget($NewTicket->URI);
          }

      }

--- 2716,2740 ----
      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 (exists $old_seen{$link->Base."-".$link->Type}) {
              $link->Delete;
+         }
+         elsif ($link->Base eq $MergeInto->URI) {
+             $link->Delete;
          } else {
!             # First, make sure the link doesn't already exist. then
move it over.
!             my $tmp = RT::Link->new($RT::SystemUser);
!             $tmp->LoadByCols(Base => $link->Base, Type => $link->Type,
LocalTarget => $MergeInto->id);
!             if ($tmp->id)   {
!                     $link->Delete;
!             } else {
!                 $link->SetTarget($MergeInto->URI);
!                 $link->SetLocalTarget($MergeInto->id);
              }
+             $old_seen{$link->Base."-".$link->Type} =1;
+         }

      }



Best regards,

	Ruediger Riediger

-- 
Dr. Ruediger Riediger                              Sun Microsystems GmbH
NSG - SunCERT                                             Komturstr. 18a
mailto:Ruediger.Riediger at Sun.com                          D-12099 Berlin
------------------------------------------------------------------------
NOTICE:  This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
------------------------------------------------------------------------
PGP 2048RSA/0x2C5020E9          964C E189 0FF0 8882  2BAB 65E2 6912 1FF2
------------------------------------------------------------------------


More information about the Rt-devel mailing list