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() 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/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 } } 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; 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 || {}; 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; + }, }); - }); diff --git a/package-lock.json b/package-lock.json index 851cfa3348..56f6045689 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": {