Improved: Added user friendly error message in duplicateProduct service, if passed productId already exists than return uer friendly error message instead of entity exception.
(OFBIZ-7402)
Thanks Arvind and Padma for reporting the issue.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1773213 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/applications/product/minilang/product/product/ProductServices.xml b/applications/product/minilang/product/product/ProductServices.xml
index 93c21e3..45ed001 100644
--- a/applications/product/minilang/product/product/ProductServices.xml
+++ b/applications/product/minilang/product/product/ProductServices.xml
@@ -167,6 +167,12 @@
<call-simple-method method-name="checkProductRelatedPermission"/>
<set value="DELETE" field="checkAction"/>
<call-simple-method method-name="checkProductRelatedPermission"/>
+ <entity-one entity-name="Product" value-field="dummyProduct">
+ <field-map field-name="productId" from-field="parameters.productId"/>
+ </entity-one>
+ <if-not-empty field="dummyProduct">
+ <add-error ><fail-property resource="CommonErrorUiLabels" property="CommonErrorDuplicateKey" /></add-error>
+ </if-not-empty>
<check-errors/>
<!-- look up the old product and clone it -->