[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [FIX] wikiplugin_trackerfilter: Handle composite filters correctly

"Domeshow Emmanuel \(@Domeshow\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6994720d4934b_3b467bc0-369@gitlab-sidekiq-low-urgency-cpu-bound-v2-599bdbfbc7-7c8cc.mail>

Domeshow Emmanuel pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
78917fb2 by Domeshow Emmanuel at 2026-02-17T15:41:20+02:00
[FIX] wikiplugin_trackerfilter: Handle composite filters correctly
---
* [FIX] wikiplugin_trackerfilter: Handle composite filters correctly
---
* [FIX] wikiplugin_trackerfilter: Handle composite filters correctly

See merge request tikiwiki/tiki!9416


(cherry picked from commit eab2db5fd30086ebf8cfc3dde8245a190e143269)

8698f840 [FIX] wikiplugin_trackerfilter: Handle composite filters correctly

Co-authored-by: Domeshow Emmanuel <[email protected]>

See merge request tikiwiki/tiki!9588

- - - - -


2 changed files:

- lib/trackers/trackerlib.php
- lib/wiki-plugins/wikiplugin_trackerfilter.php


Changes:

=====================================
lib/trackers/trackerlib.php
=====================================
@@ -3988,7 +3988,7 @@ class TrackerLib extends TikiLib
     public function get_tracker_field($fieldIdOrPermName, $useCache = true)
     {
         static $cache = [];
-        if ($useCache && isset($cache[$fieldIdOrPermName])) {
+        if ($useCache && (is_string($fieldIdOrPermName) || is_int($fieldIdOrPermName)) && isset($cache[$fieldIdOrPermName])) {
             return $cache[$fieldIdOrPermName];
         }
         if ((int)$fieldIdOrPermName > 0) {


=====================================
lib/wiki-plugins/wikiplugin_trackerfilter.php
=====================================
@@ -475,11 +475,29 @@ function wikiplugin_trackerfilter_build_trackerlist_filter($input, $formats, &$f
                 $val = '';
             }
             $fieldId = substr($key, 2);
-            $field = $tracker_definition->getField((int)$fieldId);
 
             if ($fieldId == 'status') {
                 continue;
             }
+            $isComposite = preg_match('/^\(?\d+(?::\d+)+\)?$/', $fieldId) === 1;
+            if ($isComposite) {
+                $ffs[] = ['sqlsearch' => explode(':', str_replace(['(', ')'], '', $fieldId))];
+                if (isset($formats[$fieldId]) && ($formats[$fieldId] == 't' || $formats[$fieldId] == 'i')) {
+                    $exactValues[] = '';
+                    $values[] = $val;
+                } else {
+                    if (! empty($formats[$fieldId]) && preg_match('/[\>\<]+/', $formats[$fieldId])) {
+                        $exactValues[] = [$formats[$fieldId] => $val];
+                    } else {
+                        $exactValues[] = $val;
+                    }
+                    $values[] = '';
+                }
+                continue;
+            }
+
+            $fieldLookupId = (is_numeric($fieldId) || preg_match('/^\d+/', $fieldId)) ? (int)$fieldId : $fieldId;
+            $field = $tracker_definition->getField($fieldLookupId);
             if (preg_match('/([0-9]+)(Month|Day|Year|Hour|Minute|Second)/', $fieldId, $matches)) { // a date
                 if (! in_array($matches[1], $ffs)) {
                     $fieldId = $matches[1];
@@ -526,11 +544,7 @@ function wikiplugin_trackerfilter_build_trackerlist_filter($input, $formats, &$f
                         }
                     }
                 }
-                if (! is_numeric($fieldId)) { // composite filter
-                    $ffs[] = ['sqlsearch' => explode(':', str_replace(['(', ')'], '', $fieldId))];
-                } else {
-                    $ffs[] = $fieldId;
-                }
+                $ffs[] = $fieldId;
                 if (isset($formats[$fieldId]) && ($formats[$fieldId] == 't' || $formats[$fieldId] == 'i')) {
                     $exactValues[] = '';
                     $values[] = ($formats[$fieldId] == 'i') ? "$val%" : $val;



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/78917fb256246306c9d25d289cf4b54463b7db59

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/78917fb256246306c9d25d289cf4b54463b7db59
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.