svn commit: r1759180 - in /ofbiz/trunk/applications: accounting/config/ accounting/minilang/payment/ accounting/servicedef/ accounting/src/main/java/org/apache/ofbiz/accounting/payment/ party/config/ party/groovyScripts/party/ party/template/party/ par...

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

svn commit: r1759180 - in /ofbiz/trunk/applications: accounting/config/ accounting/minilang/payment/ accounting/servicedef/ accounting/src/main/java/org/apache/ofbiz/accounting/payment/ party/config/ party/groovyScripts/party/ party/template/party/ par...

diveshdutta
Author: diveshdutta
Date: Sun Sep  4 17:11:08 2016
New Revision: 1759180

URL: http://svn.apache.org/viewvc?rev=1759180&view=rev
Log:
[OFBIZ-7475] Provided the option to update Check Payment Method from Party profile page. Introduced new service updateCheckAccount. Thanks Jagpreet Kaur for the patch and Swapnil for creating the ticket.

Modified:
    ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
    ofbiz/trunk/applications/accounting/minilang/payment/PaymentMapProcs.xml
    ofbiz/trunk/applications/accounting/minilang/payment/PaymentMethodEvents.xml
    ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
    ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java
    ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentWorker.java
    ofbiz/trunk/applications/party/config/PartyUiLabels.xml
    ofbiz/trunk/applications/party/groovyScripts/party/EditPaymentMethod.groovy
    ofbiz/trunk/applications/party/template/party/AddCheckForParty.ftl
    ofbiz/trunk/applications/party/template/party/profileblocks/PaymentMethods.ftl
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml

Modified: ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml?rev=1759180&r1=1759179&r2=1759180&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml Sun Sep  4 17:11:08 2016
@@ -19,6 +19,9 @@
     under the License.
 -->
 <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-properties.xsd">
+    <property key="AccountingCheckAccountCannotBeUpdated">
+        <value xml:lang="en">ERROR: Could not update Check Account.</value>
+    </property>
     <property key="AccountingDeleteRateAmount">
         <value xml:lang="ar">لا يمكن إيجاد سجل مبلغ النسبة لإلغائها</value>
         <value xml:lang="de">Kann die zu löschende Raten-Summe nicht finden</value>

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=1759180&r1=1759179&r2=1759180&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Sun Sep  4 17:11:08 2016
@@ -2993,10 +2993,16 @@
         <value xml:lang="zh-TW">支票金額</value>
     </property>
     <property key="AccountingCheckCreatedSuccessfully">
-        <value xml:lang="en">Check Account information created successfully</value>
+        <value xml:lang="en">Check Account information created successfully.</value>
     </property>
     <property key="AccountingCheckNotAdded">
-         <value xml:lang="en">Check Account Information can't be created</value>
+         <value xml:lang="en">Check Account Information can not be created.</value>
+    </property>
+    <property key="AccountingCheckUpdatedSuccessfully">
+        <value xml:lang="en">Check Account information updated successfully.</value>
+    </property>
+    <property key="AccountingCheckPaymentMethodIdMissing">
+        <value xml:lang="en">Check Account Payment Method ID is missing.</value>
     </property>
     <property key="AccountingCheckGiftCard">
         <value xml:lang="ar">تحقق مما إذا كان لدي بطاقة هدية للإستخدام اليوم</value>

Modified: ofbiz/trunk/applications/accounting/minilang/payment/PaymentMapProcs.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/minilang/payment/PaymentMapProcs.xml?rev=1759180&r1=1759179&r2=1759180&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/minilang/payment/PaymentMapProcs.xml (original)
+++ ofbiz/trunk/applications/accounting/minilang/payment/PaymentMapProcs.xml Sun Sep  4 17:11:08 2016
@@ -126,4 +126,7 @@ under the License.
     <process field="companyNameOnAccount"><copy/></process>
     <process field="contactMechId"><copy/></process>
   </simple-map-processor>
+  <simple-map-processor name="updateCheckAccount">
+    <process field="paymentMethodId"><copy/><not-empty><fail-property resource="AccountingUiLabels" property="AccountingCheckPaymentMethodIdMissing"/></not-empty></process>
+  </simple-map-processor>
 </simple-map-processors>

Modified: ofbiz/trunk/applications/accounting/minilang/payment/PaymentMethodEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/minilang/payment/PaymentMethodEvents.xml?rev=1759180&r1=1759179&r2=1759180&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/minilang/payment/PaymentMethodEvents.xml (original)
+++ ofbiz/trunk/applications/accounting/minilang/payment/PaymentMethodEvents.xml Sun Sep  4 17:11:08 2016
@@ -94,7 +94,7 @@ under the License.
         </call-service>
     </simple-method>
 
