Author: jacopoc
Date: Mon Dec 3 07:42:10 2007 New Revision: 600568 URL: http://svn.apache.org/viewvc?rev=600568&view=rev Log: When creating/updating a payment, if the payment method id is supplied, the payment method type id is retrieved from the payment method. Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.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=600568&r1=600567&r2=600568&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 Mon Dec 3 07:42:10 2007 @@ -45,20 +45,17 @@ <field-to-result field-name="payment.paymentId" result-name="paymentId"/> <if-not-empty field-name="parameters.paymentMethodId"> - <if-empty field-name="parameters.paymentMethodTypeId"> - <entity-one entity-name="PaymentMethod" value-name="paymentMethod"> - <field-map field-name="paymentMethodId" env-name="parameters.paymentMethodId"/> - </entity-one> - <set field="parameters.paymentMethodTypeId" from-field="paymentMethod.paymentMethodTypeId"/> - </if-empty> - </if-not-empty> - <if-empty field-name="parameters.paymentMethodId"> - <if-empty field-name="parameters.paymentMethodTypeId"> - <add-error> + <entity-one entity-name="PaymentMethod" value-name="paymentMethod"> + <field-map field-name="paymentMethodId" env-name="parameters.paymentMethodId"/> + </entity-one> + <log level="info" message="Replacing passed payment method type [${parameters.paymentMethodTypeId}] with payment method type [${paymentMethod.paymentMethodTypeId}] for payment method [${parameters.paymentMethodId}]"/> + <set field="parameters.paymentMethodTypeId" from-field="paymentMethod.paymentMethodTypeId"/> + </if-not-empty> + <if-empty field-name="parameters.paymentMethodTypeId"> + <add-error> <fail-property resource="AccountingUiLabels" property="AccountingPaymentMethodIdPaymentMethodTypeIdNullError"/> - </add-error> - </if-empty> - </if-empty> + </add-error> + </if-empty> <set-nonpk-fields map-name="parameters" value-name="payment"/> <if-empty field-name="payment.effectiveDate"> @@ -84,7 +81,7 @@ </then> </if> <check-errors/> - + <if-compare field-name="payment.statusId" value="PMNT_NOT_PAID" operator="not-equals"> <!-- check if only status change --> <make-value value-name="newPayment" entity-name="Payment"/> @@ -109,6 +106,15 @@ <if-empty field-name="payment.effectiveDate"> <now-timestamp-to-env env-name="payment.effectiveDate"/> </if-empty> + <if-not-empty field-name="payment.paymentMethodId"> + <entity-one entity-name="PaymentMethod" value-name="paymentMethod"> + <field-map field-name="paymentMethodId" env-name="payment.paymentMethodId"/> + </entity-one> + <if-compare-field field-name="payment.paymentMethodTypeId" operator="not-equals" to-field-name="paymentMethod.paymentMethodTypeId"> + <log level="info" message="Replacing passed payment method type [${payment.paymentMethodTypeId}] with payment method type [${paymentMethod.paymentMethodTypeId}] for payment method [${payment.paymentMethodId}]"/> + </if-compare-field> + <set field="payment.paymentMethodTypeId" from-field="paymentMethod.paymentMethodTypeId"/> + </if-not-empty> <store-value value-name="payment"/> <if-not-empty field-name="parameters.statusId"> |
Free forum by Nabble | Edit this page |