Author: jleroux Date: Wed Jan 3 21:18:10 2007 New Revision: 492411 URL: http://svn.apache.org/viewvc?view=rev&rev=492411 Log: A patch from Anil K Patel "Duplicate Id error on Create New FixedAsset" (https://issues.apache.org/jira/browse/OFBIZ-547).
Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties?view=diff&rev=492411&r1=492410&r2=492411 ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.properties Wed Jan 3 21:18:10 2007 @@ -160,6 +160,7 @@ AccountingFixedAssetChildren=Children AccountingFixedAssetEdit=Create/Update Fixed Asset AccountingFixedAssetId=Fixed Asset Id +AccountingFixedAssetIdAlreadyExists=Fixed Asset Id [${parameters.fixedAssetId}] Already Exists AccountingFixedAssetName=Fixed Asset Name AccountingFixedAssetParent=Asset Group AccountingFixedAssetParties=Party Roles Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml?view=diff&rev=492411&r1=492410&r2=492411 ============================================================================== --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml (original) +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/fixedasset/FixedAssetServices.xml Wed Jan 3 21:18:10 2007 @@ -33,15 +33,20 @@ <!-- create new entity and create all the fields --> <make-value value-name="newEntity" entity-name="FixedAsset"/> <set-nonpk-fields map-name="parameters" value-name="newEntity"/> - <set from-field="parameters.fixedAssetId" field="newEntity.fixedAssetId"/> <!-- create a non existing ID if not supplied --> - <if-empty field-name="newEntity.fixedAssetId"> + <if-empty field-name="parameters.fixedAssetId"> <sequenced-id-to-env sequence-name="FixedAsset" env-name="newEntity.fixedAssetId"/> <else> - <!-- check the provided ID --> - <check-id field-name="newEntity.fixedAssetId"/> + <!-- check the Duplicate ID> --> + <set from-field="parameters.fixedAssetId" field="findFixedAssetMap.fixedAssetId"/> + <find-by-primary-key entity-name="FixedAsset" map-name="findFixedAssetMap" value-name="fixedAsset"/> + <if-not-empty field-name="fixedAsset"> + <add-error><fail-property resource="AccountingUiLabels" property="AccountingFixedAssetIdAlreadyExists"/></add-error> + <log level="info" message="${AccountingUiLabels.AccountingFixedAssetIdAlreadyExists} "/> + </if-not-empty> <check-errors/> + <set from-field="parameters.fixedAssetId" field="newEntity.fixedAssetId"/> </else> </if-empty> <field-to-result field-name="newEntity.fixedAssetId" result-name="fixedAssetId"/>