Author: apatel
Date: Wed Jul 29 04:30:06 2009
New Revision: 798775

URL: http://svn.apache.org/viewvc?rev=798775&view=rev
Log:
This commit covers following improvements
1) Set  "Group in one Transaction" checkbox selected by default. 
2) When user check "Group in one Transaction" checkbox then  system crete 
payment group of type "batch of payments") with PaymentGroupMembers.
3) Added condition on batch payment search .
4) On cancel of finAccountTrans we are expiring payment and PaymentGroup 
Association .

Modified:
    
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml
    
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml
    ofbiz/trunk/applications/accounting/servicedef/secas.xml
    ofbiz/trunk/applications/accounting/servicedef/secas_payment.xml
    ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml
    ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
    
ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl
    
ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy

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?rev=798775&r1=798774&r2=798775&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml
 (original)
+++ 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml
 Wed Jul 29 04:30:06 2009
@@ -489,4 +489,27 @@
             <clear-field field="updatePaymentMap"/>
         </iterate>
     </simple-method>
+    <simple-method 
method-name="expirePaymentAssociationsOnFinAccountTransCancel" 
short-description="expire payment associations with paymentGroup on 
finAccountTrans cancel">
+        <entity-one entity-name="FinAccountTrans" 
value-field="finAccountTrans"/>
+        <if-empty field="finAccountTrans.paymentId">
+            <entity-and entity-name="Payment" list="payments">
+                <field-map field-name="finAccountTransId" 
from-field="finAccountTrans.finAccountTransId"/>
+            </entity-and>
+            <else>
+                <get-related-one relation-name="Payment" 
value-field="finAccountTrans" to-value-field="payment"/>
+                <field-to-list field="payment" list="payments"/>
+            </else>
+        </if-empty>
+        <iterate list="payments" entry="payment">
+            <entity-and entity-name="PaymentGroupMember" 
list="paymentGroupMembers" filter-by-date="true">
+                <field-map field-name="paymentId" 
from-field="payment.paymentId"/>
+            </entity-and>
+            <if-not-empty field="paymentGroupMembers">
+                <first-from-list entry="paymentGroupMember" 
list="paymentGroupMembers"/>
+                <set-service-fields service-name="expirePaymentGroupMember" 
map="paymentGroupMember" to-map="expirePaymentGroupMemberMap"/>
+                <call-service service-name="expirePaymentGroupMember" 
in-map-name="expirePaymentGroupMemberMap"/>
+                <clear-field field="expirePaymentGroupMemberMap"/>
+            </if-not-empty>
+        </iterate>
+    </simple-method>
 </simple-methods>

Modified: 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml?rev=798775&r1=798774&r2=798775&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml
 (original)
+++ 
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml
 Wed Jul 29 04:30:06 2009
@@ -126,7 +126,7 @@
         <set-nonpk-fields value-field="lookedUpValue" map="parameters"/>
         <store-value value-field="lookedUpValue"/>
     </simple-method>
-    <simple-method method-name="deletePaymentGroupMember" 
short-description="Delete a Payment Group Member">
+    <simple-method method-name="expirePaymentGroupMember" 
short-description="expire a Payment Group Member">
         <entity-one entity-name="PaymentGroupMember" 
value-field="paymentGroupMember"/>
         <now-timestamp field="paymentGroupMember.thruDate"/>
         <store-value value-field="paymentGroupMember"/>

Modified: ofbiz/trunk/applications/accounting/servicedef/secas.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas.xml?rev=798775&r1=798774&r2=798775&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/secas.xml Wed Jul 29 
04:30:06 2009
@@ -168,4 +168,8 @@
         <action service="checkInvoicePaymentApplications" mode="sync"/>
         <action service="capturePaymentsByInvoice" mode="sync"/>
     </eca>
+    <eca service="depositWithdrawPayments" event="commit">
+        <condition field-name="groupInOneTransaction" operator="equals" 
value="Y"/>
+        <action service="createPaymentGroupAndMember" mode="async"/>
+    </eca>
 </service-eca>

Modified: ofbiz/trunk/applications/accounting/servicedef/secas_payment.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas_payment.xml?rev=798775&r1=798774&r2=798775&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/secas_payment.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/secas_payment.xml Wed Jul 29 
04:30:06 2009
@@ -47,10 +47,11 @@
         <action service="createFinAccoutnTransFromPayment" mode="sync"/>
      </eca>
      
-     <!-- Update payment when FinAccountTrans status is set to Cancle, remove 
finAccountTransId form Payment entity. -->
+     <!-- Update payment and payment associations when FinAccountTrans status 
is set to Cancle, remove finAccountTransId form Payment entity. -->
      <eca service="setFinAccountTransStatus" event="commit">
          <condition field-name="finAccountTransId" operator="is-not-empty"/>
          <condition field-name="statusId" operator="equals" 
