Author: sichen
Date: Mon Nov 13 12:14:49 2006 New Revision: 474485 URL: http://svn.apache.org/viewvc?view=rev&rev=474485 Log: OFBIZ-433 and OFBIZ-438: Allow PAID -> READY status for invoices. Set the invoice.paidDate to now if none specified when status set to PAID. Clear paidDate when status set to READY. Thanks to Ashish Vijaywargiya. Modified: incubator/ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml Modified: incubator/ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml?view=diff&rev=474485&r1=474484&r2=474485 ============================================================================== --- incubator/ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml (original) +++ incubator/ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml Mon Nov 13 12:14:49 2006 @@ -469,6 +469,8 @@ <!-- finally the invoice can be paid or written off. --> <StatusValidChange condition="" statusId="INVOICE_READY" statusIdTo="INVOICE_PAID" transitionName="Pay"/> <StatusValidChange condition="" statusId="INVOICE_READY" statusIdTo="INVOICE_WRITEOFF" transitionName="Write Off"/> + <StatusValidChange condition="" statusId="INVOICE_PAID" statusIdTo="INVOICE_READY" transitionName="Unpay"/> + <!-- payment status --> <StatusType description="Payment Status" hasTable="N" parentTypeId="" statusTypeId="PMNT_STATUS"/> Modified: incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml?view=diff&rev=474485&r1=474484&r2=474485 ============================================================================== --- incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml (original) +++ incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml Mon Nov 13 12:14:49 2006 @@ -368,7 +368,11 @@ </if-empty> <!-- check if the status is not Paid... --> <if-compare field-name="invoice.statusId" operator="equals" value="INVOICE_PAID"> - <add-error><fail-message message="InvoiceID [${invoice.invoiceId}] has status 'Paid', cannot remove application."/></add-error> + <set field="invoiceStatusMap.invoiceId" value="${paymentApplication.invoiceId}" /> + <set field="invoiceStatusMap.statusId" value="INVOICE_READY"/> + <now-timestamp-to-env env-name="nowTimestamp"/> + <set field="invoiceStatusMap.statusDate" from-field="nowTimestamp" /> + <call-service service-name="setInvoiceStatus" in-map-name="invoiceStatusMap" /> </if-compare> <check-errors/> <field-to-result field-name="paymentApplication.invoiceId" result-name="invoiceId"/> @@ -431,13 +435,11 @@ <entity-one entity-name="Invoice" value-name="invoice"/> <field-to-result field-name="invoice.statusId" result-name="oldStatusId"/> - <if-compare-field field-name="invoice.statusId" operator="not-equals" to-field-name="parameters.statusId"> <entity-one entity-name="StatusValidChange" value-name="statusChange" auto-field-map="false"> <field-map field-name="statusId" env-name="invoice.statusId"/> <field-map field-name="statusIdTo" env-name="parameters.statusId"/> </entity-one> - <if-empty field-name="statusChange"> <add-error><fail-message message="Status is not a valid change"/></add-error> <log level="error" message="Cannot change from ${invoice.statusId} to ${parameters.statusId}"/> @@ -452,9 +454,21 @@ </if-compare> <!-- if it's OK to mark invoice paid, use parameter for paidDate --> - <set from-field="parameters.paidDate" field="invoice.paidDate"/> + <if-empty field-name="parameters.paidDate"> + <now-timestamp-to-env env-name="nowTimestamp"/> + <set from-field="nowTimestamp" field="invoice.paidDate"/> + <else> + <set from-field="parameters.paidDate" field="invoice.paidDate"/> + </else> + </if-empty> </if-compare> - + + <if-not-empty field-name="invoice.paidDate"> + <if-compare field-name="parameters.statusId" operator="equals" value="INVOICE_READY"> + <clear-field field-name="invoice.paidDate" /> + </if-compare> + </if-not-empty> + <set from-field="parameters.statusId" field="invoice.statusId"/> <store-value value-name="invoice"/> |
Free forum by Nabble | Edit this page |