Lost a few hairs yesterday trying to fix this problem... I'd made some changes to an HTML Envelope web part on several page templates and a transformation on our dev server -- replacing H1 tags with H2's in the HTML before and after to improve our SEO placement (can't have too many H1's on a page, you know). After reviewing the changes with our web content manager, I used the content staging module to push just those changed templates and the transformation to our QA/Production environment (after also making sure that none of the other object changes in the Content Staging list had anything to do with those templates or the transformation).
A day later, he noticed that on our production website a number of pages were missing a background banner image and the H1 text that overlays that image. Like any good programmer, I started digging around in the code to make sure that I'd not inadvertently changed anything related to the banner. As near as I've been able to determine, the code is identical on both dev and QA/Prod. Hairs were lost here...
What I did notice is that the two things that were broken in the banner web part both made reference to the .Parent document. The banner web part is a Document Attachments web part, and it looks for an attached image to use as the background graphic, calls the transformation to build the needed markup to display it, and sets the banner text to the document name. BUT, if there is no attachment, the No Data Behavior, No Record Found Text is used instead:
<section id="banner" style="background-image:url(/getattachment/{%CurrentDocument.Parent.Attachments.FirstItem.AttachmentGUID%}
</h1>
</div>
</section>
</section>
</section>
After using the Content Staging module to push the templates to QA/Prod, the values returned by these macros was NULL, resulting in the background-image:url(/getattachment/); and the H1 text being empty.
Later afternoon troubleshooting with the web content manager on a web conference, I added some static text to the H1 after the macro, and clicked the OK button on the Banner web part configuration popup. Reloading the page in another browser (Internet Explorer, not logged in to Kentico), I saw that, surprisingly, the background image was now being loaded, the parent document name appeared, and then the expected static text I just added showed up. I went back into the Banner config popup and removed my static text, and hit OK. Reloading in the other browser resulted in a correctly functioning page including the expected graphic and text. Navigating in IE to any other page that uses that template showed that all of them were now functioning properly.
The workaround fix for all the other broken pages was to edit the templates on QA/Prod, open the Banner web part config popup, then click OK, WITHOUT MAKING ANY CHANGES. Loading any of the pages that use that template in IE showed that the banner graphic and banner H1 text were now properly resolving the .Parent. value and showing the expected image and text.
I have no idea why the .Parent relationship appears to break after using Content Staging to move the page template, nor why changing nothing and clicking OK in the web part config restores the relationship. This appears to be a bug, unless I missed something very important about content staging and page templates.
-matt