enum column and varchar column field views
This commit is contained in:
@@ -1162,16 +1162,49 @@ class Base
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'columnLike':
|
||||
case 'columnIn':
|
||||
case 'columnIsNull':
|
||||
case 'columnNotIn':
|
||||
$link = $this->getMetadata()->get(['entityDefs', $this->entityType, 'fields', $attribute, 'link']);
|
||||
$column = $this->getMetadata()->get(['entityDefs', $this->entityType, 'fields', $attribute, 'column']);
|
||||
$alias = $link . 'Filter' . strval(rand(10000, 99999));
|
||||
$this->setDistinct(true, $result);
|
||||
$this->addLeftJoin([$link, $alias], $result);
|
||||
$value = $item['value'];
|
||||
$columnKey = $alias . 'Middle.' . $column;
|
||||
if ($item['type'] === 'columnIn') {
|
||||
$part[$columnKey] = $value;
|
||||
} else if ($item['type'] === 'columnNotIn') {
|
||||
$part[$columnKey . '!='] = $value;
|
||||
} else if ($item['type'] === 'columnIsNull') {
|
||||
$part[$columnKey] = null;
|
||||
} else if ($item['type'] === 'columnIsNotNull') {
|
||||
$part[$columnKey . '!='] = null;
|
||||
} else if ($item['type'] === 'columnLike') {
|
||||
$part[$columnKey . '*'] = $value;
|
||||
} else if ($item['type'] === 'columnStartsWith') {
|
||||
$part[$columnKey . '*'] = $value . '%';
|
||||
} else if ($item['type'] === 'columnEndsWith') {
|
||||
$part[$columnKey . '*'] = '%' . $value;
|
||||
} else if ($item['type'] === 'columnContains') {
|
||||
$part[$columnKey . '*'] = '%' . $value . '%';
|
||||
} else if ($item['type'] === 'columnEquals') {
|
||||
$part[$columnKey . '='] = $value;
|
||||
} else if ($item['type'] === 'columnNotEquals') {
|
||||
$part[$columnKey . '!='] = $value;
|
||||
}
|
||||
break;
|
||||
case 'isNotLinked':
|
||||
if (!$result) break;
|
||||
$alias = $attribute . 'IsNotLinkedFilter' . strval(rand(10000, 99999));;
|
||||
$alias = $attribute . 'IsNotLinkedFilter' . strval(rand(10000, 99999));
|
||||
$part[$alias . '.id'] = null;
|
||||
$this->setDistinct(true, $result);
|
||||
$this->addLeftJoin([$attribute, $alias], $result);
|
||||
break;
|
||||
case 'isLinked':
|
||||
if (!$result) break;
|
||||
$alias = $attribute . 'IsLinkedFilter' . strval(rand(10000, 99999));;
|
||||
$alias = $attribute . 'IsLinkedFilter' . strval(rand(10000, 99999));
|
||||
$part[$alias . '.id!='] = null;
|
||||
$this->setDistinct(true, $result);
|
||||
$this->addLeftJoin([$attribute, $alias], $result);
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
"portalUser": "Portal User",
|
||||
"originalLead": "Original Lead",
|
||||
"acceptanceStatus": "Acceptance Status",
|
||||
"accountIsInactive": "Account Inactive"
|
||||
"accountIsInactive": "Account Inactive",
|
||||
"acceptanceStatusMeetings": "Acceptance Status (Meetings)",
|
||||
"acceptanceStatusCalls": "Acceptance Status (Calls)"
|
||||
},
|
||||
"links": {
|
||||
"opportunities": "Opportunities",
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
"targetList": "Target List",
|
||||
"industry": "Industry",
|
||||
"acceptanceStatus": "Acceptance Status",
|
||||
"opportunityAmountCurrency": "Opportunity Amount Currency"
|
||||
"opportunityAmountCurrency": "Opportunity Amount Currency",
|
||||
"acceptanceStatusMeetings": "Acceptance Status (Meetings)",
|
||||
"acceptanceStatusCalls": "Acceptance Status (Calls)"
|
||||
},
|
||||
"links": {
|
||||
"targetLists": "Target Lists",
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
{
|
||||
"fields": {
|
||||
"acceptanceStatus": "Acceptance Status"
|
||||
"acceptanceStatus": "Acceptance Status",
|
||||
"acceptanceStatusMeetings": "Acceptance Status (Meetings)",
|
||||
"acceptanceStatusCalls": "Acceptance Status (Calls)"
|
||||
},
|
||||
"links": {
|
||||
"targetLists": "Target Lists"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,8 +61,30 @@
|
||||
"acceptanceStatus": {
|
||||
"type": "enum",
|
||||
"notStorable": true,
|
||||
"disabled": true,
|
||||
"options": ["None", "Accepted", "Tentative", "Declined"]
|
||||
"options": ["None", "Accepted", "Tentative", "Declined"],
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutMassUpdateDisabled": true,
|
||||
"where": {
|
||||
"=": {
|
||||
"leftJoins": ["users", "contacts", "leads"],
|
||||
"sql": "contactsMiddle.status = {value} OR leadsMiddle.status = {value} OR usersMiddle.status = {value}",
|
||||
"distinct": true
|
||||
},
|
||||
"<>": "call.id NOT IN (SELECT call_id FROM call_contact WHERE deleted = 0 AND status = {value}) AND call.id NOT IN (SELECT call_id FROM call_user WHERE deleted = 0 AND status = {value}) AND call.id NOT IN (SELECT call_id FROM call_lead WHERE deleted = 0 AND status = {value})",
|
||||
"IN": {
|
||||
"leftJoins": ["users", "leads", "contacts"],
|
||||
"sql": "contactsMiddle.status IN {value} OR leadsMiddle.status IN {value} OR usersMiddle.status IN {value}",
|
||||
"distinct": true
|
||||
},
|
||||
"NOT IN": "call.id NOT IN (SELECT call_id FROM call_contact WHERE deleted = 0 AND status IN {value}) AND call.id NOT IN (SELECT call_id FROM call_user WHERE deleted = 0 AND status IN {value}) AND call.id NOT IN (SELECT call_id FROM call_lead WHERE deleted = 0 AND status IN {value})",
|
||||
"IS NULL": {
|
||||
"leftJoins": ["users", "contacts", "leads"],
|
||||
"sql": "contactsMiddle.status IS NULL AND leadsMiddle.status IS NULL AND usersMiddle.status IS NULL",
|
||||
"distinct": true
|
||||
},
|
||||
"IS NOT NULL": "call.id NOT IN (SELECT call_id FROM call_contact WHERE deleted = 0 AND status IS NULL) OR call.id NOT IN (SELECT call_id FROM call_user WHERE deleted = 0 AND status IS NULL) OR call.id NOT IN (SELECT call_id FROM call_lead WHERE deleted = 0 AND status IS NULL)"
|
||||
},
|
||||
"view": "crm:views/meeting/fields/acceptance-status"
|
||||
},
|
||||
"users": {
|
||||
"type": "linkMultiple",
|
||||
|
||||
@@ -184,6 +184,26 @@
|
||||
"notStorable": true,
|
||||
"disabled": true
|
||||
},
|
||||
"acceptanceStatusMeetings": {
|
||||
"type": "enum",
|
||||
"notStorable": true,
|
||||
"layoutListDisabled": true,
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutMassUpdateDisabled": true,
|
||||
"view": "crm:views/lead/fields/acceptance-status",
|
||||
"link": "meetings",
|
||||
"column": "status"
|
||||
},
|
||||
"acceptanceStatusCalls": {
|
||||
"type": "enum",
|
||||
"notStorable": true,
|
||||
"layoutListDisabled": true,
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutMassUpdateDisabled": true,
|
||||
"view": "crm:views/lead/fields/acceptance-status",
|
||||
"link": "calls",
|
||||
"column": "status"
|
||||
},
|
||||
"campaign": {
|
||||
"type": "link",
|
||||
"layoutListDisabled": true
|
||||
|
||||
@@ -121,6 +121,26 @@
|
||||
"notStorable": true,
|
||||
"disabled": true
|
||||
},
|
||||
"acceptanceStatusMeetings": {
|
||||
"type": "enum",
|
||||
"notStorable": true,
|
||||
"layoutListDisabled": true,
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutMassUpdateDisabled": true,
|
||||
"view": "crm:views/lead/fields/acceptance-status",
|
||||
"link": "meetings",
|
||||
"column": "status"
|
||||
},
|
||||
"acceptanceStatusCalls": {
|
||||
"type": "enum",
|
||||
"notStorable": true,
|
||||
"layoutListDisabled": true,
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutMassUpdateDisabled": true,
|
||||
"view": "crm:views/lead/fields/acceptance-status",
|
||||
"link": "calls",
|
||||
"column": "status"
|
||||
},
|
||||
"teams": {
|
||||
"type": "linkMultiple",
|
||||
"view": "views/fields/teams"
|
||||
|
||||
@@ -56,8 +56,30 @@
|
||||
"acceptanceStatus": {
|
||||
"type": "enum",
|
||||
"notStorable": true,
|
||||
"disabled": true,
|
||||
"options": ["None", "Accepted", "Tentative", "Declined"]
|
||||
"options": ["None", "Accepted", "Tentative", "Declined"],
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutMassUpdateDisabled": true,
|
||||
"where": {
|
||||
"=": {
|
||||
"leftJoins": ["users", "contacts", "leads"],
|
||||
"sql": "contactsMiddle.status = {value} OR leadsMiddle.status = {value} OR usersMiddle.status = {value}",
|
||||
"distinct": true
|
||||
},
|
||||
"<>": "meeting.id NOT IN (SELECT meeting_id FROM contact_meeting WHERE deleted = 0 AND status = {value}) AND meeting.id NOT IN (SELECT meeting_id FROM meeting_user WHERE deleted = 0 AND status = {value}) AND meeting.id NOT IN (SELECT meeting_id FROM lead_meeting WHERE deleted = 0 AND status = {value})",
|
||||
"IN": {
|
||||
"leftJoins": ["users", "leads", "contacts"],
|
||||
"sql": "contactsMiddle.status IN {value} OR leadsMiddle.status IN {value} OR usersMiddle.status IN {value}",
|
||||
"distinct": true
|
||||
},
|
||||
"NOT IN": "meeting.id NOT IN (SELECT meeting_id FROM contact_meeting WHERE deleted = 0 AND status IN {value}) AND meeting.id NOT IN (SELECT meeting_id FROM meeting_user WHERE deleted = 0 AND status IN {value}) AND meeting.id NOT IN (SELECT meeting_id FROM lead_meeting WHERE deleted = 0 AND status IN {value})",
|
||||
"IS NULL": {
|
||||
"leftJoins": ["users", "contacts", "leads"],
|
||||
"sql": "contactsMiddle.status IS NULL AND leadsMiddle.status IS NULL AND usersMiddle.status IS NULL",
|
||||
"distinct": true
|
||||
},
|
||||
"IS NOT NULL": "meeting.id NOT IN (SELECT meeting_id FROM contact_meeting WHERE deleted = 0 AND status IS NULL) OR meeting.id NOT IN (SELECT meeting_id FROM meeting_user WHERE deleted = 0 AND status IS NULL) OR meeting.id NOT IN (SELECT meeting_id FROM lead_meeting WHERE deleted = 0 AND status IS NULL)"
|
||||
},
|
||||
"view": "crm:views/meeting/fields/acceptance-status"
|
||||
},
|
||||
"users": {
|
||||
"type": "linkMultiple",
|
||||
|
||||
@@ -129,6 +129,26 @@
|
||||
"notStorable": true,
|
||||
"disabled": true
|
||||
},
|
||||
"acceptanceStatusMeetings": {
|
||||
"type": "enum",
|
||||
"notStorable": true,
|
||||
"layoutListDisabled": true,
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutMassUpdateDisabled": true,
|
||||
"view": "crm:views/lead/fields/acceptance-status",
|
||||
"link": "meetings",
|
||||
"column": "status"
|
||||
},
|
||||
"acceptanceStatusCalls": {
|
||||
"type": "enum",
|
||||
"notStorable": true,
|
||||
"layoutListDisabled": true,
|
||||
"layoutDetailDisabled": true,
|
||||
"layoutMassUpdateDisabled": true,
|
||||
"view": "crm:views/lead/fields/acceptance-status",
|
||||
"link": "calls",
|
||||
"column": "status"
|
||||
},
|
||||
"teamRole": {
|
||||
"type": "varchar",
|
||||
"notStorable": true,
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 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('crm:views/lead/fields/acceptance-status', 'views/fields/enum-column', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
searchTypeList: ['anyOf', 'noneOf'],
|
||||
|
||||
setup: function () {
|
||||
this.params.options = this.getMetadata().get('entityDefs.Meeting.fields.acceptanceStatus.options');
|
||||
this.params.translation = 'Meeting.options.acceptanceStatus';
|
||||
|
||||
Dep.prototype.setup.call(this);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 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('crm:views/meeting/fields/acceptance-status', 'views/fields/enum', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
searchTypeList: ['anyOf', 'noneOf']
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,96 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 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/fields/enum-column', 'views/fields/enum', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
searchTypeList: ['anyOf', 'noneOf'],
|
||||
|
||||
fetchSearch: function () {
|
||||
var type = this.$el.find('[name="'+this.name+'-type"]').val();
|
||||
|
||||
var list = this.$element.val().split(':,:');
|
||||
if (list.length === 1 && list[0] == '') {
|
||||
list = [];
|
||||
}
|
||||
|
||||
list.forEach(function (item, i) {
|
||||
list[i] = this.parseItemForSearch(item);
|
||||
}, this);
|
||||
|
||||
if (type === 'anyOf') {
|
||||
if (list.length === 0) {
|
||||
return {
|
||||
data: {
|
||||
type: 'anyOf',
|
||||
valueList: list
|
||||
}
|
||||
};
|
||||
}
|
||||
return {
|
||||
type: 'columnIn',
|
||||
value: list,
|
||||
data: {
|
||||
type: 'anyOf',
|
||||
valueList: list
|
||||
}
|
||||
};
|
||||
} else if (type === 'noneOf') {
|
||||
if (list.length === 0) {
|
||||
return {
|
||||
data: {
|
||||
type: 'noneOf',
|
||||
valueList: list
|
||||
}
|
||||
};
|
||||
}
|
||||
return {
|
||||
type: 'or',
|
||||
value: [
|
||||
{
|
||||
type: 'columnIsNull',
|
||||
attribute: this.name
|
||||
},
|
||||
{
|
||||
type: 'columnNotIn',
|
||||
value: list,
|
||||
attribute: this.name
|
||||
}
|
||||
],
|
||||
data: {
|
||||
type: 'noneOf',
|
||||
valueList: list
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014-2017 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/fields/varchar-column', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
searchTypeList: ['startsWith', 'contains', 'equals', 'endsWith', 'like', 'isEmpty', 'isNotEmpty'],
|
||||
|
||||
fetchSearch: function () {
|
||||
var type = this.$el.find('[name="'+this.name+'-type"]').val() || 'startsWith';
|
||||
|
||||
var data;
|
||||
|
||||
if (~['isEmpty', 'isNotEmpty'].indexOf(type)) {
|
||||
if (type == 'isEmpty') {
|
||||
data = {
|
||||
typeFront: type,
|
||||
where: {
|
||||
type: 'or',
|
||||
value: [
|
||||
{
|
||||
type: 'columnIsNull',
|
||||
field: this.name,
|
||||
},
|
||||
{
|
||||
type: 'columnEquals',
|
||||
field: this.name,
|
||||
value: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
} else {
|
||||
data = {
|
||||
typeFront: type,
|
||||
where: {
|
||||
type: 'and',
|
||||
value: [
|
||||
{
|
||||
type: 'columnNotEquals',
|
||||
field: this.name,
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
type: 'columnIsNotNull',
|
||||
field: this.name,
|
||||
value: null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
return data;
|
||||
} else {
|
||||
var value = this.$element.val().toString().trim();
|
||||
value = value.trim();
|
||||
if (value) {
|
||||
data = {
|
||||
value: value,
|
||||
type: 'column' . Espo.Utils.upperCaseFirst(type),
|
||||
data: {
|
||||
type: type,
|
||||
value: value
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -149,7 +149,7 @@ Espo.define('views/fields/varchar', 'views/fields/base', function (Dep) {
|
||||
},
|
||||
|
||||
getSearchType: function () {
|
||||
return this.searchParams.typeFront || this.searchParams.type;
|
||||
return this.getSearchParamsData().type || this.searchParams.typeFront || this.searchParams.type;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user