Author: jleroux
Date: Thu Mar 12 13:51:35 2009 New Revision: 752866 URL: http://svn.apache.org/viewvc?rev=752866&view=rev Log: A patch from Bharat Soni "Buyer should be able to specify PO# otherwise it should be generated automatically while placing a purchase order." (https://issues.apache.org/jira/browse/OFBIZ-2218) - OFBIZ-2218 Modified: ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml ofbiz/trunk/applications/order/servicedef/services.xml ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.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/entry/orderagreements.ftl Modified: ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml?rev=752866&r1=752865&r2=752866&view=diff ============================================================================== --- ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml (original) +++ ofbiz/trunk/applications/order/config/OrderErrorUiLabels.xml Thu Mar 12 13:51:35 2009 @@ -159,6 +159,10 @@ <value xml:lang="th">à¸à¸²à¸£à¸à¸±à¸à¹à¸à¸à¸à¸à¸à¸±à¸à¸£à¸à¸à¸§à¹à¸²à¸¡à¸µà¸à¹à¸à¸¢à¸à¹à¸§à¹à¸</value> <value xml:lang="zh">æ´æ°è´ç©è½¦æ¶åçæå¤æ åµ </value> </property> + <property key="OrderCaughtGenericServiceExceptionWhileGettingOrderId"> + <value xml:lang="en">Caught generic service exception while getting order Id </value> + <value xml:lang="fr">Erreur générique de service lors de l'acquisition de la réf. de commande </value> + </property> <property key="OrderCaughtNumberFormatExceptionOnCartUpdate"> <value xml:lang="en">Caught number format exception on cart update. </value> <value xml:lang="es">Excepción de formato de número capturada en la actualización del carro.</value> @@ -593,6 +597,10 @@ <value xml:lang="th">ERROR : à¸à¹à¸à¸à¸´à¸à¸à¸¥à¸²à¸ ! à¸à¸²à¸£à¸£à¹à¸à¸à¸à¸à¸à¸à¸à¸¥à¸¹à¸à¸à¹à¸²à¸à¹à¸§à¸¢à¸£à¸«à¸±à¸ª [ ${custRequestId} ] à¹à¸¡à¹à¸¡à¸µà¸à¸¢à¸¹à¹. </value> <value xml:lang="zh">é误ï¼ä¸åå¨æ è¯ä¸º [ ${custRequestId} ] ç客æ·è¯·æ±ã </value> </property> + <property key="OrderErrorGettingNextOrderIdWhileCreatingOrder"> + <value xml:lang="en">Error getting next order Id while creating order </value> + <value xml:lang="fr">Erreur lors de l'acquisition de la prochaine réf. de commande durant sa création </value> + </property> <property key="OrderErrorGettingOrderHeaderInformationNull"> <value xml:lang="en">Error getting order header information; null</value> <value xml:lang="es">Error obteniendo información del encabezado del pedido; nulo</value> @@ -937,6 +945,10 @@ <value xml:lang="th">à¹à¸¡à¹à¸£à¸°à¸à¸¸à¸à¸±à¸à¸£à¸²à¸à¸²à¸£à¸à¸£à¸²à¸à¸à¸à¸¶à¹à¸à¸«à¸£à¸·à¸à¹à¸§à¸¥à¸²à¸£à¸°à¸«à¸§à¹à¸²à¸ </value> <value xml:lang="zh">没ææå®é¢çæé´é</value> </property> + <property key="OrderIdAlreadyExistsPleaseChooseAnother"> + <value xml:lang="en">Order Id already exists please choose another </value> + <value xml:lang="fr">Cette réf. de commande existe déjà , SVP chjoisissez en une autre </value> + </property> <property key="OrderIllegalCharacterInSelectedItemField"> <value xml:lang="en">Illegal character in selectedItem field</value> <value xml:lang="es">Caracter ilegal en el campo del Ãtem seleccionado</value> Modified: ofbiz/trunk/applications/order/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=752866&r1=752865&r2=752866&view=diff ============================================================================== --- ofbiz/trunk/applications/order/servicedef/services.xml (original) +++ ofbiz/trunk/applications/order/servicedef/services.xml Thu Mar 12 13:51:35 2009 @@ -138,6 +138,7 @@ <attribute name="orderItemAssociations" type="List" mode="IN" optional="true"/> <attribute name="orderInternalNotes" type="List" mode="IN" optional="true"/> <attribute name="orderNotes" type="List" mode="IN" optional="true"/> + <attribute name="orderId" type="String" mode="IN" optional="true"/> <attribute name="orderId" type="String" mode="OUT" optional="false"/> <attribute name="statusId" type="String" mode="OUT" optional="false"/> </service> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=752866&r1=752865&r2=752866&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Thu Mar 12 13:51:35 2009 @@ -412,7 +412,7 @@ successResult.put("statusId", initialStatus); // create the order object - String orderId = null; + String orderId = (String) context.get("orderId"); String orgPartyId = null; if (productStore != null) { orgPartyId = productStore.getString("payToPartyId"); @@ -426,18 +426,19 @@ if ((orderTypeId.equals("SALES_ORDER")) || (productStoreId != null)) { getNextOrderIdContext.put("productStoreId", productStoreId); } - - try { - Map getNextOrderIdResult = dispatcher.runSync("getNextOrderId", getNextOrderIdContext); - if (ServiceUtil.isError(getNextOrderIdResult)) { - return ServiceUtil.returnError("Error getting next orderId while creating order", null, null, getNextOrderIdResult); + if (UtilValidate.isEmpty(orderId)) { + try { + Map getNextOrderIdResult = dispatcher.runSync("getNextOrderId", getNextOrderIdContext); + if (ServiceUtil.isError(getNextOrderIdResult)) { + String errMsg = UtilProperties.getMessage(resource_error, "OrderErrorGettingNextOrderIdWhileCreatingOrder", locale); + return ServiceUtil.returnError(errMsg, null, null, getNextOrderIdResult); + } + orderId = (String) getNextOrderIdResult.get("orderId"); + } catch (GenericServiceException e) { + String errMsg = UtilProperties.getMessage(resource_error, "OrderCaughtGenericServiceExceptionWhileGettingOrderId", locale); + Debug.logError(e, errMsg, module); + return ServiceUtil.returnError(errMsg); } - - orderId = (String) getNextOrderIdResult.get("orderId"); - } catch (GenericServiceException e) { - String errMsg = "Error creating order while getting orderId: " + e.toString(); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); } } 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?rev=752866&r1=752865&r2=752866&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Mar 12 13:51:35 2009 @@ -578,6 +578,7 @@ if (distributorId != null) context.put("distributorId", distributorId); if (affiliateId != null) context.put("affiliateId", affiliateId); + context.put("orderId", orderId); context.put("grandTotal", grandTotal); context.put("userLogin", userLogin); context.put("visitId", visitId); 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?rev=752866&r1=752865&r2=752866&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Thu Mar 12 13:51:35 2009 @@ -1647,7 +1647,7 @@ return cart.viewCartOnAdd() ? "viewcart" : "success"; } - // request method for setting the currency, agreement and shipment dates at once + // request method for setting the currency, agreement, OrderId and shipment dates at once public static String setOrderCurrencyAgreementShipDates(HttpServletRequest request, HttpServletResponse response) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); @@ -1659,8 +1659,10 @@ String workEffortId = request.getParameter("workEffortId"); String shipBeforeDateStr = request.getParameter("shipBeforeDate"); String shipAfterDateStr = request.getParameter("shipAfterDate"); + String orderId = request.getParameter("orderId"); String orderName = request.getParameter("orderName"); String correspondingPoId = request.getParameter("correspondingPoId"); + Locale locale = UtilHttp.getLocale(request); Map result = null; // set the agreement if specified otherwise set the currency @@ -1677,6 +1679,22 @@ // set the work effort id cart.setWorkEffortId(workEffortId); + // set the order id if given + if(UtilValidate.isNotEmpty(orderId)) { + GenericValue thisOrder = null; + try { + thisOrder = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + } catch (GenericEntityException e) { + Debug.logError(e.getMessage(), module); + } + if (thisOrder == null) { + cart.setOrderId(orderId); + } else { + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderIdAlreadyExistsPleaseChooseAnother", locale)); + return "error"; + } + } + // set the order name cart.setOrderName(orderName); 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?rev=752866&r1=752865&r2=752866&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderagreements.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/orderagreements.ftl Thu Mar 12 13:51:35 2009 @@ -75,7 +75,20 @@ </td> </tr> </#if> - + + <#if "PURCHASE_ORDER" == cart.getOrderType()> + <tr> + <td> </td> + <td align='right' valign='middle' class='tableheadtext'> + ${uiLabelMap.OrderOrderId} + </td> + <td> </td> + <td align='left'> + <input type='text' size='15' maxlength='100' name='orderId' value=""/> + </td> + </tr> + </#if> + <tr> <td> </td> <td align='right' valign='middle' class='tableheadtext' nowrap> |
Free forum by Nabble | Edit this page |