value="FINACT_TRNS_CANCELED"/>
+         <action service="expirePaymentAssociationsOnFinAccountTransCancel" 
mode="sync"/>
          <action service="updatePaymentOnFinAccTransStatusSetToCancel" 
mode="sync"/>
          <action service="updateFinAccountBalancesFromTrans" mode="sync"/>
      </eca>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml?rev=798775&r1=798774&r2=798775&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml 
(original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml Wed 
Jul 29 04:30:06 2009
@@ -404,6 +404,11 @@
         <attribute name="paymentIds" type="List" mode="IN" optional="false"/>
         <attribute name="finAccountId" type="String" mode="IN" 
optional="false"/>
         <attribute name="groupInOneTransaction" type="String" mode="IN" 
optional="true"/>
+        <attribute name="paymentGroupTypeId" type="String" mode="IN" 
optional="true"/>
         <attribute name="finAccountTransId" type="String" mode="OUT" 
optional="true"/>
     </service>
+    <service name="expirePaymentAssociationsOnFinAccountTransCancel" 
engine="simple" 
location="component://accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml"
 invoke="expirePaymentAssociationsOnFinAccountTransCancel">
+        <description>expire payment associations with paymentGroup on 
finAccountTrans cancel</description>
+        <attribute name="finAccountTransId" type="String" mode="IN" 
optional="true"/>
+    </service>
 </services>

Modified: 
ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=798775&r1=798774&r2=798775&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml 
(original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml 
Wed Jul 29 04:30:06 2009
@@ -826,9 +826,13 @@
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
-    <service name="deletePaymentGroupMember" 
default-entity-name="PaymentGroupMember" engine="simple"
-            
location="component://accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml"
 invoke="deletePaymentGroupMember" auth="true">
+    <service name="deletePaymentGroupMember" 
default-entity-name="PaymentGroupMember" engine="entity-auto" invoke="delete" 
auth="true">
         <description>Delete a Payment Group Member</description>
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
+    <service name="expirePaymentGroupMember" 
default-entity-name="PaymentGroupMember" engine="simple"
+            
location="component://accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml"
 invoke="expirePaymentGroupMember" auth="true">
+        <description>expire a Payment Group Member</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+    </service>
 </services>
\ No newline at end of file

Modified: 
ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl?rev=798775&r1=798774&r2=798775&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl
 (original)
+++ 
ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl
 Wed Jul 29 04:30:06 2009
@@ -78,6 +78,7 @@
                 <input type="hidden" name='partyIdFrom' 
value="${partyIdFrom?if_exists}">
                 <input type="hidden" name='fromDate' 
value="${fromDate?if_exists}">
                 <input type="hidden" name='thruDate' 
value="${thruDate?if_exists}">
+                <input type="hidden" name='paymentGroupTypeId' 
value="BATCH_PAYMENT">
                 <div>
                     <span class="label">${uiLabelMap.AccountingRunningTotal} 
:</span>
                     <span class="label" id="showPaymentRunningTotal"></span>
@@ -121,7 +122,7 @@
                     </#list>
                     <div align="right">
                         ${uiLabelMap.AccountingGroupInOneTransaction}
-                        <input type="checkbox" name="groupInOneTransaction" 
value="Y"/>
+                        <input type="checkbox" name="groupInOneTransaction" 
value="Y" checked/>
                         <input id="submitButton" type="button"  
onclick="javascript:document.depositWithdrawPaymentsForm.submit();" 
value="${uiLabelMap.AccountingDepositWithdraw}" disabled/>
                     </div>
                 </table>

Modified: 
ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy?rev=798775&r1=798774&r2=798775&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy
 (original)
+++ 
ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy
 Wed Jul 29 04:30:06 2009
@@ -44,6 +44,8 @@
         finAccountTransIds = 
EntityUtil.getFieldListFromEntityList(finAccountTransList, "finAccountTransId", 
true);
         paymentCond.add(EntityCondition.makeCondition("finAccountTransId", 
EntityOperator.IN, finAccountTransIds));
     }
+} else {
+    paymentCond.add(EntityCondition.makeCondition("finAccountTransId", 
EntityOperator.NOT_EQUAL, null));
 }
 payments = delegator.findList("Payment", 
EntityCondition.makeCondition(paymentCond, EntityOperator.AND), null, null, 
null, false);
 paymentListWithCreditCard = [];
@@ -67,4 +69,4 @@
     } else {
         context.paymentList = paymentListWithoutCreditCard;
     }
-}
\ No newline at end of file
+}


Reply via email to