Author: sichen
Date: Tue Oct 3 10:22:41 2006
New Revision: 452577
URL:
http://svn.apache.org/viewvc?view=rev&rev=452577Log:
Prevent double posting of acctg trans to the ledger
Modified:
incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml
Modified: incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml
URL:
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml?view=diff&rev=452577&r1=452576&r2=452577==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml (original)
+++ incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml Tue Oct 3 10:22:41 2006
@@ -143,6 +143,13 @@
<field-to-result field-name="debitCreditDifference"/>
</simple-method>
<simple-method method-name="postAcctgTrans" short-description="Post a AcctgTrans">
+ <!-- make sure the AcctgTrans has not already been posted -->
+ <entity-one entity-name="AcctgTrans" value-name="acctgTrans" auto-field-map="true"/>
+ <if-compare field-name="acctgTrans.isPosted" operator="equals" value="Y">
+ <add-error><fail-message message="AcctgTrans [${parameters.acctgTransId}] has already been posted. Not posting again"/></add-error>
+ </if-compare>
+ <check-errors/>
+
<!-- check trial balance -->
<set from-field="parameters.acctgTransId" field="trialBalanceCallMap.acctgTransId"/>
<call-service service-name="calculateAcctgTransTrialBalance" in-map-name="trialBalanceCallMap">
@@ -154,8 +161,8 @@
<if-compare field-name="trialBalanceResultMap.debitCreditDifference" operator="less-equals" value="-0.01" type="Double">
<add-error><fail-message message="Not posting GL Accounting Transaction with ID [${parameters.acctgTransId}] because the trial balance failed: Debit Total=${trialBalanceResultMap.debitTotal} Credit Total=${trialBalanceResultMap.creditTotal} Debit/Credit Difference=${trialBalanceResultMap.debitCreditDifference}"/></add-error>
</if-compare>
+ <check-errors/>
- <entity-one entity-name="AcctgTrans" value-name="acctgTrans" auto-field-map="true"/>
<entity-condition entity-name="AcctgTransEntry" list-name="acctgTransEntryList">
<condition-expr field-name="acctgTransId" env-name="parameters.acctgTransId"/>
<order-by field-name="acctgTransEntrySeqId"/>