From f4a88df067faff1cbcf4d559c91f8a28d4bc79a9 Mon Sep 17 00:00:00 2001 From: yuri Date: Mon, 7 Nov 2016 12:54:14 +0200 Subject: [PATCH] import: skip search for duplicates --- application/Espo/Controllers/Import.php | 1 + application/Espo/Resources/i18n/en_US/Import.json | 3 ++- application/Espo/Services/Import.php | 5 ++++- client/res/templates/import/step-1.tpl | 8 ++++++++ client/src/views/import/step1.js | 3 +++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/application/Espo/Controllers/Import.php b/application/Espo/Controllers/Import.php index 1c2fe76c26..6a3067381a 100644 --- a/application/Espo/Controllers/Import.php +++ b/application/Espo/Controllers/Import.php @@ -138,6 +138,7 @@ class Import extends \Espo\Core\Controllers\Record 'currency' => $data['currency'], 'defaultValues' => $data['defaultValues'], 'action' => $data['action'], + 'skipDuplicateChecking' => $data['skipDuplicateChecking'] ); if (array_key_exists('updateBy', $data)) { diff --git a/application/Espo/Resources/i18n/en_US/Import.json b/application/Espo/Resources/i18n/en_US/Import.json index 729c4bd117..9663d38d27 100644 --- a/application/Espo/Resources/i18n/en_US/Import.json +++ b/application/Espo/Resources/i18n/en_US/Import.json @@ -49,7 +49,8 @@ "Single Quote": "Single Quote", "Imported": "Imported", "Duplicates": "Duplicates", - "Updated": "Updated" + "Updated": "Updated", + "Skip searching for duplicates": "Skip searching for duplicates" }, "messages": { "utf8": "Should be UTF-8 encoded", diff --git a/application/Espo/Services/Import.php b/application/Espo/Services/Import.php index 0e3ba3968d..0000ca7f1e 100644 --- a/application/Espo/Services/Import.php +++ b/application/Espo/Services/Import.php @@ -527,7 +527,10 @@ class Import extends \Espo\Services\Record try { if ($isNew) { - $isDuplicate = $recordService->checkEntityForDuplicate($entity); + $isDuplicate = false; + if (empty($params['skipDuplicateChecking'])) { + $isDuplicate = $recordService->checkEntityForDuplicate($entity); + } } if ($entity->id) { $sql = $this->getEntityManager()->getRepository($entity->getEntityType())->deleteFromDb($entity->id, true); diff --git a/client/res/templates/import/step-1.tpl b/client/res/templates/import/step-1.tpl index 4a1bbb01dc..8383c30c77 100644 --- a/client/res/templates/import/step-1.tpl +++ b/client/res/templates/import/step-1.tpl @@ -110,6 +110,14 @@ +
+
+ +
+ +
+
+
diff --git a/client/src/views/import/step1.js b/client/src/views/import/step1.js index c7c3cc50b0..5481c142df 100644 --- a/client/src/views/import/step1.js +++ b/client/src/views/import/step1.js @@ -109,6 +109,7 @@ Espo.define('views/import/step1', 'view', function (Dep) { this.formData.decimalMark = $('#import-decimal-mark').val(); this.formData.currency = $('#import-currency').val(); this.formData.personNameFormat = $('#import-person-name-format').val(); + this.formData.skipDuplicateChecking = $('#skip-duplicate-checking').get(0).checked; this.getParentView().formData = this.formData; this.getParentView().changeStep(2); @@ -117,6 +118,8 @@ Espo.define('views/import/step1', 'view', function (Dep) { setupFormData: function () { $('#import-header-row').get(0).checked = this.formData.headerRow || false; + $('#skip-duplicate-checking').get(0).checked = this.formData.skipDuplicateChecking || false; + if (this.formData.entityType) { $('#import-entity-type').val(this.formData.entityType); }