This commit is contained in:
Yuri Kuznetsov
2022-08-09 16:48:44 +03:00
parent 137b989064
commit 01dffd98f2
9 changed files with 42 additions and 29 deletions

View File

@@ -79,27 +79,32 @@ define('crm:views/account/fields/shipping-address', 'views/fields/address', func
},
copy: function (fieldFrom) {
var attrList = Object.keys(this.getMetadata().get('fields.address.fields')).forEach(function (attr) {
destField = this.name + Espo.Utils.upperCaseFirst(attr);
sourceField = fieldFrom + Espo.Utils.upperCaseFirst(attr);
Object.keys(this.getMetadata().get('fields.address.fields'))
.forEach(attr => {
let destField = this.name + Espo.Utils.upperCaseFirst(attr);
let sourceField = fieldFrom + Espo.Utils.upperCaseFirst(attr);
this.model.set(destField, this.model.get(sourceField));
}, this);
this.model.set(destField, this.model.get(sourceField));
});
},
toShowCopyButton: function () {
var billingIsNotEmpty = false;
var shippingIsNotEmpty = false;
this.attributePartList.forEach(function (part) {
var attribute = this.copyFrom + Espo.Utils.upperCaseFirst(part);
if (this.model.get(attribute)) {
this.attributePartList.forEach(part => {
let attribute1 = this.copyFrom + Espo.Utils.upperCaseFirst(part);
if (this.model.get(attribute1)) {
billingIsNotEmpty = true;
}
var attribute = this.name + Espo.Utils.upperCaseFirst(part);
if (this.model.get(attribute)) {
let attribute2 = this.name + Espo.Utils.upperCaseFirst(part);
if (this.model.get(attribute2)) {
shippingIsNotEmpty = true;
}
}, this);
});
return billingIsNotEmpty && !shippingIsNotEmpty;
},

View File

@@ -902,7 +902,7 @@ function (
this.broadcastChannel = null;
xhr = new XMLHttpRequest;
let xhr = new XMLHttpRequest;
xhr.open('GET', this.basePath + this.apiUrl + '/');
xhr.setRequestHeader('Authorization', 'Basic ' + Base64.encode('**logout:logout'));

View File

@@ -340,7 +340,7 @@ define('email-helper', [], function () {
}
if (model.get('dateSent')) {
line = this.getLanguage().translate('dateSent', 'fields', 'Email') + ': ';
let line = this.getLanguage().translate('dateSent', 'fields', 'Email') + ': ';
line += this.getDateTime().toDisplayDateTime(model.get('dateSent'));
list.push(line);

View File

@@ -449,7 +449,7 @@ define('views/email/detail', ['views/detail', 'email-helper'], function (Dep, Em
id: this.model.id,
})
.then(duplicateAttributes => {
model = this.model.clone();
let model = this.model.clone();
model.set('body', duplicateAttributes.body);

View File

@@ -195,6 +195,7 @@ Espo.define('views/external-account/oauth2', ['view', 'model'], function (Dep, M
var arr = [];
var params = (options.params || {});
for (var name in params) {
if (params[name]) {
arr.push(name + '=' + encodeURI(params[name]));
@@ -207,35 +208,42 @@ Espo.define('views/external-account/oauth2', ['view', 'model'], function (Dep, M
var error = null;
str = str.substr(str.indexOf('?') + 1, str.length);
str.split('&').forEach(function (part) {
str.split('&').forEach((part) => {
var arr = part.split('=');
var name = decodeURI(arr[0]);
var value = decodeURI(arr[1] || '');
if (name == 'code') {
if (name === 'code') {
code = value;
}
if (name == 'error') {
if (name === 'error') {
error = value;
}
}, this);
});
if (code) {
return {
code: code,
}
};
} else if (error) {
return {
error: error,
}
};
}
}
popup = window.open(path, options.windowName, options.windowOptions);
interval = window.setInterval(function () {
let popup = window.open(path, options.windowName, options.windowOptions);
let interval;
interval = window.setInterval(() => {
if (popup.closed) {
window.clearInterval(interval);
} else {
var res = parseUrl(popup.location.href.toString());
if (res) {
callback.call(self, res);
popup.close();

View File

@@ -248,12 +248,12 @@ define('views/fields/email', ['views/fields/varchar'], function (Dep) {
'click [data-action="addEmailAddress"]': function () {
var data = Espo.Utils.cloneDeep(this.fetchEmailAddressData());
o = {
let o = {
emailAddress: '',
primary: data.length ? false : true,
optOut: this.emailAddressOptedOutByDefault,
invalid: false,
lower: ''
lower: '',
};
data.push(o);

View File

@@ -257,7 +257,7 @@ define('views/fields/phone', ['views/fields/varchar'], function (Dep) {
'click [data-action="addPhoneNumber"]': function () {
var data = Espo.Utils.cloneDeep(this.fetchPhoneNumberData());
o = {
let o = {
phoneNumber: '',
primary: !data.length,
type: false,

View File

@@ -1556,7 +1556,7 @@ function (Dep, MassActionHelper, ExportHelper) {
view.close();
count = o.count;
let count = o.count;
this.collection
.fetch()

View File

@@ -423,7 +423,7 @@ InstallScript.prototype.checkSett = function(opt) {
var errors = data.errors;
Object.keys(errors).forEach(function (errorName) {
errorData = errors[errorName];
let errorData = errors[errorName];
switch(errorName) {
case 'phpRequires':
@@ -467,7 +467,7 @@ InstallScript.prototype.checkSett = function(opt) {
opt.success(data);
})
.fail(function(){
msg = self.getLang('Ajax failed', 'messages');
let msg = self.getLang('Ajax failed', 'messages');
self.showMsg({msg: msg, error: true});
opt.error();
})
@@ -518,7 +518,7 @@ InstallScript.prototype.validate = function() {
$('[name="thousandSeparator"]').parent().parent().addClass('has-error');
$('[name="decimalMark"]').parent().parent().addClass('has-error');
msg = this.getLang('Thousand Separator and Decimal Mark equal', 'messages');
let msg = this.getLang('Thousand Separator and Decimal Mark equal', 'messages');
this.showMsg({msg: msg, error: true});
valid = false;
}