[TikiWiki-commits] [Git][tikiwiki/tiki][28.x] [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 <6891d66f28b77_2cd5ca047543@gitlab-sidekiq-low-urgency-cpu-bound-v2-68d57f6d77-s5wk2.mail>

Victor Emanouilov pushed to branch 28.x at Tiki Wiki CMS Groupware / Tiki


Commits:
13c00a3e by Victor Emanouilov at 2025-08-05T13:01:08+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/13c00a3e10b2cdc855479e758c3058fdd22d43c6

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