Author: jacopoc
Date: Mon Sep 10 07:32:49 2007 New Revision: 574259 URL: http://svn.apache.org/viewvc?rev=574259&view=rev Log: Implemented ability to change the shipToParty in the cart; I have only implemented the ui for this in the quick checkout screen. Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.properties ofbiz/trunk/applications/order/data/OrderSecurityData.xml ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutoptions.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkoutoptions.ftl Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.properties?rev=574259&r1=574258&r2=574259&view=diff ============================================================================== --- ofbiz/trunk/applications/order/config/OrderUiLabels.properties (original) +++ ofbiz/trunk/applications/order/config/OrderUiLabels.properties Mon Sep 10 07:32:49 2007 @@ -844,6 +844,7 @@ OrderShippingInformation=Shipping Information OrderShipRequest=Ship Request OrderShipToAnotherParty=Ship to Another Party +OrderShipToParty=Ship to Party OrderShipmentInformation=Shipment Information OrderShortfalled=Shortfalled OrderShowAllNotes=Show All Notes Modified: ofbiz/trunk/applications/order/data/OrderSecurityData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/data/OrderSecurityData.xml?rev=574259&r1=574258&r2=574259&view=diff ============================================================================== --- ofbiz/trunk/applications/order/data/OrderSecurityData.xml (original) +++ ofbiz/trunk/applications/order/data/OrderSecurityData.xml Mon Sep 10 07:32:49 2007 @@ -51,6 +51,7 @@ <SecurityGroup description="Order entry with purchasing permissions" groupId="ORDERPURCH"/> <SecurityGroup description="Order entry permission for all stores. No special role is needed." groupId="ORDERENTRY_ALL"/> + <SecurityGroupPermission groupId="ORDERADMIN_LTD" permissionId="ORDERMGR_VIEW"/> <SecurityGroupPermission groupId="ORDERADMIN_LTD" permissionId="ORDERMGR_ROLE_VIEW"/> <SecurityGroupPermission groupId="ORDERADMIN_LTD" permissionId="ORDERMGR_ROLE_CREATE"/> <SecurityGroupPermission groupId="ORDERADMIN_LTD" permissionId="ORDERMGR_ROLE_UPDATE"/> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?rev=574259&r1=574258&r2=574259&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Mon Sep 10 07:32:49 2007 @@ -257,6 +257,13 @@ return "success"; } + public static String setCartShipToCustomerParty(HttpServletRequest request, HttpServletResponse response) { + ShoppingCart cart = (ShoppingCart) request.getSession().getAttribute("shoppingCart"); + String shipToCustomerPartyId = request.getParameter("shipToCustomerPartyId"); + cart.setShipToCustomerPartyId(shipToCustomerPartyId); + return "success"; + } + public static String checkPaymentMethods(HttpServletRequest request, HttpServletResponse response) { ShoppingCart cart = (ShoppingCart) request.getSession().getAttribute("shoppingCart"); LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutoptions.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutoptions.bsh?rev=574259&r1=574258&r2=574259&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutoptions.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutoptions.bsh Mon Sep 10 07:32:49 2007 @@ -50,7 +50,8 @@ context.put("userLogin", userLogin); context.put("productStoreId", productStore.get("productStoreId")); context.put("productStore", productStore); -context.put("shippingContactMechList", ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false)); +shipToParty = delegator.findByPrimaryKeyCache("Party", UtilMisc.toMap("partyId", shoppingCart.getShipToCustomerPartyId())); +context.put("shippingContactMechList", ContactHelper.getContactMech(shipToParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false)); context.put("emailList", ContactHelper.getContactMechByType(party, "EMAIL_ADDRESS", false)); if (shoppingCart.getShipmentMethodTypeId() != null && shoppingCart.getCarrierPartyId() != null) { @@ -66,3 +67,33 @@ if (shoppingCart.selectedPayments() == 0 && profiledefs != null && profiledefs.get("defaultPayMeth") != null) { shoppingCart.addPayment(profiledefs.get("defaultPayMeth")); } + +// create a list containing all the parties associated to the current cart, useful to change +// the ship to party id +List cartParties = UtilMisc.toList(shoppingCart.getShipToCustomerPartyId()); +if (!cartParties.contains(partyId)) { + cartParties.add(partyId); +} +if (!cartParties.contains(shoppingCart.getOrderPartyId())) { + cartParties.add(shoppingCart.getOrderPartyId()); +} +if (!cartParties.contains(shoppingCart.getPlacingCustomerPartyId())) { + cartParties.add(shoppingCart.getPlacingCustomerPartyId()); +} +if (!cartParties.contains(shoppingCart.getBillToCustomerPartyId())) { + cartParties.add(shoppingCart.getBillToCustomerPartyId()); +} +if (!cartParties.contains(shoppingCart.getEndUserCustomerPartyId())) { + cartParties.add(shoppingCart.getEndUserCustomerPartyId()); +} +if (!cartParties.contains(shoppingCart.getSupplierAgentPartyId())) { + cartParties.add(shoppingCart.getSupplierAgentPartyId()); +} +List salesReprs = (List)shoppingCart.getAdditionalPartyRoleMap().get("SALES_REP"); +for (int i = 0; i < salesReprs.size(); i++) { + String salesRep = (String)salesReprs.get(i); + if (!cartParties.contains(salesRep)) { + cartParties.add(salesRep); + } +} +context.put("cartParties", cartParties); Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml?rev=574259&r1=574258&r2=574259&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Mon Sep 10 07:32:49 2007 @@ -700,6 +700,12 @@ <response name="success" type="view" value="checkoutshippingaddress"/> <response name="error" type="view" value="showcart"/> </request-map> + <request-map uri="cartUpdateShipToCustomerParty"> + <security https="true" auth="true"/> + <event type="java" path="org.ofbiz.order.shoppingcart.CheckOutEvents" invoke="setCartShipToCustomerParty"/> + <response name="success" type="view" value="quickcheckout"/> + <response name="error" type="view" value="showcart"/> + </request-map> <request-map uri="checkout"> <security https="true" auth="true"/> <event type="java" path="org.ofbiz.order.shoppingcart.CheckOutEvents" invoke="setQuickCheckOutOptions"/> @@ -1125,6 +1131,12 @@ <request-map uri="approveRequirements"> <security https="true" auth="true"/> <event type="service-multi" invoke="approveRequirement"/> + <response name="success" type="view" value="ApproveRequirements"/> + <response name="error" type="view" value="ApproveRequirements"/> + </request-map> + <request-map uri="createTransfersFromRequirements"> + <security https="true" auth="true"/> + <event type="service-multi" invoke="createTransferFromRequirement"/> <response name="success" type="view" value="ApproveRequirements"/> <response name="error" type="view" value="ApproveRequirements"/> </request-map> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkoutoptions.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkoutoptions.ftl?rev=574259&r1=574258&r2=574259&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkoutoptions.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkoutoptions.ftl Mon Sep 10 07:32:49 2007 @@ -63,6 +63,10 @@ // selected shipping address form.action="<@ofbizUrl>updateCheckoutOptions/quickcheckout</@ofbizUrl>"; form.submit(); + } else if (mode == "SC") { + // selected ship to party + form.action="<@ofbizUrl>cartUpdateShipToCustomerParty</@ofbizUrl>"; + form.submit(); } } @@ -86,6 +90,16 @@ </div> <div class="screenlet-body" style="height: 100%;"> <table width="100%" border="0" cellpadding="1" cellspacing="0"> + <tr> + <td colspan="2"> + <span class="tabletext">${uiLabelMap.OrderShipToParty}:</span> + <select name="shipToCustomerPartyId" onChange="javascript:submitForm(document.checkoutInfoForm, 'SC', null);"> + <#list cartParties as cartParty> + <option value="${cartParty}">${cartParty}</option> + </#list> + </select> + </td> + </tr> <tr> <td colspan="2"> <span class="tabletext">${uiLabelMap.CommonAdd}:</span> |
Jacopo,
after run-install and logged with admin user i get and error in Quick Finalize Order screen. Target exception: java.lang.NullPointerException: Null Pointer in Method Invocation (Sourced file: component://order/webapp/ordermgr/WEB-INF/actions/entry/checkoutoptions.bsh) (Error running BSH script at [component://order/webapp/ordermgr/WEB-INF/actions/entry/checkoutoptions.bsh], line [93]: Sourced file: component://order/webapp/ordermgr/WEB-INF/actions/entry/checkoutoptions.bsh : at Line: 93 : in file: component://order/webapp/ordermgr/WEB-INF/actions/entry/checkoutoptions.bsh : salesReprs .size ( ) This will fix it: Index: order/webapp/ordermgr/WEB-INF/actions/entry/checkoutoptions.bsh =================================================================== --- order/webapp/ordermgr/WEB-INF/actions/entry/checkoutoptions.bsh (revision 574505) +++ order/webapp/ordermgr/WEB-INF/actions/entry/checkoutoptions.bsh (working copy) @@ -90,10 +90,12 @@ cartParties.add(shoppingCart.getSupplierAgentPartyId()); } List salesReprs = (List)shoppingCart.getAdditionalPartyRoleMap().get("SALES_REP"); -for (int i = 0; i < salesReprs.size(); i++) { - String salesRep = (String)salesReprs.get(i); - if (!cartParties.contains(salesRep)) { - cartParties.add(salesRep); +if (salesReprs != null) { + for (int i = 0; i < salesReprs.size(); i++) { + String salesRep = (String)salesReprs.get(i); + if (!cartParties.contains(salesRep)) { + cartParties.add(salesRep); + } } } context.put("cartParties", cartParties); Should i create issue for this, or it ok to copy from here ? BTW is this functionality the same with Ship to Another Party in checkout screen or it is more behind it? Of course this one is in quick checkout mode/screen :) Regards, Bilgin Ibryam |
Free forum by Nabble | Edit this page |