[OFBiz] SVN: r4715 - in trunk/applications/order: src/org/ofbiz/order/shoppingcart webapp/ordermgr/WEB-INF/actions/entry webapp/ordermgr/entry

jacopo at svn.ofbiz.org jacopo at svn.ofbiz.org
Thu Mar 31 12:23:30 EST 2005


Author: jacopo
Date: 2005-03-31 11:22:41 -0600 (Thu, 31 Mar 2005)
New Revision: 4715

Added:
   trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkinits.bsh
   trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh
Removed:
   trunk/applications/order/webapp/ordermgr/entry/orderentry.ftl
Modified:
   trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
   trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/showcart.bsh
   trunk/applications/order/webapp/ordermgr/entry/checkinits.ftl
Log:
Refactored the order entry init page.
The content of the showcart.bsh file has been splitted in a new event (initializeOrderEntry) and two new bsh scripts (checkinits.bsh and orderagreements.bsh).
Also the orderentry.ftl page has been removed: it was only there to redirect to the showcart, orderagreement and init pages (now this is performed in the initializeOrderEntry event).
So now:
- showcart.bsh sets up the content for the showcart.ftl template
- orderagreements.bsh sets up the content for the orderagreements.ftl template
- checkinits.bsh sets up the content for the checkinits.ftl template



Modified: trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
===================================================================
--- trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java	2005-03-26 14:15:59 UTC (rev 4714)
+++ trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java	2005-03-31 17:22:41 UTC (rev 4715)
@@ -44,6 +44,7 @@
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericPK;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.product.catalog.CatalogWorker;
 import org.ofbiz.product.store.ProductStoreSurveyWrapper;
@@ -838,4 +839,163 @@
       return "success";
   }
 
