Author: sascharodekamp
Date: Tue Nov 29 14:49:44 2011 New Revision: 1207891 URL: http://svn.apache.org/viewvc?rev=1207891&view=rev Log: IMPROVEMENT: When creating a new product for a productId which already exists, an user unfriendly exception will be shown in the backend. I added a quick check to see that the ID is not in use, otherwise a user friendly error text will be shown. Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml ofbiz/trunk/framework/common/config/CommonErrorUiLabels.xml Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml?rev=1207891&r1=1207890&r2=1207891&view=diff ============================================================================== --- ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml (original) +++ ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml Tue Nov 29 14:49:44 2011 @@ -35,7 +35,12 @@ under the License. <sequenced-id sequence-name="Product" field="newEntity.productId"/> <else> <check-id field="newEntity.productId"/> - <check-errors/> + <check-errors /> + <entity-one value-field="dummyProduct" entity-name="Product"><field-map field-name="productId" from-field="parameters.productId"/></entity-one> + <if-not-empty field="dummyProduct"> + <add-error ><fail-property resource="CommonErrorUiLabels" property="CommonErrorDublicateKey" /></add-error> + </if-not-empty> + <check-errors /> </else> </if-empty> <field-to-result field="newEntity.productId" result-name="productId"/> @@ -1059,7 +1064,7 @@ under the License. <entity-one entity-name="ProductGroupOrder" value-field="productGroupOrder"/> <set-nonpk-fields value-field="productGroupOrder" map="parameters"/> <store-value value-field="productGroupOrder"/> - + <entity-one entity-name="JobSandbox" value-field="jobSandbox"> <field-map field-name="jobId" from-field="productGroupOrder.jobId"/> </entity-one> @@ -1067,7 +1072,7 @@ under the License. <set field="jobSandbox.runTime" from-field="parameters.thruDate"/> <store-value value-field="jobSandbox"/> </if-not-empty> - + <entity-one value-field="systemUserLogin" entity-name="UserLogin"> <field-map field-name="userLoginId" value="system"/> </entity-one> @@ -1075,7 +1080,7 @@ under the License. <set field="checkProductGroupOrderExpiredMap.userLogin" from-field="systemUserLogin"/> <set field="checkProductGroupOrderExpiredMap.groupOrderId" from-field="productGroupOrder.groupOrderId"/> <call-service service-name="checkProductGroupOrderExpired" in-map-name="checkProductGroupOrderExpiredMap"/> - + <set field="cancelScheduledJobMap.userLogin" from-field="systemUserLogin"/> <set field="cancelScheduledJobMap.jobId" from-field="productGroupOrder.jobId"/> <call-service service-name="cancelScheduledJob" in-map-name="cancelScheduledJobMap"/> @@ -1098,7 +1103,7 @@ under the License. <set field="runtimeDataId" from-field="runtimeData.runtimeDataId"/> <set field="runtimeData.runtimeInfo" from-field="runtimeInfo"/> <create-value value-field="runtimeData"/> - + <!-- Create Job For ProductGroupOrder --> <make-value entity-name="JobSandbox" value-field="jobSandbox"/> <sequenced-id sequence-name="JobSandbox" field="jobSandbox.jobId"/> @@ -1112,7 +1117,7 @@ under the License. <set field="jobSandbox.runtimeDataId" from-field="runtimeDataId"/> <set field="jobSandbox.maxRecurrenceCount" value="1" type="Long"/> <create-value value-field="jobSandbox"/> - + <entity-one entity-name="ProductGroupOrder" value-field="productGroupOrder"/> <set field="productGroupOrder.jobId" from-field="jobId"/> <store-value value-field="productGroupOrder"/> @@ -1137,12 +1142,12 @@ under the License. </calcop> </calculate> <store-value value-field="productGroupOrder"/> - + <if-compare field="productGroupOrder.soldOrderQty" operator="equals" value="${productGroupOrder.reqOrderQty}"> <set field="checkProductGroupOrderExpiredMap.userLogin" from-field="systemUserLogin"/> <set field="checkProductGroupOrderExpiredMap.groupOrderId" from-field="productGroupOrder.groupOrderId"/> <call-service service-name="checkProductGroupOrderExpired" in-map-name="checkProductGroupOrderExpiredMap"/> - + <set field="cancelScheduledJobMap.userLogin" from-field="systemUserLogin"/> <set field="cancelScheduledJobMap.jobId" from-field="productGroupOrder.jobId"/> <call-service service-name="cancelScheduledJob" in-map-name="cancelScheduledJobMap"/> Modified: ofbiz/trunk/framework/common/config/CommonErrorUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonErrorUiLabels.xml?rev=1207891&r1=1207890&r2=1207891&view=diff ============================================================================== --- ofbiz/trunk/framework/common/config/CommonErrorUiLabels.xml (original) +++ ofbiz/trunk/framework/common/config/CommonErrorUiLabels.xml Tue Nov 29 14:49:44 2011 @@ -19,6 +19,10 @@ under the License. --> <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <property key="CommonErrorDublicateKey"> + <value xml:lang="de">Doppelter Primärschlüssel. Der Primärschlüssel existiert bereits.</value> + <value xml:lang="en">Dublicate Key. The Key already exist.</value> + </property> <property key="ImageTransform.error_occurs_during_reading"> <value xml:lang="da">Der opstår en fejl under læsning</value> <value xml:lang="en">An error occurs during reading</value> |
Free forum by Nabble | Edit this page |