If you make case type "Example 1" with an activity list, and if you then make
another case type "Example 2", the activity list form "Example 1" gets applied
to "Example 2" -- because the shared template was inappropriately modified
by "Example 1".
var crmCaseType = angular.module('crmCaseType', ['ngRoute', 'ui.utils', 'crmUi', 'unsavedChanges']);
+ // Note: This template will be passed to cloneDeep(), so don't put any funny stuff in here!
var newCaseTypeDefinitionTemplate = {
activityTypes: [
{name: 'Open Case', max_instances: 1 }
}
else {
return { title: "", name: "", is_active: "1", weight: "1",
- definition: _.extend({}, newCaseTypeDefinitionTemplate) };
+ definition: _.cloneDeep(newCaseTypeDefinitionTemplate) };
}
}
}