U4-2053 - 6.1 Beta: Document type inheritance is broken

Created by Stephan 05 Apr 2013, 08:41:29 Updated by Morten Christensen 16 Apr 2013, 20:18:44

When creating a new child document type, it seems that the link to the parent is not done: documents of that type do not inherit tabs, properties, nothing, from the parent.

Comments

Tom Fulton 09 Apr 2013, 22:47:23

Same issue here - properties/tabs are not getting inherited!


Eugene Deftsite 10 Apr 2013, 20:25:18

Same issue. Manual fix - add record to [cmsContentType2ContentType] table and touch web.config file before any documentType save.


Tom Fulton 16 Apr 2013, 16:48:44

Narrowed this down to changeset [http://umbraco.codeplex.com/SourceControl/changeset/b79c1aa06140 b79c1aa06140] where it breaks - unfortunately I have no idea what's going on here - just hope this saves someone some time.

Note if you attempt to checkout this revision it won't build, you need to replace Umbraco.Web.Cache.DistributedCache.cs with the contents from [http://umbraco.codeplex.com/SourceControl/changeset/4335138b91a6#src/Umbraco.Web/Cache/DistributedCache.cs this checkin] (seems it was missed)


Stephan 16 Apr 2013, 16:52:28

Aha, then it would be Shannon's not Morten's. Transferring ownership.


Tom Fulton 16 Apr 2013, 17:12:04

Actually, it may be back on Morten's plate as I think it's a problem with the ContentTypeService.

On line 49 [here|http://umbraco.codeplex.com/SourceControl/changeset/b79c1aa06140#src/Umbraco.Web/umbraco.presentation/umbraco/create/nodetypeTasks.cs] it creates the new Content Type and passes in the parent type ID which is coming through correctly. But this apparently doesn't add any record to the cmsContentType2ContentType table.

I can reproduce with some test code below that creates two doctypes. Both get created succesfully and show as nested in the backend, but the DB entry in the above table is missing:

protected void CreateTestTypes(object sender, EventArgs e) { var parentContentType = new ContentType(-1); parentContentType.CreatorId = 0; parentContentType.Alias = "SomeParentDoctype"; parentContentType.Icon = "folder.gif"; parentContentType.Name = "SoemParentDoctype"; ApplicationContext.Current.Services.ContentTypeService.Save(parentContentType);

        var childContentType = new ContentType(parentContentType.Id);
        childContentType.CreatorId = 0;
        childContentType.Alias = "SomeChildDoctype";
        childContentType.Icon = "folder.gif";
        childContentType.Name = "SomeChildDoctype";
        ApplicationContext.Current.Services.ContentTypeService.Save(childContentType);

        ltlStatus.Text = "Done";
    }{code}


Shannon Deminick 16 Apr 2013, 17:14:22

reassigned :)


Morten Christensen 16 Apr 2013, 19:20:37

Fixed in changeset 36857fed953e


Tom Fulton 16 Apr 2013, 19:56:51

Nice - thanks!

Any strategy for those of us with existing corrupt doctypes? Tried re-saving master/child but no dice.

Think just adding the record in cmsContentType2ContentType is good enough (and safe)?


Morten Christensen 16 Apr 2013, 20:18:44

Yes, its safe. You just need to clear cache once you have added the missing entries to the table.


Priority: Major

Type: Bug

State: Fixed

Assignee: Morten Christensen

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 6.1.0

Due in version: 6.1.0

Sprint:

Story Points:

Cycle: