[TikiWiki-commits] [Git][tikiwiki/tiki][27.x] [FIX] Tracker Field Category: revert the change made in the MR 7783 and fix...

"Jean-Marc Kadimba \(@jmkadimba\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6996b2b41f619_3b186b0442395@gitlab-sidekiq-low-urgency-cpu-bound-v2-9d6ddd889-9z97j.mail>

Jean-Marc Kadimba pushed to branch 27.x at Tiki Wiki CMS Groupware / Tiki


Commits:
9d876a2d by Jean-Marc Kadimba at 2026-02-19T08:50:24+02:00
[FIX] Tracker Field Category: revert the change made in the MR 7783 and fix...
---
* fix phpcs

* [FIX] Tracker Field Category: revert the change made in the MR 7783 and fix the issue with the field when using the wiki plugin tracker

See merge request tikiwiki/tiki!9596


(cherry picked from commit 5db69b7ae8685e9bd86f097e073c87b8ad7042d5)

820b8e81 [FIX] Tracker Field Category: revert the change made in the MR 7783 and fix...
1a1432ad fix phpcs

Co-authored-by: Jean-Marc Kadimba <[email protected]>

(cherry picked from commit f48b33249836b5a7d29f15d69983296531dbc00d)

Co-authored-by: Jean-Marc Kadimba <[email protected]>
- - - - -


1 changed file:

- lib/core/Tracker/Field/Category.php


Changes:

=====================================
lib/core/Tracker/Field/Category.php
=====================================
@@ -196,9 +196,10 @@ class Tracker_Field_Category extends \Tracker\Field\AbstractItemField implements
         $selected = array_intersect($selected, $this->getIds($categories));
 
         if (isset($requestData[$key])) {
-            $selectedCategoryIds = is_array($requestData[$key]) ? $requestData[$key] : [$requestData[$key]];
-            $selected = array_unique(array_merge($selected, $selectedCategoryIds));
-            $value = implode(',', $selected);
+            $value = $requestData[$key];
+            if (is_array($value)) {
+                $value = implode(',', $value);
+            }
         } elseif (isset($requestData["cat_managed_$key"])) {
             $value = '';
         } elseif ($this->getValue()) {
@@ -207,7 +208,11 @@ class Tracker_Field_Category extends \Tracker\Field\AbstractItemField implements
             $value = implode(',', $selected);
         }
 
-        $selected_categories = array_filter(explode(',', $value), fn ($c) => in_array($c, $selected));
+        $selected_categories = explode(',', $value);
+
+        if (! empty($selected)) {
+            $selected_categories = array_filter($selected_categories, fn ($c) => in_array($c, $selected));
+        }
 
         $data = [
             'value' => $value,



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/9d876a2d34ccf07d8d0a27977e73fdc415f0d6f4

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/9d876a2d34ccf07d8d0a27977e73fdc415f0d6f4
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.