[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] trackers: Another fix for invalid date values in item history

"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a104d3d4008e_3819278818d@gitlab-sidekiq-low-urgency-cpu-bound-v2-84c4765774-dqdlj.mail>

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


Commits:
36eecbec by Jonny Bradley at 2026-05-22T12:26:36+00:00
[FIX] trackers: Another fix for invalid date values in item history
---
* [FIX] trackers: Similar fix to !8744 but for a slightly different edge case, where a non-numeric value has been stored in a linked field in the item history. It was failing without rendering the historical data available which could help with debugging and repair.

See merge request tikiwiki/tiki!10278

- - - - -


2 changed files:

- lib/core/Tracker/Field/AbstractItemField.php
- lib/trackers/trackerlib.php


Changes:

=====================================
lib/core/Tracker/Field/AbstractItemField.php
=====================================
@@ -235,12 +235,16 @@ abstract class AbstractItemField implements ItemFieldInterface, IndexableInterfa
             if ($this->getConfiguration('type') === 'e' && is_string($old)) {   // category fields need an array input
                 $old = explode(',', $old);
             }
-            $this->definition = array_merge($this->definition, $this->getFieldData([$key => $old]));
-            $this->itemData[$this->getConfiguration('fieldId')] = $old;
-            $old = $this->renderInnerOutput($innerOutputContext);
-            $old = str_replace(['%%%', '<br>', '<br/>'], ["\n", ' ', ' '], $old);
-            $this->definition = $old_definition;
-            $this->itemData[$this->getConfiguration('fieldId')] = $new;
+            try {
+                $this->definition = array_merge($this->definition, $this->getFieldData([$key => $old]));
+                $this->itemData[$this->getConfiguration('fieldId')] = $old;
+                $old = $this->renderInnerOutput($innerOutputContext);
+                $old = str_replace(['%%%', '<br>', '<br/>'], ["\n", ' ', ' '], $old);
+                $this->definition = $old_definition;
+                $this->itemData[$this->getConfiguration('fieldId')] = $new;
+            } catch (\Exception $e) {
+                $old = tr('Error on field #%0: "%1"', $this->getConfiguration('fieldId'), $e->getMessage());
+            }
         }
         $new = $this->renderInnerOutput($innerOutputContext);
         $new = str_replace(['%%%', '<br>', '<br/>'], ["\n", ' ', ' '], $new);


=====================================
lib/trackers/trackerlib.php
=====================================
@@ -6550,8 +6550,12 @@ class TrackerLib extends TikiLib
                 } else {
                     $requestData = $field;
                 }
-                $linkedField = $handler->getFieldData($requestData);
-                $field = array_merge($field, $linkedField);
+                try {
+                    $linkedField = $handler->getFieldData($requestData);
+                    $field = array_merge($field, $linkedField);
+                } catch (Exception $e) {
+                    Feedback::error(tr('Error on linked field %0: %1', $field['fieldId'], $e->getMessage()));
+                }
                 $field['ins_id'] = 'ins_' . $field['fieldId'];
                 if (isset($field['value']) && $field['type'] == 'S') {
                     $item[$field['fieldId']] = $field['value'];



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

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/36eecbecb09cf74185eed447535422bbd2bd263c
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
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.