diff --git a/files/client/custom/modules/data-migration/res/templates/admin/data-migration.tpl b/files/client/custom/modules/data-migration/res/templates/admin/data-migration.tpl index 544ee60..af85fc5 100644 --- a/files/client/custom/modules/data-migration/res/templates/admin/data-migration.tpl +++ b/files/client/custom/modules/data-migration/res/templates/admin/data-migration.tpl @@ -150,6 +150,14 @@ — {{translate 'skipDuplicatesHint' category='messages' scope='DataMigration'}} + +
+ +
diff --git a/files/client/custom/modules/data-migration/src/views/admin/data-migration.js b/files/client/custom/modules/data-migration/src/views/admin/data-migration.js index ee96321..7e06cf1 100644 --- a/files/client/custom/modules/data-migration/src/views/admin/data-migration.js +++ b/files/client/custom/modules/data-migration/src/views/admin/data-migration.js @@ -301,6 +301,7 @@ define('modules/data-migration/views/admin/data-migration', ['view'], function ( const preserveIds = this.$el.find('input[name="preserveIds"]').is(':checked'); const skipDuplicates = this.$el.find('input[name="skipDuplicates"]').is(':checked'); + const noFiles = this.$el.find('input[name="importNoFiles"]').is(':checked'); const confirmMsg = dryRun ? this.translate('dryRunConfirmation', 'messages', 'DataMigration') @@ -315,6 +316,7 @@ define('modules/data-migration/views/admin/data-migration', ['view'], function ( Espo.Ajax.postRequest('DataMigration/action/import', { backupName: this.selectedBackup, preserveIds: preserveIds, + noFiles: noFiles, skipDuplicates: skipDuplicates, dryRun: dryRun, }, {timeout: 600000}) diff --git a/files/custom/Espo/Modules/DataMigration/Api/Import.php b/files/custom/Espo/Modules/DataMigration/Api/Import.php index d4debd7..aeb02bb 100644 --- a/files/custom/Espo/Modules/DataMigration/Api/Import.php +++ b/files/custom/Espo/Modules/DataMigration/Api/Import.php @@ -46,6 +46,7 @@ class Import implements Action $preserveIds = $body->preserveIds ?? true; $skipDuplicates = $body->skipDuplicates ?? true; $dryRun = $body->dryRun ?? false; + $noFiles = $body->noFiles ?? false; $io = new BufferedIO(); @@ -54,6 +55,7 @@ class Import implements Action 'preserveIds' => $preserveIds, 'skipDuplicates' => $skipDuplicates, 'dryRun' => $dryRun, + 'noFiles' => $noFiles, 'verbose' => true, ], $io); diff --git a/files/custom/Espo/Modules/DataMigration/Resources/i18n/en_US/DataMigration.json b/files/custom/Espo/Modules/DataMigration/Resources/i18n/en_US/DataMigration.json index a7776b7..271b94c 100644 --- a/files/custom/Espo/Modules/DataMigration/Resources/i18n/en_US/DataMigration.json +++ b/files/custom/Espo/Modules/DataMigration/Resources/i18n/en_US/DataMigration.json @@ -42,6 +42,7 @@ "deleteBackupConfirmation": "Are you sure you want to delete this backup? This action cannot be undone.", "noFilesHint": "faster export, without attachment files", "preserveIdsHint": "keep original record IDs (recommended for same-instance restore)", + "importNoFilesHint": "import only database records, skip attachment files", "skipDuplicatesHint": "skip records that already exist in the database" } } diff --git a/files/custom/Espo/Modules/DataMigration/Resources/i18n/fa_IR/DataMigration.json b/files/custom/Espo/Modules/DataMigration/Resources/i18n/fa_IR/DataMigration.json index e8be9f2..6f34127 100644 --- a/files/custom/Espo/Modules/DataMigration/Resources/i18n/fa_IR/DataMigration.json +++ b/files/custom/Espo/Modules/DataMigration/Resources/i18n/fa_IR/DataMigration.json @@ -42,6 +42,7 @@ "deleteBackupConfirmation": "האם אתה בטוח שברצונך למחוק גיבוי זה? לא ניתן לבטל פעולה זו.", "noFilesHint": "ייצוא מהיר יותר, ללא קבצים מצורפים", "preserveIdsHint": "שמור מזהי רשומות מקוריים (מומלץ לשחזור באותה מערכת)", + "importNoFilesHint": "ייבוא רשומות בלבד, ללא קבצים מצורפים", "skipDuplicatesHint": "דלג על רשומות שכבר קיימות במסד הנתונים" } } diff --git a/files/custom/Espo/Modules/DataMigration/Services/ImportService.php b/files/custom/Espo/Modules/DataMigration/Services/ImportService.php index 0ec5a1d..2af92d0 100644 --- a/files/custom/Espo/Modules/DataMigration/Services/ImportService.php +++ b/files/custom/Espo/Modules/DataMigration/Services/ImportService.php @@ -62,6 +62,7 @@ class ImportService $preserveIds = $options['preserveIds'] ?? true; $skipDuplicates = $options['skipDuplicates'] ?? false; $dryRun = $options['dryRun'] ?? false; + $noFiles = $options['noFiles'] ?? false; $verbose = $options['verbose'] ?? false; $dataDir = rtrim($inputDir, '/') . '/data'; @@ -138,7 +139,10 @@ class ImportService } // Restore attachment files - if (is_dir($filesDir)) { + if ($noFiles) { + $io->writeLine(''); + $io->writeLine('Attachment files: SKIPPED (--no-files)'); + } else if (is_dir($filesDir)) { $io->writeLine(''); $io->writeLine('Restoring attachment files...');