From 0ab88534555ae4e8b19d77df9caf8ded907d20c0 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Tue, 1 Dec 2020 13:14:17 +0200 Subject: [PATCH 1/6] fix notification for portal user --- application/Espo/Services/Notification.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/application/Espo/Services/Notification.php b/application/Espo/Services/Notification.php index da8992444c..8a93ce0d4d 100644 --- a/application/Espo/Services/Notification.php +++ b/application/Espo/Services/Notification.php @@ -81,7 +81,7 @@ class Notification extends \Espo\Services\Record implements $collection = $this->entityManager->createCollection(); $userList = $this->getEntityManager()->getRepository('User') - ->select(['id']) + ->select(['id', 'type']) ->where([ 'isActive' => true, 'id' => $userIdList, @@ -90,7 +90,10 @@ class Notification extends \Espo\Services\Record implements foreach ($userList as $user) { $userId = $user->id; - if (!$this->checkUserNoteAccess($user, $note)) continue; + if (!$this->checkUserNoteAccess($user, $note)) { + continue; + } + if ($note->get('createdById') === $user->id) continue; if ($related && $related->getEntityType() == 'Email' && $related->get('sentById') == $user->id) continue; if ($related && $related->get('createdById') == $user->id) continue; From 0bc06f3cae9b4b3003983bbace7ac2f0c3f29b02 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Wed, 2 Dec 2020 11:04:33 +0200 Subject: [PATCH 2/6] fix autofollow --- application/Espo/Resources/metadata/entityDefs/Autofollow.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/Espo/Resources/metadata/entityDefs/Autofollow.json b/application/Espo/Resources/metadata/entityDefs/Autofollow.json index 977282fb23..da125c6e08 100644 --- a/application/Espo/Resources/metadata/entityDefs/Autofollow.json +++ b/application/Espo/Resources/metadata/entityDefs/Autofollow.json @@ -12,7 +12,7 @@ }, "userId": { "type": "varchar", - "maxLength": 11, + "maxLength": 24, "index": true } } From dd708778d6db957ef8ed4b985b5223cd6d265fbf Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Thu, 3 Dec 2020 11:56:15 +0200 Subject: [PATCH 3/6] field clone validations --- client/src/views/fields/base.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/src/views/fields/base.js b/client/src/views/fields/base.js index cd10aa3ec4..de431acd33 100644 --- a/client/src/views/fields/base.js +++ b/client/src/views/fields/base.js @@ -257,6 +257,8 @@ define('views/fields/base', 'view', function (Dep) { this.events = {}; } + this.validations = Espo.Utils.clone(this.validations); + this.defs = this.options.defs || {}; this.name = this.options.name || this.defs.name; this.params = this.options.params || this.defs.params || {}; From 6b3e81e3fd8a8e450d2ad7f92dd8a686f698b2d9 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Thu, 3 Dec 2020 11:56:44 +0200 Subject: [PATCH 4/6] settings currency validation --- .../Espo/Resources/i18n/en_US/Global.json | 1 + .../views/settings/fields/default-currency.js | 32 +++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/application/Espo/Resources/i18n/en_US/Global.json b/application/Espo/Resources/i18n/en_US/Global.json index 4c7f4b8df4..06d81ed5ef 100644 --- a/application/Espo/Resources/i18n/en_US/Global.json +++ b/application/Espo/Resources/i18n/en_US/Global.json @@ -270,6 +270,7 @@ "notModified": "You have not modified the record", "duplicate": "The record you are creating might already exist", "dropToAttach": "Drop to attach", + "fieldInvalid": "{field} is invalid", "fieldIsRequired": "{field} is required", "fieldShouldBeEmail": "{field} should be a valid email", "fieldShouldBeFloat": "{field} should be a valid float", diff --git a/client/src/views/settings/fields/default-currency.js b/client/src/views/settings/fields/default-currency.js index 5d9d7fd9d6..e11854bb51 100644 --- a/client/src/views/settings/fields/default-currency.js +++ b/client/src/views/settings/fields/default-currency.js @@ -25,14 +25,40 @@ * 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. ************************************************************************/ -Espo.define('views/settings/fields/default-currency', 'views/fields/enum', function (Dep) { + +define('views/settings/fields/default-currency', 'views/fields/enum', function (Dep) { return Dep.extend({ + setup: function () { + Dep.prototype.setup.call(this); + + this.validations.push('existing'); + }, + setupOptions: function () { this.params.options = Espo.Utils.clone(this.getConfig().get('currencyList') || []); - } + }, + + validateExisting: function () { + var currencyList = this.model.get('currencyList'); + + if (!currencyList) { + return; + } + + var value = this.model.get(this.name); + + if (~currencyList.indexOf(value)) { + return; + } + + var msg = this.translate('fieldInvalid', 'messages').replace('{field}', this.getLabelText()); + + this.showValidationMessage(msg); + + return true; + }, }); - }); From 4426d81e77e22950903e9e1582f3fe6d605f6331 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Fri, 4 Dec 2020 14:28:04 +0200 Subject: [PATCH 5/6] fix category tree --- application/Espo/Core/Repositories/CategoryTree.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/application/Espo/Core/Repositories/CategoryTree.php b/application/Espo/Core/Repositories/CategoryTree.php index 6eda3f1d59..ea3c24152d 100644 --- a/application/Espo/Core/Repositories/CategoryTree.php +++ b/application/Espo/Core/Repositories/CategoryTree.php @@ -49,6 +49,9 @@ class CategoryTree extends Database ->select() ->from($pathEntityType) ->select(['ascendorId', "'" . $entity->id . "'"]) + ->where([ + 'descendorId' => $parentId, + ]) ->build(); $subSelect2 = $em->getQueryBuilder() From d3d710b2b998800cc1b8a86c245663b8c7968927 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Fri, 4 Dec 2020 15:04:36 +0200 Subject: [PATCH 6/6] v --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1e6420ea9a..6d639c6e51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "espocrm", - "version": "6.0.7", + "version": "6.0.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 11f3f5848e..51d48902cc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "espocrm", - "version": "6.0.7", + "version": "6.0.8", "description": "", "main": "index.php", "repository": {