Author: jacopoc
Date: Wed Dec 5 09:15:48 2007
New Revision: 601420
URL:
http://svn.apache.org/viewvc?rev=601420&view=revLog:
Improved logic in the createGlReconciliationEntry service.
Modified:
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml?rev=601420&r1=601419&r2=601420&view=diff==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml Wed Dec 5 09:15:48 2007
@@ -227,10 +227,23 @@
<!-- ========= GlReconciliationEntry methods ========= -->
<simple-method method-name="createGlReconciliationEntry" short-description="Add Entry To GlReconciliation">
+ <!-- first of all, make sure that the AcctgTransEntry is not already reconciled -->
+ <entity-one entity-name="AcctgTransEntry" value-name="acctgTransEntry"/>
+ <if-compare field-name="acctgTransEntry.reconcileStatusId" operator="equals" value="AES_RECONCILED">
+ <add-error><fail-message message="The accounting transaction entry ${acctgTransEntry.acctgTransId}/${acctgTransEntry.acctgTransEntrySeqId} is already reconciled: cannot reconcile."/></add-error>
+ <check-errors/>
+ </if-compare>
<make-value entity-name="GlReconciliationEntry" value-name="newEntity"/>
<set-nonpk-fields map-name="parameters" value-name="newEntity"/>
<set-pk-fields map-name="parameters" value-name="newEntity"/>
<create-value value-name="newEntity"/>
+
+ <!-- update the status of the AcctgTransEntry to reconciled -->
+ <set field="updateAcctgTransEntryInMap.acctgTransId" from-field="parameters.acctgTransId"/>
+ <set field="updateAcctgTransEntryInMap.acctgTransEntrySeqId" from-field="parameters.acctgTransEntrySeqId"/>
+ <set field="updateAcctgTransEntryInMap.acctgTransEntrySeqId" value="AES_RECONCILED"/>
+ <call-service service-name="updateAcctgTransEntry" in-map-name="updateAcctgTransEntryInMap"/>
+ <check-errors/>
<!-- when changing entries, also update the last modified info for the GlReconciliation -->
<call-simple-method method-name="updateGlReconciliationLastModified"/>