diff --git a/application/Espo/Core/Select/Order/Applier.php b/application/Espo/Core/Select/Order/Applier.php index 8a042098c3..8ffb52f4f0 100644 --- a/application/Espo/Core/Select/Order/Applier.php +++ b/application/Espo/Core/Select/Order/Applier.php @@ -62,7 +62,7 @@ class Applier $orderBy = $params->getOrderBy(); - if (/*$params->forbidComplexExpressions() && */$orderBy) { + if ($orderBy) { if ( !is_string($orderBy) || str_contains($orderBy, '.') || @@ -70,6 +70,10 @@ class Applier ) { throw new Forbidden("Complex expressions are forbidden in 'orderBy'."); } + + if ($this->metadataProvider->isFieldOrderDisabled($this->entityType, $orderBy)) { + throw new Forbidden("Order by the field '$orderBy' is disabled."); + } } if ($orderBy === null) { diff --git a/application/Espo/Core/Select/Order/MetadataProvider.php b/application/Espo/Core/Select/Order/MetadataProvider.php index dd5291a347..5f59de3627 100644 --- a/application/Espo/Core/Select/Order/MetadataProvider.php +++ b/application/Espo/Core/Select/Order/MetadataProvider.php @@ -58,6 +58,11 @@ class MetadataProvider ]) ?? null; } + public function isFieldOrderDisabled(string $entityType, string $field): bool + { + return $this->metadata->get("entityDefs.$entityType.fields.$field.orderDisabled") ?? false; + } + public function hasAttribute(string $entityType, string $attribute): bool { return $this->entityManager diff --git a/application/Espo/Core/Templates/Metadata/CategoryTree/entityDefs.json b/application/Espo/Core/Templates/Metadata/CategoryTree/entityDefs.json index fa33ec476f..702d81770b 100644 --- a/application/Espo/Core/Templates/Metadata/CategoryTree/entityDefs.json +++ b/application/Espo/Core/Templates/Metadata/CategoryTree/entityDefs.json @@ -40,7 +40,8 @@ "childList": { "type": "jsonArray", "notStorable": true, - "utility": true + "utility": true, + "orderDisabled": true } }, "links": { diff --git a/application/Espo/Core/Templates/Metadata/Event/entityDefs.json b/application/Espo/Core/Templates/Metadata/Event/entityDefs.json index ffb3749b41..7bdb65a464 100644 --- a/application/Espo/Core/Templates/Metadata/Event/entityDefs.json +++ b/application/Espo/Core/Templates/Metadata/Event/entityDefs.json @@ -65,6 +65,7 @@ "reminders": { "type": "jsonArray", "notStorable": true, + "orderDisabled": true, "view": "crm:views/meeting/fields/reminders", "layoutListDisabled": true, "validatorClassNameList": [ diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Account.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Account.json index d9c1c67d58..9a241ced1e 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Account.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Account.json @@ -93,6 +93,7 @@ "type": "varchar", "notStorable": true, "utility": true, + "orderDisabled": true, "maxLength": 100, "pattern": "$noBadCharacters", "layoutMassUpdateDisabled": true, @@ -106,6 +107,7 @@ "contactIsInactive": { "type": "bool", "notStorable": true, + "orderDisabled": true, "default": false, "utility": true }, @@ -201,6 +203,7 @@ "targetList": { "type": "link", "notStorable": true, + "orderDisabled": true, "layoutDetailDisabled": true, "layoutListDisabled": true, "layoutMassUpdateDisabled": true, @@ -216,6 +219,7 @@ "targetListIsOptedOut": { "type": "bool", "notStorable": true, + "orderDisabled": true, "readOnly": true, "utility": true } diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json index bf892ece03..42c4ad7959 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json @@ -47,6 +47,7 @@ "reminders": { "type": "jsonArray", "notStorable": true, + "orderDisabled": true, "view": "crm:views/meeting/fields/reminders", "layoutListDisabled": true, "validatorClassNameList": [ @@ -82,6 +83,7 @@ }, "layoutDetailDisabled": true, "layoutMassUpdateDisabled": true, + "orderDisabled": true, "importDisabled": true, "exportDisabled": true, "customizationDefaultDisabled": true, @@ -304,6 +306,7 @@ "phoneNumbersMap": { "type": "jsonObject", "notStorable": true, + "orderDisabled": true, "utility": true, "customizationDisabled": true }, diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Campaign.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Campaign.json index 19366e194a..a204099f52 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Campaign.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Campaign.json @@ -86,6 +86,7 @@ "sentCount": { "type": "int", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "readOnly": true, "utility": true @@ -94,6 +95,7 @@ "view": "crm:views/campaign/fields/int-with-percentage", "type": "int", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "readOnly": true, "utility": true @@ -102,6 +104,7 @@ "view": "crm:views/campaign/fields/int-with-percentage", "type": "int", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "readOnly": true, "utility": true @@ -109,6 +112,7 @@ "optedInCount": { "type": "int", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "readOnly": true, "utility": true @@ -117,6 +121,7 @@ "view": "crm:views/campaign/fields/int-with-percentage", "type": "int", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "readOnly": true, "utility": true @@ -125,6 +130,7 @@ "view": "crm:views/campaign/fields/int-with-percentage", "type": "int", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "readOnly": true, "utility": true @@ -132,6 +138,7 @@ "hardBouncedCount": { "type": "int", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "readOnly": true, "utility": true @@ -139,6 +146,7 @@ "softBouncedCount": { "type": "int", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "readOnly": true, "utility": true @@ -146,6 +154,7 @@ "leadCreatedCount": { "type": "int", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "readOnly": true, "utility": true @@ -153,6 +162,7 @@ "openedPercentage": { "type": "int", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "readOnly": true, "utility": true @@ -160,6 +170,7 @@ "clickedPercentage": { "type": "int", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "readOnly": true, "utility": true @@ -167,6 +178,7 @@ "optedOutPercentage": { "type": "int", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "readOnly": true, "utility": true @@ -174,6 +186,7 @@ "bouncedPercentage": { "type": "int", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "readOnly": true, "utility": true @@ -181,6 +194,7 @@ "revenue": { "type": "currency", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "readOnly": true, "utility": true diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/CampaignTrackingUrl.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/CampaignTrackingUrl.json index 55e237693c..af351bf7c5 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/CampaignTrackingUrl.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/CampaignTrackingUrl.json @@ -11,6 +11,7 @@ "urlToUse": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "readOnly": true }, "campaign": { diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Case.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Case.json index 3ca1ac335b..d789b4a755 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Case.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Case.json @@ -74,6 +74,7 @@ "originalEmail": { "type": "link", "notStorable": true, + "orderDisabled": true, "entity": "Email", "customizationDisabled": true, "layoutAvailabilityList": [], diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json index 3c864e2d4a..813e8bf354 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json @@ -19,6 +19,7 @@ }, "accountAnyId": { "notStorable": true, + "orderDisabled": true, "customizationDisabled": true, "utility": true, "type": "varchar", @@ -277,6 +278,7 @@ "accountRole": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "directUpdateDisabled": true, "layoutDetailDisabled": true, "layoutMassUpdateDisabled": true, @@ -377,6 +379,7 @@ "opportunityRole": { "type": "enum", "notStorable": true, + "orderDisabled": true, "options": ["", "Decision Maker", "Evaluator", "Influencer"], "layoutMassUpdateDisabled": true, "layoutListDisabled": true, @@ -397,6 +400,7 @@ "acceptanceStatus": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "exportDisabled": true, "utility": true, "fieldManagerParamList": [] @@ -404,6 +408,7 @@ "acceptanceStatusMeetings": { "type": "enum", "notStorable": true, + "orderDisabled": true, "directUpdateDisabled": true, "layoutAvailabilityList": ["filters"], "importDisabled": true, @@ -416,6 +421,7 @@ "acceptanceStatusCalls": { "type": "enum", "notStorable": true, + "orderDisabled": true, "directUpdateDisabled": true, "layoutAvailabilityList": ["filters"], "importDisabled": true, @@ -472,6 +478,7 @@ "targetList": { "type": "link", "notStorable": true, + "orderDisabled": true, "layoutDetailDisabled": true, "layoutListDisabled": true, "layoutMassUpdateDisabled": true, @@ -528,12 +535,14 @@ "targetListIsOptedOut": { "type": "bool", "notStorable": true, + "orderDisabled": true, "readOnly": true, "utility": true }, "originalEmail": { "type": "link", "notStorable": true, + "orderDisabled": true, "entity": "Email", "customizationDisabled": true, "layoutAvailabilityList": [], diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/DocumentFolder.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/DocumentFolder.json index 8c6ff139b7..7cd0ce3238 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/DocumentFolder.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/DocumentFolder.json @@ -41,7 +41,8 @@ }, "childList": { "type": "jsonArray", - "notStorable": true + "notStorable": true, + "orderDisabled": true } }, "links": { diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseCategory.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseCategory.json index f99ee1af9c..8849c144ed 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseCategory.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseCategory.json @@ -47,7 +47,8 @@ }, "childList": { "type": "jsonArray", - "notStorable": true + "notStorable": true, + "orderDisabled": true } }, "links": { diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json index bc36ecb7f3..7f0ceaa269 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json @@ -168,6 +168,7 @@ "acceptanceStatus": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "exportDisabled": true, "utility": true, "fieldManagerParamList": [] @@ -175,6 +176,7 @@ "acceptanceStatusMeetings": { "type": "enum", "notStorable": true, + "orderDisabled": true, "directUpdateDisabled": true, "layoutAvailabilityList": ["filters"], "importDisabled": true, @@ -187,6 +189,7 @@ "acceptanceStatusCalls": { "type": "enum", "notStorable": true, + "orderDisabled": true, "directUpdateDisabled": true, "layoutAvailabilityList": ["filters"], "importDisabled": true, @@ -230,6 +233,7 @@ "targetList": { "type": "link", "notStorable": true, + "orderDisabled": true, "layoutDetailDisabled": true, "layoutListDisabled": true, "layoutMassUpdateDisabled": true, @@ -240,12 +244,14 @@ "targetListIsOptedOut": { "type": "bool", "notStorable": true, + "orderDisabled": true, "readOnly": true, "utility": true }, "originalEmail": { "type": "link", "notStorable": true, + "orderDisabled": true, "entity": "Email", "customizationDisabled": true, "layoutAvailabilityList": [], diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/MassEmail.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/MassEmail.json index 0636fa1e50..a956555a65 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/MassEmail.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/MassEmail.json @@ -72,6 +72,7 @@ "smtpAccount": { "type": "base", "notStorable": true, + "orderDisabled": true, "view": "crm:views/mass-email/fields/smtp-account" }, "createdAt": { diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json index 3ac3ee02ff..16e43281dc 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json @@ -55,6 +55,7 @@ "reminders": { "type": "jsonArray", "notStorable": true, + "orderDisabled": true, "view": "crm:views/meeting/fields/reminders", "layoutListDisabled": true, "validatorClassNameList": [ @@ -77,6 +78,7 @@ "acceptanceStatus": { "type": "enum", "notStorable": true, + "orderDisabled": true, "options": ["None", "Accepted", "Tentative", "Declined"], "style": { "Accepted": "success", @@ -281,6 +283,7 @@ "sourceEmail": { "type": "link", "notStorable": true, + "orderDisabled": true, "layoutDetailDisabled": true, "layoutListDisabled": true, "layoutMassUpdateDisabled": true, diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Opportunity.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Opportunity.json index 49d87220d3..6b0d6a8a5d 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Opportunity.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Opportunity.json @@ -224,6 +224,7 @@ "contactRole": { "type": "enum", "notStorable": true, + "orderDisabled": true, "layoutMassUpdateDisabled": true, "layoutDetailDisabled": true, "layoutAvailabilityList": ["listForContact"], diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/TargetList.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/TargetList.json index 4af9581846..68e965502b 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/TargetList.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/TargetList.json @@ -9,6 +9,7 @@ "type": "int", "readOnly": true, "notStorable": true, + "orderDisabled": true, "layoutFiltersDisabled": true, "layoutMassUpdateDisabled": true }, @@ -16,6 +17,7 @@ "type": "int", "readOnly": true, "notStorable": true, + "orderDisabled": true, "layoutListDisabled": true, "layoutFiltersDisabled": true, "layoutMassUpdateDisabled": true @@ -26,6 +28,7 @@ "sourceCampaign": { "type": "link", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "customizationDisabled": true, "layoutAvailabilityList": [] @@ -71,6 +74,7 @@ "layoutFiltersDisabled": true, "layoutLinkDisabled": true, "notStorable": true, + "orderDisabled": true, "utility": true }, "excludingActionList": { @@ -80,12 +84,14 @@ "layoutFiltersDisabled": true, "layoutLinkDisabled": true, "notStorable": true, + "orderDisabled": true, "utility": true }, "targetStatus": { "type": "enum", "options": ["Listed", "Opted Out"], "notStorable": true, + "orderDisabled": true, "readOnly": true, "layoutListDisabled": true, "layoutDetailDisabled": true, @@ -98,6 +104,7 @@ "isOptedOut": { "type": "bool", "notStorable": true, + "orderDisabled": true, "readOnly": true, "layoutListDisabled": true, "layoutDetailDisabled": true, diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Task.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Task.json index 489f5737bf..3518f159ef 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Task.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Task.json @@ -73,12 +73,14 @@ "type": "bool", "readOnly": true, "notStorable": true, + "orderDisabled": true, "view": "crm:views/task/fields/is-overdue", "utility": true }, "reminders": { "type": "jsonArray", "notStorable": true, + "orderDisabled": true, "view": "crm:views/meeting/fields/reminders", "dateField": "dateEnd", "validatorClassNameList": [ diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/User.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/User.json index fcefa708af..f9416e46e9 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/User.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/User.json @@ -3,6 +3,7 @@ "targetListIsOptedOut": { "type": "bool", "notStorable": true, + "orderDisabled": true, "readOnly": true, "utility": true, "fieldManagerParamList": [] diff --git a/application/Espo/Resources/metadata/entityDefs/Email.json b/application/Espo/Resources/metadata/entityDefs/Email.json index a3ea7687dc..d3432f035e 100644 --- a/application/Espo/Resources/metadata/entityDefs/Email.json +++ b/application/Espo/Resources/metadata/entityDefs/Email.json @@ -10,6 +10,7 @@ "type": "varchar", "required": true, "notStorable": true, + "orderDisabled": true, "view": "views/email/fields/subject", "utility": true }, @@ -27,6 +28,7 @@ "type": "varchar", "readOnly": true, "notStorable": true, + "orderDisabled": true, "textFilterDisabled": true, "layoutFiltersDisabled": true, "customizationDisabled": true, @@ -49,6 +51,7 @@ "type": "varchar", "readOnly": true, "notStorable": true, + "orderDisabled": true, "textFilterDisabled": true, "layoutFiltersDisabled": true, "customizationDisabled": true, @@ -58,6 +61,7 @@ "type": "varchar", "readOnly": true, "notStorable": true, + "orderDisabled": true, "textFilterDisabled": true, "layoutFiltersDisabled": true, "customizationDisabled": true, @@ -72,6 +76,7 @@ "from": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "required": true, "view": "views/email/fields/from-address-varchar", "textFilterDisabled": true, @@ -82,6 +87,7 @@ "to": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "required": true, "view": "views/email/fields/email-address-varchar", "validatorClassName": "Espo\\Classes\\FieldValidators\\Email\\EmailAddresses", @@ -97,6 +103,7 @@ "cc": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "view": "views/email/fields/email-address-varchar", "validatorClassNameList": [ "Espo\\Classes\\FieldValidators\\Email\\Addresses\\Valid", @@ -110,6 +117,7 @@ "bcc": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "view": "views/email/fields/email-address-varchar", "validatorClassNameList": [ "Espo\\Classes\\FieldValidators\\Email\\Addresses\\Valid", @@ -123,6 +131,7 @@ "replyTo": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "view": "views/email/fields/email-address-varchar", "textFilterDisabled": true, "customizationDisabled": true, @@ -132,6 +141,7 @@ "personStringData": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "utility": true, "view": "views/email/fields/person-string-data", "customizationDisabled": true @@ -198,6 +208,7 @@ "folder": { "type": "link", "notStorable": true, + "orderDisabled": true, "readOnly": true, "entity": "EmailFolder", "customizationDisabled": true @@ -205,6 +216,7 @@ "nameHash": { "type": "text", "notStorable": true, + "orderDisabled": true, "readOnly": true, "utility": true, "customizationDisabled": true @@ -219,6 +231,7 @@ "idHash": { "type": "text", "notStorable": true, + "orderDisabled": true, "readOnly": true, "utility": true, "customizationDisabled": true diff --git a/application/Espo/Resources/metadata/entityDefs/Notification.json b/application/Espo/Resources/metadata/entityDefs/Notification.json index 1fa10a1635..541acb3508 100644 --- a/application/Espo/Resources/metadata/entityDefs/Notification.json +++ b/application/Espo/Resources/metadata/entityDefs/Notification.json @@ -10,7 +10,8 @@ }, "noteData": { "type": "jsonObject", - "notStorable": true + "notStorable": true, + "orderDisabled": true }, "type": { "type": "varchar" diff --git a/application/Espo/Resources/metadata/entityDefs/User.json b/application/Espo/Resources/metadata/entityDefs/User.json index b4c4184d95..5598eb1d7f 100644 --- a/application/Espo/Resources/metadata/entityDefs/User.json +++ b/application/Espo/Resources/metadata/entityDefs/User.json @@ -52,6 +52,7 @@ "internal": true, "utility": true, "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "fieldManagerParamList": [] }, @@ -85,6 +86,7 @@ "maxLength": 100, "readOnly": true, "notStorable": true, + "orderDisabled": true, "layoutMassUpdateDisabled": true, "layoutDetailDisabled": true, "layoutFiltersDisabled": true, @@ -127,6 +129,7 @@ "type": "varchar", "maxLength": 100, "notStorable": true, + "orderDisabled": true, "where": { "LIKE": { "whereClause": { @@ -245,24 +248,28 @@ "token": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "utility": true, "customizationDisabled": true }, "authTokenId": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "utility": true, "customizationDisabled": true }, "authLogRecordId": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "utility": true, "customizationDisabled": true }, "ipAddress": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "utility": true, "customizationDisabled": true }, @@ -275,6 +282,7 @@ "acceptanceStatus": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "exportDisabled": true, "utility": true, "fieldManagerParamList": [] @@ -282,6 +290,7 @@ "acceptanceStatusMeetings": { "type": "enum", "notStorable": true, + "orderDisabled": true, "directUpdateDisabled": true, "layoutAvailabilityList": ["filters"], "importDisabled": true, @@ -294,6 +303,7 @@ "acceptanceStatusCalls": { "type": "enum", "notStorable": true, + "orderDisabled": true, "directUpdateDisabled": true, "layoutAvailabilityList": ["filters"], "importDisabled": true, @@ -306,6 +316,7 @@ "teamRole": { "type": "varchar", "notStorable": true, + "orderDisabled": true, "utility": true, "fieldManagerParamList": [] }, @@ -363,6 +374,7 @@ "account": { "type": "link", "notStorable": true, + "orderDisabled": true, "directAccessDisabled": true, "foreignAccessDisabled": true, "layoutDetailDisabled": true, @@ -373,6 +385,7 @@ "portal": { "type": "link", "notStorable": true, + "orderDisabled": true, "readOnly": true, "utility": true }, @@ -386,6 +399,7 @@ "sendAccessInfo": { "type": "bool", "notStorable": true, + "orderDisabled": true, "utility": true }, "gender": { @@ -446,6 +460,7 @@ "lastAccess": { "type": "datetime", "notStorable": true, + "orderDisabled": true, "readOnly": true, "layoutListDisabled": true, "layoutFiltersDisabled": true, diff --git a/application/Espo/Resources/metadata/fields/address.json b/application/Espo/Resources/metadata/fields/address.json index 01f4a1c6b1..13410fc946 100644 --- a/application/Espo/Resources/metadata/fields/address.json +++ b/application/Espo/Resources/metadata/fields/address.json @@ -41,6 +41,7 @@ "map": { "type": "map", "notStorable": true, + "orderDisabled": true, "readOnly": true, "layoutListDisabled": true, "provider": "Google", diff --git a/application/Espo/Resources/metadata/fields/map.json b/application/Espo/Resources/metadata/fields/map.json index 350af95a3f..ac5bd6b029 100644 --- a/application/Espo/Resources/metadata/fields/map.json +++ b/application/Espo/Resources/metadata/fields/map.json @@ -10,6 +10,7 @@ "notCreatable": true, "notSortable": true, "fieldDefs": { - "notStorable": true + "notStorable": true, + "orderDisabled": true } } diff --git a/client/src/views/admin/entity-manager/edit.js b/client/src/views/admin/entity-manager/edit.js index ae2fba4918..8d02908cf7 100644 --- a/client/src/views/admin/entity-manager/edit.js +++ b/client/src/views/admin/entity-manager/edit.js @@ -138,7 +138,7 @@ class EntityManagerEditView extends View { return false; } - if (fieldDefs[item].notStorable) { + if (fieldDefs[item].orderDisabled) { return false; } diff --git a/client/src/views/dashlets/fields/records/sort-by.js b/client/src/views/dashlets/fields/records/sort-by.js index f36f1bdcd2..dc8d4515be 100644 --- a/client/src/views/dashlets/fields/records/sort-by.js +++ b/client/src/views/dashlets/fields/records/sort-by.js @@ -53,7 +53,7 @@ define('views/dashlets/fields/records/sort-by', ['views/fields/enum'], function var orderableFieldList = Object.keys(fieldDefs) .filter(item => { - if (fieldDefs[item].notStorable) { + if (fieldDefs[item].orderDisabled) { return false; } diff --git a/client/src/views/record/list.js b/client/src/views/record/list.js index 8251d54a09..efefe8dcc7 100644 --- a/client/src/views/record/list.js +++ b/client/src/views/record/list.js @@ -2259,11 +2259,11 @@ class ListRecordView extends View { forbiddenFieldList = []; } - if (!forbiddenFieldList.length) { + /*if (!forbiddenFieldList.length) { this._cachedFilteredListLayout = listLayout; return this._cachedFilteredListLayout; - } + }*/ const filteredListLayout = Espo.Utils.cloneDeep(listLayout); @@ -2282,6 +2282,19 @@ class ListRecordView extends View { .reverse() .forEach(index => filteredListLayout.splice(index, 1)); + /** @type {Record} */ + const fieldDefs = this.getMetadata().get(`entityDefs.${this.entityType}.fields`) || {}; + + filteredListLayout.forEach(item => { + if (!item.name || !fieldDefs[item.name]) { + return; + } + + if (fieldDefs[item.name].orderDisabled) { + item.notSortable = true; + } + }); + this._cachedFilteredListLayout = filteredListLayout; return this._cachedFilteredListLayout; diff --git a/schema/metadata/entityDefs.json b/schema/metadata/entityDefs.json index ff4cfd9f55..95d842819e 100644 --- a/schema/metadata/entityDefs.json +++ b/schema/metadata/entityDefs.json @@ -735,6 +735,10 @@ }, "description": "A list of layout types the field won't be available in. As of v8.2." }, + "orderDisabled": { + "type": "boolean", + "default": "Disables the ability to order by the field." + }, "textFilterDisabled": { "type": "boolean", "description": "Disables the ability to add the field to text filters (in the Entity Manager tool)."