1) Extract a clean instance of Liferay 6.2 SP16
2) Start server and login with admin
3) Navigate to Document and Media portlet
4) Add document with type 'Contract'.
5) In Status drop-down, select value - 'In Review'.
6) Click on publish.
7) Search for "Review".
8) the document published will be available in the search result.
Up-till this point everything is working as expected
9) Now edit this document.
10) change document type from contract to - Marketing Banner
11) select business goal drop down to value - Lead Generation
12) click on publish
13) Search for "Review" once again (the attribute which should ideally not exist).
Observed Behavior: the document is still available in the search result.
Expected Behavior: the document should not be available in search result as it has been edited and the document type has been changed where 'Review' doesn't exist.
Cause of the issue is that while creating a new version and changing the document type, it calls
com.liferay.portlet.documentlibrary.service.impl.DLFileEntryLocalServiceImpl.checkOutFileEntry(long, long, String, long, ServiceContext) (added since
The fields for the previous versions are shown because during checkout the DDM field contents are copied from the old version to the new, even when the new version has a different document type with different fields.
The solution is to prevent the metadata copy when the document types are different.