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) {
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.
* @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") : '');
},
/**
},
'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.'),
+ 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': {
ufGroupModel: this
});
paletteFieldCollection.sync = function(method, model, options) {
- options || (options = {});
+ if (!options) options = {};
// console.log(method, model, options);
switch (method) {
case 'read':
case 'create':
case 'update':
case 'delete':
+ throw 'Unsupported method: ' + method;
+
default:
throw 'Unsupported method: ' + method;
}
checkGroupType: function(validTypesExpr, allowAllSubtypes) {
var allMatched = true;
allowAllSubtypes = allowAllSubtypes || false;
- if (! this.get('group_type') || this.get('group_type') == '') {
+ if (_.isEmpty(this.get('group_type'))) {
return true;
}