Author: hansbak
Date: Wed Aug 15 07:17:37 2007 New Revision: 566181 URL: http://svn.apache.org/viewvc?view=rev&rev=566181 Log: OFBIZ 1171, patch from Bilgin Ibryam to allow reservations also on quotes. Modified: ofbiz/trunk/applications/order/entitydef/entitymodel.xml ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Modified: ofbiz/trunk/applications/order/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/entitymodel.xml?view=diff&rev=566181&r1=566180&r2=566181 ============================================================================== --- ofbiz/trunk/applications/order/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/applications/order/entitydef/entitymodel.xml Wed Aug 15 07:17:37 2007 @@ -1328,6 +1328,9 @@ <field name="quantity" type="floating-point"></field> <field name="selectedAmount" type="floating-point"></field> <field name="quoteUnitPrice" type="currency-amount"></field> + <field name="reservStart" type="date-time"></field> + <field name="reservLength" type="floating-point"></field> + <field name="reservPersons" type="floating-point"></field> <field name="estimatedDeliveryDate" type="date-time"></field> <field name="comments" type="comment"></field> <field name="isPromo" type="indicator"></field> @@ -1652,6 +1655,9 @@ <field name="quantity" type="floating-point"></field> <field name="selectedAmount" type="floating-point"></field> <field name="maximumAmount" type="currency-amount"></field> + <field name="reservStart" type="date-time"></field> + <field name="reservLength" type="floating-point"></field> + <field name="reservPersons" type="floating-point"></field> <field name="description" type="description"></field> <field name="story" type="very-long"></field> <prim-key field="custRequestId"/> Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml?view=diff&rev=566181&r1=566180&r2=566181 ============================================================================== --- ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml (original) +++ ofbiz/trunk/applications/order/script/org/ofbiz/order/quote/QuoteServices.xml Wed Aug 15 07:17:37 2007 @@ -709,6 +709,10 @@ <call-object-method obj-field-name="item" method-name="getSelectedAmount" ret-field-name="createQuoteItemInMap.selectedAmount"/> <call-object-method obj-field-name="item" method-name="getBasePrice" ret-field-name="createQuoteItemInMap.quoteUnitPrice"/> <call-object-method obj-field-name="item" method-name="getItemComment" ret-field-name="createQuoteItemInMap.comments"/> + <call-object-method obj-field-name="item" method-name="getReservStart" ret-field-name="createQuoteItemInMap.reservStart"/> + <call-object-method obj-field-name="item" method-name="getReservLength" ret-field-name="createQuoteItemInMap.reservLength"/> + <call-object-method obj-field-name="item" method-name="getReservPersons" ret-field-name="createQuoteItemInMap.reservPersons"/> + <call-service service-name="createQuoteItem" in-map-name="createQuoteItemInMap"> <result-to-field result-name="quoteItemSeqId" field-name="quoteItemSeqId"/> </call-service> @@ -802,6 +806,9 @@ <set field="createQuoteItemInMap.productId" from-field="custRequestItem.productId"/> <set field="createQuoteItemInMap.quantity" from-field="custRequestItem.quantity"/> <set field="createQuoteItemInMap.selectedAmount" from-field="custRequestItem.selectedAmount"/> + <set field="createQuoteItemInMap.reservStart" from-field="custRequestItem.reservStart"/> + <set field="createQuoteItemInMap.reservLength" from-field="custRequestItem.reservLength"/> + <set field="createQuoteItemInMap.reservPersons" from-field="custRequestItem.reservPersons"/> <call-service service-name="createQuoteItem" in-map-name="createQuoteItemInMap"/> </iterate> <!-- roles --> Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml?view=diff&rev=566181&r1=566180&r2=566181 ============================================================================== --- ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml (original) +++ ofbiz/trunk/applications/order/script/org/ofbiz/order/request/CustRequestServices.xml Wed Aug 15 07:17:37 2007 @@ -218,6 +218,9 @@ <call-object-method obj-field-name="item" method-name="getQuantity" ret-field-name="createCustRequestItemInMap.quantity"/> <!--<call-object-method obj-field-name="item" method-name="getSelectedAmount" ret-field-name="createCustRequestItemInMap.selectedAmount"/>--> <!--<call-object-method obj-field-name="item" method-name="getItemComment" ret-field-name="createCustRequestItemInMap.comments"/>--> + <call-object-method obj-field-name="item" method-name="getReservStart" ret-field-name="createCustRequestItemInMap.reservStart"/> + <call-object-method obj-field-name="item" method-name="getReservLength" ret-field-name="createCustRequestItemInMap.reservLength"/> + <call-object-method obj-field-name="item" method-name="getReservPersons" ret-field-name="createCustRequestItemInMap.reservPersons"/> <call-service service-name="createCustRequestItem" in-map-name="createCustRequestItemInMap"> <result-to-field result-name="custRequestItemSeqId" field-name="custRequestItemSeqId"/> </call-service> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?view=diff&rev=566181&r1=566180&r2=566181 ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Wed Aug 15 07:17:37 2007 @@ -1620,18 +1620,16 @@ } public String getCurrentOrderItemWorkEffort(GenericValue orderItem) { + String orderItemSeqId = orderItem.getString("orderItemSeqId"); + String orderId = orderItem.getString("orderId"); + GenericDelegator delegator = orderItem.getDelegator(); GenericValue workOrderItemFulFillment; + GenericValue workEffort; try { - workOrderItemFulFillment = orderItem.getRelatedOne("WorkOrderItemFulFillment"); - } - catch (GenericEntityException e) { - return null; - } - GenericValue workEffort = null; - try { - workEffort = workOrderItemFulFillment.getRelatedOne("WorkEffort"); - } - catch (GenericEntityException e) { + List workOrderItemFulFillments = delegator.findByAndCache("WorkOrderItemFulfillment", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId)); + workOrderItemFulFillment = EntityUtil.getFirst(workOrderItemFulFillments); + workEffort = workOrderItemFulFillment.getRelatedOne("WorkEffort"); + } catch (GenericEntityException e) { return null; } return workEffort.getString("workEffortId"); @@ -2659,6 +2657,14 @@ return getOrderItemTotalBd(orderItem, adjustments).doubleValue(); } + public static Double getWorkEffortRentalLenght(GenericValue workEffort){ + Double length = null; + if (workEffort.get("estimatedStartDate") != null && workEffort.get("estimatedCompletionDate") != null) { + length = new Double(UtilDateTime.getInterval(workEffort.getTimestamp("estimatedStartDate"),workEffort.getTimestamp("estimatedCompletionDate"))/86400000); + } + return length; + } + public static BigDecimal getWorkEffortRentalQuantityBd(GenericValue workEffort){ BigDecimal persons = new BigDecimal(1); if (workEffort.get("reservPersons") != null) Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?view=diff&rev=566181&r1=566180&r2=566181 ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Wed Aug 15 07:17:37 2007 @@ -544,6 +544,16 @@ return addItemToEnd(productId, amount, quantity, unitPrice, features, attributes, prodCatalogId, itemType, dispatcher, triggerExternalOps, triggerPriceRules, Boolean.FALSE, Boolean.FALSE); } + /** Add an (rental)item to the shopping cart. */ + public int addItemToEnd(String productId, Double amount, double quantity, Double unitPrice, Timestamp reservStart, Double reservLengthDbl, Double reservPersonsDbl, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException { + return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, reservStart, reservLengthDbl, reservPersonsDbl, null, null, features, attributes, prodCatalogId, null, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, Boolean.FALSE, Boolean.FALSE)); + } + + /** Add an (rental)item to the shopping cart. */ + public int addItemToEnd(String productId, Double amount, double quantity, Double unitPrice, Timestamp reservStart, Double reservLengthDbl, Double reservPersonsDbl, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException { + return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, reservStart, reservLengthDbl, reservPersonsDbl, null, null, features, attributes, prodCatalogId, null, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, skipInventoryChecks, skipProductChecks)); + } + /** Add an item to the shopping cart. */ public int addItemToEnd(String productId, Double amount, double quantity, Double unitPrice, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException { return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, null, null, null, null, null, features, attributes, prodCatalogId, null, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, skipInventoryChecks, skipProductChecks)); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?view=diff&rev=566181&r1=566180&r2=566181 ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Wed Aug 15 07:17:37 2007 @@ -25,6 +25,7 @@ import java.util.Map; import java.util.HashMap; import java.util.LinkedList; +import java.sql.Timestamp; import javolution.util.FastMap; @@ -311,8 +312,29 @@ // product item String prodCatalogId = item.getString("prodCatalogId"); String productId = item.getString("productId"); + + //prepare the rental data + Timestamp reservStart = null; + Double reservLength = null; + Double reservPersons = null; + + GenericValue workEffort = null; + String workEffortId = orh.getCurrentOrderItemWorkEffort(item); + if (workEffortId != null) { + try { + workEffort = delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId)); + } catch (GenericEntityException e) { + Debug.logError(e, module); + } + } + if (workEffort != null && "ASSET_USAGE".equals(workEffort.getString("workEffortTypeId"))){ + reservStart = workEffort.getTimestamp("estimatedStartDate"); + reservLength = OrderReadHelper.getWorkEffortRentalLenght(workEffort); + reservPersons = workEffort.getDouble("reservPersons"); + } //end of rental data + try { - itemIndex = cart.addItemToEnd(productId, amount, quantityDbl, null, null, null, prodCatalogId, item.getString("orderItemTypeId"), dispatcher, null, null, skipInventoryChecks, skipProductChecks); + itemIndex = cart.addItemToEnd(productId, amount, quantityDbl, null, reservStart, reservLength, reservPersons, null, null, prodCatalogId, item.getString("orderItemTypeId"), dispatcher, null, null, skipInventoryChecks, skipProductChecks); } catch (ItemNotFoundException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -556,6 +578,12 @@ // pass to the cart the quoteUnitPrice/amount value. quoteUnitPrice = new Double(quoteUnitPrice.doubleValue() / amount.doubleValue()); } + + //rental product data + Timestamp reservStart = item.getTimestamp("reservStart"); + Double reservLength = item.getDouble("reservLength"); + Double reservPersons = item.getDouble("reservPersons"); + int itemIndex = -1; if (item.get("productId") == null) { // non-product item @@ -571,7 +599,7 @@ // product item String productId = item.getString("productId"); try { - itemIndex = cart.addItemToEnd(productId, amount, quantity.doubleValue(), quoteUnitPrice, null, null, null, null, dispatcher, new Boolean(!applyQuoteAdjustments), new Boolean(quoteUnitPrice.doubleValue() == 0)); + itemIndex = cart.addItemToEnd(productId, amount, quantity.doubleValue(), quoteUnitPrice, reservStart, reservLength, reservPersons, null, null, null, null, dispatcher, new Boolean(!applyQuoteAdjustments), new Boolean(quoteUnitPrice.doubleValue() == 0)); } catch (ItemNotFoundException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); |
Hi All,
After rev=566181. On 8/15/07, [hidden email] <[hidden email]> > Author: hansbak > Date: Wed Aug 15 07:17:37 2007 > New Revision: 566181 > > URL: http://svn.apache.org/viewvc?view=rev&rev=566181 > Log: > OFBIZ 1171, patch from Bilgin Ibryam to allow reservations also on quotes. I got error when i edit item of an order. I got an exception (nullPointerException) the nullPointerException is generated from OrderReadHelper.java when code workEffort = workOrderItemFulFillment.getRelatedOne("WorkEffort"); execute The stack trace is :- 2007-08-31 13:28:29,911 (http-0.0.0.0-8443-Processor4) [ OrderServices.java:3292:ERROR] ---- exception report ---------------------------------------------------------- Exception: org.ofbiz.service.GenericServiceException Message: Service target threw an unexpected exception (null) ---- stack trace --------------------------------------------------------------- org.ofbiz.service.GenericServiceException: Service target threw an unexpected exception (null) org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker( StandardJavaEngine.java:103) org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java :53) org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335) org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210) org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136) org.ofbiz.order.order.OrderServices.loadCartForUpdate(OrderServices.java :3287) org.ofbiz.order.order.OrderServices.updateApprovedOrderItems( OrderServices.java:3123) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java :39) sun.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:585) org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker( StandardJavaEngine.java:91) org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java :53) org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335) org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210) org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136) org.ofbiz.webapp.event.ServiceEventHandler.invoke(ServiceEventHandler.java :325) org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:448) org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:277) org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:193) org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:78) javax.servlet.http.HttpServlet.service(HttpServlet.java:615) javax.servlet.http.HttpServlet.service(HttpServlet.java:688) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:269) org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:188) org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:248) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:188) org.apache.catalina.core.StandardWrapperValve.invoke( StandardWrapperValve.java:210) org.apache.catalina.core.StandardContextValve.invoke( StandardContextValve.java:174) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :127) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :117) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :108) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:542) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection (Http11BaseProtocol.java:665) org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket( PoolTcpEndpoint.java:528) org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt( LeaderFollowerWorkerThread.java:81) org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run( ThreadPool.java:685) java.lang.Thread.run(Thread.java:595) java.lang.NullPointerException org.ofbiz.order.order.OrderReadHelper.getCurrentOrderItemWorkEffort( OrderReadHelper.java:1655) org.ofbiz.order.shoppingcart.ShoppingCartServices.loadCartFromOrder( ShoppingCartServices.java:322) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java :39) sun.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:585) org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker( StandardJavaEngine.java:91) org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java :53) org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335) org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210) org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136) org.ofbiz.order.order.OrderServices.loadCartForUpdate(OrderServices.java :3287) org.ofbiz.order.order.OrderServices.updateApprovedOrderItems( OrderServices.java:3123) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java :39) sun.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:585) org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker( StandardJavaEngine.java:91) org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java :53) org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335) org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210) org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136) org.ofbiz.webapp.event.ServiceEventHandler.invoke(ServiceEventHandler.java :325) org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:448) org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:277) org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:193) org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:78) javax.servlet.http.HttpServlet.service(HttpServlet.java:615) javax.servlet.http.HttpServlet.service(HttpServlet.java:688) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:269) org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:188) org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:248) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:215) org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:188) org.apache.catalina.core.StandardWrapperValve.invoke( StandardWrapperValve.java:210) org.apache.catalina.core.StandardContextValve.invoke( StandardContextValve.java:174) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :127) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :117) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :108) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:542) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection (Http11BaseProtocol.java:665) org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket( PoolTcpEndpoint.java:528) org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt( LeaderFollowerWorkerThread.java:81) org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run( ThreadPool.java:685) java.lang.Thread.run(Thread.java:595) -------------------------------------------------------------------------------- -- Thanks & Regards Sumit Pandit
Thanks And Regards
Sumit Pandit |
Hi Sumit,
can you please replace the getCurrentOrderItemWorkEffort class in orderReadHelper.java with the code below and see if it solves the problem? Regards, Hans public String getCurrentOrderItemWorkEffort(GenericValue orderItem) { String orderItemSeqId = orderItem.getString("orderItemSeqId"); String orderId = orderItem.getString("orderId"); GenericDelegator delegator = orderItem.getDelegator(); GenericValue workOrderItemFulFillment = null; GenericValue workEffort = null; try { List workOrderItemFulFillments = delegator.findByAndCache("WorkOrderItemFulfillment", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId)); if (!UtilValidate.isEmpty(workOrderItemFulFillments)) { workOrderItemFulFillment = EntityUtil.getFirst(workOrderItemFulFillments); workEffort = workOrderItemFulFillment.getRelatedOne("WorkEffort"); } } catch (GenericEntityException e) { return null; } if (workEffort != null) { return workEffort.getString("workEffortId"); } else { return null; } } On Fri, 2007-08-31 at 13:35 +0530, sumit pandit wrote: > Hi All, > After rev=566181. > > On 8/15/07, [hidden email] <[hidden email]> > > > Author: hansbak > > Date: Wed Aug 15 07:17:37 2007 > > New Revision: 566181 > > > > URL: http://svn.apache.org/viewvc?view=rev&rev=566181 > > Log: > > OFBIZ 1171, patch from Bilgin Ibryam to allow reservations also on quotes. > > > > I got error when i edit item of an order. > I got an exception (nullPointerException) > the nullPointerException is generated from OrderReadHelper.java when code > workEffort = workOrderItemFulFillment.getRelatedOne("WorkEffort"); execute > > The stack trace is :- > > 2007-08-31 13:28:29,911 (http-0.0.0.0-8443-Processor4) [ > OrderServices.java:3292:ERROR] > ---- exception report > ---------------------------------------------------------- > Exception: org.ofbiz.service.GenericServiceException > Message: Service target threw an unexpected exception (null) > ---- stack trace > --------------------------------------------------------------- > org.ofbiz.service.GenericServiceException: Service target threw an > unexpected exception (null) > org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker( > StandardJavaEngine.java:103) > org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java > :53) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210) > org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136) > org.ofbiz.order.order.OrderServices.loadCartForUpdate(OrderServices.java > :3287) > org.ofbiz.order.order.OrderServices.updateApprovedOrderItems( > OrderServices.java:3123) > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java > :39) > sun.reflect.DelegatingMethodAccessorImpl.invoke( > DelegatingMethodAccessorImpl.java:25) > java.lang.reflect.Method.invoke(Method.java:585) > org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker( > StandardJavaEngine.java:91) > org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java > :53) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210) > org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136) > org.ofbiz.webapp.event.ServiceEventHandler.invoke(ServiceEventHandler.java > :325) > org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:448) > org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:277) > org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:193) > org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:78) > javax.servlet.http.HttpServlet.service(HttpServlet.java:615) > javax.servlet.http.HttpServlet.service(HttpServlet.java:688) > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( > ApplicationFilterChain.java:269) > org.apache.catalina.core.ApplicationFilterChain.doFilter( > ApplicationFilterChain.java:188) > org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:248) > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( > ApplicationFilterChain.java:215) > org.apache.catalina.core.ApplicationFilterChain.doFilter( > ApplicationFilterChain.java:188) > org.apache.catalina.core.StandardWrapperValve.invoke( > StandardWrapperValve.java:210) > org.apache.catalina.core.StandardContextValve.invoke( > StandardContextValve.java:174) > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java > :127) > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java > :117) > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java > :108) > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:542) > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection > (Http11BaseProtocol.java:665) > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket( > PoolTcpEndpoint.java:528) > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt( > LeaderFollowerWorkerThread.java:81) > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run( > ThreadPool.java:685) > java.lang.Thread.run(Thread.java:595) > java.lang.NullPointerException > org.ofbiz.order.order.OrderReadHelper.getCurrentOrderItemWorkEffort( > OrderReadHelper.java:1655) > org.ofbiz.order.shoppingcart.ShoppingCartServices.loadCartFromOrder( > ShoppingCartServices.java:322) > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java > :39) > sun.reflect.DelegatingMethodAccessorImpl.invoke( > DelegatingMethodAccessorImpl.java:25) > java.lang.reflect.Method.invoke(Method.java:585) > org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker( > StandardJavaEngine.java:91) > org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java > :53) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210) > org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136) > org.ofbiz.order.order.OrderServices.loadCartForUpdate(OrderServices.java > :3287) > org.ofbiz.order.order.OrderServices.updateApprovedOrderItems( > OrderServices.java:3123) > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java > :39) > sun.reflect.DelegatingMethodAccessorImpl.invoke( > DelegatingMethodAccessorImpl.java:25) > java.lang.reflect.Method.invoke(Method.java:585) > org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker( > StandardJavaEngine.java:91) > org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java > :53) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210) > org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136) > org.ofbiz.webapp.event.ServiceEventHandler.invoke(ServiceEventHandler.java > :325) > org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:448) > org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:277) > org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:193) > org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:78) > javax.servlet.http.HttpServlet.service(HttpServlet.java:615) > javax.servlet.http.HttpServlet.service(HttpServlet.java:688) > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( > ApplicationFilterChain.java:269) > org.apache.catalina.core.ApplicationFilterChain.doFilter( > ApplicationFilterChain.java:188) > org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:248) > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( > ApplicationFilterChain.java:215) > org.apache.catalina.core.ApplicationFilterChain.doFilter( > ApplicationFilterChain.java:188) > org.apache.catalina.core.StandardWrapperValve.invoke( > StandardWrapperValve.java:210) > org.apache.catalina.core.StandardContextValve.invoke( > StandardContextValve.java:174) > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java > :127) > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java > :117) > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java > :108) > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:542) > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection > (Http11BaseProtocol.java:665) > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket( > PoolTcpEndpoint.java:528) > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt( > LeaderFollowerWorkerThread.java:81) > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run( > ThreadPool.java:685) > java.lang.Thread.run(Thread.java:595) > -------------------------------------------------------------------------------- > > http://Antwebsystems.com : OFBiz Quality support for competitive rates. |
Hi Hans,
yes, your change fixes the bug. I missed it somehow at that time.Thanks. Bilgin |
In reply to this post by Sumit Pandit
Problem solved in revision 571504. Thanks for reporting by Sunit and
tested by Sumit and Bilgin. On Fri, 2007-08-31 at 13:35 +0530, sumit pandit wrote: > Hi All, > After rev=566181. > > On 8/15/07, [hidden email] <[hidden email]> > > > Author: hansbak > > Date: Wed Aug 15 07:17:37 2007 > > New Revision: 566181 > > > > URL: http://svn.apache.org/viewvc?view=rev&rev=566181 > > Log: > > OFBIZ 1171, patch from Bilgin Ibryam to allow reservations also on quotes. > > > > I got error when i edit item of an order. > I got an exception (nullPointerException) > the nullPointerException is generated from OrderReadHelper.java when code > workEffort = workOrderItemFulFillment.getRelatedOne("WorkEffort"); execute > > The stack trace is :- > > 2007-08-31 13:28:29,911 (http-0.0.0.0-8443-Processor4) [ > OrderServices.java:3292:ERROR] > ---- exception report > ---------------------------------------------------------- > Exception: org.ofbiz.service.GenericServiceException > Message: Service target threw an unexpected exception (null) > ---- stack trace > --------------------------------------------------------------- > org.ofbiz.service.GenericServiceException: Service target threw an > unexpected exception (null) > org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker( > StandardJavaEngine.java:103) > org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java > :53) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210) > org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136) > org.ofbiz.order.order.OrderServices.loadCartForUpdate(OrderServices.java > :3287) > org.ofbiz.order.order.OrderServices.updateApprovedOrderItems( > OrderServices.java:3123) > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java > :39) > sun.reflect.DelegatingMethodAccessorImpl.invoke( > DelegatingMethodAccessorImpl.java:25) > java.lang.reflect.Method.invoke(Method.java:585) > org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker( > StandardJavaEngine.java:91) > org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java > :53) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210) > org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136) > org.ofbiz.webapp.event.ServiceEventHandler.invoke(ServiceEventHandler.java > :325) > org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:448) > org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:277) > org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:193) > org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:78) > javax.servlet.http.HttpServlet.service(HttpServlet.java:615) > javax.servlet.http.HttpServlet.service(HttpServlet.java:688) > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( > ApplicationFilterChain.java:269) > org.apache.catalina.core.ApplicationFilterChain.doFilter( > ApplicationFilterChain.java:188) > org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:248) > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( > ApplicationFilterChain.java:215) > org.apache.catalina.core.ApplicationFilterChain.doFilter( > ApplicationFilterChain.java:188) > org.apache.catalina.core.StandardWrapperValve.invoke( > StandardWrapperValve.java:210) > org.apache.catalina.core.StandardContextValve.invoke( > StandardContextValve.java:174) > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java > :127) > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java > :117) > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java > :108) > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:542) > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection > (Http11BaseProtocol.java:665) > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket( > PoolTcpEndpoint.java:528) > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt( > LeaderFollowerWorkerThread.java:81) > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run( > ThreadPool.java:685) > java.lang.Thread.run(Thread.java:595) > java.lang.NullPointerException > org.ofbiz.order.order.OrderReadHelper.getCurrentOrderItemWorkEffort( > OrderReadHelper.java:1655) > org.ofbiz.order.shoppingcart.ShoppingCartServices.loadCartFromOrder( > ShoppingCartServices.java:322) > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java > :39) > sun.reflect.DelegatingMethodAccessorImpl.invoke( > DelegatingMethodAccessorImpl.java:25) > java.lang.reflect.Method.invoke(Method.java:585) > org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker( > StandardJavaEngine.java:91) > org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java > :53) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210) > org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136) > org.ofbiz.order.order.OrderServices.loadCartForUpdate(OrderServices.java > :3287) > org.ofbiz.order.order.OrderServices.updateApprovedOrderItems( > OrderServices.java:3123) > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java > :39) > sun.reflect.DelegatingMethodAccessorImpl.invoke( > DelegatingMethodAccessorImpl.java:25) > java.lang.reflect.Method.invoke(Method.java:585) > org.ofbiz.service.engine.StandardJavaEngine.serviceInvoker( > StandardJavaEngine.java:91) > org.ofbiz.service.engine.StandardJavaEngine.runSync(StandardJavaEngine.java > :53) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:335) > org.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:210) > org.ofbiz.service.GenericDispatcher.runSync(GenericDispatcher.java:136) > org.ofbiz.webapp.event.ServiceEventHandler.invoke(ServiceEventHandler.java > :325) > org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:448) > org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:277) > org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:193) > org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:78) > javax.servlet.http.HttpServlet.service(HttpServlet.java:615) > javax.servlet.http.HttpServlet.service(HttpServlet.java:688) > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( > ApplicationFilterChain.java:269) > org.apache.catalina.core.ApplicationFilterChain.doFilter( > ApplicationFilterChain.java:188) > org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:248) > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( > ApplicationFilterChain.java:215) > org.apache.catalina.core.ApplicationFilterChain.doFilter( > ApplicationFilterChain.java:188) > org.apache.catalina.core.StandardWrapperValve.invoke( > StandardWrapperValve.java:210) > org.apache.catalina.core.StandardContextValve.invoke( > StandardContextValve.java:174) > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java > :127) > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java > :117) > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java > :108) > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:542) > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection > (Http11BaseProtocol.java:665) > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket( > PoolTcpEndpoint.java:528) > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt( > LeaderFollowerWorkerThread.java:81) > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run( > ThreadPool.java:685) > java.lang.Thread.run(Thread.java:595) > -------------------------------------------------------------------------------- > > http://Antwebsystems.com : OFBiz Quality support for competitive rates. |
Free forum by Nabble | Edit this page |