[Rt-commit] [rtir] 01/02: When linking a singular Incident Child type, delete other Links

Kevin Falcone falcone at bestpractical.com
Tue Jun 18 19:00:57 EDT 2013


This is an automated email from the git hooks/post-receive script.

falcone pushed a commit to branch 2.9/incident-children
in repository rtir.

commit f701072d3a54ceb436819aa328fbae65549b7abc
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Mon Jun 17 19:16:47 2013 -0400

    When linking a singular Incident Child type, delete other Links
    
    Investigations have long been limited to being applied to a single
    Incident. We've allowed Blocks to apply to multiple Incidents since
    1.0.0.  Starting in 2.4.0 we allowed the same behavior for Incident Reports.
    
    In c991958 a comment was added saying that this code looked "wrong
    absolutly" for passing the correct arguments to ProcessTicketLinks.
    
    In baa9f2c the comment was removed and the code 'fixed' to specify the
    child and the incident id.  However, this is completely incorrect.
    Since 3.4 (years before this code was written) the Delete Link path has
    ONLY accepted a target or a base because you're calling DeleteLink on
    the other side of the link (you call it on the target object, passing
    the base or call it on the base object passing the target).
    
    This resulted in the delete never running for the entirety of the 2.4 or
    2.6 series of RTIR.  As a result, while you could never apply an
    Investigation to two Incidents during Investigation creation, you could
    backdoor yourself links to two Incidents by clicking Link on an
    Investigation page and ignoring the "Can't specifiy both base and
    target" message that shows up at the top of the page, before the message
    saying that a link was created.
    
    You could also use the Link action in the Investigations box on an
    Incident page.  This provides a list of active Investigations and when
    you pick an Investigation which is already linked to an Incident, the
    old code would not remove it from the old Incident and you would end up
    with an Investigation linked to two Incidents.  The same error about
    specifying both base and target would be shown to the user.
    
    In 3.0, this code runs if the Incident Child Type isn't marked Multiple.
    By default, this provides the intended behavior that Blocks and Incident
    Reports may belong to multiple Incidents, but that Investigations may
    not.  If you've been relying on the backdoor behavior in 2.6, you can
    specify explicitly that Investigations can belong to multiple Incidents
    using the RTIR_IncidentChildren configuration.
---
 html/RTIR/Incident/Display.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/html/RTIR/Incident/Display.html b/html/RTIR/Incident/Display.html
index 7216eb0..52500e2 100644
--- a/html/RTIR/Incident/Display.html
+++ b/html/RTIR/Incident/Display.html
@@ -172,7 +172,7 @@ my $DoLinks = sub {
         my $incidents = RT::IR->Incidents( $child, Exclude => $parent );
         while ( my $incident = $incidents->Next ) {
             $deleted_links = 1;
-            $args{'DeleteLink-'. $child->id .'-MemberOf-'. $incident->id } = '';
+            $args{'DeleteLink--MemberOf-'. $incident->id } = '';
         }
     }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Rt-commit mailing list