X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2Fmodel%2Fcrm.uf.js;h=e72c8383c58aa7efb4e010c571b29955f5adbc2a;hb=66663184e286093a2eb87adccfbacc618898bb62;hp=ca9fdd255d00bdc7c09c6b117f49773155ff8416;hpb=ff0eef159a6bd2b662a6d6576ecec401147f5f38;p=civicrm-core.git diff --git a/js/model/crm.uf.js b/js/model/crm.uf.js index ca9fdd255d..e72c8383c5 100644 --- a/js/model/crm.uf.js +++ b/js/model/crm.uf.js @@ -87,6 +87,8 @@ return 'membership_1'; case 'Participant': return 'participant_1'; + case 'Case': + return 'case_1'; default: throw "Cannot guess entity name for field_type=" + field_type; } @@ -687,7 +689,13 @@ // set proper entity model based on selected profile var contactTypes = ['Individual', 'Household', 'Organization']; var profileType = ufGroupModel.get('group_type') || ''; + + // check if selected profile have subtype defined eg: ["Individual,Contact,Case", "caseType:7"] + if (_.isArray(profileType) && profileType[0]) { + profileType = profileType[0]; + } profileType = profileType.split(','); + var ufEntityModel; _.each(profileType, function (ptype) { if ($.inArray(ptype, contactTypes) > -1) { @@ -703,7 +711,7 @@ var newUfEntityModels = []; _.each(allEntityModels, function (values) { - if (values.entity_name == 'contact_1') { + if (entityType && values.entity_name == 'contact_1') { values.entity_type = entityType; } newUfEntityModels.push(new CRM.UF.UFEntityModel(values));