Author: jacopoc
Date: Wed Nov 28 09:07:16 2007
New Revision: 599065
URL:
http://svn.apache.org/viewvc?rev=599065&view=revLog:
Code to assign a failed transaction to the error journal, if it is set; if no error journal is set, the service returns an error.
The code needs some cleanups: the main issue is that the glJournalId should be moved from the AcctgTrans to the AcctgTransEntry entity.
Modified:
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml
Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml?rev=599065&r1=599064&r2=599065&view=diff==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml Wed Nov 28 09:07:16 2007
@@ -242,8 +242,25 @@
<if-compare field-name="parameters.verifyOnly" operator="equals" value="Y">
<check-errors/>
<else>
- <!-- TODO: if there are errors and we have an error journal assign to the journal and return -->
- <check-errors/>
+ <!-- if there are errors and we have an error journal assign to the journal and return -->
+ <if-not-empty field-name="error_list">
+ <iterate list-name="acctgTransEntryList" entry-name="acctgTransEntry">
+ <entity-one entity-name="PartyAcctgPreference" value-name="partyAcctgPreference" use-cache="true" auto-field-map="false">
+ <field-map field-name="partyId" env-name="acctgTransEntry.organizationPartyId"/>
+ </entity-one>
+ <if-empty field-name="partyAcctgPreference.errorGlJournalId">
+ <!-- if no error journal is set, then return the error messages -->
+ <check-errors/>
+ <else>
+ <!-- assign the transaction to the error journal -->
+ <set field="acctgTrans.glJournalId" from-field="partyAcctgPreference.errorGlJournalId"/>
+ <!-- FIXME: we should probably store the journal id in each one of the AcctgTransEntry records-->
+ <store-value value-name="acctgTrans"/>
+ <return/>
+ </else>
+ </if-empty>
+ </iterate>
+ </if-not-empty>
<!-- TODO: for each entry: lookup GlAccount, update posted balance -->
<iterate entry-name="acctgTransEntry" list-name="acctgTransEntryList">
<!-- Get all data to operate on: GlAccount, GlAccountOrganization, GlAccountHistory -->