Skip to content

Commit

Permalink
Merge pull request #19747 from colemanw/searchKitRemoveSelectWhenRemo…
Browse files Browse the repository at this point in the history
…vingJoin

SearchKit - Fix removing all related fields from SELECT when removing a JOIN
  • Loading branch information
eileenmcnaughton authored Mar 7, 2021
2 parents c16fd30 + 133f6a1 commit a87f4bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ext/search/ang/crmSearchAdmin/crmSearchAdmin.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@
var alias = searchMeta.getJoin(ctrl.savedSearch.api_params.join[index][0]).alias;
ctrl.clearParam('join', index);
_.remove(ctrl.savedSearch.api_params.select, function(item) {
return item.indexOf(alias + '.') === 0;
var pattern = new RegExp('\\b' + alias + '\\.');
return pattern.test(item.split(' AS ')[0]);
});
_.remove(ctrl.savedSearch.api_params.where, function(clause) {
return clauseUsesJoin(clause, alias);
Expand Down

0 comments on commit a87f4bb

Please sign in to comment.