From 506cd41433ec54e76822631f980ae214d19591ed Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 2 Jul 2014 18:54:19 -0700 Subject: [PATCH] CRM-14798 - crmCaseType - Fix leak of activity-types when making multiple case-types 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". --- js/angular-crmCaseType.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/angular-crmCaseType.js b/js/angular-crmCaseType.js index 6a1bc9a50f..1c47d9bf09 100644 --- a/js/angular-crmCaseType.js +++ b/js/angular-crmCaseType.js @@ -6,6 +6,7 @@ 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 } @@ -46,7 +47,7 @@ } else { return { title: "", name: "", is_active: "1", weight: "1", - definition: _.extend({}, newCaseTypeDefinitionTemplate) }; + definition: _.cloneDeep(newCaseTypeDefinitionTemplate) }; } } } -- 2.25.1