Author: hansbak
Date: Wed Oct 19 11:19:21 2011
New Revision: 1186102

URL: http://svn.apache.org/viewvc?rev=1186102&view=rev
Log:
remove the possibility to update payment applications: is too complicated and 
can cause posting problems, only allow add and delete, this is at the payment 
side

Added:
    
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/PaymentApplicationTests.xml
   (with props)
    
ofbiz/trunk/applications/accounting/testdef/data/PaymentApplicationTestsData.xml
   (with props)
    ofbiz/trunk/applications/accounting/testdef/paymentappltests.xml   (with 
props)
Modified:
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
    ofbiz/trunk/applications/accounting/ofbiz-component.xml
    
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
    ofbiz/trunk/applications/accounting/servicedef/services_payment.xml
    ofbiz/trunk/applications/accounting/widget/PaymentForms.xml

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=1186102&r1=1186101&r2=1186102&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Wed Oct 
19 11:19:21 2011
@@ -3085,6 +3085,9 @@
         <value xml:lang="hi_IN">जमा</value>
         <value xml:lang="pt">Cr</value>
     </property>
+    <property key="AccountingCurrenciesOfInvoiceAndPaymentNotCompatible">
+        <value xml:lang="en">Currencies of invoice and payment not 
compatible</value>
+    </property>
     <property key="AccountingCurrency">
         <value xml:lang="de">Währung</value>
         <value xml:lang="en">Currency</value>
@@ -8408,6 +8411,9 @@
         <value xml:lang="fr">Factures en attente de règlement</value>
         <value xml:lang="pt">Faturas passdas em débito</value>
     </property>
+    <property key="AccountingPaymentParentTypesNotCompatible">
+        <value xml:lang="en">Payment parent types not compatible for 
application</value>
+    </property>
     <property key="AccountingPayOnlyWithBillingAccount">
         <value xml:lang="de">Bezahlung nur mit Rechnungskonto</value>
         <value xml:lang="en">Pay only with Billing Account</value>

Modified: ofbiz/trunk/applications/accounting/ofbiz-component.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/ofbiz-component.xml?rev=1186102&r1=1186101&r2=1186102&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/accounting/ofbiz-component.xml Wed Oct 19 11:19:21 
2011
@@ -97,6 +97,7 @@ under the License.
 
     <test-suite loader="main" location="testdef/accountingtests.xml"/>
     <test-suite loader="main" location="testdef/paymenttests.xml"/>
+    <test-suite loader="main" location="testdef/paymentappltests.xml"/>
     <test-suite loader="main" location="testdef/invoicetests.xml"/>
     <test-suite loader="main" location="testdef/fixedassettests.xml"/>
 

Modified: 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml?rev=1186102&r1=1186101&r2=1186102&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
 (original)
+++ 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
 Wed Oct 19 11:19:21 2011
@@ -149,7 +149,7 @@ under the License.
         <if-empty field="parameters.invoiceId">
             <if-empty field="parameters.billingAccountId">
                 <if-empty field="parameters.taxAuthGeoId">
-                    <if-empty field="parameters.overrideGlAccountId">
+                    <if-empty field="parameters.toPaymentId">
                       <add-error>
                           <fail-property resource="AccountingUiLabels" 
property="AccountingPaymentApplicationParameterMissing"/>
                       </add-error>
@@ -162,25 +162,121 @@ under the License.
         <make-value entity-name="PaymentApplication" 
value-field="paymentAppl"/>
         <set-nonpk-fields map="parameters" value-field="paymentAppl"/>
 
-        <!-- get the invoice and do some further validation against it -->
+        <entity-one entity-name="Payment" value-field="payment"/>
+        <if-empty field="payment">
+            <add-error>
+                <fail-property resource="AccountingUiLabels" 
property="AccountingPaymentApplicationParameterMissing"/>
+            </add-error>
+            <check-errors/>
+        </if-empty>
+ 
+        <call-class-method method-name="getPaymentNotApplied" 
class-name="org.ofbiz.accounting.payment.PaymentWorker" 
ret-field="notAppliedPayment">
+            <field field="payment" type="GenericValue"/>
+        </call-class-method>
+        
         <if-not-empty field="parameters.invoiceId">
+            <!-- get the invoice and do some further validation against it -->
             <entity-one entity-name="Invoice" value-field="invoice"/>
