From ba226c0491a5b0d37c050bef7fe5c9d9f586c613 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 2 Feb 2021 10:09:53 -0500 Subject: [PATCH] Search kit: Fix bug when showing functions in HAVING clause --- ext/search/ang/crmSearchAdmin.module.js | 2 +- ext/search/ang/crmSearchAdmin/crmSearchAdmin.component.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ext/search/ang/crmSearchAdmin.module.js b/ext/search/ang/crmSearchAdmin.module.js index 824e68db35..9d4b86bca6 100644 --- a/ext/search/ang/crmSearchAdmin.module.js +++ b/ext/search/ang/crmSearchAdmin.module.js @@ -170,7 +170,7 @@ return; } var splitAs = expr.split(' AS '), - info = {fn: null, modifier: ''}, + info = {fn: null, modifier: '', field: {}}, fieldName = splitAs[0], bracketPos = splitAs[0].indexOf('('); if (bracketPos >= 0) { diff --git a/ext/search/ang/crmSearchAdmin/crmSearchAdmin.component.js b/ext/search/ang/crmSearchAdmin/crmSearchAdmin.component.js index e1deda0be6..de4b1bfed3 100644 --- a/ext/search/ang/crmSearchAdmin/crmSearchAdmin.component.js +++ b/ext/search/ang/crmSearchAdmin/crmSearchAdmin.component.js @@ -659,7 +659,8 @@ $scope.fieldsForHaving = function() { return {results: _.transform(ctrl.savedSearch.api_params.select, function(fields, name) { - fields.push({id: name, text: ctrl.getFieldLabel(name)}); + var info = searchMeta.parseExpr(name); + fields.push({id: info.alias + info.suffix, text: ctrl.getFieldLabel(name)}); })}; }; -- 2.25.1