From: Coleman Watts Date: Tue, 30 Nov 2021 17:02:47 +0000 (-0500) Subject: SearchKit - Fix regression for pseudoconstant selection X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=860f7244714109f58ce8bd96476de96e3f2d7919;p=civicrm-core.git SearchKit - Fix regression for pseudoconstant selection Fixes dev/report#83 --- diff --git a/ext/search_kit/ang/crmSearchAdmin/crmSearchClause.component.js b/ext/search_kit/ang/crmSearchAdmin/crmSearchClause.component.js index de886f38eb..558e4817b6 100644 --- a/ext/search_kit/ang/crmSearchAdmin/crmSearchClause.component.js +++ b/ext/search_kit/ang/crmSearchAdmin/crmSearchClause.component.js @@ -61,16 +61,21 @@ } } - this.getField = function(expr) { + // Gets the first arg of type "field" + function getFirstArgFromExpr(expr) { if (!(expr in meta)) { meta[expr] = _.findWhere(searchMeta.parseExpr(expr).args, {type: 'field'}); } - return meta[expr] && meta[expr].field; + return meta[expr] || {}; + } + + this.getField = function(expr) { + return getFirstArgFromExpr(expr).field; }; this.getOptionKey = function(expr) { - var field = ctrl.getField(expr) || {}; - return field.suffix ? field.suffix.slice(1) : 'id'; + var arg = getFirstArgFromExpr(expr); + return arg.suffix ? arg.suffix.slice(1) : 'id'; }; this.addGroup = function(op) {