[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][FIX] importing tracker fields keeping the fieldId catch the exception and continue importing

"Baraka Kinywa \(@bkinywa24\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68b806463ad8_2cdcf50478b8@gitlab-sidekiq-low-urgency-cpu-bound-v2-dc78c9688-qs2wg.mail>

Baraka Kinywa pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
5381c7fe by MAGENE Sem Joel at 2025-09-03T12:03:35+03:00
[BP][FIX] importing tracker fields keeping the fieldId catch the exception and continue importing
---
* [FIX] importing tracker fields keeping the fieldId catch the exception and continue importing

(cherry picked from commit 6a39e7221b0716ccce1ff1f23697788d60cd1940)

See merge request tikiwiki/tiki!8481

- - - - -


1 changed file:

- lib/core/Services/Tracker/Utilities.php


Changes:

=====================================
lib/core/Services/Tracker/Utilities.php
=====================================
@@ -203,7 +203,16 @@ class Services_Tracker_Utilities
         $definition = Tracker_Definition::get($trackerId);
 
         //$fieldId = 0 when is a new field, e.g. when importing tracker structure
-        $field = ($fieldId === 0) ? [] : $definition->getField($fieldId);
+        try {
+            $field = ($fieldId === 0) ? [] : $definition->getField($fieldId);
+        } catch (RuntimeException $e) {
+            if ($fieldId > 0) {
+                // importing tracker field keeping the fieldId
+                $field = [];
+            } else {
+                throw $e;
+            }
+        }
         $trklib = TikiLib::lib('trk');
         $trklib->replace_tracker_field(
             $trackerId,



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

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