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

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6891d64e221ac_2c85c5b43c6@gitlab-sidekiq-low-urgency-cpu-bound-v2-68d57f6d77-kmkmb.mail>

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


Commits:
6a39e722 by Victor Emanouilov at 2025-08-05T13:00:36+03:00
[FIX] importing tracker fields keeping the fieldId catch the exception and continue importing

- - - - -


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/6a39e7221b0716ccce1ff1f23697788d60cd1940

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