+  /** Add order term **/
+  public static String initializeOrderEntry(HttpServletRequest request, HttpServletResponse response) {
+      GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
+      //LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
+      HttpSession session = request.getSession();
+      Security security = (Security) request.getAttribute("security");
+      GenericValue userLogin = (GenericValue)session.getAttribute("userLogin");
+      
+      ShoppingCart cart = getCartObject(request);
+      
+      //ShoppingCartHelper cartHelper = new ShoppingCartHelper(delegator, dispatcher, cart);
+      
+      String orderMode = request.getParameter("orderMode");
+      if (orderMode != null) {
+          session.setAttribute("orderMode", orderMode);
+          cart.setOrderType(orderMode);
+      }
+      orderMode = (String)session.getAttribute("orderMode");
+      
+      String finalizeMode = (String)session.getAttribute("finalizeMode");
+      String updateParty = request.getParameter("updateParty");
+      
+      if (orderMode == null && finalizeMode != null) {
+          request.setAttribute("_ERROR_MESSAGE_", "Please select either sale or purchase order.");
+          return "error";
+      } else if (orderMode == null) {
+          return "error"; //?????
+      }
+      
+      if ("SALES_ORDER".equals(cart.getOrderType()) && UtilValidate.isEmpty(cart.getProductStoreId())) {
+          request.setAttribute("_ERROR_MESSAGE_", "A Product Store MUST be selected for a Sales Order.");
+          cart.clear();
+          session.removeAttribute("orderMode");
+          session.removeAttribute("agreementsMode");
+          return "error";
+      }
+      
+      // check the selected product store
+      String productStoreId = request.getParameter("productStoreId");
+      GenericValue productStore = null;
+      if (UtilValidate.isNotEmpty(productStoreId)) {
+          productStore = ProductStoreWorker.getProductStore(productStoreId, delegator);
+          if (productStore != null) {
+              
+              // check permission for taking the order
+              boolean hasPermission = false;
+              if ((cart.getOrderType().equals("PURCHASE_ORDER")) && (security.hasEntityPermission("ORDERMGR", "_PURCHASE_CREATE", session))) {
+                  hasPermission = true;
+              } else if (cart.getOrderType().equals("SALES_ORDER")) {
+                  if (security.hasEntityPermission("ORDERMGR", "_SALES_CREATE", session)) {
+                      hasPermission = true;
+                  } else {
+                      // if the user is a rep of the store, then he also has permission
+                      List storeReps = null;
+                      try {
+                          storeReps = delegator.findByAnd("ProductStoreRole", UtilMisc.toMap("productStoreId", productStore.getString("productStoreId"),
+                              "partyId", userLogin.getString("partyId"), "roleTypeId", "SALES_REP"));
+                      } catch(GenericEntityException gee) {
+                          //
+                      }
+                      storeReps = EntityUtil.filterByDate(storeReps);
+                      if (storeReps != null && storeReps.size() > 0) {
+                          hasPermission = true;
+                      }
+                  }
+              }
+              
+              if (hasPermission) {
+                  cart = ShoppingCartEvents.getCartObject(request, null, productStore.getString("defaultCurrencyUomId"));
+                  //context.put("currencyUomId", cart.getCurrency());
+              } else {
+                  request.setAttribute("_ERROR_MESSAGE_", "You do not have permission to take orders for this store.");
+                  cart.clear();
+                  session.removeAttribute("orderMode");
+                  session.removeAttribute("agreementsMode");
+                  return "error";
+              }
+              cart.setProductStoreId(productStoreId);
+          } else {
+              cart.setProductStoreId(null);
+          }
+      }
+      
+      String salesChannelEnumId = request.getParameter("salesChannelEnumId");
+      if (UtilValidate.isNotEmpty(salesChannelEnumId)) {
+          cart.setChannelType(salesChannelEnumId);
+      }
+      
+      // set party info
+      String partyId = request.getParameter("supplierPartyId");
+      if (!UtilValidate.isEmpty(request.getParameter("partyId"))) {
+          partyId = request.getParameter("partyId");
+      }
+      String userLoginId = request.getParameter("userLoginId");
+      if (partyId != null || userLoginId != null) {
+          if ((partyId == null || partyId.length() == 0) && userLoginId != null && userLoginId.length() > 0) {
+              GenericValue thisUserLogin = null;
+              try {
+                  thisUserLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", userLoginId));
+              } catch(GenericEntityException gee) {
+                  //
+              }
+              if (thisUserLogin != null) {
+                  partyId = thisUserLogin.getString("partyId");
+              } else {
+                  partyId = userLoginId;
+              }
+          }
+          //Debug.log("1st PartyID - " + partyId);
+          if (partyId != null && partyId.length() > 0) {
+              GenericValue thisParty = null;
+              try{
+                  thisParty = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", partyId));
+              } catch(GenericEntityException gee) {
+                  //
+              }
+              //Debug.log("This party : " + thisParty);
+              if (thisParty == null) {
+                  request.setAttribute("_ERROR_MESSAGE_", "Could not locate the selected party.");
+                  //context.put("updateParty", "Y");
+                  return "error";
+              } else {
+                  cart.setOrderPartyId(partyId);
+              }
+          } else if (partyId != null && partyId.length() == 0) {
+              cart.setOrderPartyId("_NA_");
+              partyId = null;
+          }
+      } else {
+          partyId = cart.getPartyId();
+          if (partyId != null && partyId.equals("_NA_")) partyId = null;
+      }
+      
+      String agreementsMode = null;
+      if ("PURCHASE_ORDER".equals(cart.getOrderType())) {
+          // set agreementsMode, which tracks if the user has already set a currency or agreement (used in orderentry.ftl)
+          agreementsMode = request.getParameter("currencyUomId");
+          if (UtilValidate.isEmpty(agreementsMode)) {
+              agreementsMode = request.getParameter("agreementId");
+          }
+          if (UtilValidate.isNotEmpty(agreementsMode)) {
+              session.setAttribute("agreementsMode", agreementsMode.trim());
+          }
+      }
+      agreementsMode = (String)session.getAttribute("agreementsMode");
+
+      
+      
+      
+      // Routing
+      if (orderMode == null || updateParty != null) {
+          return "init";
+      }
+      if (orderMode.equals("PURCHASE_ORDER") && agreementsMode == null) {
+          return "agreements";
+      }
+      return "cart";
+  }
+
 }

