Author: jaz
Date: Mon Apr 23 11:18:26 2007 New Revision: 531551 URL: http://svn.apache.org/viewvc?view=rev&rev=531551 Log: now creates an order note when a CSR changes and item or adds a new one Modified: ofbiz/trunk/applications/order/servicedef/secas.xml ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Modified: ofbiz/trunk/applications/order/servicedef/secas.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/secas.xml?view=diff&rev=531551&r1=531550&r2=531551 ============================================================================== --- ofbiz/trunk/applications/order/servicedef/secas.xml (original) +++ ofbiz/trunk/applications/order/servicedef/secas.xml Mon Apr 23 11:18:26 2007 @@ -100,6 +100,7 @@ <eca service="appendOrderItem" event="return"> <action service="processOrderPayments" mode="sync"/> </eca> + <!-- cancel order items --> <eca service="cancelOrderItem" event="commit"> <action service="recreateOrderAdjustments" mode="sync"/> 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?view=diff&rev=531551&r1=531550&r2=531551 ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Mon Apr 23 11:18:26 2007 @@ -2417,7 +2417,6 @@ /** Service to create a order header note. */ public static Map createOrderNote(DispatchContext dctx, Map context) { - Map result = new HashMap(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); @@ -2447,15 +2446,13 @@ delegator.create(v); } catch (GenericEntityException ee) { Debug.logError(ee, module); - result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); - result.put(ModelService.ERROR_MESSAGE, "Problem associating note with order (" + ee.getMessage() + ")."); + return ServiceUtil.returnError("Problem associating note with order (" + ee.getMessage() + ")"); } catch (GenericServiceException se) { Debug.logError(se, module); - result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); - result.put(ModelService.ERROR_MESSAGE, "Problem associating note with order (" + se.getMessage() + ")."); + return ServiceUtil.returnError("Problem associating note with order (" + se.getMessage() + ")"); } - return result; + return ServiceUtil.returnSuccess(); } public static Map allowOrderSplit(DispatchContext ctx, Map context) { @@ -2968,6 +2965,14 @@ return ServiceUtil.returnError(e.getMessage()); } + // log an order note + try { + dispatcher.runSync("createOrderNote", UtilMisc.toMap("orderId", orderId, "note", "Added item to order: " + + productId + " (" + quantity + ")", "internalNote", "Y", "userLogin", userLogin)); + } catch (GenericServiceException e) { + Debug.logError(e, module); + } + Map result = ServiceUtil.returnSuccess(); result.put("shoppingCart", cart); result.put("orderId", orderId); @@ -3043,9 +3048,8 @@ } Debug.log("Set item quantity: [" + itemSeqId + "] " + qty, module); - if(cartItem.getIsModifiedPrice()) + if (cartItem.getIsModifiedPrice()) // set price cartItem.setBasePrice(priceSave); - // set price if (overridePriceMap.containsKey(itemSeqId)) { String priceStr = (String) itemPriceMap.get(itemSeqId); @@ -3125,6 +3129,13 @@ return ServiceUtil.returnError(e.getMessage()); } + // log an order note + try { + dispatcher.runSync("createOrderNote", UtilMisc.toMap("orderId", orderId, "note", "Updated order.", "internalNote", "Y", "userLogin", userLogin)); + } catch (GenericServiceException e) { + Debug.logError(e, module); + } + Map result = ServiceUtil.returnSuccess(); result.put("shoppingCart", cart); result.put("orderId", orderId); @@ -4138,21 +4149,22 @@ manualHold = Boolean.FALSE; } - String productStoreId = cart.getProductStoreId(); + if (!"PURCHASE_ORDER".equals(cart.getOrderType())) { + String productStoreId = cart.getProductStoreId(); + GenericValue productStore = ProductStoreWorker.getProductStore(productStoreId, delegator); + CheckOutHelper coh = new CheckOutHelper(dispatcher, delegator, cart); - GenericValue productStore = ProductStoreWorker.getProductStore(productStoreId, delegator); - CheckOutHelper coh = new CheckOutHelper(dispatcher, delegator, cart); - - // process payment - Map payResp; - try { - payResp = coh.processPayment(productStore, userLogin, false, manualHold.booleanValue()); - } catch (GeneralException e) { - Debug.logError(e, module); - return ServiceUtil.returnError(e.getMessage()); - } - if (ServiceUtil.isError(payResp)) { - return ServiceUtil.returnError(ServiceUtil.getErrorMessage(payResp)); + // process payment + Map payResp; + try { + payResp = coh.processPayment(productStore, userLogin, false, manualHold.booleanValue()); + } catch (GeneralException e) { + Debug.logError(e, module); + return ServiceUtil.returnError(e.getMessage()); + } + if (ServiceUtil.isError(payResp)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(payResp)); + } } return ServiceUtil.returnSuccess(); 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=531551&r1=531550&r2=531551 ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Mon Apr 23 11:18:26 2007 @@ -235,8 +235,9 @@ while (oppi.hasNext()) { GenericValue opp = (GenericValue) oppi.next(); String paymentId = opp.getString("paymentMethodId"); - if(paymentId==null) + if (paymentId == null) { paymentId = opp.getString("paymentMethodTypeId"); + } Double maxAmount = opp.getDouble("maxAmount"); String overflow = opp.getString("overflowFlag"); if ((overflow == null || !"Y".equals(overflow)) && oppi.hasNext()) { |
Free forum by Nabble | Edit this page |