Skip to content

Commit

Permalink
Merge pull request #22130 from colemanw/fixSearchKitHaving
Browse files Browse the repository at this point in the history
SearchKit - Fix selecting HAVING operator
  • Loading branch information
colemanw authored Nov 24, 2021
2 parents 05df8f5 + df88f71 commit 0c13e17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
12 changes: 5 additions & 7 deletions ext/search_kit/ang/crmSearchAdmin/crmSearchClause.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,15 @@
}

this.getField = function(expr) {
if (!meta[expr]) {
meta[expr] = searchMeta.parseExpr(expr).args[0];
if (!(expr in meta)) {
meta[expr] = _.findWhere(searchMeta.parseExpr(expr).args, {type: 'field'});
}
return meta[expr].field;
return meta[expr] && meta[expr].field;
};

this.getOptionKey = function(expr) {
if (!meta[expr]) {
meta[expr] = _.findWhere(searchMeta.parseExpr(expr).args, {type: 'field'});
}
return meta[expr].suffix ? meta[expr].suffix.slice(1) : 'id';
var field = ctrl.getField(expr) || {};
return field.suffix ? field.suffix.slice(1) : 'id';
};

this.addGroup = function(op) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
ctrl = this;

this.$onInit = function() {
var rendered = false;
var rendered = false,
field = this.field || {};
ctrl.dateRanges = CRM.crmSearchTasks.dateRanges;
ctrl.entity = ctrl.field.fk_entity || ctrl.field.entity;
ctrl.entity = field.fk_entity || field.entity;

this.ngModel.$render = function() {
ctrl.value = ctrl.ngModel.$viewValue;
if (!rendered && ctrl.field.input_type === 'Date') {
if (!rendered && field.input_type === 'Date') {
setDateType();
}
rendered = true;
Expand Down

0 comments on commit 0c13e17

Please sign in to comment.