You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2009/12/19 08:55:45 UTC

svn commit: r892447 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml webapp/accounting/WEB-INF/controller.xml widget/PaymentForms.xml widget/PaymentScreens.xml

Author: jacopoc
Date: Sat Dec 19 07:55:44 2009
New Revision: 892447

URL: http://svn.apache.org/viewvc?rev=892447&view=rev
Log:
Fixed a series of bugs affecting payment applications; gl postings associated to payment application are now in a better shape (still need some enhancements).


Modified:
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
    ofbiz/trunk/applications/accounting/widget/PaymentForms.xml
    ofbiz/trunk/applications/accounting/widget/PaymentScreens.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=892447&r1=892446&r2=892447&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 Sat Dec 19 07:55:44 2009
@@ -1924,12 +1924,9 @@
                 <set field="creditEntry.origCurrencyUomId" from-field="origCurrencyUomId"/>
                 <if-not-empty field="paymentApplication.overrideGlAccountId">
                     <set field="creditEntry.glAccountId" from-field="paymentApplication.overrideGlAccountId"/>
-                <else>
-                    <set field="creditEntry.glAccountId" from-field="payment.overrideGlAccountId"/>
-                </else>
                 </if-not-empty>
                 <set field="creditEntry.organizationPartyId" from-field="organizationPartyId"/>
-                <set field="creditEntry.glAccountTypeId" from-field="creditGlAccountTypeId"/>
+                <set field="creditEntry.glAccountTypeId" value="ACCOUNTS_RECEIVABLE"/>
                 <calculate field="amountAppliedTotal" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}">
                     <calcop operator="add">
                         <calcop operator="get" field="amountAppliedTotal"/>
@@ -2251,7 +2248,7 @@
                 <set field="debitEntry.debitCreditFlag" value="D"/>
                 <set field="debitEntry.origAmount" from-field="paymentApplication.amountApplied"/>
                 <set field="debitEntry.origCurrencyUomId" from-field="payment.currencyUomId"/>
-                <set field="debitEntry.glAccountTypeId" from-field="debitGlAccountTypeId"/>
+                <set field="debitEntry.glAccountTypeId" value="ACCOUNTS_PAYABLE"/>
                 <set field="debitEntry.organizationPartyId" from-field="organizationPartyId"/>
                 <if-not-empty field="paymentApplication.overrideGlAccountId">
                     <set field="debitEntry.glAccountId" from-field="paymentApplication.overrideGlAccountId"/>
@@ -2263,9 +2260,6 @@
                             <field-map field-name="taxAuthPartyId" from-field="partyId"/>
                         </entity-one>
                         <set field="debitEntry.glAccountId" from-field="taxAuthorityGlAccount.glAccountId"/>
-                    <else>
-                        <set field="debitEntry.glAccountId" from-field="payment.overrideGlAccountId"/>
-                    </else>
                     </if-not-empty>
                 </else>
                 </if-not-empty>
@@ -2354,14 +2348,22 @@
             <field-map field-name="paymentApplicationId" from-field="parameters.paymentApplicationId"/>
         </entity-one>
         <get-related-one value-field="paymentApplication" relation-name="Payment" to-value-field="payment"/>
+        <!-- if the payment transaction has not been already posted to gl then don't do nothing; the transaction for the payment application will be posted together with the payment -->
+        <if-compare field="payment.statusId" operator="equals" value="PMNT_NOT_PAID">
+            <return/>
+        </if-compare>
         <call-class-method class-name="org.ofbiz.accounting.util.UtilAccounting" method-name="isReceipt" ret-field="isReceipt">
             <field field="payment" type="org.ofbiz.entity.GenericValue"/>
         </call-class-method>
         <if-compare field="isReceipt" operator="equals" type="Boolean" value="true">
+            <!-- if the payment Credited account is already "accounts receivable" then don't do nothing -->
             <entity-one entity-name="PaymentGlAccountTypeMap" value-field="paymentGlAccountTypeMap">
                 <field-map field-name="paymentTypeId" from-field="payment.paymentTypeId"/>
                 <field-map field-name="organizationPartyId" from-field="payment.partyIdTo"/>
             </entity-one>
+            <if-compare field="paymentGlAccountTypeMap.glAccountTypeId" operator="equals" value="ACCOUNTS_RECEIVABLE">
+                <return/>
+            </if-compare>
             <!--Debit -->
             <make-value entity-name="AcctgTransEntry" value-field="debitEntry"/>
             <set field="debitEntry.debitCreditFlag" value="D"/>
@@ -2372,7 +2374,7 @@
             <set field="debitEntry.origCurrencyUomId" from-field="payment.currencyUomId"/>
             <set field="debitEntry.glAccountId" from-field="payment.overrideGlAccountId"/>
             <set field="debitEntry.glAccountTypeId" from-field="paymentGlAccountTypeMap.glAccountTypeId"/>
