import improvements

This commit is contained in:
Yuri Kuznetsov
2014-10-10 10:50:07 +03:00
parent bfb0fcba0c
commit a548245fca
5 changed files with 34 additions and 12 deletions
@@ -0,0 +1,15 @@
{
"labels": {
"Revert": "Revert",
"Return to Import": "Return to Import",
"Run Import": "Run Import",
"Back": "Back",
"Field Mapping": "Field Mapping",
"Default Values": "Default Values",
"Add Field": "Add Field",
"Created": "Created",
"Updated": "Updated",
"Result": "Result",
"Show records": "Show records"
}
}
+10 -7
View File
@@ -329,14 +329,17 @@ class Import extends \Espo\Core\Services\Base
$a = $entity->toArray();
if ($this->getEntityManager()->saveEntity($entity)) {
$result['id'] = $entity->id;
if (empty($id)) {
$result['imported'] = true;
} else {
$result['updated'] = true;
try {
if ($this->getEntityManager()->saveEntity($entity)) {
$result['id'] = $entity->id;
if (empty($id)) {
$result['imported'] = true;
} else {
$result['updated'] = true;
}
}
}
} catch (\Exception $e) {}
return $result;
}
@@ -14,7 +14,7 @@
<div class="button-container">
<div class="btn-group">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
{{translate 'Add Field'}}
{{translate 'Add Field' scope='Import'}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-left">
@@ -30,6 +30,6 @@
</div>
<div style="padding-bottom: 10px;" class="clearfix">
<button class="btn btn-default pull-left" data-action="back">{{translate 'Back'}}</button>
<button class="btn btn-danger pull-right" data-action="next">{{translate 'Run Import'}}</button>
<button class="btn btn-default pull-left" data-action="back">{{translate 'Back' scope='Import'}}</button>
<button class="btn btn-danger pull-right" data-action="next">{{translate 'Run Import' scope='Import'}}</button>
</div>
@@ -9,6 +9,8 @@
</div>
<div style="margin-top: 10px;">
<a class="btn btn-link" href="#Import">{{translate 'Return to Import' scope='Import'}}</a>
<a class="btn btn-link" href="#{{scope}}">{{translate 'Show records' scope='Import'}}</a>
{{#if result.countCreated}}
<button class="btn btn-danger" data-action="revert">{{translate 'Revert' scope='Import'}}</button>
{{/if}}
@@ -16,5 +18,3 @@
</div>
</div>
@@ -37,6 +37,10 @@ Espo.define('Views.Import.Step3', 'View', function (Dep) {
},
},
afterRender: function () {
this.getRouter().navigate('#Import/results');
},
setup: function () {
this.formData = this.options.formData;
this.scope = this.formData.entityType;