Added: trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkinits.bsh
===================================================================
--- trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkinits.bsh	2005-03-26 14:15:59 UTC (rev 4714)
+++ trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkinits.bsh	2005-03-31 17:22:41 UTC (rev 4715)
@@ -0,0 +1,62 @@
+/*
+ *  Copyright (c) 2003 The Open For Business Project - www.ofbiz.org
+ *
+ *  Permission is hereby granted, free of charge, to any person obtaining a 
+ *  copy of this software and associated documentation files (the "Software"), 
+ *  to deal in the Software without restriction, including without limitation 
+ *  the rights to use, copy, modify, merge, publish, distribute, sublicense, 
+ *  and/or sell copies of the Software, and to permit persons to whom the 
+ *  Software is furnished to do so, subject to the following conditions:
+ *
+ *  The above copyright notice and this permission notice shall be included 
+ *  in all copies or substantial portions of the Software.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+ *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+ *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
+ *  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
+ *  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 
+ *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 
+ *  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *@author     David E. Jones
+ *@version    1.0
+ */
+
+import org.ofbiz.service.*;
+import org.ofbiz.entity.*;
+import org.ofbiz.entity.condition.*;
+import org.ofbiz.entity.util.*;
+import org.ofbiz.base.util.*;
+import org.ofbiz.order.shoppingcart.*;
+import org.ofbiz.party.party.PartyWorker;
+import org.ofbiz.product.catalog.CatalogWorker;
+import org.ofbiz.product.store.ProductStoreWorker;
+import org.ofbiz.order.shoppingcart.product.ProductDisplayWorker;
+import org.ofbiz.order.shoppingcart.product.ProductPromoWorker;
+
+delegator = request.getAttribute("delegator");
+security = request.getAttribute("security");
+dispatcher= (LocalDispatcher)request.getAttribute("dispatcher");
+userLogin = session.getAttribute("userLogin");
+
+context.put("dispatcher",dispatcher);
+
+// Get the Cart and Prepare Size
+shoppingCart = ShoppingCartEvents.getCartObject(request);
+context.put("shoppingCart", shoppingCart);
+
+
+
+salesChannels = delegator.findByAndCache("Enumeration", UtilMisc.toMap("enumTypeId", "ORDER_SALES_CHANNEL"), UtilMisc.toList("sequenceId"));
+context.put("salesChannels", salesChannels);
+
+productStores = delegator.findAllCache("ProductStore", UtilMisc.toList("storeName"));
+context.put("productStores", productStores);
+
+suppliers = delegator.findByAnd("PartyRole", UtilMisc.toMap("roleTypeId", "SUPPLIER"));
+context.put("suppliers", suppliers);
+
+
+
+


Property changes on: trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkinits.bsh
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + "Id Rev Author"
Name: svn:eol-style
   + native

