diff --git a/application/Espo/Resources/metadata/fields/int.json b/application/Espo/Resources/metadata/fields/int.json index 774e199289..cd590534f2 100644 --- a/application/Espo/Resources/metadata/fields/int.json +++ b/application/Espo/Resources/metadata/fields/int.json @@ -11,11 +11,13 @@ }, { "name": "min", - "type": "int" + "type": "int", + "view": "views/admin/field-manager/fields/int/max" }, { "name": "max", - "type": "int" + "type": "int", + "view": "views/admin/field-manager/fields/int/max" }, { "name": "disableFormatting", diff --git a/client/src/views/admin/field-manager/fields/int/max.js b/client/src/views/admin/field-manager/fields/int/max.js new file mode 100644 index 0000000000..8a7e842974 --- /dev/null +++ b/client/src/views/admin/field-manager/fields/int/max.js @@ -0,0 +1,44 @@ +/************************************************************************ + * This file is part of EspoCRM. + * + * EspoCRM – Open Source CRM application. + * Copyright (C) 2014-2024 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko + * Website: https://www.espocrm.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * 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 Affero General Public License version 3. + * + * In accordance with Section 7(b) of the GNU Affero General Public License version 3, + * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. + ************************************************************************/ + +import IntFieldView from 'views/fields/int'; + +export default class extends IntFieldView { + + setupAutoNumericOptions() { + super.setupAutoNumericOptions(); + + if (this.params.max == null) { + this.autoNumericOptions.maximumValue = '9223372036854775807'; + } + + if (this.params.min == null) { + this.autoNumericOptions.minimumValue = '-9223372036854775808'; + } + } +} diff --git a/client/src/views/fields/int.js b/client/src/views/fields/int.js index 57dab59b4f..5a8ccfdcc9 100644 --- a/client/src/views/fields/int.js +++ b/client/src/views/fields/int.js @@ -147,6 +147,14 @@ class IntFieldView extends BaseFieldView { selectOnFocus: false, formulaMode: true, }; + + if (this.params.max != null && this.params.max > Math.pow(10, 6)) { + this.autoNumericOptions.maximumValue = this.params.max.toString(); + } + + if (this.params.min != null && this.params.min < - Math.pow(10, 6)) { + this.autoNumericOptions.minimumValue = this.params.min.toString(); + } } afterRender() {