[TikiWiki-commits] [Git][tikiwiki/tiki][29.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 <6996b2752cdca_3b1871f858977@gitlab-sidekiq-low-urgency-cpu-bound-v2-9d6ddd889-nrkcs.mail>

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


Commits:
f48b3324 by Jean-Marc Kadimba at 2026-02-19T08:49:22+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]>
- - - - -


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/f48b33249836b5a7d29f15d69983296531dbc00d

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