Author: lektran
Date: Sun Mar 18 00:33:30 2007 New Revision: 519570 URL: http://svn.apache.org/viewvc?view=rev&rev=519570 Log: A few improvements to the use of OrderItem's correspondingPoId field during order entry. Includes a bug fix reported by Philip W. Dalrymple III Modified: ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkoutoptions.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/optionsettings.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/order/orderheaderinfo.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderHeaderInfo.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderagreements.ftl Modified: ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml?view=diff&rev=519570&r1=519569&r2=519570 ============================================================================== --- ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml (original) +++ ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml Sun Mar 18 00:33:30 2007 @@ -821,6 +821,11 @@ </if-not-empty> <set field="correspondingPoId" from-field="parameters.corresponding_po_id"/> + <if-not-empty field-name="correspondingPoId"> + <call-object-method obj-field-name="cart" method-name="setPoNumber"> + <field field-name="correspondingPoId" type="String"/> + </call-object-method> + </if-not-empty> <set field="isGift" from-field="parameters.is_gift" type="Boolean"/> <if-not-empty field-name="isGift"> 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?view=diff&rev=519570&r1=519569&r2=519570 ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Sun Mar 18 00:33:30 2007 @@ -118,7 +118,6 @@ } else if ("shippingoptions".equals(curPage) == true) { // Set the general shipping options String shippingMethod = request.getParameter("shipping_method"); - String correspondingPoId = request.getParameter("corresponding_po_id"); String shippingInstructions = request.getParameter("shipping_instructions"); String orderAdditionalEmails = request.getParameter("order_additional_emails"); String maySplit = request.getParameter("may_split"); @@ -127,8 +126,8 @@ String internalCode = request.getParameter("internalCode"); String shipBeforeDate = request.getParameter("shipBeforeDate"); String shipAfterDate = request.getParameter("shipAfterDate"); - Map callResult = checkOutHelper.setCheckOutShippingOptions(shippingMethod, correspondingPoId, - shippingInstructions, orderAdditionalEmails, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate); + Map callResult = checkOutHelper.setCheckOutShippingOptions(shippingMethod, shippingInstructions, + orderAdditionalEmails, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate); ServiceUtil.getMessages(request, callResult, null); @@ -301,7 +300,6 @@ String partyTaxId = request.getParameter("partyTaxId"); String isExempt = request.getParameter("isExempt"); - String correspondingPoId = request.getParameter("corresponding_po_id"); String shippingInstructions = request.getParameter("shipping_instructions"); String orderAdditionalEmails = request.getParameter("order_additional_emails"); String maySplit = request.getParameter("may_split"); @@ -359,7 +357,7 @@ } Map optResult = checkOutHelper.setCheckOutOptions(shippingMethod, shippingContactMechId, selectedPaymentMethods, - singleUsePayments, billingAccountId, billingAccountAmt, correspondingPoId, shippingInstructions, + singleUsePayments, billingAccountId, billingAccountAmt, shippingInstructions, orderAdditionalEmails, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate); ServiceUtil.getMessages(request, optResult, null); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?view=diff&rev=519570&r1=519569&r2=519570 ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Sun Mar 18 00:33:30 2007 @@ -107,15 +107,15 @@ return errorMessages; } - public Map setCheckOutShippingOptions(String shippingMethod, String correspondingPoId, String shippingInstructions, + public Map setCheckOutShippingOptions(String shippingMethod, String shippingInstructions, String orderAdditionalEmails, String maySplit, String giftMessage, String isGift, String internalCode, String shipBeforeDate, String shipAfterDate ) { List errorMessages = new ArrayList(); Map result; String errMsg = null; if (this.cart != null && this.cart.size() > 0) { - errorMessages.addAll(setCheckOutShippingOptionsInternal(shippingMethod, correspondingPoId, - shippingInstructions, orderAdditionalEmails, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate)); + errorMessages.addAll(setCheckOutShippingOptionsInternal(shippingMethod, shippingInstructions, + orderAdditionalEmails, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate)); } else { errMsg = UtilProperties.getMessage(resource,"checkhelper.no_items_in_cart", (cart != null ? cart.getLocale() : Locale.getDefault())); errorMessages.add(errMsg); @@ -132,8 +132,8 @@ return result; } - private List setCheckOutShippingOptionsInternal(String shippingMethod, String correspondingPoId, String shippingInstructions, - String orderAdditionalEmails, String maySplit, String giftMessage, String isGift, String internalCode, String shipBeforeDate, String shipAfterDate ) { + private List setCheckOutShippingOptionsInternal(String shippingMethod, String shippingInstructions, String orderAdditionalEmails, + String maySplit, String giftMessage, String isGift, String internalCode, String shipBeforeDate, String shipAfterDate ) { List errorMessages = new ArrayList(); String errMsg = null; @@ -200,13 +200,6 @@ // set any additional notification emails this.cart.setOrderAdditionalEmails(orderAdditionalEmails); - // set the PO number - if (UtilValidate.isNotEmpty(correspondingPoId)) { - this.cart.setPoNumber(correspondingPoId); - } else { - this.cart.setPoNumber(null); - } - return errorMessages; } @@ -339,8 +332,8 @@ public Map setCheckOutOptions(String shippingMethod, String shippingContactMechId, Map selectedPaymentMethods, - List singleUsePayments, String billingAccountId, Double billingAccountAmt, String correspondingPoId, - String shippingInstructions, String orderAdditionalEmails, String maySplit, String giftMessage, String isGift, String internalCode, String shipBeforeDate, String shipAfterDate) { + List singleUsePayments, String billingAccountId, Double billingAccountAmt, String shippingInstructions, + String orderAdditionalEmails, String maySplit, String giftMessage, String isGift, String internalCode, String shipBeforeDate, String shipAfterDate) { List errorMessages = new ArrayList(); Map result = null; String errMsg = null; @@ -348,8 +341,8 @@ if (this.cart != null && this.cart.size() > 0) { // set the general shipping options and method - errorMessages.addAll(setCheckOutShippingOptionsInternal(shippingMethod, correspondingPoId, - shippingInstructions, orderAdditionalEmails, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate)); + errorMessages.addAll(setCheckOutShippingOptionsInternal(shippingMethod, shippingInstructions, + orderAdditionalEmails, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate)); // set the shipping address errorMessages.addAll(setCheckOutShippingAddressInternal(shippingContactMechId)); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?view=diff&rev=519570&r1=519569&r2=519570 ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Sun Mar 18 00:33:30 2007 @@ -923,6 +923,17 @@ return "success"; } + /** + * set the PO number of the cart based on request. right now will always return "success" + * + */ + public static String setPoNumber(HttpServletRequest request, HttpServletResponse response) { + ShoppingCart cart = getCartObject(request); + String correspondingPoId = request.getParameter("correspondingPoId"); + cart.setPoNumber(correspondingPoId); + return "success"; + } + /** Add order term **/ public static String addOrderTerm(HttpServletRequest request, HttpServletResponse response) { GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); @@ -1442,6 +1453,7 @@ String shipBeforeDateStr = request.getParameter("shipBeforeDate"); String shipAfterDateStr = request.getParameter("shipAfterDate"); String orderName = request.getParameter("orderName"); + String correspondingPoId = request.getParameter("correspondingPoId"); Map result = null; // set the agreement if specified otherwise set the currency @@ -1457,6 +1469,9 @@ // set the order name cart.setOrderName(orderName); + + // set the corresponding purchase order id + cart.setPoNumber(correspondingPoId); // set the default ship before and after dates if supplied try { Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh?view=diff&rev=519570&r1=519569&r2=519570 ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh Sun Mar 18 00:33:30 2007 @@ -29,15 +29,9 @@ 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("cart", shoppingCart); // check the selected product store productStoreId = shoppingCart.getProductStoreId(); @@ -71,5 +65,4 @@ // currencies and shopping cart currency currencies = delegator.findByAndCache("Uom", UtilMisc.toMap("uomTypeId","CURRENCY_MEASURE")); context.put("currencies", currencies); -context.put("currencyUomId", shoppingCart.getCurrency()); - +context.put("currencyUomId", shoppingCart.getCurrency()); \ No newline at end of file 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?view=diff&rev=519570&r1=519569&r2=519570 ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Sun Mar 18 00:33:30 2007 @@ -395,6 +395,12 @@ <response name="success" type="request" value="orderentry"/> <response name="error" type="request" value="orderentry"/> </request-map> + <request-map uri="setPoNumber"> + <security https="true" auth="true"/> + <event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="setPoNumber"/> + <response name="success" type="request" value="orderentry"/> + <response name="error" type="request" value="orderentry"/> + </request-map> <request-map uri="additem"> <security https="true" auth="true"/> 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?view=diff&rev=519570&r1=519569&r2=519570 ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkoutoptions.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/checkoutoptions.ftl Sun Mar 18 00:33:30 2007 @@ -230,16 +230,6 @@ <textarea class="textAreaBox" cols="30" rows="3" wrap="hard" name="shipping_instructions">${shoppingCart.getShippingInstructions()?if_exists}</textarea> </td> </tr> - <tr><td colspan="2"><hr class="sepbar"/></td></tr> - <tr> - <td colspan="2"> - <span class="head2"><b>${uiLabelMap.OrderPoNumber}</b></span> - <#if shoppingCart.getPoNumber()?exists && shoppingCart.getPoNumber() != "(none)"> - <#assign currentPoNumber = shoppingCart.getPoNumber()> - </#if> - <input type="text" class="inputBox" name="corresponding_po_id" size="15" value="${currentPoNumber?if_exists}"> - </td> - </tr> <#if shipping == true> <#if productStore.showCheckoutGiftOptions?if_exists != "N"> <tr><td colspan="2"><hr class="sepbar"/></td></tr> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/optionsettings.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/optionsettings.ftl?view=diff&rev=519570&r1=519569&r2=519570 ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/optionsettings.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/optionsettings.ftl Sun Mar 18 00:33:30 2007 @@ -116,16 +116,6 @@ <textarea class='textAreaBox' cols="30" rows="3" name="${shipGroupIndex?default("0")}_shipping_instructions">${cart.getShippingInstructions(shipGroupIndex)?if_exists}</textarea> </td> </tr> - <#if cart.getOrderType() != "PURCHASE_ORDER"> - <tr><td colspan="2"><hr class='sepbar'></td></tr> - <tr> - <td colspan="2"> - <span class="head2"><b>${uiLabelMap.OrderPONumber}</b></span> - <input type="text" class='inputBox' name="corresponding_po_id" size="15" value='${cart.getPoNumber()?if_exists}'> - </td> - </tr> - <tr><td colspan="2"><hr class='sepbar'></td></tr> - </#if> <tr> <td colspan="2"> <#if cart.getOrderType() = "PURCHASE_ORDER"> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/order/orderheaderinfo.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/order/orderheaderinfo.ftl?view=diff&rev=519570&r1=519569&r2=519570 ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/order/orderheaderinfo.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/order/orderheaderinfo.ftl Sun Mar 18 00:33:30 2007 @@ -21,7 +21,7 @@ <div class="screenlet-body"> <table width="100%" border="0" cellpadding="1"> <#-- order name --> - <#if (orderName?exists)> + <#if (orderName?has_content)> <tr> <td align="right" valign="top" width="15%"> <span class="tabletext"> <b>${uiLabelMap.OrderOrderName}</b> </span> @@ -42,6 +42,18 @@ <td width="5"> </td> <td align="left" valign="top" width="80%" class="tabletext"> ${Static["org.ofbiz.party.party.PartyHelper"].getPartyName(orderForParty, false)} [${orderForParty.partyId}] + </td> + </tr> + <tr><td colspan="7"><hr class="sepbar"/></td></tr> + </#if> + <#if (cart.getPoNumber()?has_content)> + <tr> + <td align="right" valign="top" width="15%"> + <span class="tabletext"> <b>${uiLabelMap.OrderPoNumber}</b> </span> + </td> + <td width="5"> </td> + <td align="left" valign="top" width="80%" class="tabletext"> + ${cart.getPoNumber()} </td> </tr> <tr><td colspan="7"><hr class="sepbar"/></td></tr> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderHeaderInfo.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderHeaderInfo.ftl?view=diff&rev=519570&r1=519569&r2=519570 ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderHeaderInfo.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderHeaderInfo.ftl Sun Mar 18 00:33:30 2007 @@ -71,6 +71,15 @@ </div> </td> </tr> + <tr valign="top"> + <td class="tabletext"><b>${uiLabelMap.OrderPONumber}</b>:</td> + <td class="tabletext"> + <form method="post" action="setPoNumber" name="setCartPoNumberForm"> + <input type="text" name="correspondingPoId" class="inputBox" size="15" value='${shoppingCart.getPoNumber()?default("")}'/> + <input type="submit" value="${uiLabelMap.CommonSet}" class="smallSubmit"/> + </form> + </td> + </tr> <tr> <td valign="bottom"><div class="tabletext"><b>${uiLabelMap.CommonCurrency}</b>:</div></td> <td valign="bottom"><div class="tabletext">${currencyUomId}</div></td> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderagreements.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderagreements.ftl?view=diff&rev=519570&r1=519569&r2=519570 ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderagreements.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderagreements.ftl Sun Mar 18 00:33:30 2007 @@ -70,6 +70,19 @@ <input type='text' class="inputBox" size='60' maxlength='100' name='orderName'/> </td> </tr> + + <#if cart.getOrderType() != "PURCHASE_ORDER"> + <tr> + <td> </td> + <td align='right' valign='middle' class='tableheadtext' nowrap> + ${uiLabelMap.OrderPONumber} + </td> + <td> </td> + <td align='left'> + <input type="text" class='inputBox' name="correspondingPoId" size="15"> + </td> + </tr> + </#if> <tr> <td> </td> |
Free forum by Nabble | Edit this page |