-    <!-- Check events -->
+    <!-- Check Account events -->
     <simple-method method-name="createCheckAccount" short-description="Create Check Account for party">
         <call-map-processor xml-resource="component://accounting/minilang/payment/PaymentMapProcs.xml"
                 processor-name="createCheckAccount" in-map-name="parameters" out-map-name="context"/>
@@ -103,4 +103,16 @@ under the License.
             <default-message resource="AccountingUiLabels" property="AccountingCheckCreatedSuccessfully"/>
             <result-to-request result-name="paymentMethodId"/></call-service>
     </simple-method>
+    <simple-method method-name="updateCheckAccount" short-description="Update Check Account">
+        <call-map-processor xml-resource="component://accounting/minilang/payment/PaymentMapProcs.xml"
+                            processor-name="updateCheckAccount" in-map-name="parameters" out-map-name="context"/>
+        <!-- before check-errors also call createCheckAccount, which completes the checking, etc for updateCheckAccount -->
+        <call-map-processor xml-resource="component://accounting/minilang/payment/PaymentMapProcs.xml"
+                            processor-name="createCheckAccount" in-map-name="parameters" out-map-name="context"/>
+        <check-errors/>
+        <call-service service-name="updateCheckAccount" in-map-name="context">
+            <default-message resource="AccountingUiLabels" property="AccountingCheckUpdatedSuccessfully"/>
+            <result-to-request result-name="paymentMethodId" request-name="paymentMethodId"/>
+        </call-service>
+    </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=1759180&r1=1759179&r2=1759180&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Sun Sep  4 17:11:08 2016
@@ -155,6 +155,24 @@ under the License.
         <attribute name="paymentMethodId" type="String" mode="INOUT" optional="true"/>
     </service>
 
+    <service name="updateCheckAccount" engine="java"
+             location="org.apache.ofbiz.accounting.payment.PaymentMethodServices" invoke="updateCheckAccount" auth="true">
+        <description>Update Check Account</description>
+        <attribute name="partyId" type="String" mode="IN" optional="true"/>
+        <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/>
+        <attribute name="paymentMethodTypeId" type="String" mode="IN" optional="false"/>
+        <attribute name="description" type="String" mode="IN" optional="true"/>
+        <attribute name="paymentMethodId" type="String" mode="INOUT" optional="false"/>
+        <attribute name="bankName" type="String" mode="IN" optional="true"/>
+        <attribute name="routingNumber" type="String" mode="IN" optional="true"/>
+        <attribute name="accountType" type="String" mode="IN" optional="true"/>
+        <attribute name="accountNumber" type="String" mode="IN" optional="true"/>
+        <attribute name="nameOnAccount" type="String" mode="IN" optional="false"/>
+        <attribute name="companyNameOnAccount" type="String" mode="IN" optional="true"/>
+        <attribute name="contactMechId" type="String" mode="IN" optional="true"/>
+        <attribute name="oldPaymentMethodId" type="String" mode="OUT" optional="true"/>
+    </service>
+
     <service name="createEftAccountAndAddress" engine="group" location="createEftAccountAndAddress" invoke="" auth="true">
         <description>Creates an EftAccount and PostalAddress</description>
         <attribute name="contactMechId" type="String" mode="INOUT" optional="true"/>

Modified: ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java?rev=1759180&r1=1759179&r2=1759180&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java Sun Sep  4 17:11:08 2016
@@ -991,4 +991,141 @@ public class PaymentMethodServices {
         result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
         return result;
     }
