hhuijser/liferay-portal — pull request #1812 by jonathanmccann (2014-03-27 22:35:42+00:00)
Title: LPS-45479

Hey Hugo,

This is the pull I IM'd you about. Like I said I'm not sure about this one. The issue is that when editing a document, the previous metadata is copied and then overwritten by the new values that are entered. The issue is that if you modify a Document Type and make a field required, and that field in the previous metadata is null, it will fail a validation check (the field is required but the value is null). This fix adds in a new parameter to specify whether or not the metadata is being added or copied and if it is being copied, then the validation check is skipped. It can be skipped because when it was initially added (or updated) it'll run through that check so there's no need to do it twice.

I thought about making a new method copyFileEntryMetadata instead of using the existing updateFileEntryMetadata, but the two methods would do the same thing so I didn't want to duplicate the logic. Let me know if your thoughts on it. Thanks.