From c87f5dfab37816190cd0982fb3561387938456fb Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 28 Jul 2014 10:34:39 +0300 Subject: [PATCH 01/20] bool filter change --- .../metadata/clientDefs/Account.json | 3 +- .../Resources/metadata/clientDefs/Call.json | 3 +- .../Resources/metadata/clientDefs/Case.json | 3 +- .../metadata/clientDefs/Contact.json | 3 +- .../Resources/metadata/clientDefs/Lead.json | 3 +- .../metadata/clientDefs/Meeting.json | 3 +- .../metadata/clientDefs/Opportunity.json | 3 +- .../Resources/metadata/clientDefs/Target.json | 3 +- .../Resources/metadata/clientDefs/Task.json | 3 +- .../Espo/Modules/Crm/SelectManagers/Task.php | 46 +++++++++++++++++++ .../Resources/metadata/clientDefs/Email.json | 3 +- .../metadata/clientDefs/EmailTemplate.json | 5 +- .../Resources/metadata/entityDefs/Email.json | 3 +- frontend/client/src/views/record/search.js | 2 +- 14 files changed, 71 insertions(+), 15 deletions(-) create mode 100644 application/Espo/Modules/Crm/SelectManagers/Task.php diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Account.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Account.json index e6a5bf9376..e544768c5d 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Account.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Account.json @@ -29,5 +29,6 @@ ], "layout":"listForAccount" } - } + }, + "boolFilters": ["onlyMy"] } diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Call.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Call.json index 8df29b2205..7f32172640 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Call.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Call.json @@ -76,5 +76,6 @@ } } } - ] + ], + "boolFilters": ["onlyMy"] } diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Case.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Case.json index 4bc56d2fe1..568a97000c 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Case.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Case.json @@ -44,5 +44,6 @@ } } } - ] + ], + "boolFilters": ["onlyMy"] } diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Contact.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Contact.json index c57b4d2bf6..d3d0214746 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Contact.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Contact.json @@ -21,5 +21,6 @@ "view":"Crm:Record.Panels.Tasks" } ] - } + }, + "boolFilters": ["onlyMy"] } diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json index 5d55e50371..4e278a6bb8 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Lead.json @@ -36,5 +36,6 @@ } } } - ] + ], + "boolFilters": ["onlyMy"] } diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Meeting.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Meeting.json index 711774b909..91700d6e53 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Meeting.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Meeting.json @@ -76,5 +76,6 @@ } } } - ] + ], + "boolFilters": ["onlyMy"] } diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Opportunity.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Opportunity.json index e8b9bd89f3..56f3f7518d 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Opportunity.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Opportunity.json @@ -43,5 +43,6 @@ } } } - ] + ], + "boolFilters": ["onlyMy"] } diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Target.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Target.json index d14cfa12c8..f92518ec90 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Target.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Target.json @@ -13,5 +13,6 @@ } ] } - } + }, + "boolFilters": ["onlyMy"] } diff --git a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Task.json b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Task.json index 8cb5ade2b8..16940bbcb4 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Task.json +++ b/application/Espo/Modules/Crm/Resources/metadata/clientDefs/Task.json @@ -44,5 +44,6 @@ } } } - ] + ], + "boolFilters": ["onlyMy"] } diff --git a/application/Espo/Modules/Crm/SelectManagers/Task.php b/application/Espo/Modules/Crm/SelectManagers/Task.php new file mode 100644 index 0000000000..791da4a29a --- /dev/null +++ b/application/Espo/Modules/Crm/SelectManagers/Task.php @@ -0,0 +1,46 @@ + 'notIn', + 'field' => 'status', + 'value' => array('Completed', 'Canceled') + ); + } + + protected function getBoolFilterWhereInactive() + { + return array( + 'type' => 'in', + 'field' => 'status', + 'value' => array('Completed', 'Canceled') + ); + } +} + diff --git a/application/Espo/Resources/metadata/clientDefs/Email.json b/application/Espo/Resources/metadata/clientDefs/Email.json index 0a83f50ccc..bf2fcaaaa0 100644 --- a/application/Espo/Resources/metadata/clientDefs/Email.json +++ b/application/Espo/Resources/metadata/clientDefs/Email.json @@ -35,5 +35,6 @@ } } } - ] + ], + "boolFilters": ["onlyMy"] } diff --git a/application/Espo/Resources/metadata/clientDefs/EmailTemplate.json b/application/Espo/Resources/metadata/clientDefs/EmailTemplate.json index dd800f04e3..76de4c9aee 100644 --- a/application/Espo/Resources/metadata/clientDefs/EmailTemplate.json +++ b/application/Espo/Resources/metadata/clientDefs/EmailTemplate.json @@ -1,7 +1,8 @@ { - "controller": "Controllers.Record", + "controller": "Controllers.Record", "recordViews":{ "edit": "EmailTemplate.Record.Edit", "detail": "EmailTemplate.Record.Detail" - } + }, + "boolFilters": ["onlyMy"] } diff --git a/application/Espo/Resources/metadata/entityDefs/Email.json b/application/Espo/Resources/metadata/entityDefs/Email.json index 0ed1ca9bed..d0f4d36dcf 100644 --- a/application/Espo/Resources/metadata/entityDefs/Email.json +++ b/application/Espo/Resources/metadata/entityDefs/Email.json @@ -173,7 +173,6 @@ }, "collection": { "sortBy": "dateSent", - "asc": false, - "boolFilters": ["onlyMy"] + "asc": false } } diff --git a/frontend/client/src/views/record/search.js b/frontend/client/src/views/record/search.js index ca75e91661..66cc4c9ceb 100644 --- a/frontend/client/src/views/record/search.js +++ b/frontend/client/src/views/record/search.js @@ -67,7 +67,7 @@ Espo.define('Views.Record.Search', 'View', function (Dep) { return this.fields != null && this.moreFields != null; }.bind(this)); - this.boolFilters = this.getMetadata().get('entityDefs.' + this.scope + '.collection.boolFilters') || []; + this.boolFilters = this.getMetadata().get('clientDefs.' + this.scope + '.boolFilters') || []; this._helper.layoutManager.get(this.scope, 'filters', function (list) { this.moreFields = list; From 982f0e1f62e54a0b783e26661ef0b6e28a7b2bf6 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 28 Jul 2014 10:54:01 +0300 Subject: [PATCH 02/20] change filter defs --- .../Resources/metadata/fields/address.json | 5 +--- .../Espo/Resources/metadata/fields/array.json | 5 +--- .../metadata/fields/autoincrement.json | 5 +--- .../Espo/Resources/metadata/fields/base.json | 5 +--- .../Espo/Resources/metadata/fields/bool.json | 5 +--- .../Resources/metadata/fields/currency.json | 5 +--- .../Espo/Resources/metadata/fields/date.json | 5 +--- .../Resources/metadata/fields/datetime.json | 5 +--- .../Espo/Resources/metadata/fields/email.json | 5 +--- .../Espo/Resources/metadata/fields/enum.json | 5 +--- .../Resources/metadata/fields/enumFloat.json | 5 +--- .../Resources/metadata/fields/enumInt.json | 5 +--- .../Espo/Resources/metadata/fields/file.json | 5 +--- .../Espo/Resources/metadata/fields/float.json | 5 +--- .../Resources/metadata/fields/foreign.json | 5 +--- .../Espo/Resources/metadata/fields/image.json | 5 +--- .../Espo/Resources/metadata/fields/int.json | 5 +--- .../Espo/Resources/metadata/fields/link.json | 5 +--- .../metadata/fields/linkMultiple.json | 5 +--- .../Resources/metadata/fields/linkParent.json | 5 +--- .../Resources/metadata/fields/multienum.json | 5 +--- .../Resources/metadata/fields/password.json | 5 +--- .../Resources/metadata/fields/personName.json | 5 +--- .../Espo/Resources/metadata/fields/phone.json | 5 +--- .../Espo/Resources/metadata/fields/text.json | 5 +--- .../Espo/Resources/metadata/fields/url.json | 5 +--- .../Resources/metadata/fields/varchar.json | 5 +--- frontend/client/src/field-manager.js | 25 ++++++++----------- .../client/src/views/admin/layouts/filters.js | 3 +-- 29 files changed, 39 insertions(+), 124 deletions(-) diff --git a/application/Espo/Resources/metadata/fields/address.json b/application/Espo/Resources/metadata/fields/address.json index 2aa953393d..561875579d 100644 --- a/application/Espo/Resources/metadata/fields/address.json +++ b/application/Espo/Resources/metadata/fields/address.json @@ -27,8 +27,5 @@ }, "mergable":false, "notCreatable": false, - "search":{ - "basic":false, - "advanced":true - } + "filter": true } diff --git a/application/Espo/Resources/metadata/fields/array.json b/application/Espo/Resources/metadata/fields/array.json index f856ff3142..dcc2077d83 100644 --- a/application/Espo/Resources/metadata/fields/array.json +++ b/application/Espo/Resources/metadata/fields/array.json @@ -15,10 +15,7 @@ "hidden": true } ], - "search":{ - "basic":false, - "advanced":false - }, + "filter": false, "notCreatable": false, "fieldDefs":{ "type":"jsonArray" diff --git a/application/Espo/Resources/metadata/fields/autoincrement.json b/application/Espo/Resources/metadata/fields/autoincrement.json index ad07054ab2..8d3a36ed37 100644 --- a/application/Espo/Resources/metadata/fields/autoincrement.json +++ b/application/Espo/Resources/metadata/fields/autoincrement.json @@ -2,10 +2,7 @@ "params":[ ], "notCreatable": true, - "search":{ - "basic":false, - "advanced":true - }, + "filter": true, "fieldDefs":{ "type":"int", "autoincrement":true, diff --git a/application/Espo/Resources/metadata/fields/base.json b/application/Espo/Resources/metadata/fields/base.json index 73a550958f..f3673ba203 100644 --- a/application/Espo/Resources/metadata/fields/base.json +++ b/application/Espo/Resources/metadata/fields/base.json @@ -5,10 +5,7 @@ "type":"bool" } ], - "search":{ - "basic":false, - "advanced":false - }, + "filter": false, "notCreatable": true, "fieldDefs":{ "notStorable":true diff --git a/application/Espo/Resources/metadata/fields/bool.json b/application/Espo/Resources/metadata/fields/bool.json index 5db27091c4..8b6dac7ad6 100644 --- a/application/Espo/Resources/metadata/fields/bool.json +++ b/application/Espo/Resources/metadata/fields/bool.json @@ -5,8 +5,5 @@ "type":"bool" } ], - "search":{ - "basic":false, - "advanced":true - } + "filter": true } diff --git a/application/Espo/Resources/metadata/fields/currency.json b/application/Espo/Resources/metadata/fields/currency.json index b640fb8e66..f7e2cf57c0 100644 --- a/application/Espo/Resources/metadata/fields/currency.json +++ b/application/Espo/Resources/metadata/fields/currency.json @@ -24,10 +24,7 @@ "disabled": true } }, - "search":{ - "basic":false, - "advanced":true - }, + "filter": true, "fieldDefs":{ "type":"float" } diff --git a/application/Espo/Resources/metadata/fields/date.json b/application/Espo/Resources/metadata/fields/date.json index 600c80a6dd..3a8d1ab525 100644 --- a/application/Espo/Resources/metadata/fields/date.json +++ b/application/Espo/Resources/metadata/fields/date.json @@ -18,10 +18,7 @@ "type":"varchar" } ], - "search":{ - "basic":false, - "advanced":true - }, + "filter": true, "fieldDefs":{ "notNull":false } diff --git a/application/Espo/Resources/metadata/fields/datetime.json b/application/Espo/Resources/metadata/fields/datetime.json index aa153110f7..3a8d1ab525 100644 --- a/application/Espo/Resources/metadata/fields/datetime.json +++ b/application/Espo/Resources/metadata/fields/datetime.json @@ -18,10 +18,7 @@ "type":"varchar" } ], - "search":{ - "basic":false, - "advanced":false - }, + "filter": true, "fieldDefs":{ "notNull":false } diff --git a/application/Espo/Resources/metadata/fields/email.json b/application/Espo/Resources/metadata/fields/email.json index 974c07faea..3342f8a980 100644 --- a/application/Espo/Resources/metadata/fields/email.json +++ b/application/Espo/Resources/metadata/fields/email.json @@ -10,10 +10,7 @@ "data" ], "notCreatable": true, - "search":{ - "basic":true, - "advanced":true - }, + "filter": true, "fieldDefs":{ "notStorable":true } diff --git a/application/Espo/Resources/metadata/fields/enum.json b/application/Espo/Resources/metadata/fields/enum.json index 2961c7392d..0c669276ba 100644 --- a/application/Espo/Resources/metadata/fields/enum.json +++ b/application/Espo/Resources/metadata/fields/enum.json @@ -14,10 +14,7 @@ "type":"varchar" } ], - "search":{ - "basic":false, - "advanced":true - }, + "filter": true, "fieldDefs":{ "type":"varchar" } diff --git a/application/Espo/Resources/metadata/fields/enumFloat.json b/application/Espo/Resources/metadata/fields/enumFloat.json index 95d7e1f315..add7553dae 100644 --- a/application/Espo/Resources/metadata/fields/enumFloat.json +++ b/application/Espo/Resources/metadata/fields/enumFloat.json @@ -9,10 +9,7 @@ "type":"float" } ], - "search":{ - "basic":false, - "advanced":true - }, + "filter": true, "notCreatable": true, "fieldDefs":{ "type":"float" diff --git a/application/Espo/Resources/metadata/fields/enumInt.json b/application/Espo/Resources/metadata/fields/enumInt.json index 54b241a0a3..81a86c001f 100644 --- a/application/Espo/Resources/metadata/fields/enumInt.json +++ b/application/Espo/Resources/metadata/fields/enumInt.json @@ -9,10 +9,7 @@ "type":"int" } ], - "search":{ - "basic":false, - "advanced":true - }, + "filter": true, "notCreatable": true, "fieldDefs":{ "type":"int" diff --git a/application/Espo/Resources/metadata/fields/file.json b/application/Espo/Resources/metadata/fields/file.json index a2715ea2b3..905cd98581 100644 --- a/application/Espo/Resources/metadata/fields/file.json +++ b/application/Espo/Resources/metadata/fields/file.json @@ -15,10 +15,7 @@ "fieldDefs":{ "skip":true }, - "search":{ - "basic":false, - "advanced":false - }, + "filter": false, "linkDefs": { "type": "belongsTo", "entity": "Attachment" diff --git a/application/Espo/Resources/metadata/fields/float.json b/application/Espo/Resources/metadata/fields/float.json index d121fcb19a..f714f710f4 100644 --- a/application/Espo/Resources/metadata/fields/float.json +++ b/application/Espo/Resources/metadata/fields/float.json @@ -18,10 +18,7 @@ "type":"float" } ], - "search":{ - "basic":false, - "advanced":true - }, + "filter": true, "fieldDefs":{ "notNull":false } diff --git a/application/Espo/Resources/metadata/fields/foreign.json b/application/Espo/Resources/metadata/fields/foreign.json index 0d77de4d67..8d5e4c7145 100644 --- a/application/Espo/Resources/metadata/fields/foreign.json +++ b/application/Espo/Resources/metadata/fields/foreign.json @@ -9,10 +9,7 @@ "type":"varchar" } ], - "search":{ - "basic":false, - "advanced":false - }, + "filter": false, "notCreatable": true, "fieldDefs":{ "skip":true diff --git a/application/Espo/Resources/metadata/fields/image.json b/application/Espo/Resources/metadata/fields/image.json index 8555815d07..2f905539bf 100644 --- a/application/Espo/Resources/metadata/fields/image.json +++ b/application/Espo/Resources/metadata/fields/image.json @@ -21,10 +21,7 @@ "fieldDefs":{ "skip":true }, - "search":{ - "basic":false, - "advanced":false - }, + "filter": false, "linkDefs": { "type": "belongsTo", "entity": "Attachment" diff --git a/application/Espo/Resources/metadata/fields/int.json b/application/Espo/Resources/metadata/fields/int.json index 79bd06eab6..ca12bb6f97 100644 --- a/application/Espo/Resources/metadata/fields/int.json +++ b/application/Espo/Resources/metadata/fields/int.json @@ -18,8 +18,5 @@ "type":"int" } ], - "search":{ - "basic":false, - "advanced":true - } + "filter": true } diff --git a/application/Espo/Resources/metadata/fields/link.json b/application/Espo/Resources/metadata/fields/link.json index a44217ce28..aaa89c3c60 100644 --- a/application/Espo/Resources/metadata/fields/link.json +++ b/application/Espo/Resources/metadata/fields/link.json @@ -12,10 +12,7 @@ "notActualFields":[ "name" ], - "search":{ - "basic":false, - "advanced":true - }, + "filter": true, "notCreatable": true, "fieldDefs":{ "skip":true diff --git a/application/Espo/Resources/metadata/fields/linkMultiple.json b/application/Espo/Resources/metadata/fields/linkMultiple.json index 540ae7b3d8..f018ebe247 100644 --- a/application/Espo/Resources/metadata/fields/linkMultiple.json +++ b/application/Espo/Resources/metadata/fields/linkMultiple.json @@ -13,8 +13,5 @@ "names" ], "notCreatable": true, - "search":{ - "basic":false, - "advanced":true - } + "filter": true } diff --git a/application/Espo/Resources/metadata/fields/linkParent.json b/application/Espo/Resources/metadata/fields/linkParent.json index 38bcec39cf..fc42859f2f 100644 --- a/application/Espo/Resources/metadata/fields/linkParent.json +++ b/application/Espo/Resources/metadata/fields/linkParent.json @@ -13,10 +13,7 @@ "notActualFields":[ "name" ], - "search":{ - "basic":false, - "advanced":true - }, + "filter": true, "notCreatable": true, "fieldDefs":{ "notStorable":true diff --git a/application/Espo/Resources/metadata/fields/multienum.json b/application/Espo/Resources/metadata/fields/multienum.json index c5376d547d..c25cc33a62 100644 --- a/application/Espo/Resources/metadata/fields/multienum.json +++ b/application/Espo/Resources/metadata/fields/multienum.json @@ -15,8 +15,5 @@ } ], "notCreatable": true, - "search":{ - "basic":false, - "advanced":false - } + "filter": false } diff --git a/application/Espo/Resources/metadata/fields/password.json b/application/Espo/Resources/metadata/fields/password.json index e22769a146..5abdd453de 100644 --- a/application/Espo/Resources/metadata/fields/password.json +++ b/application/Espo/Resources/metadata/fields/password.json @@ -7,8 +7,5 @@ } ], "notCreatable": true, - "search":{ - "basic":false, - "advanced":false - } + "filter": false } diff --git a/application/Espo/Resources/metadata/fields/personName.json b/application/Espo/Resources/metadata/fields/personName.json index 28f451d78e..1b5d713851 100644 --- a/application/Espo/Resources/metadata/fields/personName.json +++ b/application/Espo/Resources/metadata/fields/personName.json @@ -18,10 +18,7 @@ "naming":"prefix", "mergable":false, "notCreatable": true, - "search":{ - "basic":true, - "advanced":true - }, + "filter": true, "fieldDefs":{ "default":"" } diff --git a/application/Espo/Resources/metadata/fields/phone.json b/application/Espo/Resources/metadata/fields/phone.json index 7834b5505c..8c4842bd3b 100644 --- a/application/Espo/Resources/metadata/fields/phone.json +++ b/application/Espo/Resources/metadata/fields/phone.json @@ -20,10 +20,7 @@ "data" ], "notCreatable": true, - "search":{ - "basic":true, - "advanced":true - }, + "filter": true, "fieldDefs":{ "notStorable":true } diff --git a/application/Espo/Resources/metadata/fields/text.json b/application/Espo/Resources/metadata/fields/text.json index 1e58e69b14..a219905eb8 100644 --- a/application/Espo/Resources/metadata/fields/text.json +++ b/application/Espo/Resources/metadata/fields/text.json @@ -14,8 +14,5 @@ "type":"int" } ], - "search":{ - "basic":true, - "advanced":true - } + "filter": true } diff --git a/application/Espo/Resources/metadata/fields/url.json b/application/Espo/Resources/metadata/fields/url.json index 9ff37a21fc..22e403f42a 100644 --- a/application/Espo/Resources/metadata/fields/url.json +++ b/application/Espo/Resources/metadata/fields/url.json @@ -14,10 +14,7 @@ "type":"int" } ], - "search":{ - "basic":true, - "advanced":true - }, + "filter": true, "fieldDefs":{ "type":"varchar" } diff --git a/application/Espo/Resources/metadata/fields/varchar.json b/application/Espo/Resources/metadata/fields/varchar.json index 8bf30f983a..44e5700813 100644 --- a/application/Espo/Resources/metadata/fields/varchar.json +++ b/application/Espo/Resources/metadata/fields/varchar.json @@ -14,8 +14,5 @@ "type":"int" } ], - "search":{ - "basic":true, - "advanced":true - } + "filter": true } diff --git a/frontend/client/src/field-manager.js b/frontend/client/src/field-manager.js index 77be9b553d..d000e1f702 100644 --- a/frontend/client/src/field-manager.js +++ b/frontend/client/src/field-manager.js @@ -30,20 +30,6 @@ _.extend(Espo.FieldManager.prototype, { metadata: null, - getSearchParams: function (fieldType) { - if (fieldType in this.defs) { - var res = this.defs[fieldType].search || {}; - if (!('basic' in res)) { - res.basic = true; - } - if (!('advanced' in res)) { - res.advanced = true; - } - return res; - } - return false; - }, - getParams: function (fieldType) { if (fieldType in this.defs) { return this.defs[fieldType].params || []; @@ -51,6 +37,17 @@ _.extend(Espo.FieldManager.prototype, { return []; }, + checkFilter: function (fieldType) { + if (fieldType in this.defs) { + if ('filter' in this.defs[fieldType]) { + return this.defs[fieldType].filter; + } else { + return false; + } + } + return false; + }, + isMergable: function (fieldType) { if (fieldType in this.defs) { if ('mergable' in this.defs[fieldType]) { diff --git a/frontend/client/src/views/admin/layouts/filters.js b/frontend/client/src/views/admin/layouts/filters.js index 964ec7dfa1..aa7b0992ba 100644 --- a/frontend/client/src/views/admin/layouts/filters.js +++ b/frontend/client/src/views/admin/layouts/filters.js @@ -84,8 +84,7 @@ Espo.define('Views.Admin.Layouts.Filters', 'Views.Admin.Layouts.Rows', function }, checkFieldType: function (type) { - var params = this.getFieldManager().getSearchParams(type) || {}; - return params.advanced; + return this.getFieldManager().checkFilter(type); }, validate: function () { From 8fd05547149b69029856d8073383b1a13c9c9dc7 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 28 Jul 2014 11:17:21 +0300 Subject: [PATCH 03/20] fix null filter issue --- frontend/client/src/views/search/filter.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/frontend/client/src/views/search/filter.js b/frontend/client/src/views/search/filter.js index c5ff1a666f..b05c20a465 100644 --- a/frontend/client/src/views/search/filter.js +++ b/frontend/client/src/views/search/filter.js @@ -36,17 +36,19 @@ Espo.define('Views.Search.Filter', 'View', function (Dep) { var name = this.name = this.options.name; var type = this.model.getFieldType(name); - var viewName = this.model.getFieldParam(name, 'view') || 'Fields.' + Espo.Utils.upperCaseFirst(type); + if (type) { + var viewName = this.model.getFieldParam(name, 'view') || 'Fields.' + Espo.Utils.upperCaseFirst(type); - this.createView('field', viewName, { - mode: 'search', - model: this.model, - el: this.options.el + ' .field', - defs: { - name: name, - }, - searchParams: this.options.params, - }); + this.createView('field', viewName, { + mode: 'search', + model: this.model, + el: this.options.el + ' .field', + defs: { + name: name, + }, + searchParams: this.options.params, + }); + } }, }); }); From c32b0f365b73b0b5218b02391a9ff4d3639248ec Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 28 Jul 2014 12:50:25 +0300 Subject: [PATCH 04/20] diff.js --- diff.js | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 diff.js diff --git a/diff.js b/diff.js new file mode 100644 index 0000000000..97c5a8d2ba --- /dev/null +++ b/diff.js @@ -0,0 +1,88 @@ +var versionFrom = process.argv[2]; + +if (process.argv.length < 3) { + throw new Error("No 'version from' passed"); +} + +var path = require('path'); +var fs = require('fs'); +var sys = require('sys') + +var version = (require('./package.json') || {}).version; + +var currentPath = path.dirname(fs.realpathSync(__filename)); + +var buildRelPath = 'build/EspoCRM-' + version; +var buildPath = currentPath + '/' + buildRelPath; +var diffFilePath = currentPath + '/build/diff'; + +var upgradePath = currentPath + '/build/EspoCRM-upgrade-' + versionFrom + '-' + version; + + +var exec = require('child_process').exec; + +function execute(command, callback) { + exec(command, function(error, stdout, stderr) { + callback(stdout); + }); +}; + +execute('git diff --name-only ' + versionFrom, function (stdout) { + if (!fs.existsSync(upgradePath)) { + fs.mkdirSync(upgradePath); + } + if (!fs.existsSync(upgradePath + '/files')) { + fs.mkdirSync(upgradePath + '/files'); + } + + var fileList = []; + + (stdout || '').split('\n').forEach(function (file) { + if (file == '') { + return; + } + fileList.push(file.replace('frontend/', '')); + }); + + fileList.push('client/espo.min.js'); + + fs.writeFileSync(diffFilePath, fileList.join('\n')); + + execute('git diff --name-only --diff-filter=D ' + versionFrom, function (stdout) { + var deletedFileList = []; + + (stdout || '').split('\n').forEach(function (file) { + if (file == '') { + return; + } + deletedFileList.push(file.replace('frontend/', '')); + }); + + process.chdir(buildPath); + execute('xargs -a ' + diffFilePath + ' cp --parents -t ' + upgradePath + '/files ' , function (stdout) { + + }); + + var d = new Date(); + var date = d.getFullYear().toString() + '-' + (d.getMonth() + 1).toString() + '-' + (d.getDate()).toString(); + + var manifest = { + "name": "EspoCRM Upgrade "+versionFrom+" to "+version, + "version": version, + "acceptableVersions": [ + versionFrom + ], + "releaseDate": date, + "author": "EspoCRM", + "description": "", + "delete": deletedFileList + } + + fs.writeFileSync(upgradePath + '/manifest.json', JSON.stringify(manifest, null, ' ')); + + fs.unlinkSync(diffFilePath) + + }); + +}); + From 3e3348c4a77617c18b5c70ee5852365356b9147a Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 28 Jul 2014 12:51:17 +0300 Subject: [PATCH 05/20] version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2fda45b1a7..073645e157 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "espocrm", - "version": "2.1.0", + "version": "2.1.1", "description": "", "main": "index.php", "repository": "", From d0b61b42e0fd76bf906e6c4463d5d0c2459faa9a Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 28 Jul 2014 12:54:33 +0300 Subject: [PATCH 06/20] fix diff --- diff.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diff.js b/diff.js index 97c5a8d2ba..031d3ca882 100644 --- a/diff.js +++ b/diff.js @@ -16,7 +16,7 @@ var buildRelPath = 'build/EspoCRM-' + version; var buildPath = currentPath + '/' + buildRelPath; var diffFilePath = currentPath + '/build/diff'; -var upgradePath = currentPath + '/build/EspoCRM-upgrade-' + versionFrom + '-' + version; +var upgradePath = currentPath + '/build/EspoCRM-upgrade-' + versionFrom + '-to-' + version; var exec = require('child_process').exec; From 08553bdf9d484aeefa92ce94684863ed9edbd8f2 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 28 Jul 2014 15:37:46 +0300 Subject: [PATCH 07/20] diff changes --- diff.js | 49 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/diff.js b/diff.js index 031d3ca882..c53406beeb 100644 --- a/diff.js +++ b/diff.js @@ -4,6 +4,8 @@ if (process.argv.length < 3) { throw new Error("No 'version from' passed"); } +var acceptedVersionName = process.argv[3] || versionFrom; + var path = require('path'); var fs = require('fs'); var sys = require('sys') @@ -16,7 +18,7 @@ var buildRelPath = 'build/EspoCRM-' + version; var buildPath = currentPath + '/' + buildRelPath; var diffFilePath = currentPath + '/build/diff'; -var upgradePath = currentPath + '/build/EspoCRM-upgrade-' + versionFrom + '-to-' + version; +var upgradePath = currentPath + '/build/EspoCRM-upgrade-' + acceptedVersionName + '-to-' + version; var exec = require('child_process').exec; @@ -64,21 +66,40 @@ execute('git diff --name-only ' + versionFrom, function (stdout) { }); var d = new Date(); - var date = d.getFullYear().toString() + '-' + (d.getMonth() + 1).toString() + '-' + (d.getDate()).toString(); - var manifest = { - "name": "EspoCRM Upgrade "+versionFrom+" to "+version, - "version": version, - "acceptableVersions": [ - versionFrom - ], - "releaseDate": date, - "author": "EspoCRM", - "description": "", - "delete": deletedFileList - } + var dateN = ((d.getMonth() + 1).toString()); + dateN = dateN.length == 1 ? '0' + dateN : dateN; - fs.writeFileSync(upgradePath + '/manifest.json', JSON.stringify(manifest, null, ' ')); + var date = d.getFullYear().toString() + '-' + dateN + '-' + (d.getDate()).toString(); + + execute('git tag', function (stdout) { + var versionList = []; + var occured = false; + tagList = stdout.split('\n').forEach(function (tag) { + if (tag == versionFrom) { + occured = true; + } + if (!tag || tag == version) { + return; + } + if (occured) { + versionList.push(tag); + } + }); + + var manifest = { + "name": "EspoCRM Upgrade "+acceptedVersionName+" to "+version, + "version": version, + "acceptableVersions": versionList, + "releaseDate": date, + "author": "EspoCRM", + "description": "", + "delete": deletedFileList + } + + fs.writeFileSync(upgradePath + '/manifest.json', JSON.stringify(manifest, null, ' ')); + + }); fs.unlinkSync(diffFilePath) From cbf9dd458e6e71ca2508bd1476ed3e4f4b1d3cb8 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Tue, 29 Jul 2014 13:06:15 +0300 Subject: [PATCH 08/20] diff change --- diff.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/diff.js b/diff.js index c53406beeb..a94f2ac0eb 100644 --- a/diff.js +++ b/diff.js @@ -48,6 +48,8 @@ execute('git diff --name-only ' + versionFrom, function (stdout) { fileList.push('client/espo.min.js'); + fileList.push('client/css/espo.min.css'); + fs.writeFileSync(diffFilePath, fileList.join('\n')); execute('git diff --name-only --diff-filter=D ' + versionFrom, function (stdout) { From 5a4613617cd2e268f6cf6f2f430545101ec632c5 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Tue, 29 Jul 2014 16:07:25 +0300 Subject: [PATCH 09/20] fix diff --- diff.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/diff.js b/diff.js index a94f2ac0eb..1c801fc0f9 100644 --- a/diff.js +++ b/diff.js @@ -36,6 +36,7 @@ execute('git diff --name-only ' + versionFrom, function (stdout) { if (!fs.existsSync(upgradePath + '/files')) { fs.mkdirSync(upgradePath + '/files'); } + process.chdir(buildPath); var fileList = []; @@ -62,7 +63,7 @@ execute('git diff --name-only ' + versionFrom, function (stdout) { deletedFileList.push(file.replace('frontend/', '')); }); - process.chdir(buildPath); + execute('xargs -a ' + diffFilePath + ' cp --parents -t ' + upgradePath + '/files ' , function (stdout) { }); From 149fa41e2b5808b10bedda5d3d3dd7b4e9be63b5 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Tue, 29 Jul 2014 17:19:00 +0300 Subject: [PATCH 10/20] textFilter --- application/Espo/Core/SelectManagers/Base.php | 17 ++++++++++ .../metadata/entityDefs/Account.json | 3 +- .../Resources/metadata/entityDefs/Call.json | 3 +- .../metadata/entityDefs/Contact.json | 3 +- .../Resources/metadata/entityDefs/Lead.json | 3 +- .../metadata/entityDefs/Meeting.json | 3 +- .../metadata/entityDefs/Opportunity.json | 3 +- .../Resources/metadata/entityDefs/Target.json | 3 +- .../Resources/metadata/entityDefs/Task.json | 3 +- .../client/res/templates/record/search.tpl | 4 +-- frontend/client/src/search-manager.js | 31 +++++++------------ frontend/client/src/views/record/search.js | 29 ++++++----------- 12 files changed, 47 insertions(+), 58 deletions(-) diff --git a/application/Espo/Core/SelectManagers/Base.php b/application/Espo/Core/SelectManagers/Base.php index a7cb2c1c82..74c73a6fff 100644 --- a/application/Espo/Core/SelectManagers/Base.php +++ b/application/Espo/Core/SelectManagers/Base.php @@ -82,6 +82,11 @@ class Base } } } + + protected function getTextFilterFields() + { + return $this->metadata->get("entityDefs.{$this->entityName}.collection.textFilterFields", array('name')); + } protected function where($params, &$result) { @@ -96,6 +101,18 @@ class Base $params['where'][] = $p; } } + } else if ($item['type'] == 'textFilter' && !empty($item['value'])) { + if (!empty($item['value'])) { + if (empty($result['whereClause'])) { + $result['whereClause'] = array(); + } + $fieldList = $this->getTextFilterFields(); + $d = array(); + foreach ($fieldList as $field) { + $d[$field . '*'] = $item['value'] . '%'; + } + $where['OR'] = $d; + } } } diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Account.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Account.json index 10ab1881dd..af9b9610f9 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Account.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Account.json @@ -155,7 +155,6 @@ }, "collection": { "sortBy": "name", - "asc": true, - "boolFilters": ["onlyMy"] + "asc": true } } diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json index 5dd8ed6797..8e58a5235d 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Call.json @@ -148,7 +148,6 @@ }, "collection": { "sortBy": "dateStart", - "asc": false, - "boolFilters": ["onlyMy"] + "asc": false } } diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json index dec63d2b35..cbae898ba2 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json @@ -183,7 +183,6 @@ }, "collection": { "sortBy": "name", - "asc": true, - "boolFilters": ["onlyMy"] + "asc": true } } diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json index dfe5755c82..a9178832a3 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json @@ -189,7 +189,6 @@ }, "collection": { "sortBy": "createdAt", - "asc": false, - "boolFilters": ["onlyMy"] + "asc": false } } diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json index 69a1eaf423..2d6b57a976 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Meeting.json @@ -143,7 +143,6 @@ }, "collection": { "sortBy": "dateStart", - "asc": false, - "boolFilters": ["onlyMy"] + "asc": false } } diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Opportunity.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Opportunity.json index f31c43c239..864182c730 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Opportunity.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Opportunity.json @@ -125,7 +125,6 @@ }, "collection": { "sortBy": "createdAt", - "asc": false, - "boolFilters": ["onlyMy"] + "asc": false } } diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Target.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Target.json index 4398cab884..c1cd05f74f 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Target.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Target.json @@ -108,7 +108,6 @@ }, "collection": { "sortBy": "createdAt", - "asc": false, - "boolFilters": ["onlyMy"] + "asc": false } } diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Task.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Task.json index c08c1a621e..18b2227153 100644 --- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Task.json +++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Task.json @@ -87,7 +87,6 @@ }, "collection": { "sortBy": "createdAt", - "asc": false, - "boolFilters": ["onlyMy"] + "asc": false } } diff --git a/frontend/client/res/templates/record/search.tpl b/frontend/client/res/templates/record/search.tpl index ad12dc3b4d..6c32a1b496 100644 --- a/frontend/client/res/templates/record/search.tpl +++ b/frontend/client/res/templates/record/search.tpl @@ -7,7 +7,7 @@ -