+
+    public static Map<String, Object> updateCheckAccount(DispatchContext ctx, Map<String, ? extends Object> context) {
+        Map<String, Object> result = new HashMap<String, Object>();
+        Delegator delegator = ctx.getDelegator();
+        Security security = ctx.getSecurity();
+        GenericValue userLogin = (GenericValue) context.get("userLogin");
+        Locale locale = (Locale) context.get("locale");
+
+        Timestamp now = UtilDateTime.nowTimestamp();
+
+        String partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin, security, context, result, "PAY_INFO", "_UPDATE", "ACCOUNTING", "_UPDATE");
+
+        if (result.size() > 0) return result;
+
+        List<GenericValue> toBeStored = new LinkedList<GenericValue>();
+        boolean isModified = false;
+
+        GenericValue paymentMethod = null;
+        GenericValue newPm = null;
+        GenericValue checkAccount = null;
+        GenericValue newCa = null;
+        String paymentMethodId = (String) context.get("paymentMethodId");
+
+        try {
+            checkAccount = EntityQuery.use(delegator).from("CheckAccount").where("paymentMethodId", paymentMethodId).queryOne();
+            paymentMethod =
+                    EntityQuery.use(delegator).from("PaymentMethod").where("paymentMethodId", paymentMethodId).queryOne();
+        } catch (GenericEntityException e) {
+            Debug.logWarning(e.getMessage(), module);
+            return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+                    "AccountingCheckAccountCannotBeUpdated",
+                    UtilMisc.toMap("errorString", e.getMessage()), locale));
+        }
+
+        if (checkAccount == null || paymentMethod == null) {
+            return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+                    "AccountingCheckAccountCannotBeUpdated",
+                    UtilMisc.toMap("errorString", paymentMethodId), locale));
+        }
+        if (!paymentMethod.getString("partyId").equals(partyId) && !security.hasEntityPermission("PAY_INFO", "_UPDATE", userLogin) && !security.hasEntityPermission("ACCOUNTING", "_UPDATE", userLogin)) {
+            return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+                    "AccountingCheckAccountCannotBeUpdated",
+                    UtilMisc.toMap("partyId", partyId, "paymentMethodId", paymentMethodId), locale));
+        }
+
+        newPm = GenericValue.create(paymentMethod);
+        toBeStored.add(newPm);
+        newCa = GenericValue.create(checkAccount);
+        toBeStored.add(newCa);
+
+        String newPmId = null;
+        try {
+            newPmId = delegator.getNextSeqId("PaymentMethod");
+        } catch (IllegalArgumentException e) {
+            return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+                    "AccountingCheckAccountCannotBeUpdated", locale));
+        }
+
+        newPm.set("partyId", partyId);
+        newPm.set("paymentMethodTypeId", context.get("paymentMethodTypeId"));
+        newPm.set("fromDate", context.get("fromDate"), false);
+        newPm.set("description",context.get("description"));
+        newCa.set("bankName", context.get("bankName"));
+        newCa.set("routingNumber", context.get("routingNumber"));
+        newCa.set("accountType", context.get("accountType"));
+        newCa.set("accountNumber", context.get("accountNumber"));
+        newCa.set("nameOnAccount", context.get("nameOnAccount"));
+        newCa.set("companyNameOnAccount", context.get("companyNameOnAccount"));
+        newCa.set("contactMechId", context.get("contactMechId"));
+
+        if (!newCa.equals(checkAccount) || !newPm.equals(paymentMethod)) {
+            newPm.set("paymentMethodId", newPmId);
+            newCa.set("paymentMethodId", newPmId);
+            newPm.set("fromDate", (context.get("fromDate") != null ? context.get("fromDate") : now));
+            isModified = true;
+        }
+
+        GenericValue newPartyContactMechPurpose = null;
+        String contactMechId = (String) context.get("contactMechId");
+
+        if (UtilValidate.isNotEmpty(contactMechId)) {
+            // add a PartyContactMechPurpose of BILLING_LOCATION if necessary
+            String contactMechPurposeTypeId = "BILLING_LOCATION";
+
+            GenericValue tempVal = null;
+
+            try {
+                List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose")
+                        .where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
+                allPCWPs = EntityUtil.filterByDate(allPCWPs, now, "contactFromDate", "contactThruDate", true);
+                allPCWPs = EntityUtil.filterByDate(allPCWPs, now, "purposeFromDate", "purposeThruDate", true);
+                tempVal = EntityUtil.getFirst(allPCWPs);
+            } catch (GenericEntityException e) {
+                Debug.logWarning(e.getMessage(), module);
+                tempVal = null;
+            }
+
+            if (tempVal == null) {
+                // no value found, create a new one
+                newPartyContactMechPurpose = delegator.makeValue("PartyContactMechPurpose",
+                        UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId,
+                                "contactMechPurposeTypeId", contactMechPurposeTypeId, "fromDate", now));
+            }
+        }
+
+        if (isModified) {
+            // Debug.logInfo("yes, is modified", module);
+            if (newPartyContactMechPurpose != null)
+                toBeStored.add(newPartyContactMechPurpose);
+
+            // set thru date on old paymentMethod
+            paymentMethod.set("thruDate", now);
+            toBeStored.add(paymentMethod);
+
+            try {
+                delegator.storeAll(toBeStored);
+            } catch (GenericEntityException e) {
+                Debug.logWarning(e.getMessage(), module);
+                return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+                        "AccountingCheckAccountCannotBeUpdated",
+                        UtilMisc.toMap("errorString", e.getMessage()), locale));
+            }
+        } else {
+            result.put("paymentMethodId", paymentMethodId);
+            result.put("oldPaymentMethodId", paymentMethodId);
+            result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
+            result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource,
+                    "AccountingCheckAccountCannotBeUpdated", locale));
+
+            return result;
+        }
+
+        result.put("paymentMethodId", newCa.getString("paymentMethodId"));
+        result.put("oldPaymentMethodId", paymentMethodId);
+        result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
+        return result;
+    }
 }

