SearchKit - Fix option loading & rendering for in-place edit
authorColeman Watts <coleman@civicrm.org>
Sat, 17 Dec 2022 23:02:15 +0000 (18:02 -0500)
committerColeman Watts <coleman@civicrm.org>
Sat, 17 Dec 2022 23:02:56 +0000 (18:02 -0500)
Fixes dev/core#4037

ext/search_kit/ang/crmSearchAdmin.module.js
ext/search_kit/ang/crmSearchTasks/crmSearchInput/crmSearchInputVal.component.js

index 88f3ec77c500372a1d10596d8dee501a30bf5e31..54d3322809843496865b9dfd44c7d7147b9891a5 100644 (file)
               _.each(results, function(fields, entityName) {
                 var entity = getEntity(entityName);
                 _.each(fields, function(options, fieldName) {
-                  _.find(entity.fields, {name: fieldName}).options = options;
+                  var field = _.find(entity.fields, {name: fieldName});
+                  if (field) {
+                    field.options = options;
+                  }
                 });
                 entity.optionsLoaded = true;
               });
index f55cce68d4bb6f93644e4fb9860f1886834f8a3b..0168ba0d20854daa592c3d20e65717278580c72a 100644 (file)
 
         if (!_.includes(['>', '<', '>=', '<='], ctrl.op)) {
           // Only use option list if the field has a "name" suffix
-          if (field.options && field.suffixes && field.suffixes.includes('name')) {
+          if (field.options && (!field.suffixes || field.suffixes.includes('name'))) {
             return '~/crmSearchTasks/crmSearchInput/select.html';
           }
           if (field.fk_entity || field.name === 'id') {