[TikiWiki-commits] [Git][tikiwiki/tiki][26.x] [FIX] tabular imports: return formatted data after import from the API, so the...

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

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


Commits:
fb88a868 by Victor Emanouilov at 2025-09-03T14:00:52+03:00
[FIX] tabular imports: return formatted data after import from the API, so the remote point can sync any PKs or other data if needed

- - - - -


2 changed files:

- lib/core/Services/Tracker/TabularController.php
- lib/core/Tracker/Tabular/Writer/TrackerWriter.php


Changes:

=====================================
lib/core/Services/Tracker/TabularController.php
=====================================
@@ -4,6 +4,7 @@
 //
 // All Rights Reserved. See copyright.txt for details and a complete list of authors.
 // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
+
 class Services_Tracker_TabularController
 {
     public function setUp()
@@ -480,15 +481,25 @@ class Services_Tracker_TabularController
 
             return TikiLib::lib('tiki')->allocate_extra(
                 'tracker_import_items',
-                function () use ($writer, $source, $info) {
-                    $writer->write($source);
+                function () use ($writer, $source, $info, $schema) {
+                    $result = $writer->write($source);
 
                     unlink($_FILES['file']['tmp_name']);
 
                     $message = tr('Your import was completed successfully.');
 
                     if (TIKI_API) {
-                        return ['feedback' => $message];
+                        $data = [];
+                        $columns = $schema->getColumns();
+                        foreach ($result as $itemId) {
+                            $entry = new \Tracker\Tabular\Source\TrackerSourceEntry($itemId);
+                            $row = ['itemId' => $itemId];
+                            foreach ($columns as $column) {
+                                $row[$column->getLabel()] = $entry->render($column, false);
+                            }
+                            $data[] = $row;
+                        }
+                        return $data;
                     }
 
                     Feedback::success($message);


=====================================
lib/core/Tracker/Tabular/Writer/TrackerWriter.php
=====================================
@@ -127,7 +127,7 @@ class TrackerWriter
 
         $definition = $schema->getDefinition();
 
-        $iterate(function ($line, $info, $columns) use ($utilities, $definition, $schema) {
+        $result = $iterate(function ($line, $info, $columns) use ($utilities, $definition, $schema) {
             if (! isset($info['status'])) {
                 $info['status'] = '';
             }
@@ -174,7 +174,7 @@ class TrackerWriter
             $source->importSuccess();
         }
 
-        return true;
+        return $result;
     }
 
     /**



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

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