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

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6996a0d4b0b61_3b1594b8c137c1@gitlab-sidekiq-low-urgency-cpu-bound-v2-57c6bc4678-lrn2r.mail>

Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
5db69b7a by Jean-Marc Kadimba at 2026-02-19T05:26:10+00: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

- - - - -


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/5db69b7ae8685e9bd86f097e073c87b8ad7042d5

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