Modified: ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentWorker.java?rev=1759180&r1=1759179&r2=1759180&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentWorker.java (original)
+++ ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentWorker.java Sun Sep  4 17:11:08 2016
@@ -121,6 +121,7 @@ public final class PaymentWorker {
         GenericValue creditCard = null;
         GenericValue giftCard = null;
         GenericValue eftAccount = null;
+        GenericValue checkAccount = null;
 
         if (UtilValidate.isNotEmpty(paymentMethodId)) {
             try {
@@ -128,6 +129,7 @@ public final class PaymentWorker {
                 creditCard = EntityQuery.use(delegator).from("CreditCard").where("paymentMethodId", paymentMethodId).queryOne();
                 giftCard = EntityQuery.use(delegator).from("GiftCard").where("paymentMethodId", paymentMethodId).queryOne();
                 eftAccount = EntityQuery.use(delegator).from("EftAccount").where("paymentMethodId", paymentMethodId).queryOne();
+                checkAccount = EntityQuery.use(delegator).from("CheckAccount").where("paymentMethodId", paymentMethodId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logWarning(e, module);
             }
@@ -147,6 +149,9 @@ public final class PaymentWorker {
         if (eftAccount != null) {
             results.put("eftAccount", eftAccount);
         }
+        if (checkAccount != null) {
+            results.put("checkAccount", checkAccount);
+        }
 
         String curContactMechId = null;
 
@@ -156,6 +161,8 @@ public final class PaymentWorker {
             curContactMechId = UtilFormatOut.checkNull(tryEntity ? giftCard.getString("contactMechId") : request.getParameter("contactMechId"));
         } else if (eftAccount != null) {
             curContactMechId = UtilFormatOut.checkNull(tryEntity ? eftAccount.getString("contactMechId") : request.getParameter("contactMechId"));
+        }  else if (checkAccount != null) {
+            curContactMechId = UtilFormatOut.checkNull(tryEntity ? checkAccount.getString("contactMechId") : request.getParameter("contactMechId"));
         }
         if (curContactMechId != null) {
             results.put("curContactMechId", curContactMechId);

Modified: ofbiz/trunk/applications/party/config/PartyUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/config/PartyUiLabels.xml?rev=1759180&r1=1759179&r2=1759180&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/config/PartyUiLabels.xml (original)
+++ ofbiz/trunk/applications/party/config/PartyUiLabels.xml Sun Sep  4 17:11:08 2016
@@ -2269,6 +2269,9 @@
         <value xml:lang="zh">编辑电子资金转账账户</value>
         <value xml:lang="zh-TW">編輯電子資金轉帳帳戶</value>
     </property>
+    <property key="PageTitleEditCheckAccount">
+        <value xml:lang="en">Edit Check Account</value>
+    </property>
     <property key="PageTitleEditGiftCard">
         <value xml:lang="ar">تعديل بطاقة الهدية</value>
         <value xml:lang="cs">Zpracovat dárkový poukaz</value>

Modified: ofbiz/trunk/applications/party/groovyScripts/party/EditPaymentMethod.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/groovyScripts/party/EditPaymentMethod.groovy?rev=1759180&r1=1759179&r2=1759180&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/groovyScripts/party/EditPaymentMethod.groovy (original)
+++ ofbiz/trunk/applications/party/groovyScripts/party/EditPaymentMethod.groovy Sun Sep  4 17:11:08 2016
@@ -49,6 +49,10 @@ eftAccountData = paymentResults.eftAccou
 if (!tryEntity) eftAccountData = parameters;
 context.eftAccountData = eftAccountData ?: [:];
 
+checkAccountData = paymentResults.checkAccount;
+if (!tryEntity) checkAccountData = parameters;
+context.checkAccountData = checkAccountData ?: [:];
+
 context.donePage = parameters.DONE_PAGE ?:"viewprofile";
 
 paymentMethodData = paymentResults.paymentMethod;

Modified: ofbiz/trunk/applications/party/template/party/AddCheckForParty.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/template/party/AddCheckForParty.ftl?rev=1759180&r1=1759179&r2=1759180&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/template/party/AddCheckForParty.ftl (original)
+++ ofbiz/trunk/applications/party/template/party/AddCheckForParty.ftl Sun Sep  4 17:11:08 2016
@@ -1,28 +1,37 @@
 <div class="screenlet">
   <div class="screenlet-title-bar">
+    <#if !checkAccountData.paymentMethodId??>
       <h3>${uiLabelMap.AccountingAddCheckAccount}</h3>
+    <#else>
+      <h3>${uiLabelMap.PageTitleEditCheckAccount}</h3>
+    </#if>
   </div>
   <div class="screenlet-body">
-    <form method="post" action='<@ofbizUrl>createCheckForParty?DONE_PAGE=${donePage}</@ofbizUrl>' name="addcheckform" style='margin: 0;'>
+    <#if !checkAccountData.paymentMethodId??>
+      <form method="post" action='<@ofbizUrl>createCheckForParty?DONE_PAGE=${donePage}</@ofbizUrl>' name="addcheckform" style='margin: 0;'>
+    <#else>
+      <form method="post" action='<@ofbizUrl>updateCheckAccount?DONE_PAGE=${donePage}</@ofbizUrl>' name="addcheckform" style='margin: 0;'>
+      <input type="hidden" name='paymentMethodId' value='${paymentMethodData.paymentMethodId}' />
+    </#if>
       <input type="hidden" name="partyId" value="${parameters.partyId}"/>
       <table class="basic-table" cellspacing="0">
         <tr>
           <td class="label">${uiLabelMap.AccountingNameAccount}</td>
           <td>
-            <input type="text" class='required' size="30" maxlength="60" name="nameOnAccount" />
+            <input type="text" class='required' size="30" maxlength="60" name="nameOnAccount" value="${checkAccountData.nameOnAccount!}"/>
             <span class="tooltip">${uiLabelMap.CommonRequired}</span>
           </td>
         </tr>
         <tr>
           <td class="label">${uiLabelMap.AccountingCompanyNameAccount}</td>
           <td>
-            <input type="text" size="30" maxlength="60" name="companyNameOnAccount" />
+            <input type="text" size="30" maxlength="60" name="companyNameOnAccount" value="${checkAccountData.companyNameOnAccount!}"/>
           </td>
         </tr>
         <tr>
           <td class="label">${uiLabelMap.AccountingBankName}</td>
           <td>
-            <input type="text" class='required' size="30" maxlength="60" name="bankName" value="" />
+            <input type="text" class='required' size="30" maxlength="60" name="bankName" value="${checkAccountData.bankName!}" />
             <span class="tooltip">${uiLabelMap.CommonRequired}</span>
           </td>
         </tr>
@@ -30,6 +39,8 @@
           <td class="label">${uiLabelMap.CommonPaymentMethodType}</td>
           <td>
             <select name="paymentMethodTypeId" class='required'>
+              <option>${paymentMethodData.paymentMethodTypeId!}</option>
+              <option></option>
               <option>CERTIFIED_CHECK</option>
               <option>COMPANY_CHECK</option>
               <option>PERSONAL_CHECK</option>
@@ -40,13 +51,14 @@
         <tr>
           <td class="label">${uiLabelMap.AccountingRoutingNumber}</td>
           <td>
-            <input type="text" size="10" maxlength="30" name="routingNumber"/>
+            <input type="text" size="10" maxlength="30" name="routingNumber" value="${checkAccountData.routingNumber!}"/>
           </td>
         </tr>
         <tr>
           <td class="label">${uiLabelMap.AccountingAccountType}</td>
           <td>
             <select name="accountType">
+              <option>${checkAccountData.accountType!}</option>
               <option></option>
               <option>${uiLabelMap.CommonChecking}</option>
               <option>${uiLabelMap.CommonSavings}</option>
@@ -56,13 +68,13 @@
         <tr>
           <td class="label">${uiLabelMap.AccountingAccountNumber}</td>
           <td>
-            <input type="text" size="20" maxlength="40" name="accountNumber" />
+            <input type="text" size="20" maxlength="40" name="accountNumber" value="${checkAccountData.accountNumber!}"/>
           </td>
         </tr>
         <tr>
           <td class="label">${uiLabelMap.CommonDescription}</td>
           <td>
-            <input type="text" size="30" maxlength="60" name="description"/>
+            <input type="text" size="30" maxlength="60" name="description" value="${paymentMethodData.description!}"/>
           </td>
         </tr>
         <tr>

Modified: ofbiz/trunk/applications/party/template/party/profileblocks/PaymentMethods.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/template/party/profileblocks/PaymentMethods.ftl?rev=1759180&r1=1759179&r2=1759180&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/template/party/profileblocks/PaymentMethods.ftl (original)
+++ ofbiz/trunk/applications/party/template/party/profileblocks/PaymentMethods.ftl Sun Sep  4 17:11:08 2016
@@ -138,7 +138,9 @@ under the License.
                   <#if paymentMethod.thruDate?has_content>(${uiLabelMap.PartyContactEffectiveThru}:&nbsp;${paymentMethod.thruDate.toString()}</#if>
                 </td>
                 <td class="button-col">
-                  &nbsp;
+                <#if security.hasEntityPermission("PAY_INFO", "_UPDATE", session) || security.hasEntityPermission("ACCOUNTING", "_UPDATE", session)>
+                    <a href="<@ofbizUrl>AddCheckAccount?partyId=${partyId}&amp;paymentMethodId=${paymentMethod.paymentMethodId}</@ofbizUrl>">${uiLabelMap.CommonUpdate}</a>
+                </#if>
               <#elseif "PERSONAL_CHECK" == paymentMethod.paymentMethodTypeId>
                 <#assign checkAccount = paymentMethodValueMap.personalCheckAccount>
                 <td class="label" valign="top">
@@ -153,7 +155,9 @@ under the License.
                   <#if paymentMethod.thruDate?has_content>(${uiLabelMap.PartyContactEffectiveThru}:&nbsp;${paymentMethod.thruDate.toString()}</#if>
                 </td>
                 <td class="button-col">
-                  &nbsp;
+                <#if security.hasEntityPermission("PAY_INFO", "_UPDATE", session) || security.hasEntityPermission("ACCOUNTING", "_UPDATE", session)>
+                    <a href="<@ofbizUrl>AddCheckAccount?partyId=${partyId}&amp;paymentMethodId=${paymentMethod.paymentMethodId}</@ofbizUrl>">${uiLabelMap.CommonUpdate}</a>
+                </#if>
               <#elseif "CERTIFIED_CHECK" == paymentMethod.paymentMethodTypeId>
                 <#assign checkAccount = paymentMethodValueMap.certifiedCheckAccount>
                 <td class="label" valign="top">
@@ -168,7 +172,9 @@ under the License.
                   <#if paymentMethod.thruDate?has_content>(${uiLabelMap.PartyContactEffectiveThru}:&nbsp;${paymentMethod.thruDate.toString()}</#if>
                 </td>
                 <td class="button-col">
-                &nbsp;
+                <#if security.hasEntityPermission("PAY_INFO", "_UPDATE", session) || security.hasEntityPermission("ACCOUNTING", "_UPDATE", session)>
+                    <a href="<@ofbizUrl>AddCheckAccount?partyId=${partyId}&amp;paymentMethodId=${paymentMethod.paymentMethodId}</@ofbizUrl>">${uiLabelMap.CommonUpdate}</a>
+                </#if>
               <#else>
                 <td class="button-col">
                   &nbsp;

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml?rev=1759180&r1=1759179&r2=1759180&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml Sun Sep  4 17:11:08 2016
@@ -313,6 +313,12 @@ under the License.
         <response name="success" type="view" value="AddCheckAccount"/>
         <response name="error" type="view" value="AddCheckAccount"/>
     </request-map>
+    <request-map uri="updateCheckAccount">
+        <security https="true" auth="true"/>
+        <event type="simple" path="component://accounting/minilang/payment/PaymentMethodEvents.xml" invoke="updateCheckAccount"/>
+        <response name="success" type="view" value="AddCheckAccount"/>
+        <response name="error" type="view" value="AddCheckAccount"/>
+    </request-map>
     <request-map uri="editAvsOverride"><security https="true" auth="true"/><response name="success" type="view" value="editavsoverride"/></request-map>
     <request-map uri="updateAvsOverride">
         <security https="true" auth="true"/>