[Rt-devel] LinkCallback logic inverted

Joby Walker joby at u.washington.edu
Wed Oct 19 16:28:42 EDT 2005


I was doing some testing of the various search fields available and
noticed that the logic in /Elements/RT_Ticket/ColumnMap subroutine
LinkCallback is inverted.

It categorizes tickets on the opposite of the base/target link
direction.  For example:

1) Ticket 100 DependsOn Ticket 200 (thus 200 DependedOnBy 100)
2) In a search with the DependsOn and DependedOnBy fields you get

ID          DependsOn          DependedOnBy
100                                200
200            100

When it should be:
ID          DependsOn          DependedOnBy
100            200
200                                100

The attached patch fixes this.

-- 

Joby Walker
ITI SSG, University of Washington
-------------- next part --------------
==== Patch <InvLinkCallBack.diff> level 1
Source: [No source]
Target: e417ac7c-1bcc-0310-8ffa-8f5827389a85:/rt/branches/3.4-RELEASE:3967
        (svn://svn.bestpractical.com/rt)
Log:
* Inverts the Logic of LinkCallback so that Tickets get assigned properly to base or target of a link
=== html/Elements/RT__Ticket/ColumnMap
==================================================================
--- html/Elements/RT__Ticket/ColumnMap  (revision 3967)
+++ html/Elements/RT__Ticket/ColumnMap  (patch InvLinkCallBack.diff level 1)
@@ -96,17 +96,17 @@
     my $mode            = $RT::Ticket::LINKTYPEMAP{$method}{Mode};
     my $type            = $RT::Ticket::LINKTYPEMAP{$method}{Type};
     my $other_mode      = ($mode eq "Target" ? "Base" : "Target");
-    my $mode_uri        = $other_mode.'URI';
-    my $local_type      = 'Local'.$other_mode;
+    my $mode_uri        = $mode.'URI';
+    my $local_type      = 'Local'.$mode;
 
     return sub {
         map {
             \'<A HREF="',
             $_->$mode_uri->Resolver->HREF,
             \'">',
-            ( $_->$mode_uri->IsLocal ? $_->$local_type : $_->$other_mode ),
+            ( $_->$mode_uri->IsLocal ? $_->$local_type : $_->$mode ),
             \'</A><BR>',
-        } @{ $_[0]->Links($mode,$type)->ItemsArrayRef }
+        } @{ $_[0]->Links($other_mode,$type)->ItemsArrayRef }
     }
 }
 

==== BEGIN SVK PATCH BLOCK ====
Version: svk 1.00 (linux)

eJyFk81q20AUhbXuqnTT7SyUTcGR5kc/doNxGtxSmpYSO9l0IUYzV7bwWGNGk9DAQOljNG3foC+S
t+pIctIWUoJAIO4537m6c+e1Wb6cYTedxi7EsVtcvJtMPnIr1gf+K0wdyNpqEyZOwRWokDqlVyFz
Dd+Cr1puVmCnU+zN+WCe94Y7COsYJbe6acNxDyusAQixS2apmxE3o97qsC/qHTSF0dp6PMsS4otF
15JQuoWis3bypJOTELNBL2sDwudde9PablXP2vtp50/2/j9Cr7gH0QdAmPakaK5gC41t+7zHkOQe
yR5AEvYvMjpbFsWyFhuwfROP0ek9PbkbVFUrCOn/udGJVpfb5j3f9T09lsCGhL7Kdzt1XVj4bCUo
y/tUSlwCUqalqHDqnzLLeZlwEme0lFWeECa7bhYXH4LgdnH75nkQ3JwH0c2n4OvR96dHP86efPsS
/Dr++WzG/j7V/i/2/HE2zjJBpYAMCB/jNCVplVAqc85YBbI/Whxj9wK9ba7A2BbZNaBTvaoF0hU6
rZvNCVeq5GKDWu2L3KJhGC3yW4p429arBiTaGT9Co66R1ajkLSBt0LDJHYcj5UkhiZ2PuYO+8tBD
WVfVdEpcSMiw68veNJmcN7VvqOXqIHV+1Dtu1/6mGLjyH5eXtewWIDI2Kg1vxBraiB6y0dn8dH68
mHsJHadZSP1dYzjjIhMjXAoxiimOR3lVcf9KcpLRfMzz5DfuBzfB
==== END SVK PATCH BLOCK ====


More information about the Rt-devel mailing list