Loading...
 
Skip to main content

Filter error when filterfield contains a field that is a multi-valued item link

Status
Open
Subject
Filter error when filterfield contains a field that is a multi-valued item link
Version
12.x
14.x
Category
  • Error
Feature
Trackers
Resolution status
New
Submitted by
mbeijers
Lastmod by
mbeijers
Rating
(0)
Description

Consider a tracker 1 that has a field with fieldId=2 of type item link, and multiple values are allowed for this field. Assume that the tracker contains an item 3 where field 3 is a set of 2 item links, one to value "A" and one to value "B". The value of field 3 of item 2 in tracker 1 will show as "A,B".

Now make a trackerlist with trackerId="1" filterfield="2" and filtervalue="B". Due to a bug in trackerlib.php item 3 will not be shown. Item 3 should be shown, because value B occurs in field 2.

The problem is that the code does not handle item links with multiple values, and the filtervalue is checked only against the first link in the link item field.

The bug is due to the following piece of code:

INNER JOIN tiki_tracker_item_fields ttif{$i}_remote ON ttif$i.`value` = ttif{$i}_remote.`itemId`

The ON statement should take into account that ttif$i.`value` can be a list of itemIds, not a single value. Replacing this code with the following code resolves the problem:

INNER JOIN tiki_tracker_item_fields ttif{$i}_remote ON FIND_IN_SET(ttif{$i}_remote.`itemId`,ttif$i.`value`) > 0

Importance
4
Easy to solve?
10 easy
Priority
40
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
5757
Created
Monday 09 November, 2015 17:51:51 UTC
by mbeijers
LastModif
Monday 09 November, 2015 17:51:51 UTC


Show PHP error messages