You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by David E Jones <jo...@apache.org> on 2008/12/03 06:08:55 UTC

Re: svn commit: r722753 - /ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml

Why do a remove and then create instead of a store/update? Did that  
not work for some reason?

-David


On Dec 2, 2008, at 9:23 PM, hansbak@apache.org wrote:

> Author: hansbak
> Date: Tue Dec  2 20:23:30 2008
> New Revision: 722753
>
> URL: http://svn.apache.org/viewvc?rev=722753&view=rev
> Log:
> remove timeentries from an invoice when invoice is cancelled
>
> Modified:
>    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ 
> invoice/InvoiceServices.xml
>
> Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/ 
> accounting/invoice/InvoiceServices.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml?rev=722753&r1=722752&r2=722753&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ 
> invoice/InvoiceServices.xml (original)
> +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ 
> invoice/InvoiceServices.xml Tue Dec  2 20:23:30 2008
> @@ -487,10 +487,19 @@
>                 </if-empty>
>                 <create-value value-name="newEntity"/>
>
> -                <!-- if new status is cancelled remove existing  
> payment applications. -->
> +                <!-- if new status is cancelled remove existing  
> payment applications and time entries. -->
>                 <if-compare field="parameters.statusId"  
> operator="equals" value="INVOICE_CANCELLED">
>                     <set  
> field="removePaymentApplicationMap.invoiceId" from- 
> field="parameters.invoiceId"/>
>                     <remove-by-and entity-name="PaymentApplication"  
> map-name="removePaymentApplicationMap"/>
> +                    <entity-and entity-name="TimeEntry" list- 
> name="entries">
> +                        <field-map field-name="invoiceId" env- 
> name="parameters.invoiceId"/>
> +                    </entity-and>
> +                    <iterate entry-name="entry" list-name="entries">
> +                        <remove-value value-name="entry"/>
> +                        <clear-field field-name="entry.invoiceId"/>
> +                        <clear-field field- 
> name="entry.invoiceItemSeqId"/>
> +                        <create-value value-name="entry"/>
> +                    </iterate>
>                 </if-compare>
>             </else>
>             </if-empty>
>
>