You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2007/07/08 02:00:06 UTC

svn commit: r554280 - in /ofbiz/branches/release4.0/applications: ecommerce/webapp/ecommerce/order/ order/src/org/ofbiz/order/shoppingcart/ order/webapp/ordermgr/entry/

Author: lektran
Date: Sat Jul  7 17:00:04 2007
New Revision: 554280

URL: http://svn.apache.org/viewvc?view=rev&rev=554280
Log:
Applied fix from trunk for revision: 544091

Modified:
    ofbiz/branches/release4.0/applications/ecommerce/webapp/ecommerce/order/checkoutshippingoptions.ftl
    ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
    ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
    ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
    ofbiz/branches/release4.0/applications/order/webapp/ordermgr/entry/billsettings.ftl
    ofbiz/branches/release4.0/applications/order/webapp/ordermgr/entry/checkoutoptions.ftl

Modified: ofbiz/branches/release4.0/applications/ecommerce/webapp/ecommerce/order/checkoutshippingoptions.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/ecommerce/webapp/ecommerce/order/checkoutshippingoptions.ftl?view=diff&rev=554280&r1=554279&r2=554280
==============================================================================
--- ofbiz/branches/release4.0/applications/ecommerce/webapp/ecommerce/order/checkoutshippingoptions.ftl (original)
+++ ofbiz/branches/release4.0/applications/ecommerce/webapp/ecommerce/order/checkoutshippingoptions.ftl Sat Jul  7 17:00:04 2007
@@ -55,18 +55,6 @@
     }
 }
 
-function toggleBillingAccount(box) {
-    var amountName = box.value + "_amount";
-    box.checked = true;
-    box.form.elements[amountName].disabled = false;
-
-    for (var i = 0; i < box.form.elements[box.name].length; i++) {
-        if (!box.form.elements[box.name][i].checked) {
-            box.form.elements[box.form.elements[box.name][i].value + "_amount"].disabled = true;
-        }
-    }
-}
-
 // -->
 </script>
 

Modified: ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?view=diff&rev=554280&r1=554279&r2=554280
==============================================================================
--- ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original)
+++ ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Sat Jul  7 17:00:04 2007
@@ -136,22 +136,21 @@
                 curPage = "payment";
             }
         } else if ("payment".equals(curPage) == true) {
-            // get the currency format
-            String currencyFormat = UtilProperties.getPropertyValue("general.properties", "currency.decimal.format", "##0.00");
-            DecimalFormat formatter = new DecimalFormat(currencyFormat);
-
             // Set the payment options
             Map selectedPaymentMethods = getSelectedPaymentMethods(request);
-            if (selectedPaymentMethods == null) {
-                return "error";
-            }
 
             String billingAccountId = request.getParameter("billingAccountId");
-            Double billingAccountAmt = determineBillingAccountAmount(request, checkOutHelper, formatter);
-            if ((billingAccountId != null) && !"_NA_".equals(billingAccountId) && (billingAccountAmt == null)) {
-                Map messageMap = UtilMisc.toMap("billingAccountId", billingAccountId);
-                String errMsg = UtilProperties.getMessage(resource, "checkevents.invalid_amount_set_for_billing_account", messageMap, (cart != null ? cart.getLocale() : Locale.getDefault()));
-                request.setAttribute("_ERROR_MESSAGE_", errMsg);
+            if (UtilValidate.isNotEmpty(billingAccountId)) {
+                Double billingAccountAmt = null;
+                billingAccountAmt = determineBillingAccountAmount(billingAccountId, request.getParameter("billingAccountAmount"), dispatcher);
+                if ((billingAccountId != null) && !"_NA_".equals(billingAccountId) && (billingAccountAmt == null)) { 
+                    request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId",billingAccountId), (cart != null ? cart.getLocale() : Locale.getDefault())));
+                    return "error";
+                }
+                selectedPaymentMethods.put("EXT_BILLACT", billingAccountAmt);
+            }
+
+            if (UtilValidate.isEmpty(selectedPaymentMethods)) {
                 return "error";
             }
 
@@ -174,7 +173,7 @@
                 }
             }
 