Added: trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh
===================================================================
--- trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh	2005-03-26 14:15:59 UTC (rev 4714)
+++ trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh	2005-03-31 17:22:41 UTC (rev 4715)
@@ -0,0 +1,76 @@
+/*
+ *  Copyright (c) 2003 The Open For Business Project - www.ofbiz.org
+ *
+ *  Permission is hereby granted, free of charge, to any person obtaining a 
+ *  copy of this software and associated documentation files (the "Software"), 
+ *  to deal in the Software without restriction, including without limitation 
+ *  the rights to use, copy, modify, merge, publish, distribute, sublicense, 
+ *  and/or sell copies of the Software, and to permit persons to whom the 
+ *  Software is furnished to do so, subject to the following conditions:
+ *
+ *  The above copyright notice and this permission notice shall be included 
+ *  in all copies or substantial portions of the Software.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+ *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+ *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
+ *  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
+ *  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 
+ *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 
+ *  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *@author     David E. Jones
+ *@version    1.0
+ */
+
+import org.ofbiz.service.*;
+import org.ofbiz.entity.*;
+import org.ofbiz.entity.condition.*;
+import org.ofbiz.entity.util.*;
+import org.ofbiz.base.util.*;
+import org.ofbiz.order.shoppingcart.*;
+import org.ofbiz.party.party.PartyWorker;
+import org.ofbiz.product.catalog.CatalogWorker;
+import org.ofbiz.product.store.ProductStoreWorker;
+import org.ofbiz.order.shoppingcart.product.ProductDisplayWorker;
+import org.ofbiz.order.shoppingcart.product.ProductPromoWorker;
+
+delegator = request.getAttribute("delegator");
+security = request.getAttribute("security");
+dispatcher= (LocalDispatcher)request.getAttribute("dispatcher");
+userLogin = session.getAttribute("userLogin");
+
+context.put("dispatcher",dispatcher);
+
+// Get the Cart and Prepare Size
+shoppingCart = ShoppingCartEvents.getCartObject(request);
+
+// check the selected product store
+productStoreId = shoppingCart.getProductStoreId();
+productStore = null;
+if (UtilValidate.isNotEmpty(productStoreId)) {
+    productStore = ProductStoreWorker.getProductStore(productStoreId, delegator);
+    if (productStore != null) {
+        // put in the default currency, to help selecting a currency for a purchase order
+        context.put("defaultCurrencyUomId", productStore.getString("defaultCurrencyUomId"));
+        payToPartyId = productStore.getString("payToPartyId");
+        partyId = shoppingCart.getOrderPartyId();
+        agreements = delegator.findByAndCache("Agreement", UtilMisc.toMap("partyIdTo", partyId, "partyIdFrom", payToPartyId));
+        if (agreements != null && agreements.size() > 0) {
+            context.put("hasAgreements","Y");
+            context.put("agreements", agreements);
+        } else {
+            context.put("hasAgreements","N");
+        }
+    }
+}
+
+partyId = shoppingCart.getPartyId();
+if (partyId != null && partyId.equals("_NA_")) partyId = null;
+context.put("partyId", partyId);  
+
+// currencies and shopping cart currency
+currencies = delegator.findByAndCache("Uom", UtilMisc.toMap("uomTypeId","CURRENCY_MEASURE"));
+context.put("currencies", currencies);
+context.put("currencyUomId", shoppingCart.getCurrency());
+


Property changes on: trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + "Id Rev Author"
Name: svn:eol-style
   + native

Modified: trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/showcart.bsh
===================================================================
--- trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/showcart.bsh	2005-03-26 14:15:59 UTC (rev 4714)
+++ trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/showcart.bsh	2005-03-31 17:22:41 UTC (rev 4715)
@@ -25,15 +25,11 @@
 
 import org.ofbiz.service.*;
 import org.ofbiz.entity.*;
-import org.ofbiz.entity.condition.*;
-import org.ofbiz.entity.util.*;
 import org.ofbiz.base.util.*;
 import org.ofbiz.order.shoppingcart.*;
 import org.ofbiz.party.party.PartyWorker;
 import org.ofbiz.product.catalog.CatalogWorker;
-import org.ofbiz.product.store.ProductStoreWorker;
 import org.ofbiz.order.shoppingcart.product.ProductDisplayWorker;
-import org.ofbiz.order.shoppingcart.product.ProductPromoWorker;
 
 delegator = request.getAttribute("delegator");
 security = request.getAttribute("security");
@@ -48,102 +44,12 @@
 context.put("shoppingCart", shoppingCart);
 context.put("currencyUomId", shoppingCart.getCurrency());
 
+mode = shoppingCart.getOrderType();
+
 // get all the possible gift wrap options
 allgiftWraps = delegator.findByAnd("ProductFeature", UtilMisc.toMap("productFeatureTypeId", "GIFT_WRAP"), UtilMisc.toList("defaultSequenceNum"));
 context.put("allgiftWraps", allgiftWraps);
 
