From e9b2261aaba589c031ea57b9821cbdf898c74d3e Mon Sep 17 00:00:00 2001 From: Morten Christensen Date: Tue, 26 Feb 2013 11:30:19 -0100 Subject: [PATCH] Fixes the moving of a PropertyType from a named tab to generic properties --- .../Persistence/Factories/PropertyGroupFactory.cs | 6 ++++++ .../Persistence/Repositories/ContentTypeBaseRepository.cs | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs b/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs index 92ac5a55ba..0e35cb956d 100644 --- a/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs +++ b/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs @@ -108,7 +108,13 @@ namespace Umbraco.Core.Persistence.Factories }; if (tabId != default(int)) + { propertyTypeDto.PropertyTypeGroupId = tabId; + } + else + { + propertyTypeDto.PropertyTypeGroupId = null; + } if (propertyType.HasIdentity) propertyTypeDto.Id = propertyType.Id; diff --git a/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs index db3b846851..ca52678b91 100644 --- a/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs @@ -255,9 +255,11 @@ namespace Umbraco.Core.Persistence.Repositories propertyGroup.Id = groupPrimaryKey; //Set Id on new PropertyGroup //Ensure that the PropertyGroup's Id is set on the PropertyTypes within a group + //unless the PropertyGroupId has already been changed. foreach (var propertyType in propertyGroup.PropertyTypes) { - propertyType.PropertyGroupId = propertyGroup.Id; + if(propertyType.IsPropertyDirty("PropertyGroupId") == false) + propertyType.PropertyGroupId = propertyGroup.Id; } }