-            <!-- Debit -->
+            <!-- Credit -->
             <make-value entity-name="AcctgTransEntry" value-field="creditEntry"/>
             <set field="creditEntry.debitCreditFlag" value="C"/>
             <set field="creditEntry.organizationPartyId" from-field="payment.partyIdTo"/>
@@ -2382,10 +2384,14 @@
             <set field="creditEntry.origCurrencyUomId" from-field="payment.currencyUomId"/>
             <set field="creditEntry.glAccountTypeId" value="ACCOUNTS_RECEIVABLE"/>
         <else>
+            <!-- if the payment Debited account is already "accounts payable" then don't do nothing -->
             <entity-one entity-name="PaymentGlAccountTypeMap" value-field="paymentGlAccountTypeMap">
                 <field-map field-name="paymentTypeId" from-field="payment.paymentTypeId"/>
                 <field-map field-name="organizationPartyId" from-field="payment.partyIdFrom"/>
             </entity-one>
+            <if-compare field="paymentGlAccountTypeMap.glAccountTypeId" operator="equals" value="ACCOUNTS_PAYABLE">
+                <return/>
+            </if-compare>
             <!--Credit -->
             <make-value entity-name="AcctgTransEntry" value-field="creditEntry"/>
             <set field="creditEntry.debitCreditFlag" value="C"/>

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=892447&r1=892446&r2=892447&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Sat Dec 19 07:55:44 2009
@@ -328,6 +328,11 @@
         <security https="true" auth="true"/>
         <response name="success" type="view" value="editPaymentApplications"/>
     </request-map>
+    <request-map uri="createPaymentApplication">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="createPaymentApplication"/>
+        <response name="success" type="view" value="editPaymentApplications"/>
+    </request-map>
     <request-map uri="updatePaymentApplication">
         <security https="true" auth="true"/>
         <event type="service" invoke="updatePaymentApplicationDef"/>

Modified: ofbiz/trunk/applications/accounting/widget/PaymentForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/PaymentForms.xml?rev=892447&r1=892446&r2=892447&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/PaymentForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/PaymentForms.xml Sat Dec 19 07:55:44 2009
@@ -282,8 +282,10 @@
             </display-entity>
         </field>
         <field name="invoiceItemSeqId"><display/></field>
-        <field name="amountApplied"><text size="15"/></field>
+        <field name="amountApplied"><display/></field>
+        <!-- TODO: this is commented out because updating (instead of removing and recreating) payment application can cause wrong gl postings.
         <field name="updateButton" widget-style="buttontext"><submit button-type="text-link"/></field>
+        -->
         <field name="removeButton" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext">
             <hyperlink description="${uiLabelMap.CommonRemove}" target="removePaymentApplication">
                 <parameter param-name="paymentApplicationId"/>
@@ -342,7 +344,7 @@
         </field>
     </form>
 
-    <form name="listInvoicesNotApplied" type="list" list-name="invoices" target="updatePaymentApplication" title=""
+    <form name="listInvoicesNotApplied" type="list" list-name="invoices" target="createPaymentApplication" title=""
         odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
         <field name="paymentId"><hidden/></field>
         <field name="invoiceId" widget-style="buttontext">

Modified: ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml?rev=892447&r1=892446&r2=892447&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/PaymentScreens.xml Sat Dec 19 07:55:44 2009
@@ -182,21 +182,21 @@
                 <entity-condition entity-name="PaymentApplication" list="paymentApplicationsPay">
                     <condition-list combine="and">
                         <condition-expr field-name="paymentId" operator="equals" from-field="paymentId"/>
-                        <condition-expr field-name="toPaymentId" operator="not-equals" from-field="null"/>
+                        <condition-expr field-name="toPaymentId" operator="not-equals" from-field="nullField"/>
                     </condition-list>
                     <order-by field-name="toPaymentId"/>
                 </entity-condition>
                 <entity-condition entity-name="PaymentApplication" list="paymentApplicationsBil">
                     <condition-list combine="and">
                         <condition-expr field-name="paymentId" from-field="paymentId"/>
-                        <condition-expr field-name="billingAccountId" operator="not-equals" from-field="null"/>
+                        <condition-expr field-name="billingAccountId" operator="not-equals" from-field="nullField"/>
                     </condition-list>
                     <order-by field-name="billingAccountId"/>
                 </entity-condition>
                 <entity-condition entity-name="PaymentApplication" list="paymentApplicationsTax">
                     <condition-list combine="and">
                         <condition-expr field-name="paymentId" from-field="paymentId"/>
-                        <condition-expr field-name="taxAuthGeoId" operator="not-equals" from-field="null"/>
+                        <condition-expr field-name="taxAuthGeoId" operator="not-equals" from-field="nullField"/>
                     </condition-list>
                     <order-by field-name="taxAuthGeoId"/>
                 </entity-condition>