-updateParty = request.getParameter("updateParty");
-if (updateParty != null) {
-    context.put("updateParty", updateParty);
-}
-
-salesChannels = delegator.findByAndCache("Enumeration", UtilMisc.toMap("enumTypeId", "ORDER_SALES_CHANNEL"), UtilMisc.toList("sequenceId"));
-context.put("salesChannels", salesChannels);
-
-productStores = delegator.findAllCache("ProductStore", UtilMisc.toList("storeName"));
-context.put("productStores", productStores);
-
-suppliers = delegator.findByAnd("PartyRole", UtilMisc.toMap("roleTypeId", "SUPPLIER"));
-context.put("suppliers", suppliers);
-
-//Get the order mode
-mode = request.getParameter("orderMode");
-if (mode != null) {
-    session.setAttribute("orderMode", mode);
-    shoppingCart.setOrderType(mode);
-} 
-mode = shoppingCart.getOrderType();
-if ("SALES_ORDER".equals(mode)) context.put("modeStr", "Sales");
-if ("PURCHASE_ORDER".equals(mode)) context.put("modeStr", "Purchase");
-
-if (session.getAttribute("orderMode") != null && updateParty == null) {
-    page.setProperty("leftbar", "/includes/entry_left.ftl");    
-}     
-
-if (session.getAttribute("orderMode") == null && request.getParameter("finalizeMode") != null) {
-    request.setAttribute("_ERROR_MESSAGE_", "Please select either sale or purchase order.");
-    return;
-} else if (session.getAttribute("orderMode") == null) {
-    return;
-}
-
-if ("SALES_ORDER".equals(mode) && UtilValidate.isEmpty(shoppingCart.getProductStoreId())) {
-    request.setAttribute("_ERROR_MESSAGE_", "A Product Store MUST be selected for a Sales Order.");
-    shoppingCart.clear();
-    session.removeAttribute("orderMode");
-    session.removeAttribute("agreementsMode");
-    return;
-}
-
-// check the selected product store
-productStoreId = request.getParameter("productStoreId");
-productStore = null;
-
-if (UtilValidate.isNotEmpty(productStoreId)) {
-    productStore = ProductStoreWorker.getProductStore(productStoreId, delegator);
-    if (productStore != null) {
-        // put in the default currency, to help selecting a currency for a purchase order
-        context.put("defaultCurrencyUomId", productStore.getString("defaultCurrencyUomId"));
-
-        // check permission for taking the order
-        hasPermission = false;
-        if ((mode.equals("PURCHASE_ORDER")) && (security.hasEntityPermission("ORDERMGR", "_PURCHASE_CREATE", session))) {
-            hasPermission = true;
-        } else if (mode.equals("SALES_ORDER")) {
-            if (security.hasEntityPermission("ORDERMGR", "_SALES_CREATE", session)) {
-                hasPermission = true;
-            } else {
-                // if the user is a rep of the store, then he also has permission
-                storeReps = delegator.findByAnd("ProductStoreRole", UtilMisc.toMap("productStoreId", productStore.getString("productStoreId"),
-                        "partyId", userLogin.getString("partyId"), "roleTypeId", "SALES_REP"));
-                storeReps = EntityUtil.filterByDate(storeReps);
-                if (storeReps != null && storeReps.size() > 0) {
-                    hasPermission = true;
-                }
-            }
-        }
-        
-        if (hasPermission) {
-            shoppingCart = ShoppingCartEvents.getCartObject(request, null, productStore.getString("defaultCurrencyUomId"));
-            context.put("currencyUomId", shoppingCart.getCurrency());            
-        } else {
-            request.setAttribute("_ERROR_MESSAGE_", "You do not have permission to take orders for this store.");
-            shoppingCart.clear();
-            session.removeAttribute("orderMode");
-            session.removeAttribute("agreementsMode");
-            return;
-        }
-        shoppingCart.setProductStoreId(productStoreId);
-    } else {
-        shoppingCart.setProductStoreId(null);
-    }
-}
-
-salesChannelEnumId = request.getParameter("salesChannelEnumId");
-if (UtilValidate.isNotEmpty(salesChannelEnumId)) {
-    shoppingCart.setChannelType(salesChannelEnumId);
-}
-
 if (mode != null && mode.equals("SALES_ORDER")) {
     // Get Cart Associated Products Data
     associatedProducts = ProductDisplayWorker.getRandomCartProductAssoc(request, true);
@@ -156,41 +62,8 @@
 productCategoryList = delegator.findAll("ProductCategory", UtilMisc.toList("description", "productCategoryId"));
 context.put("productCategoryList", productCategoryList);
 
-// set party info
-partyId = request.getParameter("supplierPartyId");
-if (!UtilValidate.isEmpty(request.getParameter("partyId"))) {
-    partyId = request.getParameter("partyId");
-}
-userLoginId = request.getParameter("userLoginId");
-if (partyId != null || userLoginId != null) {
-    if ((partyId == null || partyId.length() == 0) && userLoginId != null && userLoginId.length() > 0) {
-        thisUserLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", userLoginId));
-        if (thisUserLogin != null) {        
-            partyId = thisUserLogin.getString("partyId");
-        } else {
-            partyId = userLoginId;
-        }
-    }
-    //Debug.log("1st PartyID - " + partyId);
-    if (partyId != null && partyId.length() > 0) {
-        thisParty  = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", partyId));
-        //Debug.log("This party : " + thisParty);
-        if (thisParty == null) {
-            request.setAttribute("_ERROR_MESSAGE_", "Could not locate the selected party.");
-            context.put("updateParty", "Y");
-            return;        
-        } else {
-            shoppingCart.setOrderPartyId(partyId);
-        }
-    } else if (partyId != null && partyId.length() == 0) {
-        shoppingCart.setOrderPartyId("_NA_");
-        partyId = null;
-    } 
-} else {
-    partyId = shoppingCart.getPartyId();
-    if (partyId != null && partyId.equals("_NA_")) partyId = null;
-}
-
+partyId = shoppingCart.getPartyId();
+if (partyId != null && partyId.equals("_NA_")) partyId = null;
 context.put("partyId", partyId);  
 
 if (partyId != null) {
@@ -217,34 +90,3 @@
     context.put("useAsDefaultComment", "true");
 }
 context.put("defaultComment", defaultComment);
-
-if ("PURCHASE_ORDER".equals(mode)) {
-    // for purchase orders, get purchasing agreements
-    payToPartyId = null;
-    if (productStore != null) {
-        payToPartyId = productStore.getString("payToPartyId");
-    }
-    partyId = shoppingCart.getOrderPartyId();
-    agreements = delegator.findByAndCache("Agreement", UtilMisc.toMap("partyIdTo", partyId, "partyIdFrom", payToPartyId));
-    if (agreements != null && agreements.size() > 0) {
-        context.put("hasAgreements","Y");
-        context.put("agreements", agreements);
-    } else {
-        context.put("hasAgreements","N");
-    }
-
-    // set agreementsMode, which tracks if the user has already set a currency or agreement (used in orderentry.ftl)
-    agreementsMode = request.getParameter("currencyUomId");
-    if (UtilValidate.isEmpty(agreementsMode)) {
-        agreementsMode = request.getParameter("agreementId");
-     }
-    if (UtilValidate.isNotEmpty(agreementsMode)) {
-        session.setAttribute("agreementsMode", agreementsMode.trim());
-     }
-}
-
-// currencies and shopping cart currency
-currencies = delegator.findByAndCache("Uom", UtilMisc.toMap("uomTypeId","CURRENCY_MEASURE"));
-context.put("currencies", currencies);
-context.put("currencyUomId", shoppingCart.getCurrency());
-

Modified: trunk/applications/order/webapp/ordermgr/entry/checkinits.ftl
===================================================================
--- trunk/applications/order/webapp/ordermgr/entry/checkinits.ftl	2005-03-26 14:15:59 UTC (rev 4714)
+++ trunk/applications/order/webapp/ordermgr/entry/checkinits.ftl	2005-03-31 17:22:41 UTC (rev 4715)
@@ -25,9 +25,10 @@
  *@since      2.2
 -->
 
-<#assign uiLabelMap = requestAttributes.uiLabelMap>
+<#if requestAttributes.uiLabelMap?exists>
+    <#assign uiLabelMap = requestAttributes.uiLabelMap>
+</#if>
 
-
 <script language="JavaScript">
 <!--
 var defaultStoreText = "!";
@@ -78,10 +79,10 @@
 //-->
 </script>
 
-<table border=0 width='100%' cellspacing='0' cellpadding='0' class='boxoutside'>
+<table border=0 align="center" cellspacing='0' cellpadding='0' class='boxoutside'>
   <tr>
-    <td width='100%'>
-      <table width='100%' border='0' cellspacing='0' cellpadding='0' class='boxtop'>
+    <td>
+      <table width="100%" border='0' cellspacing='0' cellpadding='0' class='boxtop'>
         <tr>
           <td valign="middle" align="left">
             <div class="boxhead">${uiLabelMap.OrderOrderEntry}</div>
@@ -94,15 +95,15 @@
     </td>
   </tr>
   <tr>
-    <td width='100%'>
+    <td>
       <form method="post" name="entryform" action="<@ofbizUrl>/orderentry</@ofbizUrl>">
       <input type='hidden' name='finalizeMode' value='type'>
-      <table width='100%' border='0' cellspacing='0' cellpadding='0' class='boxbottom'>
+      <table border='0' cellspacing='0' cellpadding='0' class='boxbottom'>
         <tr>
-          <td width='14%'>&nbsp;</td>
-          <td wdith='6%' align='right' valign='middle' nowrap><div class='tableheadtext'>${uiLabelMap.OrderOrderType}</div></td>
-          <td width='6%'>&nbsp;</td>
-          <td width='74%' valign='middle'>
+          <td >&nbsp;</td>
+          <td align='right' valign='middle' nowrap><div class='tableheadtext'>${uiLabelMap.OrderOrderType}</div></td>
+          <td >&nbsp;</td>
+          <td valign='middle'>
             <div class='tabletext' valign='top'>
               <input type='radio' name='orderMode' onChange="javascript:setOrderType(false)" value='SALES_ORDER'<#if sessionAttributes.orderMode?default("") == "SALES_ORDER"> checked</#if><#if sessionAttributes.orderMode?exists> disabled</#if>>${uiLabelMap.OrderSalesOrder}
               <input type='radio' name='orderMode' onChange="javascript:setOrderType(true)" value='PURCHASE_ORDER'<#if sessionAttributes.orderMode?default("") == "PURCHASE_ORDER"> checked</#if><#if sessionAttributes.orderMode?exists> disabled</#if>>${uiLabelMap.OrderPurchaseOrder}&nbsp;&nbsp;
@@ -112,10 +113,10 @@
         </tr>
         <tr><td colspan="4">&nbsp;</td></tr>
         <tr>
-          <td width='14%'>&nbsp;</td>
-          <td wdith='6%' align='right' valign='middle' nowrap><div class='tableheadtext'>${uiLabelMap.ProductProductStore}</div></td>
-          <td width='6%'>&nbsp;</td>
-          <td width='74%' valign='middle'>
+          <td >&nbsp;</td>
+          <td align='right' valign='middle' nowrap><div class='tableheadtext'>${uiLabelMap.ProductProductStore}</div></td>
+          <td >&nbsp;</td>
+          <td valign='middle'>
             <div class='tabletext' valign='top'>
               <select class="selectBox" name="productStoreId"<#if sessionAttributes.orderMode?exists>${uiLabelMap.CommonDisabled}</#if>>
                 <#assign currentStore = shoppingCart.getProductStoreId()?default("NA")>
@@ -129,10 +130,10 @@
         </tr>
         <tr><td colspan="4">&nbsp;</td></tr>
         <tr>
-          <td width='14%'>&nbsp;</td>
-          <td wdith='6%' align='right' valign='middle' nowrap><div class='tableheadtext'>Sales Channel</div></td>
-          <td width='6%'>&nbsp;</td>
-          <td width='74%' valign='middle'>
+          <td>&nbsp;</td>
+          <td align='right' valign='middle' nowrap><div class='tableheadtext'>Sales Channel</div></td>
+          <td>&nbsp;</td>
+          <td valign='middle'>
             <div class='tabletext' valign='top'>
               <select class="selectBox" name="salesChannelEnumId">
                 <#assign currentChannel = shoppingCart.getChannelType()?default("")>               
@@ -152,10 +153,10 @@
           <#assign thisPartyId = requestParameters.partyId?if_exists>
         </#if>
         <tr>
-          <td width='14%'>&nbsp;</td>
-          <td wdith='6%' align='right' valign='middle' nowrap><div class='tableheadtext'>${uiLabelMap.PartySupplier}</div></td>
-          <td width='6%'>&nbsp;</td>
-          <td width='74%' valign='middle'>
+          <td>&nbsp;</td>
+          <td align='right' valign='middle' nowrap><div class='tableheadtext'>${uiLabelMap.PartySupplier}</div></td>
+          <td>&nbsp;</td>
+          <td valign='middle'>
             <div class='tabletext' valign='top'>
               <select class="selectBox" name="supplierPartyId"<#if sessionAttributes.orderMode?default("") == "SALES_ORDER">${uiLabelMap.CommonDisabled}</#if>>
                 <option value="">${uiLabelMap.PartyNoSupplier}</option>
@@ -167,20 +168,20 @@
           </td>
         </tr>
         <tr>
-          <td width='14%'>&nbsp;</td>
-          <td wdith='6%' align='right' valign='middle' nowrap><div class='tableheadtext'>${uiLabelMap.PartyUserLoginId}</div></td>
-          <td width='6%'>&nbsp;</td>
-          <td width='74%' valign='middle'>
+          <td>&nbsp;</td>
+          <td align='right' valign='middle' nowrap><div class='tableheadtext'>${uiLabelMap.PartyUserLoginId}</div></td>
+          <td>&nbsp;</td>
+          <td valign='middle'>
             <div class='tabletext' valign='top'>
               <input type='text' class='inputBox' name='userLoginId' value='${requestParameters.userLoginId?if_exists}'>
             </div>
           </td>
         </tr>                 
         <tr>
-          <td width='14%'>&nbsp;</td>
-          <td wdith='6%' align='right' valign='middle' nowrap><div class='tableheadtext'>${uiLabelMap.PartyPartyId}</div></td>
-          <td width='6%'>&nbsp;</td>
-          <td width='74%' valign='middle'>
+          <td>&nbsp;</td>
+          <td align='right' valign='middle' nowrap><div class='tableheadtext'>${uiLabelMap.PartyPartyId}</div></td>
+          <td>&nbsp;</td>
+          <td valign='middle'>
             <div class='tabletext' valign='top'>
               <input type='text' class='inputBox' name='partyId' value='${thisPartyId?if_exists}'>
               ${uiLabelMap.CommonOverridesSelection}

Deleted: trunk/applications/order/webapp/ordermgr/entry/orderentry.ftl
===================================================================
--- trunk/applications/order/webapp/ordermgr/entry/orderentry.ftl	2005-03-26 14:15:59 UTC (rev 4714)
+++ trunk/applications/order/webapp/ordermgr/entry/orderentry.ftl	2005-03-31 17:22:41 UTC (rev 4715)
@@ -1,33 +0,0 @@
-<#--
- *  Copyright (c) 2003 The Open For Business Project - www.ofbiz.org
- *
- *  Permission is hereby granted, free of charge, to any person obtaining a 
- *  copy of this software and associated documentation files (the "Software"), 
- *  to deal in the Software without restriction, including without limitation 
- *  the rights to use, copy, modify, merge, publish, distribute, sublicense, 
- *  and/or sell copies of the Software, and to permit persons to whom the 
- *  Software is furnished to do so, subject to the following conditions:
- *
- *  The above copyright notice and this permission notice shall be included 
- *  in all copies or substantial portions of the Software.
- *
- *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
- *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
- *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
- *  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
- *  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 
- *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 
- *  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *@author     Andy Zeneski (jaz at ofbiz.org)
- *@version    $Rev:$
- *@since      2.2
--->
-
-<#if !sessionAttributes.orderMode?exists || updateParty?exists>
-  ${pages.get("/entry/checkinits.ftl")}
-<#elseif (sessionAttributes.orderMode?exists && sessionAttributes.orderMode == "PURCHASE_ORDER") && (!sessionAttributes.agreementsMode?exists)>
-  ${pages.get("/entry/orderagreements.ftl")}
-<#else>
-  ${pages.get("/entry/showcart.ftl")}
-</#if>



More information about the Svn mailing list