svn commit: r547500 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/finaccount/ servicedef/ src/org/ofbiz/accounting/finaccount/ widget/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r547500 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/finaccount/ servicedef/ src/org/ofbiz/accounting/finaccount/ widget/

jaz-3
Author: jaz
Date: Thu Jun 14 19:41:09 2007
New Revision: 547500

URL: http://svn.apache.org/viewvc?view=rev&rev=547500
Log:
implemented auto-replenish when changing replenish level or replenish payment iD

Modified:
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml
    ofbiz/trunk/applications/accounting/servicedef/secas.xml
    ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
    ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml?view=diff&rev=547500&r1=547499&r2=547500
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml Thu Jun 14 19:41:09 2007
@@ -64,9 +64,14 @@
     </simple-method>
     <simple-method method-name="updateFinAccount" short-description="Update a Financial Account">
         <entity-one entity-name="FinAccount" value-name="lookedUpValue"/>
+        <field-to-result field-name="lookedUpValue.replenishPaymentId" result-name="oldReplenishPaymentId"/>
+        <field-to-result field-name="lookedUpValue.replenishLevel" result-name="oldReplenishLevel"/>
         <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
         <store-value value-name="lookedUpValue"/>
-        <field-to-result field-name="lookedUpValue.finAccountId" result-name="finAccountId"/>
+        
+        <field-to-result field-name="lookedUpValue.replenishPaymentId" result-name="replenishPaymentId"/>
+        <field-to-result field-name="lookedUpValue.replenishLevel" result-name="replenishLevel"/>
+        <field-to-result field-name="lookedUpValue.finAccountId" result-name="finAccountId"/>        
     </simple-method>
     <simple-method method-name="deleteFinAccount" short-description="Delete a Financial Account">
         <entity-one value-name="finAccount" entity-name="FinAccount"/>

Modified: ofbiz/trunk/applications/accounting/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas.xml?view=diff&rev=547500&r1=547499&r2=547500
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/secas.xml Thu Jun 14 19:41:09 2007
@@ -108,7 +108,21 @@
     <eca service="finAccountWithdraw" event="return" run-on-error="true">
         <condition field-name="productStoreId" operator="is-not-empty"/>
         <action service="finAccountReplenish" mode="async" run-as-user="system"/>
-    </eca>    
+    </eca>
+
+    <!-- attempt replenish when payment method is updated -->
+    <eca service="updateFinAccount" event="commit" run-on-error="false">
+        <condition-field field-name="oldReplenishPaymentId" operator="not-equals" to-field-name="replenishPaymentId"/>
+        <condition field-name="replenishLevel" operator="is-not-empty"/>
+        <action service="finAccountReplenish" mode="sync" run-as-user="system"/>
+    </eca>
+
+    <!-- attempt replenish when replenish level is updated -->
+    <eca service="updateFinAccount" event="commit" run-on-error="false">
+        <condition-field field-name="oldReplenishLevel" operator="not-equals" to-field-name="replenishLevel"/>
+        <condition field-name="replenishPaymentId" operator="is-not-empty"/>
+        <action service="finAccountReplenish" mode="sync" run-as-user="system"/>
+    </eca>
     
     <!--
     <eca service="createFinAccountTrans" event="commit">

Modified: ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml?view=diff&rev=547500&r1=547499&r2=547500
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml Thu Jun 14 19:41:09 2007
@@ -42,6 +42,10 @@
             <exclude field-name="actualBalance"/>
             <exclude field-name="availableBalance"/>
         </auto-attributes>
+        <attribute name="oldReplenishPaymentId" type="String" mode="OUT" optional="true"/>
+        <attribute name="oldReplenishLevel" type="Double" mode="OUT" optional="true"/>
+        <attribute name="replenishPaymentId" type="String" mode="OUT" optional="true"/>
+        <attribute name="replenishLevel" type="Double" mode="OUT" optional="true"/>
     </service>
     <service name="deleteFinAccount" engine="simple" default-entity-name="FinAccount"
             location="org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="deleteFinAccount">
@@ -156,11 +160,11 @@
         <description>Refunds the deposits to a financial account back to the source</description>
         <attribute name="finAccountId" type="String" mode="IN" optional="false"/>
     </service>
-    <service name="finAccountReplenish" engine="java"
+    <service name="finAccountReplenish" engine="java" max-retry="3"
             location="org.ofbiz.accounting.finaccount.FinAccountPaymentServices" invoke="finAccountReplenish" auth="true">
         <description>Auto-replenish a financial account</description>
         <attribute name="finAccountId" type="String" mode="IN" optional="false"/>
-        <attribute name="productStoreId" type="String" mode="IN" optional="false"/>
+        <attribute name="productStoreId" type="String" mode="IN" optional="true"/>
     </service>
     <service name="checkFinAccountBalance" engine="java"
             location="org.ofbiz.accounting.finaccount.FinAccountServices" invoke="checkFinAccountBalance" auth="true">

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java?view=diff&rev=547500&r1=547499&r2=547500
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java Thu Jun 14 19:41:09 2007
@@ -842,6 +842,15 @@
             return orh.getProductStoreId();
         }
 
+        // none found; pick one from our set stores
+        try {
+            GenericValue store = EntityUtil.getFirst(delegator.findAll("ProductStore", UtilMisc.toList("productStoreId")));
+            if (store != null)
+                return store.getString("productStoreId");
+        } catch (GenericEntityException e) {
+            Debug.logError(e, module);
+        }
+        
         return null;
     }
     

Modified: ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml?view=diff&rev=547500&r1=547499&r2=547500
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml Thu Jun 14 19:41:09 2007
@@ -19,7 +19,7 @@
 -->
 
 <forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
+    xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
 
     <form name="FindFinAccounts" type="single" target="FindFinAccount">
         <auto-fields-entity entity-name="FinAccount" default-field-type="find"/>