mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-29 15:36:07 +00:00
fixes
This commit is contained in:
@@ -74,7 +74,7 @@ class Export
|
||||
$params['entityType'] = $entityType;
|
||||
|
||||
$where = $data->where ?? null;
|
||||
$searchParams = $data->searchParams ?? null;
|
||||
$searchParams = $data->searchParams ?? $data->selectData ?? null;
|
||||
$ids = $data->ids ?? null;
|
||||
|
||||
if (!is_null($where) || !is_null($searchParams)) {
|
||||
|
||||
@@ -87,7 +87,7 @@ class MassAction
|
||||
private function prepareMassActionParams(stdClass $data): array
|
||||
{
|
||||
$where = $data->where ?? null;
|
||||
$searchParams = $data->searchParams ?? null;
|
||||
$searchParams = $data->searchParams ?? $data->selectData ?? null;
|
||||
$ids = $data->ids ?? null;
|
||||
|
||||
if (!is_null($where) || !is_null($searchParams)) {
|
||||
|
||||
@@ -62,14 +62,14 @@ define('views/admin/auth-token/record/list', 'views/record/list', function (Dep)
|
||||
params: {
|
||||
ids: ids || null,
|
||||
where: (!ids || ids.length === 0) ? this.collection.getWhere() : null,
|
||||
selectData: (!ids || ids.length === 0) ? this.collection.data : null,
|
||||
searchParams: (!ids || ids.length === 0) ? this.collection.data : null,
|
||||
},
|
||||
data: attributes,
|
||||
}).then(function () {
|
||||
}).then(() => {
|
||||
var result = result || {};
|
||||
|
||||
this.collection.fetch();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
actionSetInactive: function (data) {
|
||||
@@ -85,11 +85,13 @@ define('views/admin/auth-token/record/list', 'views/record/list', function (Dep)
|
||||
|
||||
Espo.Ui.notify(this.translate('pleaseWait', 'messages'));
|
||||
|
||||
model.save({
|
||||
'isActive': false
|
||||
}, {patch: true}).then(function () {
|
||||
Espo.Ui.notify(false);
|
||||
});
|
||||
model
|
||||
.save({
|
||||
'isActive': false
|
||||
}, {patch: true})
|
||||
.then(() => {
|
||||
Espo.Ui.notify(false);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -110,7 +110,7 @@ define('views/modals/mass-convert-currency', ['views/modal', 'model'], function
|
||||
params: {
|
||||
ids: this.options.ids || null,
|
||||
where: hasWhere ? this.options.where : null,
|
||||
searchParams: hasWhere ? this.options.selectData : null,
|
||||
searchParams: hasWhere ? this.options.searchParams : null,
|
||||
},
|
||||
data: {
|
||||
fieldList: this.options.fieldList || null,
|
||||
@@ -119,13 +119,13 @@ define('views/modals/mass-convert-currency', ['views/modal', 'model'], function
|
||||
rates: currencyRates,
|
||||
},
|
||||
})
|
||||
.then(function (result) {
|
||||
.then(result => {
|
||||
this.trigger('after:update', result.count);
|
||||
this.close();
|
||||
}.bind(this))
|
||||
.fail(function () {
|
||||
})
|
||||
.catch(() => {
|
||||
this.enableButton('convert');
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
@@ -76,7 +76,7 @@ define('views/modals/mass-update', 'views/modal', function (Dep) {
|
||||
|
||||
this.ids = this.options.ids;
|
||||
this.where = this.options.where;
|
||||
this.selectData = this.options.selectData;
|
||||
this.searchParams = this.options.searchParams;
|
||||
this.byWhere = this.options.byWhere;
|
||||
|
||||
this.headerHtml = this.translate(this.scope, 'scopeNamesPlural') +
|
||||
@@ -86,15 +86,15 @@ define('views/modals/mass-update', 'views/modal', function (Dep) {
|
||||
|
||||
this.wait(true);
|
||||
|
||||
this.getModelFactory().create(this.entityType, function (model) {
|
||||
this.getModelFactory().create(this.entityType, (model) => {
|
||||
this.model = model;
|
||||
|
||||
this.getHelper().layoutManager.get(this.entityType, this.layoutName, function (layout) {
|
||||
this.getHelper().layoutManager.get(this.entityType, this.layoutName, (layout) => {
|
||||
layout = layout || [];
|
||||
|
||||
this.fieldList = [];
|
||||
|
||||
layout.forEach(function (field) {
|
||||
layout.forEach((field) => {
|
||||
if (~forbiddenList.indexOf(field)) {
|
||||
return;
|
||||
}
|
||||
@@ -102,11 +102,11 @@ define('views/modals/mass-update', 'views/modal', function (Dep) {
|
||||
if (model.hasField(field)) {
|
||||
this.fieldList.push(field);
|
||||
}
|
||||
}, this);
|
||||
});
|
||||
|
||||
this.wait(false);
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
});
|
||||
});
|
||||
|
||||
this.addedFieldList = [];
|
||||
},
|
||||
@@ -143,13 +143,13 @@ define('views/modals/mass-update', 'views/modal', function (Dep) {
|
||||
name: name,
|
||||
},
|
||||
mode: 'edit',
|
||||
}, function (view) {
|
||||
}, (view) => {
|
||||
this.addedFieldList.push(name);
|
||||
|
||||
view.render();
|
||||
|
||||
view.notify(false);
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
actionUpdate: function () {
|
||||
@@ -159,7 +159,7 @@ define('views/modals/mass-update', 'views/modal', function (Dep) {
|
||||
|
||||
var attributes = {};
|
||||
|
||||
this.addedFieldList.forEach(function (field) {
|
||||
this.addedFieldList.forEach((field) => {
|
||||
var view = self.getView(field);
|
||||
|
||||
_.extend(attributes, view.fetch());
|
||||
@@ -169,7 +169,7 @@ define('views/modals/mass-update', 'views/modal', function (Dep) {
|
||||
|
||||
var notValid = false;
|
||||
|
||||
this.addedFieldList.forEach(function (field) {
|
||||
this.addedFieldList.forEach((field) => {
|
||||
var view = self.getView(field);
|
||||
|
||||
notValid = view.validate() || notValid;
|
||||
@@ -186,20 +186,20 @@ define('views/modals/mass-update', 'views/modal', function (Dep) {
|
||||
params: {
|
||||
ids: self.ids || null,
|
||||
where: (!self.ids || self.ids.length === 0) ? self.options.where : null,
|
||||
selectData: (!self.ids || self.ids.length === 0) ? self.options.selectData : null,
|
||||
searchParams: (!self.ids || self.ids.length === 0) ? self.options.searchParams : null,
|
||||
},
|
||||
data: attributes,
|
||||
})
|
||||
.then(
|
||||
function (result) {
|
||||
(result) => {
|
||||
var result = result || {};
|
||||
var count = result.count;
|
||||
|
||||
self.trigger('after:update', count);
|
||||
}
|
||||
)
|
||||
.fail(
|
||||
function () {
|
||||
.catch(
|
||||
() =>{
|
||||
self.notify('Error occurred', 'error');
|
||||
|
||||
self.enableButton('update');
|
||||
@@ -213,11 +213,11 @@ define('views/modals/mass-update', 'views/modal', function (Dep) {
|
||||
},
|
||||
|
||||
reset: function () {
|
||||
this.addedFieldList.forEach(function (field) {
|
||||
this.addedFieldList.forEach((field) => {
|
||||
this.clearView(field);
|
||||
|
||||
this.$el.find('.cell[data-name="'+field+'"]').remove();
|
||||
}, this);
|
||||
});
|
||||
|
||||
this.addedFieldList = [];
|
||||
|
||||
|
||||
@@ -583,7 +583,8 @@ define('views/record/list', 'view', function (Dep) {
|
||||
|
||||
if (this.allResultIsChecked) {
|
||||
data.where = this.collection.getWhere();
|
||||
data.searchData = this.collection.data || {};
|
||||
data.searchParams = this.collection.data || {};
|
||||
data.searchData = this.collection.data || {}; // for bc;
|
||||
}
|
||||
else {
|
||||
data.ids = this.checkedList;
|
||||
@@ -679,7 +680,7 @@ define('views/record/list', 'view', function (Dep) {
|
||||
|
||||
if (this.allResultIsChecked) {
|
||||
data.where = this.collection.getWhere();
|
||||
data.searchData = this.collection.data || {};
|
||||
data.searchParams = this.collection.data || {};
|
||||
data.selectData = data.searchData; // for bc;
|
||||
data.byWhere = true; // for bc
|
||||
}
|
||||
@@ -736,8 +737,9 @@ define('views/record/list', 'view', function (Dep) {
|
||||
|
||||
if (this.allResultIsChecked) {
|
||||
data.where = this.collection.getWhere();
|
||||
data.selectData = this.collection.data || {};
|
||||
data.byWhere = true;
|
||||
data.searchParams = this.collection.data || {};
|
||||
data.selectData = this.collection.data || {}; // for bc;
|
||||
data.byWhere = true; // for bc;
|
||||
}
|
||||
else {
|
||||
data.ids = [];
|
||||
@@ -1046,7 +1048,7 @@ define('views/record/list', 'view', function (Dep) {
|
||||
entityType: this.entityType,
|
||||
ids: ids,
|
||||
where: this.collection.getWhere(),
|
||||
selectData: this.collection.data,
|
||||
searchParams: this.collection.data,
|
||||
byWhere: this.allResultIsChecked,
|
||||
}, (view) => {
|
||||
view.render();
|
||||
@@ -1123,7 +1125,7 @@ define('views/record/list', 'view', function (Dep) {
|
||||
entityType: this.entityType,
|
||||
ids: ids,
|
||||
where: this.collection.getWhere(),
|
||||
selectData: this.collection.data,
|
||||
searchParams: this.collection.data,
|
||||
byWhere: this.allResultIsChecked,
|
||||
}, (view) => {
|
||||
view.render();
|
||||
|
||||
@@ -91,7 +91,7 @@ class ParamsTest extends \PHPUnit\Framework\TestCase
|
||||
$params = Params::fromRaw(
|
||||
[
|
||||
'where' => $where,
|
||||
'selectData' => [
|
||||
'searchParams' => [
|
||||
'primaryFilter' => 'testFilter',
|
||||
],
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user