diff --git a/application/Espo/Controllers/Import.php b/application/Espo/Controllers/Import.php
index 4d1b7b0cc6..d8d101608b 100644
--- a/application/Espo/Controllers/Import.php
+++ b/application/Espo/Controllers/Import.php
@@ -54,6 +54,11 @@ class Import extends \Espo\Core\Controllers\Base
);
}
+ public function actionRevert($params, $data)
+ {
+ return $this->getService('Import')->revert($data['entityType'], $data['idsToRemove']);
+ }
+
public function actionCreate($params, $data)
{
$importParams = array(
diff --git a/application/Espo/Services/Import.php b/application/Espo/Services/Import.php
index 515800d414..f40e1c0b0d 100644
--- a/application/Espo/Services/Import.php
+++ b/application/Espo/Services/Import.php
@@ -159,7 +159,20 @@ class Import extends \Espo\Core\Services\Base
$string = substr($string, $i);
return $o;
}
-
+
+ public function revert($scope, array $idsToRemove)
+ {
+ $ids = array();
+ if (!empty($scope) && !empty($idsToRemove)) {
+ foreach ($idsToRemove as $id) {
+ $entity = $this->getEntityManager()->getEntity($scope, $id);
+ if ($this->getEntityManager()->removeEntity($entity)) {
+ $ids[] = $id;
+ }
+ }
+ }
+ return $ids;
+ }
public function import($scope, array $fields, $attachmentId, array $params = array())
{
@@ -207,6 +220,7 @@ class Import extends \Espo\Core\Services\Base
return array(
'countCreated' => count($result['importedIds']),
'countUpdated' => count($result['updatedIds']),
+ 'importedIds' => $result['importedIds'],
'duplicateIds' => $result['duplicateIds'],
);
}
diff --git a/frontend/client/res/templates/import/step-3.tpl b/frontend/client/res/templates/import/step-3.tpl
index 36a40258c2..45ee31a39e 100644
--- a/frontend/client/res/templates/import/step-3.tpl
+++ b/frontend/client/res/templates/import/step-3.tpl
@@ -7,6 +7,12 @@
{{translate 'Updated' scope='Import'}}: {{result.countUpdated}}
+
+