+            <!-- check the currencies if they are compatible -->           
+            <property-to-field field="defaultCurrencyUomId" resource="general" 
property="currency.uom.id.default" default="USD"/>
+            <if>
+                <condition>
+                    <or>
+                        <if-compare-field  field="invoice.currencyUomId" 
operator="equals" to-field="defaultCurrencyUomId"/>
+                        <and>
+                            <if-compare-field  field="invoice.currencyUomId" 
operator="not-equals" to-field="defaultCurrencyUomId"/>
+                            <if-compare-field  field="invoice.currencyUomId" 
operator="equals" to-field="payment.actualCurrencyUomId"/>
+                        </and>
+                    </or>
+                </condition>
+                <then><!-- if required get the payment amount in foreign 
currency (local we already have) -->
+                    <if-compare-field  field="invoice.currencyUomId" 
operator="not-equals" to-field="defaultCurrencyUomId">
+                        <set field="actual" value="true" type="Boolean"/>
+                        <call-class-method method-name="getPaymentNotApplied" 
class-name="org.ofbiz.accounting.payment.PaymentWorker" 
ret-field="notAppliedPayment">
+                            <field field="payment" type="GenericValue"/>
+                            <field field="actual"/>
+                        </call-class-method>
+                    </if-compare-field>
+                </then>
+                <else>
+                    <add-error>
+                        <fail-property resource="AccountingUiLabels" 
property="AccountingCurrenciesOfInvoiceAndPaymentNotCompatible"/>
+                    </add-error>
+                </else>
+            </if>
+            <check-errors/>
 
             <!-- get the amount that has not been applied yet for the invoice 
(outstanding amount) -->
-            <set field="notApplied" 
value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(invoice)}"
 type="BigDecimal"/>
-
-            <!-- if the amount to apply goes over the outstanding amount, then 
use the notApplied amount and log a warning -->
-            <if-compare-field field="paymentAppl.amountApplied" 
to-field="notApplied" operator="greater" type="BigDecimal">
-                <log level="warning" message="Create Payment Application: 
Amount to apply [${paymentAppl.amountApplied}] is greater than the outstanding 
amount [${notApplied}] of the invoice [${invoice.invoiceId}]. Creating Payment 
Application for outstanding amount [${notApplied}] instead."/>
-                <set field="paymentAppl.amountApplied" 
from-field="notApplied"/>
-            </if-compare-field>
-
+            <call-class-method method-name="getInvoiceNotApplied" 
class-name="org.ofbiz.accounting.invoice.InvoiceWorker" 
ret-field="notAppliedInvoice">
+                <field field="invoice" type="GenericValue"/>
+            </call-class-method>
+
+            <if-empty field="paymentAppl.amountApplied">
+                <if-compare-field field="notAppliedInvoice" 
operator="less-equals" to-field="notAppliedPayment">
+                    <set field="paymentAppl.amountApplied" 
from-field="notAppliedInvoice"/>
+                    <else>
+                        <set field="paymentAppl.amountApplied" 
from-field="notAppliedPayment"/>
+                    </else>
+                </if-compare-field>
+            </if-empty>
+            
             <if-not-empty field="invoice.billingAccountId">
                 <set field="paymentAppl.billingAccountId" 
from-field="invoice.billingAccountId"/>
             </if-not-empty>
         </if-not-empty>
 
