[OFBiz] SVN: r6947 - in trunk/applications/accounting: script/org/ofbiz/accounting/invoice servicedef
sichen@svn.ofbiz.org
sichen at svn.ofbiz.org
Wed Mar 8 11:23:41 CST 2006
Author: sichen
Date: 2006-03-08 11:23:35 -0600 (Wed, 08 Mar 2006)
New Revision: 6947
Modified:
trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml
trunk/applications/accounting/servicedef/services_invoice.xml
Log:
Patch from Hans Bakker for preventing deleting too many payment applications
Modified: trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml
===================================================================
--- trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml 2006-03-08 16:58:11 UTC (rev 6946)
+++ trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml 2006-03-08 17:23:35 UTC (rev 6947)
@@ -312,21 +312,51 @@
<simple-method method-name="removeInvoiceItem" short-description="Remove an existing Invoice Item">
<set field="invoiceId" from-field="parameters.invoiceId"/>
<call-simple-method method-name="InvoiceStatusInProgress"/>
+
+ <set field="paymentApplicationMap.invoiceId" from-field="parameters.invoiceId"/>
+ <set field="paymentApplicationMap.invoiceItemSeqId" from-field="parameters.invoiceItemSeqId"/>
+ <if-not-empty field-name="parameters.invoiceItemSeqId">
+ <!-- check if there are specific item paymentApplications when yes remove those -->
+ <remove-by-and entity-name="PaymentApplication" map-name="paymentApplicationMap"/>
+ <else><!-- update global application with a null sequence number -->
+ <!-- TODO: reduce amount on global paymentApplication record -->
+ </else>
+ </if-not-empty>
- <!-- check if there are specific item paymentApplications when yes remove those -->
- <set from-field="parameters.invoiceItemSeqId" field="removePaymentApplicationMap.invoiceItemSeqId"/>
- <remove-by-and entity-name="PaymentApplication" map-name="removePaymentApplicationMap"/>
-
<entity-one entity-name="InvoiceItem" value-name="lookedUpValue"/>
<remove-value value-name="lookedUpValue"/>
</simple-method>
<simple-method method-name="removePaymentApplication"
short-description="Remove an existing payment application">
- <entity-one entity-name="PaymentApplication" value-name="lookedUpValue"/>
- <field-to-result field-name="lookedUpValue.paymentId" result-name="paymentId"/>
- <field-to-result field-name="lookedUpValue.invoiceId" result-name="invoiceId"/>
+ <entity-one entity-name="PaymentApplication" value-name="lookedUpValue">
+ <field-map field-name="paymentApplicationId" value="${parameters.paymentApplicationId}"/>
+ </entity-one>
+ <if-empty field-name="lookedUpValue">
+ <add-error>
+ <fail-message message="Cannot find payment application record [${parameters.paymentApplicationId}]"/>
+ </add-error>
+ <return/>
+ </if-empty>
<remove-value value-name="lookedUpValue"/>
+ <if-not-empty field-name="lookedUpValue.invoiceId">
+ <field-to-result field-name="lookedUpValue.invoiceId" result-name="invoiceId"/>
+ </if-not-empty>
+ <if-not-empty field-name="lookedUpValue.invoiceItemSeqId">
+ <field-to-result field-name="lookedUpValue.invoiceItemSeqId" result-name="invoiceItemSeqId"/>
+ </if-not-empty>
+ <if-not-empty field-name="lookedUpValue.paymentId">
+ <field-to-result field-name="lookedUpValue.paymentId" result-name="paymentId"/>
+ </if-not-empty>
+ <if-not-empty field-name="lookedUpValue.toPaymentId">
+ <field-to-result field-name="lookedUpValue.toPaymentId" result-name="toPaymentId"/>
+ </if-not-empty>
+ <if-not-empty field-name="lookedUpValue.billingAccountId">
+ <field-to-result field-name="lookedUpValue.billingAccountId" result-name="billingAccountId"/>
+ </if-not-empty>
+ <if-not-empty field-name="lookedUpValue.taxAuthGeoId">
+ <field-to-result field-name="lookedUpValue.taxAuthGeoId" result-name="taxAuthGeoId"/>
+ </if-not-empty>
</simple-method>
<simple-method method-name="createInvoiceRole" short-description="Create a Invoice Role">
Modified: trunk/applications/accounting/servicedef/services_invoice.xml
===================================================================
--- trunk/applications/accounting/servicedef/services_invoice.xml 2006-03-08 16:58:11 UTC (rev 6946)
+++ trunk/applications/accounting/servicedef/services_invoice.xml 2006-03-08 17:23:35 UTC (rev 6947)
@@ -118,10 +118,9 @@
</service>
<service name="removePaymentApplication" default-entity-name="PaymentApplication" engine="simple"
location="org/ofbiz/accounting/invoice/InvoiceServices.xml" invoke="removePaymentApplication">
- <description>Remove a payment to a Invoice, delete a paymentApplication record.</description>
+ <description>Delete a paymentApplication record.</description>
<auto-attributes mode="IN" include="pk" optional="false"/>
- <attribute name="invoiceId" type="String" mode="INOUT" optional="true"/>
- <attribute name="paymentId" type="String" mode="INOUT" optional="true"/>
+ <auto-attributes mode="OUT" include="nonpk" optional="true"/>
</service>
<service name="createInvoiceTerm" engine="simple" default-entity-name="InvoiceTerm"
location="org/ofbiz/accounting/invoice/InvoiceServices.xml" invoke="createInvoiceTerm">
More information about the Svn
mailing list