-            Map callResult = checkOutHelper.setCheckOutPayment(selectedPaymentMethods, singleUsePayments, billingAccountId, billingAccountAmt);
+            Map callResult = checkOutHelper.setCheckOutPayment(selectedPaymentMethods, singleUsePayments, billingAccountId);
             ServiceUtil.getMessages(request, callResult, null);
 
             if (!(callResult.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_ERROR))) {
@@ -283,13 +282,24 @@
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
 
-        // get the currency format
-        String currencyFormat = UtilProperties.getPropertyValue("general.properties", "currency.decimal.format", "##0.00");
-        DecimalFormat formatter = new DecimalFormat(currencyFormat);
-
         // Set the payment options
         Map selectedPaymentMethods = getSelectedPaymentMethods(request);
-        if (selectedPaymentMethods == null) {
+
+        CheckOutHelper checkOutHelper = new CheckOutHelper(dispatcher, delegator, cart);
+
+        // get the billing account and amount
+        String billingAccountId = request.getParameter("billingAccountId");
+        if (UtilValidate.isNotEmpty(billingAccountId)) {
+            Double billingAccountAmt = null;
+            billingAccountAmt = determineBillingAccountAmount(billingAccountId, request.getParameter("billingAccountAmount"), dispatcher);
+            if (billingAccountAmt == null) { 
+                request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId",billingAccountId), (cart != null ? cart.getLocale() : Locale.getDefault())));
+                return "error";
+            }
+            selectedPaymentMethods.put("EXT_BILLACT", billingAccountAmt);
+        }
+
+        if (UtilValidate.isEmpty(selectedPaymentMethods)) {
             return "error";
         }
 
@@ -312,7 +322,6 @@
 
         // get a request map of parameters
         Map params = UtilHttp.getParameterMap(request);
-        CheckOutHelper checkOutHelper = new CheckOutHelper(dispatcher, delegator, cart);
 
         // if taxAuthPartyGeoIds is not empty drop that into the database
         if (UtilValidate.isNotEmpty(taxAuthPartyGeoIds)) {
@@ -330,16 +339,6 @@
             }
         }
         
-        // get the billing account and amount
-        String billingAccountId = request.getParameter("billingAccountId");
-        Double billingAccountAmt = determineBillingAccountAmount(request, checkOutHelper, formatter);
-        if ((billingAccountId != null) && !"_NA_".equals(billingAccountId) && (billingAccountAmt == null)) {
-            Map messageMap = UtilMisc.toMap("billingAccountId", billingAccountId);
-            String errMsg = UtilProperties.getMessage(resource, "checkevents.invalid_amount_set_for_billing_account", messageMap, (cart != null ? cart.getLocale() : Locale.getDefault()));
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-
         // check for gift card not on file
         Map gcResult = checkOutHelper.checkGiftCard(params, selectedPaymentMethods);
         ServiceUtil.getMessages(request, gcResult, null);
@@ -357,7 +356,7 @@
         }
 
         Map optResult = checkOutHelper.setCheckOutOptions(shippingMethod, shippingContactMechId, selectedPaymentMethods,
-                singleUsePayments, billingAccountId, billingAccountAmt, shippingInstructions,
+                singleUsePayments, billingAccountId, shippingInstructions,
                 orderAdditionalEmails, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate);
 
         ServiceUtil.getMessages(request, optResult, null);
@@ -760,7 +759,20 @@
 
             // Set the payment options
             Map selectedPaymentMethods = getSelectedPaymentMethods(request);
-            if (selectedPaymentMethods == null) {
+
+            // Set the billing account (if any)
+            String billingAccountId = request.getParameter("billingAccountId");
+            if (UtilValidate.isNotEmpty(billingAccountId)) {
+                Double billingAccountAmt = null;
+                billingAccountAmt = determineBillingAccountAmount(billingAccountId, request.getParameter("billingAccountAmount"), dispatcher);
+                if (billingAccountAmt == null) { 
+                    request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId",billingAccountId), (cart != null ? cart.getLocale() : Locale.getDefault())));
+                    return "error";
+                }
+                selectedPaymentMethods.put("EXT_BILLACT", billingAccountAmt);
+            }
+
+            if (UtilValidate.isEmpty(selectedPaymentMethods)) {
                 return "error";
             }
 
@@ -771,16 +783,8 @@
                 selectedPaymentMethods.put(newPaymentMethodId, null);
             }
             
-            String billingAccountId = request.getParameter("billingAccountId");
-            String currencyFormat = UtilProperties.getPropertyValue("general.properties", "currency.decimal.format", "##0.00");
-            DecimalFormat formatter = new DecimalFormat(currencyFormat);
-            Double billingAccountAmt = determineBillingAccountAmount(request, checkOutHelper, formatter);
-            if ((billingAccountId != null) && !"_NA_".equals(billingAccountId) && (billingAccountAmt == null)) { 
-                request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId",billingAccountId), (cart != null ? cart.getLocale() : Locale.getDefault())));
-                return "error";
-            }
             // The selected payment methods are set
-            errorMessages.addAll(checkOutHelper.setCheckOutPaymentInternal(selectedPaymentMethods, null, billingAccountId, billingAccountAmt));
+            errorMessages.addAll(checkOutHelper.setCheckOutPaymentInternal(selectedPaymentMethods, null, billingAccountId));
             // Verify if a gift card has been selected during order entry
             callResult = checkOutHelper.checkGiftCard(paramMap, selectedPaymentMethods);
             ServiceUtil.addErrors(errorMessages, errorMaps, callResult);
@@ -963,37 +967,41 @@
      * This method returns the amount that will be charged to the billing account.
      *
      * An amount can be associated with the billingAccountId with a
-     * parameter amount_${billingAccountId}.  If no amount is specified, then
-     * the entire available ballance of the given billing account will be used.
+     * parameter billingAccountAmount.  If no amount is specified, then
+     * the entire available balance of the given billing account will be used.
      * If there is an error, a null will be returned.
      *
      * @return  Amount to charge billing account or null if there was an error
      */
-    private static Double determineBillingAccountAmount(HttpServletRequest request, CheckOutHelper checkOutHelper, DecimalFormat formatter) {
-        ShoppingCart cart = (ShoppingCart) request.getSession().getAttribute("shoppingCart");
-        String billingAccountId = request.getParameter("billingAccountId");
-        String billingAcctAmtStr = request.getParameter("amount_" + billingAccountId);
+    private static Double determineBillingAccountAmount(String billingAccountId, String billingAccountAmount, LocalDispatcher dispatcher) {
         Double billingAccountAmt = null;
 
-        // parse the amount to a decimal
-        if (billingAcctAmtStr != null) {
-            try {
-                billingAccountAmt = new Double(formatter.parse(billingAcctAmtStr).doubleValue());
-            } catch (ParseException e) {
-                return null;
-            }
-        }
-
         // set the billing account amount to the minimum of billing account available balance or amount input if less than balance
-        if ((cart != null) && (billingAccountId != null) && !("".equals(billingAccountId)) && !"_NA_".equals(billingAccountId)) {
-            double availableBalance = checkOutHelper.availableAccountBalance(billingAccountId);
+        if (UtilValidate.isNotEmpty(billingAccountId)) {
+            // parse the amount to a decimal
+            if (UtilValidate.isNotEmpty(billingAccountAmount)) {
+                String currencyFormat = UtilProperties.getPropertyValue("general.properties", "currency.decimal.format", "##0.00");
+                DecimalFormat formatter = new DecimalFormat(currencyFormat);
+                try {
+                    billingAccountAmt = new Double(formatter.parse(billingAccountAmount).doubleValue());
+                } catch (ParseException e) {
+                    return null;
+                }
+            }
+            if (billingAccountAmt == null) {
+                billingAccountAmt = new Double(0.0);
+            }
+            double availableBalance = CheckOutHelper.availableAccountBalance(billingAccountId, dispatcher);
 
             // set amount to be charged to entered amount unless it exceeds the available balance
             double chargeAmount = 0;
-            if ((billingAccountAmt != null) && (billingAccountAmt.doubleValue() < availableBalance)) {
+            if (billingAccountAmt.doubleValue() < availableBalance) {
                 chargeAmount = billingAccountAmt.doubleValue();
             } else {
                 chargeAmount = availableBalance;
+            }
+            if (chargeAmount < 0.0) {
+                chargeAmount = 0.0;
             }
 
             return new Double(chargeAmount);

Modified: ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?view=diff&rev=554280&r1=554279&r2=554280
==============================================================================
--- ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
+++ ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Sat Jul  7 17:00:04 2007
@@ -203,13 +203,13 @@
         return errorMessages;
     }
 
-    public Map setCheckOutPayment(Map selectedPaymentMethods, List singleUsePayments, String billingAccountId, Double billingAccountAmt) {
+    public Map setCheckOutPayment(Map selectedPaymentMethods, List singleUsePayments, String billingAccountId) {
         List errorMessages = new ArrayList();
         Map result;
         String errMsg = null;
 
         if (this.cart != null && this.cart.size() > 0) {
-            errorMessages.addAll(setCheckOutPaymentInternal(selectedPaymentMethods, singleUsePayments, billingAccountId, billingAccountAmt));
+            errorMessages.addAll(setCheckOutPaymentInternal(selectedPaymentMethods, singleUsePayments, billingAccountId));
         } else {
             errMsg = UtilProperties.getMessage(resource,"checkhelper.no_items_in_cart", (cart != null ? cart.getLocale() : Locale.getDefault()));
             errorMessages.add(errMsg);
@@ -226,7 +226,7 @@
         return result;
     }
 
-    public List setCheckOutPaymentInternal(Map selectedPaymentMethods, List singleUsePayments, String billingAccountId, Double billingAccountAmt) {
+    public List setCheckOutPaymentInternal(Map selectedPaymentMethods, List singleUsePayments, String billingAccountId) {
         List errorMessages = new ArrayList();
         String errMsg = null;
 
@@ -239,11 +239,12 @@
             // clear out the old payments
             cart.clearPayments();
 
-            if (billingAccountId != null && billingAccountAmt != null && !billingAccountId.equals("_NA_")) {
+            if (UtilValidate.isNotEmpty(billingAccountId)) {
+                Double billingAccountAmt = (Double)selectedPaymentMethods.get("EXT_BILLACT");
                 // set cart billing account data and generate a payment method containing the amount we will be charging
-                cart.setBillingAccount(billingAccountId, billingAccountAmt.doubleValue());
-            } else if ("_NA_".equals(billingAccountId)) {
-                // if _NA_ was supplied, erase all billing account data
+                cart.setBillingAccount(billingAccountId, (billingAccountAmt != null? billingAccountAmt.doubleValue(): 0.0));
+            } else {
+                // remove the billing account from the cart
                 cart.setBillingAccount(null, 0.0);
             }
 
@@ -346,7 +347,7 @@
 
 
     public Map setCheckOutOptions(String shippingMethod, String shippingContactMechId, Map selectedPaymentMethods,
-            List singleUsePayments, String billingAccountId, Double billingAccountAmt, String shippingInstructions, 
+            List singleUsePayments, String billingAccountId, String shippingInstructions, 
             String orderAdditionalEmails, String maySplit, String giftMessage, String isGift, String internalCode, String shipBeforeDate, String shipAfterDate) {
         List errorMessages = new ArrayList();
         Map result = null;
@@ -362,7 +363,7 @@
             errorMessages.addAll(setCheckOutShippingAddressInternal(shippingContactMechId));
 
             // set the payment method(s) option
-            errorMessages.addAll(setCheckOutPaymentInternal(selectedPaymentMethods, singleUsePayments, billingAccountId, billingAccountAmt));
+            errorMessages.addAll(setCheckOutPaymentInternal(selectedPaymentMethods, singleUsePayments, billingAccountId));
 
         } else {
             errMsg = UtilProperties.getMessage(resource,"checkhelper.no_items_in_cart", (cart != null ? cart.getLocale() : Locale.getDefault()));

Modified: ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?view=diff&rev=554280&r1=554279&r2=554280
==============================================================================
--- ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Sat Jul  7 17:00:04 2007
@@ -3331,6 +3331,9 @@
         remainingAmount = remainingAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
         if (getBillingAccountId() != null) {
             double billingAccountAvailableAmount = CheckOutHelper.availableAccountBalance(getBillingAccountId(), dispatcher);
+            if (this.billingAccountAmt == 0.0 && billingAccountAvailableAmount > 0) {
+                this.billingAccountAmt = billingAccountAvailableAmount;
+            }
             if (remainingAmount.doubleValue() < getBillingAccountAmount()) {
                 this.billingAccountAmt = remainingAmount.doubleValue();
             }

Modified: ofbiz/branches/release4.0/applications/order/webapp/ordermgr/entry/billsettings.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/order/webapp/ordermgr/entry/billsettings.ftl?view=diff&rev=554280&r1=554279&r2=554280
==============================================================================
--- ofbiz/branches/release4.0/applications/order/webapp/ordermgr/entry/billsettings.ftl (original)
+++ ofbiz/branches/release4.0/applications/order/webapp/ordermgr/entry/billsettings.ftl Sat Jul  7 17:00:04 2007
@@ -26,18 +26,6 @@
     }
 }
 
-function toggleBillingAccount(box) {
-    var amountName = "amount_" + box.value;
-    box.checked = true;
-    box.form.elements[amountName].disabled = false;
-
-    for (var i = 0; i < box.form.elements[box.name].length; i++) {
-        if (!box.form.elements[box.name][i].checked) {
-            box.form.elements["amount_" + box.form.elements[box.name][i].value].disabled = true;
-        }
-    }
-}
-
 function makeExpDate() {
     document.checkoutsetupform.expireDate.value = document.checkoutsetupform.expMonth.options[document.checkoutsetupform.expMonth.selectedIndex].value + "/" + document.checkoutsetupform.expYear.options[document.checkoutsetupform.expYear.selectedIndex].value;
 }
@@ -56,7 +44,35 @@
                   <a href="<@o...@ofbizUrl>" class="buttontext">${uiLabelMap.CommonCreateNew}</a>
                 </td>
               </tr>
-              <tr><td colspan="3"><hr class="sepbar"/></td></tr>                      
+              <tr><td colspan="3"><hr class="sepbar"/></td></tr>
+              <#if billingAccountList?has_content>
+                <tr>
+                  <td width="1%">
+                    <select name="billingAccountId">
+                      <option value=""></option>
+                        <#list billingAccountList as billingAccount>
+                          <#assign availableAmount = billingAccount.accountBalance?double>
+                          <#assign accountLimit = billingAccount.accountLimit?double>
+                          <option value="${billingAccount.billingAccountId}" <#if billingAccount.billingAccountId == selectedBillingAccountId?default("")>selected</#if>>${billingAccount.description?default("")} [${billingAccount.billingAccountId}] with available amount of <@ofbizCurrency amount=availableAmount isoCode=billingAccount.accountCurrencyUomId/> and account limit of <@ofbizCurrency amount=accountLimit isoCode=billingAccount.accountCurrencyUomId/></option>
+                        </#list>
+                    </select>
+                  </td>
+                  <td width="50%">
+                    <span class="tabletext">${uiLabelMap.FormFieldTitle_billingAccountId}</span>
+                  </td>
+                  <td>&nbsp;</td>
+                </tr>
+                <tr>
+                  <td width="1%" align="right">
+                    <input type="text" size="5" name="billingAccountAmount" value=""/>
+                  </td>
+                  <td width="50%">
+                    ${uiLabelMap.OrderBillUpTo}
+                  </td>
+                  <td>&nbsp;</td>
+                </tr>
+                <tr><td colspan="3"><hr class="sepbar"/></td></tr>
+              </#if>                                    
               <tr>
                 <td width="1%">
                   <input type="radio" name="checkOutPaymentId" value="EXT_OFFLINE" <#if checkOutPaymentId?exists && checkOutPaymentId == "EXT_OFFLINE">checked="checked"</#if>/>
@@ -74,43 +90,7 @@
                   <span class="tabletext">${uiLabelMap.OrderCOD}</span>
                 </td>
               </tr>
-             <tr><td colspan="3"><hr class="sepbar"/></td></tr>                  
-              <#if billingAccountList?has_content>
-                <tr>
-                  <td width="1%">
-                    <input type="radio" name="checkOutPaymentId" value="EXT_BILLACT"/>
-                  </td>
-                  <td width="50%">
-                    <span class="tabletext">${uiLabelMap.AccountingBillingAccountOnly}</span>
-                  </td>
-                  <td>&nbsp;</td>
-                </tr>
-                <tr><td colspan="3"><hr class="sepbar"/></td></tr>
-                <#list billingAccountList as billingAccount>
-                  <#assign availableAmount = billingAccount.accountBalance?double>
-                  <tr>
-                    <td align="left" valign="top" width="1%">
-                      <input type="radio" onClick="javascript:toggleBillingAccount(this);" name="billingAccountId" value="${billingAccount.billingAccountId}" <#if (billingAccount.billingAccountId == selectedBillingAccountId?default(""))>checked="checked"</#if>/>
-                    </td>
-                    <td align="left" valign="top" width="99%">
-                      <div class="tabletext">
-                       ${billingAccount.description?default("Bill Account")} #<b>${billingAccount.billingAccountId}</b>&nbsp;(<@ofbizCurrency amount=availableAmount isoCode=billingAccount.accountCurrencyUomId/>)<br/>
-                       <b>${uiLabelMap.AccountingBillUpTo}:</b> <input type="text" size="5" class="inputBox" name="amount_${billingAccount.billingAccountId}" value="${availableAmount?double?string("##0.00")}" <#if !(billingAccount.billingAccountId == selectedBillingAccountId?default(""))>disabled="disabled"</#if>/>
-                      </div>
-                    </td>
-                  </tr>
-                </#list>
-                <tr>
-                  <td align="left" valign="top" width="1%">
-                    <input type="radio" onClick="javascript:toggleBillingAccount(this);" name="billingAccountId" value="_NA_" <#if (selectedBillingAccountId?default("") == "N")>checked="checked"</#if>/>
-                    <input type="hidden" name="_NA_amount" value="0.00"/>
-                  </td>
-                  <td align="left" valign="top" width="99%">
-                    <div class="tabletext">${uiLabelMap.AccountingNoBillingAccount}</div>
-                   </td>
-                </tr>
-                <tr><td colspan="3"><hr class="sepbar"/></td></tr>
-              </#if>                                    
+             <tr><td colspan="3"><hr class="sepbar"/></td></tr>
               <#if paymentMethodList?has_content>
                 <#list paymentMethodList as paymentMethod>
                   <#if paymentMethod.paymentMethodTypeId == "CREDIT_CARD">

Modified: ofbiz/branches/release4.0/applications/order/webapp/ordermgr/entry/checkoutoptions.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/order/webapp/ordermgr/entry/checkoutoptions.ftl?view=diff&rev=554280&r1=554279&r2=554280
==============================================================================
--- ofbiz/branches/release4.0/applications/order/webapp/ordermgr/entry/checkoutoptions.ftl (original)
+++ ofbiz/branches/release4.0/applications/order/webapp/ordermgr/entry/checkoutoptions.ftl Sat Jul  7 17:00:04 2007
@@ -66,17 +66,6 @@
     }
 }
 
-function toggleBillingAccount(box) {
-    var amountName = "amount_" + box.value;
-    box.checked = true;
-    box.form.elements[amountName].disabled = false;
-
-    for (var i = 0; i < box.form.elements[box.name].length; i++) {
-        if (!box.form.elements[box.name][i].checked) {
-            box.form.elements["amount_" + box.form.elements[box.name][i].value].disabled = true;
-        }
-    }
-}
 </script>
 
 <#assign shipping = !shoppingCart.containAllWorkEffortCartItems()> <#-- contains items which need shipping? -->
@@ -445,35 +434,26 @@
                     <tr><td colspan="2"><hr class="sepbar"/></td></tr>
                     <tr>
                       <td width="1%">
-                        <input type="radio" name="checkOutPaymentId" value="EXT_BILLACT" <#if "EXT_BILLACT" == checkOutPaymentId>checked="checked"</#if>/></hr>
+                        <select name="billingAccountId">
+                          <option value=""></option>
+                            <#list billingAccountList as billingAccount>
+                              <#assign availableAmount = billingAccount.accountBalance?double>
+                              <#assign accountLimit = billingAccount.accountLimit?double>
+                              <option value="${billingAccount.billingAccountId}" <#if billingAccount.billingAccountId == selectedBillingAccountId?default("")>selected</#if>>${billingAccount.description?default("")} [${billingAccount.billingAccountId}] with available amount of <@ofbizCurrency amount=availableAmount isoCode=billingAccount.accountCurrencyUomId/> and account limit of <@ofbizCurrency amount=accountLimit isoCode=billingAccount.accountCurrencyUomId/></option>
+                            </#list>
+                        </select>
                       </td>
                       <td width="50%">
-                        <span class="tabletext">${uiLabelMap.AccountingPayOnlyWithBillingAccount}</span>
+                        <span class="tabletext">${uiLabelMap.FormFieldTitle_billingAccountId}</span>
                       </td>
                     </tr>
-                    <tr><td colspan="2"><hr class="sepbar"/></td></tr>
-                    <#list billingAccountList as billingAccount>
-                      <#assign availableAmount = billingAccount.accountLimit?double - billingAccount.accountBalance?double>
-                      <tr>
-                        <td align="left" valign="top" width="1%">
-                          <input type="radio" onClick="javascript:toggleBillingAccount(this);" name="billingAccountId" value="${billingAccount.billingAccountId}" <#if (billingAccount.billingAccountId == selectedBillingAccountId?default(""))>checked="checked"</#if>/>
-                        </td>
-                        <td align="left" valign="top" width="99%">
-                          <div class="tabletext">
-                           ${billingAccount.description?default("Bill Account")} [${uiLabelMap.OrderNbr}<b>${billingAccount.billingAccountId}</b>]&nbsp;(<@ofbizCurrency amount=availableAmount isoCode=billingAccount.accountCurrencyUomId?default(shoppingCart.getCurrency())/>)<br/>
-                           <b>${uiLabelMap.OrderBillUpTo}:</b> <input type="text" size="8" class="inputBox" name="amount_${billingAccount.billingAccountId}" value="${availableAmount?double?string("##0.00")}" <#if !(billingAccount.billingAccountId == selectedBillingAccountId?default(""))>disabled</#if>>
-                          </div>
-                        </td>
-                      </tr>
-                    </#list>
                     <tr>
-                      <td align="left" valign="top" width="1%">
-                        <input type="radio" onClick="javascript:toggleBillingAccount(this);" name="billingAccountId" value="_NA_" <#if (selectedBillingAccountId?default("") == "N")>checked="checked"</#if>/>
-                        <input type="hidden" name="_NA_amount" value="0.00"/>
+                      <td width="1%" align="right">
+                        <input type="text" size="5" name="billingAccountAmount" value=""/>
+                      </td>
+                      <td width="50%">
+                        ${uiLabelMap.OrderBillUpTo}
                       </td>
-                      <td align="left" valign="top" width="99%">
-                        <div class="tabletext">${uiLabelMap.AccountingNoBillingAccount}</div>
-                       </td>
                     </tr>
                   </#if>
                 </#if>