';
this.$el.find('.fields-container').append(html);
@@ -123,7 +131,7 @@ Espo.define('views/modals/mass-update', 'views/modal', function (Dep) {
},
mode: 'edit'
}, function (view) {
- this.fieldList.push(name);
+ this.addedFieldList.push(name);
view.render();
view.notify(false);
}.bind(this));
@@ -135,7 +143,7 @@ Espo.define('views/modals/mass-update', 'views/modal', function (Dep) {
var self = this;
var attributes = {};
- this.fieldList.forEach(function (field) {
+ this.addedFieldList.forEach(function (field) {
var view = self.getView(field);
_.extend(attributes, view.fetch());
});
@@ -143,7 +151,7 @@ Espo.define('views/modals/mass-update', 'views/modal', function (Dep) {
this.model.set(attributes);
var notValid = false;
- this.fieldList.forEach(function (field) {
+ this.addedFieldList.forEach(function (field) {
var view = self.getView(field);
notValid = view.validate() || notValid;
});
@@ -151,7 +159,7 @@ Espo.define('views/modals/mass-update', 'views/modal', function (Dep) {
if (!notValid) {
self.notify('Saving...');
$.ajax({
- url: this.scope + '/action/massUpdate',
+ url: this.entityType + '/action/massUpdate',
type: 'PUT',
data: JSON.stringify({
attributes: attributes,
@@ -178,12 +186,12 @@ Espo.define('views/modals/mass-update', 'views/modal', function (Dep) {
},
reset: function () {
- this.fieldList.forEach(function (field) {
+ this.addedFieldList.forEach(function (field) {
this.clearView(field);
this.$el.find('.cell[data-name="'+field+'"]').remove();
}, this);
- this.fieldList = [];
+ this.addedFieldList = [];
this.model.clear();
diff --git a/client/src/views/record/list.js b/client/src/views/record/list.js
index 6e64d66222..359bdd7ff3 100644
--- a/client/src/views/record/list.js
+++ b/client/src/views/record/list.js
@@ -795,12 +795,16 @@ define('views/record/list', 'view', function (Dep) {
ids = this.checkedList;
}
- this.createView('massUpdate', 'views/modals/mass-update', {
- scope: this.entityType,
+ var viewName = this.getMetadata().get(['clientDefs', this.entityType, 'modalViews', 'massUpdate']) ||
+ 'views/modals/mass-update';
+
+ this.createView('massUpdate', viewName, {
+ scope: this.scope,
+ entityType: this.entityType,
ids: ids,
where: this.collection.getWhere(),
selectData: this.collection.data,
- byWhere: this.allResultIsChecked
+ byWhere: this.allResultIsChecked,
}, function (view) {
view.render();
view.notify(false);
diff --git a/client/src/views/user/modals/mass-update.js b/client/src/views/user/modals/mass-update.js
new file mode 100644
index 0000000000..4bb0268350
--- /dev/null
+++ b/client/src/views/user/modals/mass-update.js
@@ -0,0 +1,44 @@
+/************************************************************************
+ * This file is part of EspoCRM.
+ *
+ * EspoCRM - Open Source CRM application.
+ * Copyright (C) 2014-2019 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
+ * Website: https://www.espocrm.com
+ *
+ * EspoCRM is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * EspoCRM is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with EspoCRM. If not, see http://www.gnu.org/licenses/.
+ *
+ * The interactive user interfaces in modified source and object code versions
+ * of this program must display Appropriate Legal Notices, as required under
+ * Section 5 of the GNU General Public License version 3.
+ *
+ * In accordance with Section 7(b) of the GNU General Public License version 3,
+ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
+ ************************************************************************/
+
+define('views/user/modals/mass-update', 'views/modals/mass-update', function (Dep) {
+
+ return Dep.extend({
+
+ setup: function () {
+
+ if (this.options.scope === 'ApiUser') {
+ this.layoutName = 'massUpdateApi';
+ } else if (this.options.scope === 'PortalUser') {
+ this.layoutName = 'massUpdatePortal';
+ }
+ Dep.prototype.setup.call(this);
+ },
+
+ });
+});
diff --git a/tests/unit/Espo/ORM/DB/QueryTest.php b/tests/unit/Espo/ORM/DB/QueryTest.php
index 7430dc3b77..00b15b6f25 100644
--- a/tests/unit/Espo/ORM/DB/QueryTest.php
+++ b/tests/unit/Espo/ORM/DB/QueryTest.php
@@ -269,7 +269,26 @@ class QueryTest extends \PHPUnit\Framework\TestCase
'withDeleted' => true,
]);
- $expectedSql = "SELECT note.id AS `id` FROM `note` LEFT JOIN `post` AS `post` ON post.name = 'test' OR post.name IS NULL";
+ $expectedSql = "SELECT note.id AS `id` FROM `note` LEFT JOIN `post` AS `post` ON (post.name = 'test' OR post.name IS NULL)";
+
+ $this->assertEquals($expectedSql, $sql);
+ }
+
+ public function testJoinConditions4()
+ {
+ $sql = $this->query->createSelectQuery('Note', [
+ 'select' => ['id'],
+ 'leftJoins' => [['post', 'post', [
+ 'name' => null,
+ 'OR' => [
+ ['name' => 'test'],
+ ['post.name' => null],
+ ]
+ ]]],
+ 'withDeleted' => true,
+ ]);
+
+ $expectedSql = "SELECT note.id AS `id` FROM `note` LEFT JOIN `post` AS `post` ON post.name IS NULL AND (post.name = 'test' OR post.name IS NULL)";
$this->assertEquals($expectedSql, $sql);
}