[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Trackers: restore multi-status toggle (Open/Pending/Closed) without...

"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <693ab7996ac6d_2a17f62469518@gitlab-sidekiq-low-urgency-cpu-bound-v2-5ff4fd4844-sxxqx.mail>

Jonny Bradley pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
a7feef66 by Doddy MATABARO at 2025-12-11T12:14:21+00:00
[FIX] Trackers: restore multi-status toggle (Open/Pending/Closed) without...
---
* [FIX] Trackers: Fix status button links when single status selected

* [FIX] Trackers: restore multi-status toggle (Open/Pending/Closed) without modifiers; respect defaultStatus

See merge request tikiwiki/tiki!8400

- - - - -


1 changed file:

- tiki-view_tracker.php


Changes:

=====================================
tiki-view_tracker.php
=====================================
@@ -180,19 +180,46 @@ if (isset($_REQUEST['status'])) {
     $sts = preg_split('//', $tracker_info["defaultStatus"], -1, PREG_SPLIT_NO_EMPTY);
     $_REQUEST['status'] = $tracker_info["defaultStatus"];
 } else {
-    $sts = [
-        'o'
-    ];
+    $sts = ['o'];
     $_REQUEST['status'] = 'o';
 }
+
+/**
+ * Keep a consistent order for combined statuses, based on tracker’s declared statuses.
+ * Example typical order: ['o','p','c'].
+ */
+$statusOrder = array_keys($status_raw);
+
 foreach ($status_raw as $let => $sta) {
     if (isset($sta['perm']) || ($my || $ours)) {
-        if (in_array($let, $sts)) {
+        // Visual state
+        if (in_array($let, $sts, true)) {
             $sta['class'] = 'statuson';
         } else {
             $sta['class'] = 'statusoff';
         }
-        $sta['statuslink'] = $let;
+
+        // Build toggled set against current selection
+        $newSet = $sts;
+
+        if (in_array($let, $newSet, true)) {
+            // Remove this status from the set
+            $newSet = array_values(array_diff($newSet, [$let]));
+            // If that would leave empty, show all OTHER statuses instead
+            if (empty($newSet)) {
+                $newSet = array_values(array_diff($statusOrder, [$let]));
+            }
+        } else {
+            // Add clicked status
+            $newSet[] = $let;
+        }
+
+        // Normalize order to tracker's order, and ensure uniqueness
+        $newSet = array_values(array_intersect($statusOrder, $newSet));
+
+        // Link carries the combined status string (e.g. 'op', 'pc', 'opc', etc.)
+        $sta['statuslink'] = implode('', $newSet);
+
         $status_types[$let] = $sta;
     }
 }



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

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