Allow for the primary media for a sku to be removed#1410
Allow for the primary media for a sku to be removed#1410jefffischer merged 4 commits intoBroadleafCommerce-4.0.xfrom
Conversation
|
This looks like something that should be tested in community |
|
BroadleafCommerce/QA#256 |
|
This is close, but unfortunately it breaks down under the following scenario:
The problem is that the original clear creates a delete record in BLC_SKU_MEDIA_MAP, and then the subsequent setting of a different image creates an add record in BLC_SKU_MEDIA_MAP. The revert only ends up archiving the add record and the delete record is essentially orphaned. This enhancement needs to, upon every save, revert any existing changes to primary media before applying a different change to primary media. This guarantees there is only ever one active change for this property in the user sandbox. We do something similar to this for defaultCategory on product. In EnterpriseProductCustomPersistenceHandlerExtensionHandler.manageParentCategoryForUpdate(..), the revertExistingUserEdits(..) call performs a similar function for defaultCategory property. In MediaFieldPersistenceProvider, you need to add an extension point to the MediaFieldPersistenceProviderExtensionHandler interface and implement your similar "revertExistingUserEdits" code in the extension point in WorkflowMediaFieldPersistenceProviderExtensionHandler. |
…-media Allow for the primary media for a sku to be removed
This fixes #1228 by adding a GUI button that clears the image and value so that "null" is sent to the server. Next the old media object is removed from the database since the newMedia object is null. Lastly the sku-media map entry for its primary image is removed.