+        <if-not-empty field="parameters.toPaymentId">
+            <!-- get the to payment and check the parent types are compatible 
-->
+            <entity-one entity-name="Payment" value-field="toPayment">
+                <field-map field-name="paymentId" 
from-field="parameters.toPaymentId"/>
+            </entity-one>
+            <entity-one value-field="toPaymentType" entity-name="PaymentType">
+                <field-map field-name="paymentTypeId" 
from-field="toPayment.paymentTypeId"/>
+            </entity-one>
+            <entity-one entity-name="Payment" value-field="payment">
+                <field-map field-name="paymentId" 
from-field="parameters.paymentId"/>
+            </entity-one>
+            <entity-one value-field="paymentType" entity-name="PaymentType">
+                <field-map field-name="paymentTypeId" 
from-field="payment.paymentTypeId"/>
+            </entity-one>
+            <if-compare-field operator="equals" field="toPayment.parentTypeId" 
to-field="payment.parentTypeId">
+                <add-error>
+                    <fail-property resource="AccountingUiLabels" 
property="AccountingPaymentParentTypesNotCompatible"/>
+                </add-error>
+            </if-compare-field>
+            
+            <!-- when amount not provided use the the lowest value available 
-->
+            <if-empty field="parameters.amountApplied">
+                <call-class-method method-name="getPaymentNotApplied" 
class-name="org.ofbiz.accounting.payment.PaymentWorker" 
ret-field="notAppliedPayment">
+                    <field field="payment" type="GenericValue"/>
+                </call-class-method>
+                <call-class-method method-name="getPaymentNotApplied" 
class-name="org.ofbiz.accounting.payment.PaymentWorker" 
ret-field="notAppliedToPayment">
+                    <field field="toPayment" type="GenericValue"/>
+                </call-class-method>
+                <if-compare-field operator="less" field="notAppliedPayment" 
to-field="notAppliedToPayment">
+                    <set field="paymentAppl.amountApplied" 
from-field="notAppliedPayment"/>
+                    <else>
+                        <set field="paymentAppl.amountApplied" 
from-field="notAppliedToPayment"/>
+                    </else>
+                </if-compare-field>
+            </if-empty>
+        </if-not-empty>
+            
+        
+        <if-not-empty field="parameters.billingAccountId">
+            <if-empty field="paymentAppl.amountApplied">
+                <set field="paymentAppl.amountApplied" 
from-field="notAppliedPayment"/>
+            </if-empty>
+        </if-not-empty>
+        
+        <if-not-empty field="parameters.taxAuthGeoId">
+            <if-empty field="paymentAppl.amountApplied">
+                <set field="paymentAppl.amountApplied" 
from-field="notAppliedPayment"/>
+            </if-empty>
+        </if-not-empty>
+        
         <sequenced-id sequence-name="PaymentApplication" 
field="paymentAppl.paymentApplicationId"/>
+        <field-to-result field="paymentAppl.amountApplied" 
result-name="amountApplied"/>
         <field-to-result field="paymentAppl.paymentApplicationId" 
result-name="paymentApplicationId"/>
 
         <create-value value-field="paymentAppl"/>

Added: 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/PaymentApplicationTests.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/PaymentApplicationTests.xml?rev=1186102&view=auto
==============================================================================
--- 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/PaymentApplicationTests.xml
 (added)
+++ 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/PaymentApplicationTests.xml
 Wed Oct 19 11:19:21 2011
