From 979f07bf9b53da97bb9a1dd1fa6b8be078d71985 Mon Sep 17 00:00:00 2001 From: yuri Date: Fri, 6 Feb 2015 12:19:13 +0200 Subject: [PATCH] Merge improvements 2 --- application/Espo/Resources/i18n/en_US/Global.json | 1 + application/Espo/Services/Record.php | 10 +++------- frontend/client/src/views/record/merge.js | 15 --------------- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/application/Espo/Resources/i18n/en_US/Global.json b/application/Espo/Resources/i18n/en_US/Global.json index 906b6082b4..aac87ab56f 100644 --- a/application/Espo/Resources/i18n/en_US/Global.json +++ b/application/Espo/Resources/i18n/en_US/Global.json @@ -44,6 +44,7 @@ "Uploading...": "Uploading...", "Sending...": "Sending...", "Merging...": "Merging...", + "Merged": "Merged", "Removed": "Removed", "Posted": "Posted", "Linked": "Linked", diff --git a/application/Espo/Services/Record.php b/application/Espo/Services/Record.php index 90c37f900d..de07006aa5 100644 --- a/application/Espo/Services/Record.php +++ b/application/Espo/Services/Record.php @@ -770,7 +770,7 @@ class Record extends \Espo\Core\Services\Base `parent_type` = ".$pdo->quote($source->getEntityName())." AND `deleted` = 0 "; - //$pdo->query($sql); + $pdo->query($sql); } $repository = $this->getEntityManager()->getRepository($entity->getEntityName()); @@ -778,19 +778,15 @@ class Record extends \Espo\Core\Services\Base foreach ($sourceList as $source) { foreach ($this->mergeLinkList as $link) { $linkedList = $repository->findRelated($source, $link); - echo $link . ' '; foreach ($linkedList as $linked) { - echo $linked->get('name') . ' '; - - //$repository->relate($entity, $link, $linked); + $repository->relate($entity, $link, $linked); } } } - die; foreach ($sourceList as $source) { - //$this->getEntityManager()->removeEntity($source); + $this->getEntityManager()->removeEntity($source); } return true; diff --git a/frontend/client/src/views/record/merge.js b/frontend/client/src/views/record/merge.js index 3db66ffea1..8ef426e776 100644 --- a/frontend/client/src/views/record/merge.js +++ b/frontend/client/src/views/record/merge.js @@ -108,26 +108,11 @@ Espo.define('Views.Record.Merge', 'View', function (Dep) { }) }) }).done(function () { - return; model.once('sync', function () { this.notify('Merged', 'success'); this.getRouter().navigate('#' + this.scope + '/view/' + model.id, {trigger: true}); - /*var i = 0; - var count = this.models.length; - this.models.forEach(function (m) { - if (m.id != model.id) { - m.once('destroy', function () { - i++; - if (i == count - 1) { - this.notify('Merged', 'success'); - this.getRouter().navigate('#' + this.scope + '/view/' + model.id, {trigger: true}); - } - }, this); - m.destroy(); - } - }, this);*/ }, this); model.save(attributes, {