svn commit: r1530634 - /ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1530634 - /ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml

jacopoc
Author: jacopoc
Date: Wed Oct  9 14:35:52 2013
New Revision: 1530634

URL: http://svn.apache.org/r1530634
Log:
For backward compatibility: when a time period is closed, and a GlAccountHistory record for the same is already present (old mode, before revision 1530273), do not return an error and instead fill the balance fields of the record.

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=1530634&r1=1530633&r2=1530634&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 Oct  9 14:35:52 2013
@@ -833,12 +833,22 @@ under the License.
             <select-field field-name="glAccountId"/>
         </entity-condition>
         <iterate list="organizationGlAccounts" entry="organizationGlAccount">
-            <make-value entity-name="GlAccountHistory" value-field="glAccountHistory"/>
-            <set field="glAccountHistory.customTimePeriodId" from-field="customTimePeriod.customTimePeriodId"/>
-            <set field="glAccountHistory.organizationPartyId" from-field="customTimePeriod.organizationPartyId"/>
-            <set field="glAccountHistory.glAccountId" from-field="organizationGlAccount.glAccountId"/>
-            <create-value value-field="glAccountHistory"/>
-            <call-service service-name="computeAndStoreGlAccountHistoryBalance" in-map-name="glAccountHistory"/>
+            <entity-one entity-name="GlAccountHistory" value-field="glAccountHistory">
+                <field-map field-name="customTimePeriodId" from-field="customTimePeriod.customTimePeriodId"/>
+                <field-map field-name="organizationPartyId" from-field="customTimePeriod.organizationPartyId"/>
+                <field-map field-name="glAccountId" from-field="organizationGlAccount.glAccountId"/>
+            </entity-one>
+            <if-empty field="glAccountHistory">
+                <make-value entity-name="GlAccountHistory" value-field="glAccountHistory"/>
+                <set field="glAccountHistory.customTimePeriodId" from-field="customTimePeriod.customTimePeriodId"/>
+                <set field="glAccountHistory.organizationPartyId" from-field="customTimePeriod.organizationPartyId"/>
+                <set field="glAccountHistory.glAccountId" from-field="organizationGlAccount.glAccountId"/>
+                <create-value value-field="glAccountHistory"/>
+            </if-empty>
+            <set field="inMap.customTimePeriodId" from-field="glAccountHistory.customTimePeriodId"/>
+            <set field="inMap.organizationPartyId" from-field="glAccountHistory.organizationPartyId"/>
+            <set field="inMap.glAccountId" from-field="glAccountHistory.glAccountId"/>
+            <call-service service-name="computeAndStoreGlAccountHistoryBalance" in-map-name="inMap"/>
         </iterate>
 
         <set field="updateCustomTimePeriodInMap.customTimePeriodId" from-field="customTimePeriod.customTimePeriodId"/>