Author: hansbak
Date: Thu May 13 04:08:28 2010
New Revision: 943788

URL: http://svn.apache.org/viewvc?rev=943788&view=rev
Log:
make createpayment from approved purchase order configurable

Modified:
    ofbiz/trunk/applications/accounting/config/AccountingConfig.properties
    
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml

Modified: ofbiz/trunk/applications/accounting/config/AccountingConfig.properties
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingConfig.properties?rev=943788&r1=943787&r2=943788&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingConfig.properties 
(original)
+++ ofbiz/trunk/applications/accounting/config/AccountingConfig.properties Thu 
May 13 04:08:28 2010
@@ -34,3 +34,6 @@ accounting.fixedasset.autocreate=Y
 # create a payment application if a payment is received/sent or invoice is 
approved (take the oldest not closed one)
 accounting.payment.application.autocreate=Y
 
+# create a 'not-paid' payment record if the purchase order is approved
+accounting.payment.purchaseorder.autocreate=Y
+

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=943788&r1=943787&r2=943788&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
 Thu May 13 04:08:28 2010
@@ -748,6 +748,13 @@ under the License.
     </simple-method>
 
     <simple-method method-name="createPaymentFromOrder" 
short-description="Service auto create Payment from Order">
+    
+        <property-to-field resource="AccountingConfig" 
property="accounting.payment.purchaseorder.autocreate" field="autoCreate" 
default="Y"/>
+        <if-compare operator="not-equals" value="Y" field="autoCreate">
+            <log level="info" message="payment not created from approved order 
because config is not set to Y (AccountingConfig.properties)"/>
+            <return/>
+        </if-compare>
+    
         <entity-one value-field="orderHeader" entity-name="OrderHeader"/>
         <entity-and list="orderRoleToList" entity-name="OrderRole">
             <field-map field-name="orderId" from-field="orderHeader.orderId"/>
@@ -813,6 +820,7 @@ under the License.
         <set-service-fields service-name="updatePayment" 
to-map="updatePayment" map="parameters"/>
         <call-service service-name="updatePayment" 
in-map-name="updatePayment"/>
         <field-to-result field="parameters.paymentId" result-name="paymentId"/>
+        <log level="info" message="payment ${parameters.paymentId} with the 
not-paid status automatically created from order: ${parameters.orderId} (can be 
disabled in AccountingConfig.properties)"/>
     </simple-method>
     
     <simple-method method-name="createMatchingPaymentApplication" 
short-description="Create a payment application if either the invoice of 
payment could be found">


Reply via email to