diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Task.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Task.json index d14f377489..7958bbd4da 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Task.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Task.json @@ -30,6 +30,10 @@ "type": "notEquals", "attribute": "status", "value": "Canceled" + }, + { + "type": "isNotEmpty", + "attribute": "status" } ] } diff --git a/application/Espo/Resources/metadata/clientDefs/DynamicLogic.json b/application/Espo/Resources/metadata/clientDefs/DynamicLogic.json new file mode 100644 index 0000000000..69c1ef1afa --- /dev/null +++ b/application/Espo/Resources/metadata/clientDefs/DynamicLogic.json @@ -0,0 +1,48 @@ +{ + "itemTypes": { + "and": { + "view": "views/admin/dynamic-logic/conditions-string/group-base", + "operator": "and" + }, + "or": { + "view": "views/admin/dynamic-logic/conditions-string/group-base", + "operator": "or" + }, + "not": { + "view": "views/admin/dynamic-logic/conditions-string/group-not", + "operator": "not" + }, + "equals": { + "view": "views/admin/dynamic-logic/conditions-string/item-base", + "operatorString": "=" + }, + "notEquals": { + "view": "views/admin/dynamic-logic/conditions-string/item-base", + "operatorString": "≠" + }, + "greaterThan": { + "view": "views/admin/dynamic-logic/conditions-string/item-base", + "operatorString": ">" + }, + "lessThan": { + "view": "views/admin/dynamic-logic/conditions-string/item-base", + "operatorString": "<" + }, + "greaterThanOrEquals": { + "view": "views/admin/dynamic-logic/conditions-string/item-base", + "operatorString": "≥" + }, + "lessThanOrEquals": { + "view": "views/admin/dynamic-logic/conditions-string/item-base", + "operatorString": "≤" + }, + "isEmpty": { + "view": "views/admin/dynamic-logic/conditions-string/item-operator-only-base", + "operatorString": "= ∅" + }, + "isNotEmpty": { + "view": "views/admin/dynamic-logic/conditions-string/item-operator-only-base", + "operatorString": "≠ ∅" + } + } +} \ No newline at end of file diff --git a/client/res/templates/admin/dynamic-logic/conditions-string/item-operator-only-base.tpl b/client/res/templates/admin/dynamic-logic/conditions-string/item-operator-only-base.tpl new file mode 100644 index 0000000000..1bdcd4cfa7 --- /dev/null +++ b/client/res/templates/admin/dynamic-logic/conditions-string/item-operator-only-base.tpl @@ -0,0 +1 @@ +{{translate field category='fields' scope=scope}} {{{operatorString}}} \ No newline at end of file diff --git a/client/src/views/admin/dynamic-logic/conditions-string/equals.js b/client/src/views/admin/dynamic-logic/conditions-string/equals.js deleted file mode 100644 index 9bea556fea..0000000000 --- a/client/src/views/admin/dynamic-logic/conditions-string/equals.js +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************ - * This file is part of EspoCRM. - * - * EspoCRM - Open Source CRM application. - * Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko - * Website: http://www.espocrm.com - * - * EspoCRM is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * EspoCRM 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with EspoCRM. If not, see http://www.gnu.org/licenses/. - * - * 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 General Public License version 3. - * - * 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/admin/dynamic-logic/conditions-string/equals', 'views/admin/dynamic-logic/conditions-string/item-base', function (Dep) { - - return Dep.extend({ - - operatorString: '=' - - }); - -}); - diff --git a/client/src/views/admin/dynamic-logic/conditions-string/group-base.js b/client/src/views/admin/dynamic-logic/conditions-string/group-base.js index b8489bd22f..cbee85883e 100644 --- a/client/src/views/admin/dynamic-logic/conditions-string/group-base.js +++ b/client/src/views/admin/dynamic-logic/conditions-string/group-base.js @@ -50,6 +50,8 @@ Espo.define('views/admin/dynamic-logic/conditions-string/group-base', 'view', fu this.number = this.options.number || 0; this.scope = this.options.scope; + this.operator = this.options.operator || this.operator; + this.itemData = this.options.itemData || {}; this.viewList = []; @@ -71,12 +73,21 @@ Espo.define('views/admin/dynamic-logic/conditions-string/group-base', 'view', fu this.viewList.push(key); var type = item.type || 'equals'; - this.createView(key, 'views/admin/dynamic-logic/conditions-string/' + Espo.Utils.camelCaseToHyphen(type), { + + var viewName = this.getMetadata().get(['clientDefs', 'DynamicLogic', 'itemTypes', type, 'view']); + if (!viewName) return; + + var operator = this.getMetadata().get(['clientDefs', 'DynamicLogic', 'itemTypes', type, 'operator']); + var operatorString = this.getMetadata().get(['clientDefs', 'DynamicLogic', 'itemTypes', type, 'operatorString']); + + this.createView(key, viewName, { itemData: item, scope: this.scope, level: this.level + 1, el: '[data-view-key="'+key+'"]', - number: number + number: number, + operator: operator, + operatorString: operatorString }); }, diff --git a/client/src/views/admin/dynamic-logic/conditions-string/item-base.js b/client/src/views/admin/dynamic-logic/conditions-string/item-base.js index 04c724b80d..f110627c04 100644 --- a/client/src/views/admin/dynamic-logic/conditions-string/item-base.js +++ b/client/src/views/admin/dynamic-logic/conditions-string/item-base.js @@ -49,6 +49,9 @@ Espo.define('views/admin/dynamic-logic/conditions-string/item-base', 'view', fun this.number = this.options.number || 0; this.scope = this.options.scope; + this.operator = this.options.operator || this.operator; + this.operatorString = this.options.operatorString || this.operatorString; + this.field = (this.itemData.data || {}).field || this.itemData.attribute; this.additionalData = (this.itemData.data || {}); diff --git a/client/src/views/admin/dynamic-logic/conditions-string/and.js b/client/src/views/admin/dynamic-logic/conditions-string/item-operator-only-base.js similarity index 82% rename from client/src/views/admin/dynamic-logic/conditions-string/and.js rename to client/src/views/admin/dynamic-logic/conditions-string/item-operator-only-base.js index f6cc3f8d78..cdaaf5568d 100644 --- a/client/src/views/admin/dynamic-logic/conditions-string/and.js +++ b/client/src/views/admin/dynamic-logic/conditions-string/item-operator-only-base.js @@ -26,11 +26,14 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -Espo.define('views/admin/dynamic-logic/conditions-string/and', 'views/admin/dynamic-logic/conditions-string/group-base', function (Dep) { +Espo.define('views/admin/dynamic-logic/conditions-string/item-operator-only-base', 'views/admin/dynamic-logic/conditions-string/item-base', function (Dep) { return Dep.extend({ - operator: 'and' + template: 'admin/dynamic-logic/conditions-string/item-operator-only-base', + + createValueFieldView: function () { + }, }); diff --git a/client/src/views/admin/dynamic-logic/conditions-string/not-equals.js b/client/src/views/admin/dynamic-logic/conditions-string/not-equals.js deleted file mode 100644 index fc85bf8ecc..0000000000 --- a/client/src/views/admin/dynamic-logic/conditions-string/not-equals.js +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************ - * This file is part of EspoCRM. - * - * EspoCRM - Open Source CRM application. - * Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko - * Website: http://www.espocrm.com - * - * EspoCRM is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * EspoCRM 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with EspoCRM. If not, see http://www.gnu.org/licenses/. - * - * 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 General Public License version 3. - * - * 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/admin/dynamic-logic/conditions-string/not-equals', 'views/admin/dynamic-logic/conditions-string/item-base', function (Dep) { - - return Dep.extend({ - - operatorString: '≠' - - }); - -}); - diff --git a/client/src/views/admin/dynamic-logic/conditions-string/or.js b/client/src/views/admin/dynamic-logic/conditions-string/or.js deleted file mode 100644 index 71bcebbf65..0000000000 --- a/client/src/views/admin/dynamic-logic/conditions-string/or.js +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************ - * This file is part of EspoCRM. - * - * EspoCRM - Open Source CRM application. - * Copyright (C) 2014-2015 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko - * Website: http://www.espocrm.com - * - * EspoCRM is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * EspoCRM 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with EspoCRM. If not, see http://www.gnu.org/licenses/. - * - * 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 General Public License version 3. - * - * 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/admin/dynamic-logic/conditions-string/or', 'views/admin/dynamic-logic/conditions-string/group-base', function (Dep) { - - return Dep.extend({ - - operator: 'or' - - }); - -}); - diff --git a/client/src/views/admin/field-manager/fields/dynamic-logic-conditions.js b/client/src/views/admin/field-manager/fields/dynamic-logic-conditions.js index 0ff26032ad..60f6f7a5c3 100644 --- a/client/src/views/admin/field-manager/fields/dynamic-logic-conditions.js +++ b/client/src/views/admin/field-manager/fields/dynamic-logic-conditions.js @@ -38,11 +38,11 @@ Espo.define('views/admin/field-manager/fields/dynamic-logic-conditions', 'views/ setup: function () { var conditionGroup = (this.model.get(this.name) || {}).conditionGroup || []; - this.createView('conditionGroup', 'views/admin/dynamic-logic/conditions-string/and', { + this.createView('conditionGroup', 'views/admin/dynamic-logic/conditions-string/group-base', { itemData: { - type: 'and', value: conditionGroup }, + operator: 'and', scope: this.options.scope }); }, @@ -95,7 +95,7 @@ Espo.define('views/admin/field-manager/fields/dynamic-logic-conditions', 'views/ case 'greaterThanOrEquals': operator = '≥'; break; - case 'greaterThanOrEquals': + case 'lessThanOrEquals': operator = '≤'; break; case 'isEmpty':