Search kit: Fix bug when showing functions in HAVING clause
authorColeman Watts <coleman@civicrm.org>
Tue, 2 Feb 2021 15:09:53 +0000 (10:09 -0500)
committerColeman Watts <coleman@civicrm.org>
Tue, 2 Feb 2021 18:35:43 +0000 (13:35 -0500)
ext/search/ang/crmSearchAdmin.module.js
ext/search/ang/crmSearchAdmin/crmSearchAdmin.component.js

index 824e68db3515c9dc0454fffe2130624b669bfa77..9d4b86bca606a472422e1431f5af4b25775e5f06 100644 (file)
           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) {
index e1deda0be6358bcb58cf001c312c4ea9f5c5e575..de4b1bfed38d1321aa6686a58bdceb7ef6a77ccb 100644 (file)
 
       $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)});
         })};
       };