X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2Fmodel%2Fcrm.uf.js;h=9ed880d157e988927164f0d5c9ac3326b460ba65;hb=fb079bbfc490982a09751b5e1f6ac94ba499e573;hp=392d0a44141cd4e1c44823eb452f8dfd6dae2936;hpb=99e239bc880ee0a9165f97c8594a3046c4238295;p=civicrm-core.git diff --git a/js/model/crm.uf.js b/js/model/crm.uf.js index 392d0a4414..9ed880d157 100644 --- a/js/model/crm.uf.js +++ b/js/model/crm.uf.js @@ -48,14 +48,14 @@ var coreTypesExpr = parts[0]; var subTypesExpr = parts[1]; - if (coreTypesExpr && coreTypesExpr != '') { + if (!_.isEmpty(coreTypesExpr)) { _.each(coreTypesExpr.split(','), function(coreType){ typeList.coreTypes[coreType] = true; }); } //CRM-15427 Allow Multiple subtype filtering - if (subTypesExpr && subTypesExpr != '') { + if (!_.isEmpty(subTypesExpr)) { if (subTypesExpr.indexOf(';;') !== -1) { var subTypeparts = subTypesExpr.replace(/;;/g,'\0').split('\0'); _.each(subTypeparts, function(subTypepart) { @@ -104,9 +104,14 @@ case 'Case': return 'case_1'; default: - throw "Cannot guess entity name for field_type=" + field_type; + if (!$.isEmptyObject(CRM.contactSubTypes) && ($.inArray(field_type,CRM.contactSubTypes) > -1)) { + return 'contact_1'; + } + else { + throw "Cannot guess entity name for field_type=" + field_type; + } } - } + }; /** * Represents a field in a customizable form. @@ -240,10 +245,10 @@ * @return {String} */ getSignature: function() { - return this.get("entity_name") - + '::' + this.get("field_name") - + '::' + (this.get("location_type_id") ? this.get("location_type_id") : '') - + '::' + (this.get("phone_type_id") ? this.get("phone_type_id") : ''); + return this.get("entity_name") + + '::' + this.get("field_name") + + '::' + (this.get("location_type_id") ? this.get("location_type_id") : '') + + '::' + (this.get("phone_type_id") ? this.get("phone_type_id") : ''); }, /** @@ -491,14 +496,14 @@ }, 'help_post': { title: ts('Post-form Help'), - help: ts('Explanatory text displayed at the end of the form.') - + ts('Note that this help text is displayed on profile create/edit screens only.'), + help: ts('Explanatory text displayed at the end of the form.') + + ts('Note that this help text is displayed on profile create/edit screens only.'), type: 'TextArea' }, 'help_pre': { - title: ts('Pre-form Help '), - help: ts('Explanatory text displayed at the beginning of the form.') - + ts('Note that this help text is displayed on profile create/edit screens only.'), + title: ts('Pre-form Help'), + help: ts('Explanatory text displayed at the beginning of the form.') + + ts('Note that this help text is displayed on profile create/edit screens only.'), type: 'TextArea' }, 'is_active': { @@ -525,7 +530,7 @@ options: YESNO }, 'is_proximity_search': { - title: ts('Proximity search'), + title: ts('Proximity Search'), help: ts('FIXME'), type: 'Select', options: YESNO // FIXME @@ -593,7 +598,7 @@ ufGroupModel: this }); paletteFieldCollection.sync = function(method, model, options) { - options || (options = {}); + if (!options) options = {}; // console.log(method, model, options); switch (method) { case 'read': @@ -608,6 +613,8 @@ case 'create': case 'update': case 'delete': + throw 'Unsupported method: ' + method; + default: throw 'Unsupported method: ' + method; } @@ -666,9 +673,10 @@ * @return {Boolean} */ //CRM-15427 - checkGroupType: function(validTypesExpr, allowAllSubtypes = false) { + checkGroupType: function(validTypesExpr, allowAllSubtypes) { var allMatched = true; - if (! this.get('group_type') || this.get('group_type') == '') { + allowAllSubtypes = allowAllSubtypes || false; + if (_.isEmpty(this.get('group_type'))) { return true; }