@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+        
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd";>
+
+
+    <!-- most simple test both invoice and payment same amount same currency 
-->
+    <simple-method method-name="testInvoiceAppl" short-description="test the 
application of a payment against an invoice" login-required="false">
+
+        <!-- from the test data -->
+        <set field="serviceInMap.invoiceId" value="appltest10000"/>
+        <set field="serviceInMap.paymentId" value="appltest10000"/>
+
+        <entity-one entity-name="UserLogin" value-field="userLogin">
+            <field-map field-name="userLoginId" value="system"/>
+        </entity-one>
+        
+        <set field="serviceInMap.userLogin" from-field="userLogin"/>
+        <call-service service-name="createPaymentApplication" 
in-map-name="serviceInMap" include-user-login="false">
+            <result-to-field result-name="amountApplied"/>
+            <result-to-field result-name="paymentApplicationId"/>
+        </call-service>
+        <entity-one entity-name="PaymentApplication" 
value-field="paymentApplication">
+            <field-map field-name="paymentApplicationId" 
from-field="paymentApplicationId"/>
+        </entity-one>
+        <entity-one value-field="payment" entity-name="Payment">
+            <field-map field-name="paymentId" 
from-field="serviceInMap.paymentId"/>
+        </entity-one>
+        <assert>
+            <not><if-empty field="paymentApplication"/></not>
+            <if-compare-field field="paymentApplication.invoiceId" 
operator="equals" to-field="serviceInMap.invoiceId"/>
+            <if-compare-field field="paymentApplication.paymentId" 
operator="equals" to-field="serviceInMap.paymentId"/>
+            <if-compare-field field="paymentApplication.amountApplied" 
operator="equals" to-field="payment.amount"/>
+        </assert>
+        <check-errors/>
+        <!-- both payment and invoice should be completely applied -->
+        <call-class-method method-name="getPaymentNotApplied" 
class-name="org.ofbiz.accounting.payment.PaymentWorker" 
ret-field="notAppliedPayment">
+            <field field="delegator" type="org.ofbiz.entity.Delegator"/>
+            <field field="serviceInMap.paymentId"/>
+        </call-class-method>
+        <call-class-method method-name="getInvoiceNotApplied" 
class-name="org.ofbiz.accounting.invoice.InvoiceWorker" 
ret-field="notAppliedInvoice">
+            <field field="delegator" type="org.ofbiz.entity.Delegator"/>
+            <field field="serviceInMap.invoiceId"/>
+        </call-class-method>
+        <set field="zero" value="0" type="BigDecimal"/>
+        <assert>
+            <if-compare-field operator="equals" field="notAppliedPayment" 
to-field="zero"/>                        
+            <if-compare-field operator="equals" field="notAppliedInvoice" 
to-field="zero"/>                        
+        </assert>
+        <check-errors/>
+        <remove-value value-field="paymentApplication"/>
+    </simple-method>
+
+
+    <simple-method method-name="testBillingAppl" short-description="test the 
application of a payment against an billing account" login-required="false">
+        <!-- from the test data -->
+        <set field="serviceInMap.paymentId" value="appltest10000"/>
+        <set field="serviceInMap.billingAccountId" value="appltest10000"/>
+
+        <entity-one entity-name="UserLogin" value-field="userLogin">
+            <field-map field-name="userLoginId" value="system"/>
+        </entity-one>
+        
+        <set field="serviceInMap.userLogin" from-field="userLogin"/>
+        <call-service service-name="createPaymentApplication" 
in-map-name="serviceInMap" include-user-login="false">
+            <result-to-field result-name="amountApplied"/>
+            <result-to-field result-name="paymentApplicationId"/>
+        </call-service>
+        <entity-one entity-name="PaymentApplication" 
value-field="paymentApplication">
+            <field-map field-name="paymentApplicationId" 
from-field="paymentApplicationId"/>
+        </entity-one>
+        <call-class-method method-name="getPaymentNotApplied" 
class-name="org.ofbiz.accounting.payment.PaymentWorker" 
ret-field="notAppliedPayment">
+            <field field="delegator" type="org.ofbiz.entity.Delegator"/>
+            <field field="serviceInMap.paymentId"/>
+        </call-class-method>
+        <entity-one value-field="payment" entity-name="Payment">
+            <field-map field-name="paymentId" 
from-field="serviceInMap.paymentId"/>
+        </entity-one>
+        <assert>
+            <not><if-empty field="paymentApplication"/></not>
+            <if-compare-field field="paymentApplication.billingAccountId" 
operator="equals" to-field="serviceInMap.billingAccountId"/>
+            <if-compare-field field="paymentApplication.paymentId" 
operator="equals" to-field="serviceInMap.paymentId"/>
+            <if-compare-field field="paymentApplication.amountApplied" 
operator="equals" to-field="payment.amount"/>
+        </assert>
+        <check-errors/>
+        <!-- both payment and invoice should be completely applied -->
+        <call-class-method method-name="getPaymentNotApplied" 
class-name="org.ofbiz.accounting.payment.PaymentWorker" 
ret-field="notAppliedPayment">
+            <field field="delegator" type="org.ofbiz.entity.Delegator"/>
+            <field field="serviceInMap.paymentId"/>
+        </call-class-method>
+        <call-class-method method-name="getBillingAccountBalance" 
class-name="org.ofbiz.accounting.payment.BillingAccountWorker" 
ret-field="appliedBillling">
+            <field field="delegator" type="org.ofbiz.entity.Delegator"/>
+            <field field="serviceInMap.billingAccountId"/>
+        </call-class-method>
+        <set field="zero" value="0" type="BigDecimal"/>
+        <assert>
+            <if-compare-field operator="equals" field="notAppliedPayment" 
to-field="zero"/>                        
+            <if-compare-field operator="equals" field="appliedBilling" 
to-field="paymentAmount"/>                        
+        </assert>
+        <check-errors/>
+        <remove-value value-field="paymentApplication"/>
+    </simple-method>
+
+    <simple-method method-name="testToPayment" short-description="test the 
application of a payment against anotherpayment" login-required="false">
+        <!-- from the test data -->
+        <set field="serviceInMap.paymentId" value="appltest10000"/>
+        <set field="serviceInMap.toPaymentId" value="appltest10001"/>
+
+        <entity-one entity-name="UserLogin" value-field="userLogin">
+            <field-map field-name="userLoginId" value="system"/>
+        </entity-one>
+        
+        <set field="serviceInMap.userLogin" from-field="userLogin"/>
+        <call-service service-name="createPaymentApplication" 
in-map-name="serviceInMap" include-user-login="false">
+            <result-to-field result-name="amountApplied"/>
+            <result-to-field result-name="paymentApplicationId"/>
+        </call-service>
+        <entity-one entity-name="PaymentApplication" 
value-field="paymentApplication">
+            <field-map field-name="paymentApplicationId" 
from-field="paymentApplicationId"/>
+        </entity-one>
+        <call-class-method method-name="getPaymentNotApplied" 
class-name="org.ofbiz.accounting.payment.PaymentWorker" 
ret-field="notAppliedPayment">
+            <field field="delegator" type="org.ofbiz.entity.Delegator"/>
+            <field field="serviceInMap.paymentId"/>
+        </call-class-method>
+        <entity-one value-field="payment" entity-name="Payment">
+            <field-map field-name="paymentId" 
from-field="serviceInMap.paymentId"/>
+        </entity-one>
+        <assert>
+            <not><if-empty field="paymentApplication"/></not>
+            <if-compare-field field="paymentApplication.toPaymentId" 
operator="equals" to-field="serviceInMap.toPaymentId"/>
+            <if-compare-field field="paymentApplication.paymentId" 
operator="equals" to-field="serviceInMap.paymentId"/>
+            <if-compare-field field="paymentApplication.amountApplied" 
operator="equals" to-field="payment.amount"/>
+        </assert>
+        <check-errors/>
+        <!-- both payment and invoice should be completely applied -->
+        <call-class-method method-name="getPaymentNotApplied" 
class-name="org.ofbiz.accounting.payment.PaymentWorker" 
ret-field="notAppliedPayment">
+            <field field="delegator" type="org.ofbiz.entity.Delegator"/>
+            <field field="serviceInMap.paymentId"/>
+        </call-class-method>
+        <call-class-method method-name="getPaymentNotApplied" 
class-name="org.ofbiz.accounting.payment.PaymentWorker" 
ret-field="notAppliedToPayment">
+            <field field="delegator" type="org.ofbiz.entity.Delegator"/>
+            <field field="serviceInMap.toPaymentId"/>
+        </call-class-method>
+        <set field="zero" value="0" type="BigDecimal"/>
+        <assert>
+            <if-compare-field operator="equals" field="notAppliedPayment" 
to-field="zero"/>                        
+            <if-compare-field operator="equals" field="notAppliedToPayment" 
to-field="zero"/>                        
+        </assert>
+        <check-errors/>
+        <remove-value value-field="paymentApplication"/>
+    </simple-method>
+    <simple-method method-name="testTaxGeoId" short-description="test the 
application of a payment against a tax geo id" login-required="false">
+        <!-- from the test data -->
+        <set field="serviceInMap.paymentId" value="appltest10000"/>
+        <set field="serviceInMap.taxAuthGeoId" value="UT"/>
+
+        <entity-one entity-name="UserLogin" value-field="userLogin">
+            <field-map field-name="userLoginId" value="system"/>
+        </entity-one>
+        
+        <set field="serviceInMap.userLogin" from-field="userLogin"/>
+        <call-service service-name="createPaymentApplication" 
in-map-name="serviceInMap" include-user-login="false">
+            <result-to-field result-name="amountApplied"/>
+            <result-to-field result-name="paymentApplicationId"/>
+        </call-service>
+        <entity-one entity-name="PaymentApplication" 
value-field="paymentApplication">
+            <field-map field-name="paymentApplicationId" 
from-field="paymentApplicationId"/>
+        </entity-one>
+        <entity-one value-field="payment" entity-name="Payment">
+            <field-map field-name="paymentId" 
from-field="serviceInMap.paymentId"/>
+        </entity-one>
+        <assert>
+            <not><if-empty field="paymentApplication"/></not>
+            <if-compare-field field="paymentApplication.taxAuthGeoId" 
operator="equals" to-field="serviceInMap.taxAuthGeoId"/>
+            <if-compare-field field="paymentApplication.paymentId" 
operator="equals" to-field="serviceInMap.paymentId"/>
+            <if-compare-field field="paymentApplication.amountApplied" 
operator="equals" to-field="payment.amount"/>
+        </assert>
+        <check-errors/>
+        <!-- payment should be completely applied -->
+        <call-class-method method-name="getPaymentNotApplied" 
class-name="org.ofbiz.accounting.payment.PaymentWorker" 
ret-field="notAppliedPayment">
+            <field field="delegator" type="org.ofbiz.entity.Delegator"/>
+            <field field="serviceInMap.paymentId"/>
+        </call-class-method>
+        <set field="zero" value="0" type="BigDecimal"/>
+        <assert>
+            <if-compare-field operator="equals" field="notAppliedPayment" 
to-field="zero"/>                        
+        </assert>
+        <check-errors/>
+        <remove-value value-field="paymentApplication"/>
+    </simple-method>
+
+
+</simple-methods>

Propchange: 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/PaymentApplicationTests.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/PaymentApplicationTests.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/test/PaymentApplicationTests.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/applications/accounting/servicedef/services_payment.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_payment.xml?rev=1186102&r1=1186101&r2=1186102&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_payment.xml 
(original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_payment.xml Wed Oct 
19 11:19:21 2011
@@ -70,12 +70,11 @@ under the License.
             
location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml"
 invoke="createPaymentApplication" auth="true">
         <description>Create a payment application</description>
         <attribute name="paymentId" type="String" mode="IN" optional="false"/>
+        <attribute name="toPaymentId" type="String" mode="IN" optional="true"/>
         <attribute name="invoiceId" type="String" mode="IN" optional="true"/>
-        <attribute name="invoiceItemSeqId" type="String" mode="IN" 
optional="true"/>
         <attribute name="billingAccountId" type="String" mode="IN" 
optional="true"/>
-        <attribute name="overrideGlAccountId" type="String" mode="IN" 
optional="true"/>
         <attribute name="taxAuthGeoId" type="String" mode="IN" 
optional="true"/>
-        <attribute name="amountApplied" type="BigDecimal" mode="IN" 
optional="false"/>
+        <attribute name="amountApplied" type="BigDecimal" mode="INOUT" 
optional="true"/>
         <attribute name="paymentApplicationId" type="String" mode="OUT" 
optional="false"/>
         <attribute name="paymentTypeId" type="String" mode="OUT" 
optional="false"/>
     </service>

Added: 
ofbiz/trunk/applications/accounting/testdef/data/PaymentApplicationTestsData.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/testdef/data/PaymentApplicationTestsData.xml?rev=1186102&view=auto
==============================================================================
--- 
ofbiz/trunk/applications/accounting/testdef/data/PaymentApplicationTestsData.xml
 (added)
+++ 
ofbiz/trunk/applications/accounting/testdef/data/PaymentApplicationTestsData.xml
 Wed Oct 19 11:19:21 2011
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<entity-engine-xml>
+    <!-- testInvoiceAppl -->
+    <Invoice invoiceId="appltest10000" invoiceTypeId="SALES_INVOICE" 
partyIdFrom="Company" partyId="DemoCustomer" statusId="INVOICE_SENT" 
invoiceDate="2006-04-25 12:46:27.122" dueDate="2006-05-25 12:46:27.122" 
description="This is the first invoice number to AcctBuyer" 
currencyUomId="USD"/>
+        <InvoiceItem invoiceId="appltest10000" invoiceItemSeqId="00001" 
invoiceItemTypeId="INV_SPROD_ITEM" taxableFlag="Y" amount="20" 
description="this was e service for a product"/>
+    <Payment paymentId="appltest10000" paymentTypeId="CUSTOMER_PAYMENT" 
paymentMethodTypeId="EFT_ACCOUNT" partyIdFrom="DemoCustomer" 
partyIdTo="Company" statusId="PMNT_NOT_PAID" effectiveDate="2006-04-25 
12:56:54.292" amount="20" currencyUomId="USD"/>
+
+    <!-- billing acount  -->
+    <BillingAccount billingAccountId="appltest10000" accountLimit="10000.0" 
accountCurrencyUomId="USD" contactMechId="9010" fromDate="2001-05-13 
00:00:00.000" description="Demo Customer Company Billing Account"/>
+    <BillingAccountRole billingAccountId="appltest10000" 
partyId="DemoCustomer" roleTypeId="BILL_TO_CUSTOMER" fromDate="2001-05-13 
00:00:00.000"/>
+    
+    <!-- other payment -->
+    <Payment paymentId="appltest10001" paymentTypeId="CUSTOMER_REFUND" 
paymentMethodTypeId="EFT_ACCOUNT" partyIdFrom="Company" 
partyIdTo="DemoCustomer" statusId="PMNT_NOT_PAID" effectiveDate="2006-04-25 
12:56:54.292" amount="20" currencyUomId="USD"/>
+    <!-- Tax payment -->
+    <Payment paymentId="appltest10002" paymentTypeId="SALES_TAX_PAYMENT" 
paymentMethodTypeId="EFT_ACCOUNT" partyIdFrom="Company" partyIdTo="USA_IRS" 
statusId="PMNT_NOT_PAID" effectiveDate="2006-04-25 12:56:54.292" amount="20" 
currencyUomId="USD"/>
+    
+    <!-- tax geoid -->
+    
+</entity-engine-xml>

Propchange: 
ofbiz/trunk/applications/accounting/testdef/data/PaymentApplicationTestsData.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ofbiz/trunk/applications/accounting/testdef/data/PaymentApplicationTestsData.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: 
ofbiz/trunk/applications/accounting/testdef/data/PaymentApplicationTestsData.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/applications/accounting/testdef/paymentappltests.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/testdef/paymentappltests.xml?rev=1186102&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/testdef/paymentappltests.xml (added)
+++ ofbiz/trunk/applications/accounting/testdef/paymentappltests.xml Wed Oct 19 
11:19:21 2011
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+  -->
+
+<test-suite suite-name="paymentappltests"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+        
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd";>
+
+    <test-case case-name="application-tests-data-load">
+        <entity-xml action="load" 
entity-xml-url="component://accounting/testdef/data/PaymentApplicationTestsData.xml"/>
+    </test-case>
+    <test-case case-name="application-tests">
+        <simple-method-test 
location="component://accounting/script/org/ofbiz/accounting/test/PaymentApplicationTests.xml"/>
+    </test-case>
+    
+</test-suite>

Propchange: ofbiz/trunk/applications/accounting/testdef/paymentappltests.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/accounting/testdef/paymentappltests.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/accounting/testdef/paymentappltests.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/applications/accounting/widget/PaymentForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/PaymentForms.xml?rev=1186102&r1=1186101&r2=1186102&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/PaymentForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/PaymentForms.xml Wed Oct 19 
11:19:21 2011
@@ -277,7 +277,7 @@ under the License.
         <field position="1" name="updateButton" 
title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit 
button-type="button"/></field>
     </form>
 
-    <form name="editPaymentApplicationsInv" 
default-entity-name="PaymentApplication" list-name="paymentApplicationsInv" 
target="updatePaymentApplication" type="list" separate-columns="false"
+    <form name="editPaymentApplicationsInv" 
default-entity-name="PaymentApplication" list-name="paymentApplicationsInv" 
target="removePaymentApplication" type="list" separate-columns="false"
         odd-row-style="alternate-row" default-table-style="basic-table 
hover-bar">
         <field name="paymentApplicationId"><hidden/></field>
         <field name="paymentId"><hidden/></field>
@@ -290,58 +290,32 @@ under the License.
         </field>
         <field name="invoiceItemSeqId"><display/></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"/>
-                <parameter param-name="paymentId"/>
-            </hyperlink>
-        </field>
+        <field name="removeButton" 
title="${uiLabelMap.CommonEmptyHeader}"><submit/></field>
     </form>
-    <form name="editPaymentApplicationsPay" 
default-entity-name="PaymentApplication" list-name="paymentApplicationsPay" 
target="updatePaymentApplication" type="list" separate-columns="false"
+    <form name="editPaymentApplicationsPay" 
default-entity-name="PaymentApplication" list-name="paymentApplicationsPay" 
target="removePaymentApplication" type="list" separate-columns="false"
         odd-row-style="alternate-row" default-table-style="basic-table 
hover-bar">
         <field name="paymentApplicationId"><hidden/></field>
         <field name="paymentId"><hidden/></field>
-        <field name="toPaymentId"><lookup 
target-form-name="LookupPayment"></lookup></field>
-        <field name="amountApplied"><text size="15"/></field>
-        <field name="updateButton" title="${uiLabelMap.CommonUpdate}" 
widget-style="buttontext"><submit button-type="text-link"/></field>
-        <field name="removeButton" title="${uiLabelMap.CommonRemove}" 
widget-style="buttontext">
-            <hyperlink description="${uiLabelMap.CommonRemove}" 
target="removePaymentApplication">
-                <parameter param-name="paymentApplicationId"/>
-                <parameter param-name="paymentId"/>
-            </hyperlink>
-        </field>
+        <field name="toPaymentId"><display/></field>
+        <field name="amountApplied"><display/></field>
+        <field name="removeButton" 
title="${uiLabelMap.CommonRemove}"><submit/></field>
     </form>
-    <form name="editPaymentApplicationsBil" 
default-entity-name="PaymentApplication" list-name="paymentApplicationsBil" 
target="updatePaymentApplication"  type="list" separate-columns="false"
+    <form name="editPaymentApplicationsBil" 
default-entity-name="PaymentApplication" list-name="paymentApplicationsBil" 
target="removePaymentApplication"  type="list" separate-columns="false"
         odd-row-style="alternate-row" default-table-style="basic-table 
hover-bar">
         <field name="paymentApplicationId"><hidden/></field>
         <field name="paymentId"><hidden/></field>
-        <field name="billingAccountId"><lookup 
target-form-name="LookupBillingAccount"/></field>
+        <field name="billingAccountId"><display/></field>
         <field name="invoiceId"><hidden/></field>
-        <field name="amountApplied"><text size="15"/></field>
-        <field name="updateButton" title="${uiLabelMap.CommonUpdate}" 
widget-style="buttontext"><submit button-type="text-link"/></field>
-        <field name="removeButton" title="${uiLabelMap.CommonRemove}" 
widget-style="buttontext">
-            <hyperlink description="${uiLabelMap.CommonRemove}" 
target="removePaymentApplication">
-                <parameter param-name="paymentApplicationId"/>
-                <parameter param-name="paymentId"/>
-            </hyperlink>
-        </field>
+        <field name="amountApplied"><display/></field>
+        <field name="removeButton" 
title="${uiLabelMap.CommonRemove}"><submit/></field>
     </form>
-    <form name="editPaymentApplicationsTax" 
default-entity-name="PaymentApplication" list-name="paymentApplicationsTax" 
target="updatePaymentApplication"  type="list" separate-columns="false"
+    <form name="editPaymentApplicationsTax" 
default-entity-name="PaymentApplication" list-name="paymentApplicationsTax" 
target="removePaymentApplication"  type="list" separate-columns="false"
         odd-row-style="alternate-row" default-table-style="basic-table 
hover-bar">
         <field name="paymentApplicationId"><hidden/></field>
         <field name="paymentId"><hidden/></field>
-        <field name="taxAuthGeoId"><lookup 
target-form-name="LookupGeo"/></field>
-        <field name="amountApplied"><text size="15"/></field>
-        <field name="updateButton" title="${uiLabelMap.CommonUpdate}" 
widget-style="buttontext"><submit button-type="text-link"/></field>
-        <field name="removeButton" title="${uiLabelMap.CommonRemove}" 
widget-style="buttontext">
-            <hyperlink description="${uiLabelMap.CommonRemove}" 
target="removePaymentApplication">
-                <parameter param-name="paymentApplicationId"/>
-                <parameter param-name="paymentId"/>
-            </hyperlink>
-        </field>
+        <field name="taxAuthGeoId"><display/></field>
+        <field name="amountApplied"><display/></field>
+        <field name="removeButton" 
title="${uiLabelMap.CommonRemove}"><submit/></field>
     </form>
 
     <form name="listInvoicesNotApplied" type="list" list-name="invoices" 
target="createPaymentApplication" title=""
@@ -366,7 +340,7 @@ under the License.
 
     <form name="listInvoicesNotAppliedOtherCurrency" 
extends="listInvoicesNotApplied" list-name="invoicesOtherCurrency"/>
 
-    <form name="listPaymentsNotApplied" type="list" list-name="payments" 
target="updatePaymentApplication" title=""
+    <form name="listPaymentsNotApplied" type="list" list-name="payments" 
target="createPaymentApplication" title=""
         odd-row-style="alternate-row" default-table-style="basic-table 
hover-bar">
         <field name="paymentId"><hidden/></field>
         <field name="toPaymentId" widget-style="buttontext">
@@ -383,7 +357,7 @@ under the License.
         </field>
     </form>
 
-    <form name="addPaymentApplication" type="single" 
target="updatePaymentApplication" title=""
+    <form name="addPaymentApplication" type="single" 
target="createPaymentApplication" title=""
         header-row-style="header-row" default-table-style="basic-table">
         <field name="paymentId"><hidden/></field>
         <field name="invoiceId"><lookup 
target-form-name="LookupInvoice"/></field>


Reply via email to