|
Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java?rev=899812&r1=899811&r2=899812&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java (original) +++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java Fri Jan 15 21:00:23 2010 @@ -162,7 +162,7 @@ } Map<String, Object> eBayConfigResult = EbayHelper.buildEbayConfig(context, delegator); - + StringBuffer completeSaleXml = new StringBuffer(); if (!ServiceUtil.isFailure(buildCompleteSaleRequest(delegator, locale, externalId, transactionId, context, completeSaleXml, eBayConfigResult.get("token").toString()))) { @@ -357,7 +357,7 @@ String itemId = ""; Element transactionElement = (Element) transactionElemIter.next(); - List<? extends Element> containingOrders = UtilXml.childElementList(transactionElement, "ContainingOrder"); + List<? extends Element> containingOrders = UtilXml.childElementList(transactionElement, "ContainingOrder"); if (UtilValidate.isNotEmpty(containingOrders)) { continue; } Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java?rev=899812&r1=899811&r2=899812&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java (original) +++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java Fri Jan 15 21:00:23 2010 @@ -63,7 +63,7 @@ private static final String module = ProductsExportToEbay.class.getName(); private static List<String> productExportSuccessMessageList = FastList.newInstance(); private static List<String> productExportFailureMessageList = FastList.newInstance(); - + public static Map exportToEbay(DispatchContext dctx, Map context) { Locale locale = (Locale) context.get("locale"); @@ -101,7 +101,7 @@ return ServiceUtil.returnFailure(ServiceUtil.getErrorMessage(resultMap)); } } - } + } } catch (Exception e) { Debug.logError("Exception in exportToEbay " + e, module); return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "productsExportToEbay.exceptionInExportToEbay", locale)); @@ -216,18 +216,18 @@ if (UtilValidate.isNotEmpty(startPriceValue)) { startPrice = startPriceValue.getString("price"); startPriceCurrencyUomId = startPriceValue.getString("currencyUomId"); - } + } } - - // Buy it now is the optional value for a product that you send to eBay. Once this value is entered by user - this option allow user to win auction immediately. + + // Buy it now is the optional value for a product that you send to eBay. Once this value is entered by user - this option allow user to win auction immediately. GenericValue buyItNowPriceValue = EntityUtil.getFirst(EntityUtil.filterByDate(prod.getRelatedByAnd("ProductPrice", UtilMisc.toMap("productPricePurposeId", "EBAY", "productPriceTypeId", "MAXIMUM_PRICE")))); String buyItNowPrice = null; String buyItNowCurrencyUomId = null; if (UtilValidate.isNotEmpty(buyItNowPriceValue)) { buyItNowPrice = buyItNowPriceValue.getString("price"); buyItNowCurrencyUomId = buyItNowPriceValue.getString("currencyUomId"); - } - + } + Element itemElem = UtilXml.addChildElement(itemRequestElem, "Item", itemDocument); UtilXml.addChildElementValue(itemElem, "Country", (String)context.get("country"), itemDocument); String location = (String)context.get("location"); @@ -288,15 +288,15 @@ startPriceCurrencyUomId = UtilProperties.getPropertyValue("general.properties", "currency.uom.id.default", "USD"); } startPriceElem.setAttribute("currencyID", startPriceCurrencyUomId); - + if (UtilValidate.isNotEmpty(buyItNowPrice)) { Element buyNowPriceElem = UtilXml.addChildElementValue(itemElem, "BuyItNowPrice", buyItNowPrice, itemDocument); if (UtilValidate.isEmpty(buyItNowCurrencyUomId)) { buyItNowCurrencyUomId = UtilProperties.getPropertyValue("general.properties", "currency.uom.id.default", "USD"); } buyNowPriceElem.setAttribute("currencyID", buyItNowCurrencyUomId); - } - //Debug.logInfo("The generated string is ======= " + UtilXml.writeXmlDocument(itemDocument), module); + } + //Debug.logInfo("The generated string is ======= " + UtilXml.writeXmlDocument(itemDocument), module); dataItemsXml.append(UtilXml.writeXmlDocument(itemDocument)); } catch (Exception e) { Debug.logError("Exception during building data items to eBay: " + e.getMessage(), module); @@ -464,7 +464,7 @@ if (UtilValidate.isNotEmpty(customXmlFromUI)) { customXml = customXmlFromUI; } else { - customXml = UtilProperties.getPropertyValue(configFileName, "eBayExport.customXml"); + customXml = UtilProperties.getPropertyValue(configFileName, "eBayExport.customXml"); } if (UtilValidate.isNotEmpty(customXml)) { Document customXmlDoc = UtilXml.readXmlDocument(customXml); @@ -478,7 +478,7 @@ } } } - + public static Map getEbayCategories(DispatchContext dctx, Map context) { Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); @@ -565,7 +565,7 @@ } return results; } - + private static Map exportToEbayResponse(String msg, GenericValue product) { Map result = ServiceUtil.returnSuccess(); try { Modified: ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java?rev=899812&r1=899811&r2=899812&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java (original) +++ ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java Fri Jan 15 21:00:23 2010 @@ -405,7 +405,7 @@ Element batchElem = UtilXml.addChildElementNSElement(entryElem, "batch:operation", feedDocument, googleBaseBatchUrl); Element batchOperationElem = UtilXml.firstChildElement(batchElem, "batch:operation"); batchOperationElem.setAttribute("type", itemActionType); - + Element appControlElem = UtilXml.addChildElementNSElement(entryElem, "app:control", feedDocument, googleBaseAppUrl); Element appControlChildElem = UtilXml.firstChildElement(appControlElem, "app:control"); // Add the publishing priority for the product. By default it takes about 24 hours to publish your product if you submit data from Data Feed. By adding publishing priority your data @@ -437,12 +437,12 @@ linkElem.setAttribute("rel", "alternate"); linkElem.setAttribute("type", "text/html"); linkElem.setAttribute("href", link); - + // item_type is the categories in which your product should belong. UtilXml.addChildElementNSValue(entryElem, "g:item_type", "products", feedDocument, googleBaseNSUrl); - + List<GenericValue> productCategoryMembers = delegator.findList("ProductCategoryMember", EntityCondition.makeCondition("productId", EntityOperator.EQUALS, prod.getString("productId")), null, UtilMisc.toList("productCategoryId"), null, false); - + Iterator<GenericValue> productCategoryMembersIter = productCategoryMembers.iterator(); while (productCategoryMembersIter.hasNext()) { GenericValue productCategoryMember = (GenericValue) productCategoryMembersIter.next(); @@ -451,7 +451,7 @@ if (UtilValidate.isNotEmpty(productCategoryTypeId) && "GOOGLE_BASE_CATEGORY".equals(productCategoryTypeId)) { String categoryDescription = ""; if (UtilValidate.isNotEmpty(productCategory.getString("categoryName"))) { - categoryDescription = productCategory.getString("categoryName"); + categoryDescription = productCategory.getString("categoryName"); } else if (UtilValidate.isNotEmpty(productCategory.getString("description"))) { categoryDescription = productCategory.getString("description"); } else if (UtilValidate.isNotEmpty(productCategory.getString("longDescription"))) { @@ -462,7 +462,7 @@ } } } - + UtilXml.addChildElementNSValue(entryElem, "g:price", price, feedDocument, googleBaseNSUrl); // Might be nicer to load this from the product but for now we'll set it based on the country destination @@ -470,7 +470,7 @@ // Ensure the load goes to the correct country location either US dollar, GB sterling or DE euro UtilXml.addChildElementNSValue(entryElem, "g:target_country", countryCode, feedDocument, googleBaseNSUrl); - if (UtilValidate.isNotEmpty(prod.getString("brandName"))) { + if (UtilValidate.isNotEmpty(prod.getString("brandName"))) { UtilXml.addChildElementNSValue(entryElem, "g:brand", prod.getString("brandName"), feedDocument, googleBaseNSUrl); } try { @@ -591,11 +591,11 @@ } return ServiceUtil.returnSuccess(); } - + private static Map<String, Object> buildGoogleBaseConfig(Map<String, Object> context, Delegator delegator) { String productStoreId = (String) context.get("productStoreId"); Map<String, Object> buildGoogleBaseConfigContext = FastMap.newInstance(); - + if (UtilValidate.isNotEmpty(productStoreId)) { GenericValue googleBaseConfig = null; try { @@ -619,5 +619,5 @@ buildGoogleBaseConfigContext.put("postItemsUrl", UtilProperties.getPropertyValue(configString, "googleBaseExport.postItemsUrl")); } return buildGoogleBaseConfigContext; - } + } } \ No newline at end of file Modified: ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java?rev=899812&r1=899811&r2=899812&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java (original) +++ ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java Fri Jan 15 21:00:23 2010 @@ -63,8 +63,8 @@ public class GoogleCheckoutHelper { - private static final String module = GoogleCheckoutHelper.class.getName(); - + private static final String module = GoogleCheckoutHelper.class.getName(); + public static final String SALES_CHANNEL = "GC_SALES_CHANNEL"; public static final String ORDER_TYPE = "SALES_ORDER"; public static final String PAYMENT_METHOD = "EXT_GOOGLE_CHECKOUT"; @@ -79,7 +79,7 @@ public GoogleCheckoutHelper(LocalDispatcher dispatcher, Delegator delegator) { this.dispatcher = dispatcher; this.delegator = delegator; - + try { system = delegator.findOne("UserLogin", true, "userLoginId", "system"); } catch (GenericEntityException e) { @@ -100,10 +100,10 @@ } catch (GenericEntityException e) { Debug.logError(e, module); } - + if (order != null) { String orderId = order.getString("orderId"); - + // check for a financial state change FinancialOrderState oldFin = info.getPreviousFinancialOrderState(); FinancialOrderState newFin = info.getNewFinancialOrderState(); @@ -115,7 +115,7 @@ OrderChangeHelper.cancelOrder(dispatcher, system, orderId); } } else if (newFin.equals(FinancialOrderState.CHARGEABLE) && oldFin.equals(FinancialOrderState.REVIEWING)) { - // approve the order + // approve the order if (!"ORDER_APPROVED".equals(order.getString("statusId"))) { OrderChangeHelper.approveOrder(dispatcher, system, orderId, hasHoldOrderNotes(orderId)); } @@ -127,15 +127,15 @@ } // TODO: look at how to implement the other state changes // CHARGED, CHARGING - } - } + } + } } - + public void processRiskNotification(RiskInformationNotification info) throws GeneralException { // TODO implement me (if desired) return; // the notification will be accepted } - + public void processAuthNotification(AuthorizationAmountNotification info) throws GeneralException { String externalId = info.getGoogleOrderNumber(); List<GenericValue> orders = null; @@ -229,7 +229,7 @@ // TODO: implement me (if desired) return; // the notification will be accepted } - + @SuppressWarnings("unchecked") public void createOrder(NewOrderNotification info, String productStoreId, Locale locale) throws GeneralException { // get the google order number @@ -248,18 +248,18 @@ if (googleCfg == null) { throw new GeneralException("No google configuration found for product store : " + productStoreId); } - + String websiteId = googleCfg.getString("webSiteId"); String currencyUom = googleCfg.getString("currencyUomId"); String prodCatalogId = googleCfg.getString("prodCatalogId"); - boolean errorOnUnknownItem = googleCfg.get("errorOnBadItem") != null && + boolean errorOnUnknownItem = googleCfg.get("errorOnBadItem") != null && "Y".equalsIgnoreCase(googleCfg.getString("errorOnBadItem")) ? true : false; - + // Initialize the shopping cart - ShoppingCart cart = new ShoppingCart(delegator, productStoreId, websiteId, locale, currencyUom); + ShoppingCart cart = new ShoppingCart(delegator, productStoreId, websiteId, locale, currencyUom); cart.setUserLogin(system, dispatcher); cart.setOrderType(ORDER_TYPE); - cart.setChannelType(SALES_CHANNEL); + cart.setChannelType(SALES_CHANNEL); //cart.setOrderDate(UtilDateTime.toTimestamp(info.getTimestamp().())); cart.setExternalId(externalId); @@ -304,9 +304,9 @@ for (Item item : items) { try { addItem(cart, item, prodCatalogId, 0); - } catch (ItemNotFoundException e) { + } catch (ItemNotFoundException e) { Debug.logWarning(e, "Item was not found : " + item.getMerchantItemId(), module); - // throwing this exception tell google the order failed; it will continue to retry + // throwing this exception tell google the order failed; it will continue to retry if (errorOnUnknownItem) { throw new GeneralException("Invalid item requested from Google Checkout - " + item.getMerchantItemId()); } @@ -321,7 +321,7 @@ Shipping shipping = info.getOrderAdjustment().getShipping(); addShipInfo(cart, shipping, partyInfo[1]); } - + // set the cart payment method cart.addPaymentAmount(PAYMENT_METHOD, new BigDecimal(info.getOrderTotal())); @@ -338,13 +338,13 @@ if (ServiceUtil.isError(createResp)) { throw new GeneralException(ServiceUtil.getErrorMessage(createResp)); } - + // notify google of our order number try { dispatcher.runAsync("sendGoogleOrderNumberRequest", UtilMisc.toMap("orderId", orderId), true); } catch (GeneralException e) { Debug.logError(e, module); - } + } } protected void addItem(ShoppingCart cart, Item item, String prodCatalogId, int groupIdx) throws GeneralException { @@ -352,7 +352,7 @@ BigDecimal qty = new BigDecimal(item.getQuantity()); BigDecimal price = new BigDecimal(item.getUnitPriceAmount()); price = price.setScale(ShoppingCart.scale, ShoppingCart.rounding); - + HashMap<Object, Object> attrs = new HashMap<Object, Object>(); attrs.put("shipGroup", groupIdx); @@ -375,7 +375,7 @@ // assign the item to its ship group cart.setItemShipGroupQty(cartItem, qty, groupIdx); } - + @SuppressWarnings("unchecked") protected void addAdjustments(ShoppingCart cart, OrderAdjustment adjustment) { // handle shipping @@ -400,16 +400,16 @@ promoAdj.set("orderAdjustmentTypeId", "PROMOTION_ADJUSTMENT"); promoAdj.set("description", "Promotion Code: " + codes.getCode()); promoAdj.set("comments", "Google Promotion: " + codes.getMessage()); - promoAdj.set("amount", new BigDecimal(-1 * (codes.getAppliedAmount()))); // multiply by -1 + promoAdj.set("amount", new BigDecimal(-1 * (codes.getAppliedAmount()))); // multiply by -1 cart.addAdjustment(promoAdj); } } - protected void addShipInfo(ShoppingCart cart, Shipping shipping, String shipContactMechId) { - String shippingName = shipping.getShippingName(); - GenericValue googleShipping = null; + protected void addShipInfo(ShoppingCart cart, Shipping shipping, String shipContactMechId) { + String shippingName = shipping.getShippingName(); + GenericValue googleShipping = null; try { - googleShipping = delegator.findOne("GoogleCoShippingMethod", UtilMisc.toMap("shipmentMethodName", shippingName, + googleShipping = delegator.findOne("GoogleCoShippingMethod", UtilMisc.toMap("shipmentMethodName", shippingName, "productStoreId", cart.getProductStoreId()), false); } catch (GenericEntityException e) { Debug.logError(e, module); @@ -417,8 +417,8 @@ if (googleShipping != null) { String shipmentMethodTypeId = googleShipping.getString("shipmentMethodTypeId"); String carrierPartyId = googleShipping.getString("carrierPartyId"); - Boolean maySplit = Boolean.FALSE; - + Boolean maySplit = Boolean.FALSE; + cart.setShipmentMethodTypeId(shipmentMethodTypeId); cart.setCarrierPartyId(carrierPartyId); cart.setMaySplit(maySplit); @@ -432,26 +432,26 @@ String shipCmId = null; String billCmId = null; String partyId = null; - + // look for an existing shipping address - List<GenericValue> shipInfo = PartyWorker.findMatchingPartyAndPostalAddress(delegator, shipAddr.getAddress1(), - (UtilValidate.isEmpty(shipAddr.getAddress2()) ? null : shipAddr.getAddress2()), shipAddr.getCity(), shipAddr.getRegion(), - shipAddr.getPostalCode(), null, getCountryGeoId(shipAddr.getCountryCode()), shipAddr.getStructuredName().getFirstName(), + List<GenericValue> shipInfo = PartyWorker.findMatchingPartyAndPostalAddress(delegator, shipAddr.getAddress1(), + (UtilValidate.isEmpty(shipAddr.getAddress2()) ? null : shipAddr.getAddress2()), shipAddr.getCity(), shipAddr.getRegion(), + shipAddr.getPostalCode(), null, getCountryGeoId(shipAddr.getCountryCode()), shipAddr.getStructuredName().getFirstName(), null, shipAddr.getStructuredName().getLastName()); - + if (UtilValidate.isNotEmpty(shipInfo)) { GenericValue first = EntityUtil.getFirst(shipInfo); shipCmId = first.getString("contactMechId"); partyId = first.getString("partyId"); Debug.logInfo("Existing shipping address found : " + shipCmId + " (party: " + partyId + ")", module); } - + // look for an existing billing address - List<GenericValue> billInfo = PartyWorker.findMatchingPartyAndPostalAddress(delegator, billAddr.getAddress1(), - (UtilValidate.isEmpty(billAddr.getAddress2()) ? null : billAddr.getAddress2()), billAddr.getCity(), billAddr.getRegion(), - billAddr.getPostalCode(), null, getCountryGeoId(billAddr.getCountryCode()), billAddr.getStructuredName().getFirstName(), + List<GenericValue> billInfo = PartyWorker.findMatchingPartyAndPostalAddress(delegator, billAddr.getAddress1(), + (UtilValidate.isEmpty(billAddr.getAddress2()) ? null : billAddr.getAddress2()), billAddr.getCity(), billAddr.getRegion(), + billAddr.getPostalCode(), null, getCountryGeoId(billAddr.getCountryCode()), billAddr.getStructuredName().getFirstName(), null, billAddr.getStructuredName().getLastName()); - + if (UtilValidate.isNotEmpty(billInfo)) { GenericValue first = EntityUtil.getFirst(billInfo); billCmId = first.getString("contactMechId"); @@ -481,11 +481,11 @@ // create the billing address if necessary if (billCmId == null) { // check the billing address again (in case it was just created) - billInfo = PartyWorker.findMatchingPartyAndPostalAddress(delegator, billAddr.getAddress1(), - billAddr.getAddress2(), billAddr.getCity(), billAddr.getRegion(), - billAddr.getPostalCode(), null, getCountryGeoId(billAddr.getCountryCode()), billAddr.getStructuredName().getFirstName(), + billInfo = PartyWorker.findMatchingPartyAndPostalAddress(delegator, billAddr.getAddress1(), + billAddr.getAddress2(), billAddr.getCity(), billAddr.getRegion(), + billAddr.getPostalCode(), null, getCountryGeoId(billAddr.getCountryCode()), billAddr.getStructuredName().getFirstName(), null, billAddr.getStructuredName().getLastName()); - + if (UtilValidate.isNotEmpty(billInfo)) { GenericValue first = EntityUtil.getFirst(billInfo); billCmId = first.getString("contactMechId"); @@ -509,11 +509,11 @@ throw new GeneralException("Unable to create new customer account: " + ServiceUtil.getErrorMessage(personResp)); } String partyId = (String) personResp.get("partyId"); - + Debug.logInfo("New party created : " + partyId, module); return partyId; } - + protected String createPartyAddress(String partyId, Address addr) throws GeneralException { // check for zip+4 String postalCode = addr.getPostalCode(); @@ -538,7 +538,7 @@ addrMap.put("allowSolicitation", "Y"); addrMap.put("contactMechPurposeTypeId", "GENERAL_LOCATION"); addrMap.put("userLogin", system); // run as the system user - + // invoke the create address service Map<String, Object> addrResp = dispatcher.runSync("createPartyPostalAddress", addrMap); if (ServiceUtil.isError(addrResp)) { @@ -546,33 +546,33 @@ ServiceUtil.getErrorMessage(addrResp)); } String contactMechId = (String) addrResp.get("contactMechId"); - + Debug.logInfo("Created new address for partyId [" + partyId + "] :" + contactMechId, module); return contactMechId; } - + protected void addPurposeToAddress(String partyId, String contactMechId, int addrType) throws GeneralException { // convert the int to a purpose type ID String contactMechPurposeTypeId = getAddressType(addrType); - + // check to make sure the purpose doesn't already exist - List<GenericValue> values = delegator.findByAnd("PartyContactMechPurpose", UtilMisc.toMap("partyId", partyId, + List<GenericValue> values = delegator.findByAnd("PartyContactMechPurpose", UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId)); - + if (UtilValidate.isEmpty(values)) { Map<String, Object> addPurposeMap = FastMap.newInstance(); addPurposeMap.put("contactMechId", contactMechId); - addPurposeMap.put("partyId", partyId); + addPurposeMap.put("partyId", partyId); addPurposeMap.put("contactMechPurposeTypeId", contactMechPurposeTypeId); addPurposeMap.put("userLogin", system); - + Map<String, Object> addPurposeResp = dispatcher.runSync("createPartyContactMechPurpose", addPurposeMap); if (addPurposeResp != null && ServiceUtil.isError(addPurposeResp)) { throw new GeneralException(ServiceUtil.getErrorMessage(addPurposeResp)); } } } - + protected String getAddressType(int addrType) { String contactMechPurposeTypeId = "GENERAL_LOCATION"; switch (addrType) { @@ -585,7 +585,7 @@ } return contactMechPurposeTypeId; } - + protected void setContactInfo(ShoppingCart cart, String contactMechPurposeTypeId, String infoString) throws GeneralException { Map<String, Object> lookupMap = FastMap.newInstance(); String cmId = null; @@ -650,7 +650,7 @@ cart.addContactMech(contactMechPurposeTypeId, cmId); } } - + protected String getCountryGeoId(String geoCode) { if (geoCode != null && geoCode.length() == 3) { return geoCode; @@ -667,12 +667,12 @@ return "_NA_"; } } - + protected boolean hasHoldOrderNotes(String orderId) { EntityCondition idCond = EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId); EntityCondition content = EntityCondition.makeCondition("noteInfo", EntityOperator.LIKE, "%Order is held%"); EntityCondition mainCond = EntityCondition.makeCondition(UtilMisc.toList(idCond, content), EntityOperator.AND); - List<GenericValue> holdOrderNotes = null; + List<GenericValue> holdOrderNotes = null; try { holdOrderNotes = delegator.findList("OrderHeaderNoteView", mainCond, null, null, null, false); } catch (GenericEntityException e) { Modified: ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutResponseEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutResponseEvents.java?rev=899812&r1=899811&r2=899812&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutResponseEvents.java (original) +++ ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutResponseEvents.java Fri Jan 15 21:00:23 2010 @@ -47,13 +47,13 @@ public static String checkNotification(HttpServletRequest request, HttpServletResponse response) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); Delegator delegator = (Delegator) request.getAttribute("delegator"); - + GoogleCheckoutHelper helper = new GoogleCheckoutHelper(dispatcher, delegator); - + // check and parse the document Document document = null; try { - document = Utils.newDocumentFromInputStream(request.getInputStream()); + document = Utils.newDocumentFromInputStream(request.getInputStream()); } catch (CheckoutException e) { Debug.logError(e, module); sendResponse(response, null, e); @@ -61,13 +61,13 @@ Debug.logError(e, module); sendResponse(response, null, e); } - - // check the document type and process + + // check the document type and process if (document != null) { String nodeValue = document.getDocumentElement().getNodeName(); if ("new-order-notification".equals(nodeValue)) { // handle create new order - NewOrderNotification info = new NewOrderNotification(document); + NewOrderNotification info = new NewOrderNotification(document); String serialNumber = info.getSerialNumber(); try { helper.createOrder(info, ProductStoreWorker.getProductStoreId(request), ProductStoreWorker.getStoreLocale(request)); @@ -93,7 +93,7 @@ String serialNumber = info.getSerialNumber(); try { helper.processRiskNotification(info); - sendResponse(response, serialNumber, null); + sendResponse(response, serialNumber, null); } catch (GeneralException e) { Debug.logError(e, module); sendResponse(response, serialNumber, e); @@ -104,53 +104,53 @@ String serialNumber = info.getSerialNumber(); try { helper.processAuthNotification(info); - sendResponse(response, serialNumber, null); + sendResponse(response, serialNumber, null); } catch (GeneralException e) { Debug.logError(e, module); sendResponse(response, serialNumber, e); return null; - } + } } else if ("charge-amount-notification".equals(nodeValue)) { ChargeAmountNotification info = new ChargeAmountNotification(document); String serialNumber = info.getSerialNumber(); try { helper.processChargeNotification(info); - sendResponse(response, serialNumber, null); + sendResponse(response, serialNumber, null); } catch (GeneralException e) { Debug.logError(e, module); sendResponse(response, serialNumber, e); return null; - } + } } else if ("chargeback-amount-notification".equals(nodeValue)) { ChargebackAmountNotification info = new ChargebackAmountNotification(document); String serialNumber = info.getSerialNumber(); try { helper.processChargeBackNotification(info); - sendResponse(response, serialNumber, null); + sendResponse(response, serialNumber, null); } catch (GeneralException e) { Debug.logError(e, module); sendResponse(response, serialNumber, e); return null; - } + } } else if ("refund-amount-notification".equals(nodeValue)) { RefundAmountNotification info = new RefundAmountNotification(document); String serialNumber = info.getSerialNumber(); try { helper.processRefundNotification(info); - sendResponse(response, serialNumber, null); + sendResponse(response, serialNumber, null); } catch (GeneralException e) { Debug.logError(e, module); sendResponse(response, serialNumber, e); return null; - } + } } else { Debug.logWarning("Unsupported document type submitted by Google; [" + nodeValue + "] has not yet been implemented.", module); } } - + return null; } - + private static void sendResponse(HttpServletResponse response, String serialNumber, Exception error) { if (error != null) { try { @@ -170,5 +170,5 @@ out.close(); } } - } + } } Modified: ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java?rev=899812&r1=899811&r2=899812&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java (original) +++ ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java Fri Jan 15 21:00:23 2010 @@ -61,13 +61,13 @@ import com.google.checkout.orderprocessing.lineitem.ShipItemsRequest; public class GoogleRequestServices { - + private static final String module = GoogleRequestServices.class.getName(); private static int decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); private static int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding"); - + @SuppressWarnings("unchecked") - public static Map<String, Object> sendShoppingCartRequest(DispatchContext dctx, Map<String, ? extends Object> context) { + public static Map<String, Object> sendShoppingCartRequest(DispatchContext dctx, Map<String, ? extends Object> context) { ShoppingCart cart = (ShoppingCart) context.get("shoppingCart"); String productStoreId = cart.getProductStoreId(); Delegator delegator = dctx.getDelegator(); @@ -77,7 +77,7 @@ Debug.logError("Invalid Google Chechout Merchant settings, check your configuration!", module); return ServiceUtil.returnError("Google checkout configuration error"); } - + // the checkout request object CheckoutShoppingCartRequest req = new CheckoutShoppingCartRequest(mInfo, 300); String requestAuthStr = googleCfg.getString("requestAuthDetails"); @@ -86,46 +86,46 @@ } boolean requestAuth = "Y".equalsIgnoreCase(requestAuthStr) ? true : false; req.setRequestInitialAuthDetails(requestAuth); // send the auth notification - + String sendPromoItemStr = googleCfg.getString("sendPromoItems"); if (sendPromoItemStr == null) { sendPromoItemStr = "Y"; } boolean sendPromoItems = "Y".equalsIgnoreCase(sendPromoItemStr) ? true : false; - + // add the items List<ShoppingCartItem> items = cart.items(); - for (ShoppingCartItem item : items) { + for (ShoppingCartItem item : items) { if (!item.getIsPromo() || sendPromoItems) { - Item i = new Item(); + Item i = new Item(); i.setItemName(item.getName()); i.setItemDescription(item.getDescription()); i.setMerchantItemId(item.getProductId()); i.setQuantity(item.getQuantity().intValue()); i.setUnitPriceAmount(item.getBasePrice().floatValue()); - i.setUnitPriceCurrency(cart.getCurrency()); - //i.setItemWeight(item.getWeight().floatValue()); // must convert weight to Lb + i.setUnitPriceCurrency(cart.getCurrency()); + //i.setItemWeight(item.getWeight().floatValue()); // must convert weight to Lb if (!item.taxApplies()) { i.setTaxTableSelector("tax_exempt"); } req.addItem(i); } } - + // flow support URLs String contShoppingUrl = UtilProperties.getPropertyValue("googleCheckout.properties", "continueShoppingUrl"); String editCartUrl = UtilProperties.getPropertyValue("googleCheckout.properties", "editCartUrl"); req.setContinueShoppingUrl(contShoppingUrl); req.setEditCartUrl(editCartUrl); - + // setup exempt tax support TaxArea exemptArea = new TaxArea(); exemptArea.addWorldArea(); req.addAlternateTaxRule("tax_exempt", true, 0, exemptArea); - + // setup default tax table // TODO: implement this; for now use the tax table in Google Checkout Settings - + // setup shipping options support List<GenericValue> shippingOptions = null; try { @@ -142,13 +142,13 @@ } if ("GOOGLE_FLAT_RATE".equals(option.getString("methodTypeEnumId"))) { req.addFlatRateShippingMethod(shippingName, amount.floatValue()); - } else if ("GOOGLE_MERCHANT_CALC".equals(option.getString("methodTypeEnumId"))) { + } else if ("GOOGLE_MERCHANT_CALC".equals(option.getString("methodTypeEnumId"))) { req.addMerchantCalculatedShippingMethod(shippingName, amount.floatValue()); } else if ("GOOGLE_PICKUP".equals(option.getString("methodTypeEnumId"))) { - req.addPickupShippingMethod(shippingName, amount.floatValue()); + req.addPickupShippingMethod(shippingName, amount.floatValue()); } else if ("GOOGLE_CARRIER_CALC".equals(option.getString("methodTypeEnumId"))) { String carrierPartyId = option.getString("carrierPartyId"); - + Double additionalAmount = option.getDouble("additionalAmount"); Double additionalPercent = option.getDouble("additionalPercent"); if (additionalAmount == null) { @@ -157,12 +157,12 @@ if (additionalPercent == null) { additionalPercent = 0.0; } - + String shippingCompany = null; if ("ups".equalsIgnoreCase(carrierPartyId)) { shippingCompany = "UPS"; } else if ("fedex".equalsIgnoreCase(carrierPartyId)) { - shippingCompany = "FedEx"; + shippingCompany = "FedEx"; } else if ("usps".equalsIgnoreCase(carrierPartyId)) { shippingCompany = "USPS"; } @@ -170,38 +170,38 @@ return ServiceUtil.returnError("Invalid Google Checkout Shipping Configuration! Carriers can only be UPS, FedEx or USPS."); } req.addCarrierCalculatedShippingOption(amount.floatValue(), shippingCompany, CarrierPickup.REGULAR_PICKUP, - shippingName, additionalAmount.floatValue(), additionalPercent.floatValue()); + shippingName, additionalAmount.floatValue(), additionalPercent.floatValue()); } } } - + // merchant stuff String acceptCouponStr = googleCfg.getString("acceptCoupons"); if (acceptCouponStr == null) { acceptCouponStr = "N"; } boolean acceptCoupons = "Y".equalsIgnoreCase(acceptCouponStr) ? true : false; - + String acceptCertStr = googleCfg.getString("acceptGiftCerts"); if (acceptCertStr == null) { acceptCertStr = "N"; } boolean acceptGiftCerts = "Y".equalsIgnoreCase(acceptCertStr) ? true : false; - + if (acceptCoupons || acceptGiftCerts) { - req.setAcceptMerchantCoupons(acceptCoupons); + req.setAcceptMerchantCoupons(acceptCoupons); req.setAcceptMerchantGiftCertificates(acceptGiftCerts); - + // TODO: merchant calc support needs to be implemented if these are ever TRUE } - + String requestPhoneStr = googleCfg.getString("requestPhone"); if (requestPhoneStr == null) { requestPhoneStr = "Y"; } - boolean requestPhone = "Y".equalsIgnoreCase(requestPhoneStr) ? true : false; + boolean requestPhone = "Y".equalsIgnoreCase(requestPhoneStr) ? true : false; req.setRequestBuyerPhoneNumber(requestPhone); - + // send the request CheckoutResponse resp = null; try { @@ -218,12 +218,12 @@ Debug.logError("Error returned from Google: " + resp.getErrorMessage(), module); return ServiceUtil.returnError(resp.getErrorMessage()); } - + Map<String, Object> result = ServiceUtil.returnSuccess(); result.put("redirect", resp.getRedirectUrl()); return result; } - + public static Map<String, Object> sendOrderNumberRequest(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String orderId = (String) context.get("orderId"); @@ -231,19 +231,19 @@ if (order != null) { MerchantInfo mInfo = getMerchantInfo(delegator, getProductStoreFromOrder(order)); if (mInfo != null) { - String externalId = order.getString("externalId"); + String externalId = order.getString("externalId"); AddMerchantOrderNumberRequest aor = new AddMerchantOrderNumberRequest(mInfo, externalId, orderId); try { aor.send(); } catch (CheckoutException e) { Debug.logError(e, module); - } + } } } - + return ServiceUtil.returnSuccess(); } - + public static Map<String, Object> sendAuthorizeRequest(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String orderId = (String) context.get("orderId"); @@ -257,13 +257,13 @@ aor.send(); } catch (CheckoutException e) { Debug.logError(e, module); - } + } } } - + return ServiceUtil.returnSuccess(); } - + // trigger on captureOrderPayments public static Map<String, Object> sendChargeRequest(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); @@ -287,14 +287,14 @@ } } } - + return ServiceUtil.returnSuccess(); } - + public static Map<String, Object> sendReturnRequest(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); - String returnId = (String) context.get("returnId"); - + String returnId = (String) context.get("returnId"); + // sort by order Map<String, BigDecimal> toRefund = FastMap.newInstance(); Map<String, List<String>> toReturn = FastMap.newInstance(); @@ -306,7 +306,7 @@ } catch (GenericEntityException e) { Debug.logError(e, module); } - + // go through the items and sort them by order if (UtilValidate.isNotEmpty(returnItems)) { for (GenericValue returnItem : returnItems) { @@ -345,7 +345,7 @@ } } } - + // create the return items request for (String returnOrderId : toReturn.keySet()) { GenericValue gOrder = findGoogleOrder(delegator, returnOrderId); @@ -366,7 +366,7 @@ } } } - + // create the refund request for (String refundOrderId : toRefund.keySet()) { GenericValue gOrder = findGoogleOrder(delegator, refundOrderId); @@ -378,7 +378,7 @@ String reason = "Item(s) Returned"; if (amount.floatValue() > 0) { try { - RefundOrderRequest ror = new RefundOrderRequest(mInfo, externalId, reason, amount.floatValue(), ""); + RefundOrderRequest ror = new RefundOrderRequest(mInfo, externalId, reason, amount.floatValue(), ""); ror.send(); } catch (CheckoutException e) { Debug.logError(e, module); @@ -390,22 +390,22 @@ } } } - + return ServiceUtil.returnSuccess(); } - + public static Map<String, Object> sendShipRequest(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); - String shipmentId = (String) context.get("shipmentId"); + String shipmentId = (String) context.get("shipmentId"); try { sendItemsShipped(delegator, shipmentId); } catch (GeneralException e) { Debug.logError(e, module); } - + return ServiceUtil.returnSuccess(); } - + public static Map<String, Object> sendOrderCancelRequest(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String orderId = (String) context.get("orderId"); @@ -413,19 +413,19 @@ if (order != null) { MerchantInfo mInfo = getMerchantInfo(delegator, getProductStoreFromOrder(order)); if (mInfo != null) { - String externalId = order.getString("externalId"); + String externalId = order.getString("externalId"); CancelOrderRequest cor = new CancelOrderRequest(mInfo, externalId, "Order Cancelled", ""); // TODO: configure the reason and comment try { cor.send(); } catch (CheckoutException e) { Debug.logError(e, module); - } + } } } - + return ServiceUtil.returnSuccess(); } - + public static Map<String, Object> sendOrderItemCancelRequest(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String orderId = (String) context.get("orderId"); @@ -438,25 +438,25 @@ } catch (GenericEntityException e) { Debug.logError(e, module); } - + if (orderItem != null) { MerchantInfo mInfo = getMerchantInfo(delegator, getProductStoreFromOrder(order)); if (mInfo != null) { - String externalId = order.getString("externalId"); + String externalId = order.getString("externalId"); CancelItemsRequest cir = new CancelItemsRequest(mInfo, externalId, "Item Cancelled", ""); // TODO: configure the reason and comment cir.addItem(orderItem.getString("productId")); try { cir.send(); } catch (CheckoutException e) { Debug.logError(e, module); - } + } } } } - + return ServiceUtil.returnSuccess(); } - + public static Map<String, Object> sendArchiveOrderRequest(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String orderId = (String) context.get("orderId"); @@ -464,7 +464,7 @@ if (order != null) { MerchantInfo mInfo = getMerchantInfo(delegator, getProductStoreFromOrder(order)); if (mInfo != null) { - String externalId = order.getString("externalId"); + String externalId = order.getString("externalId"); ArchiveOrderRequest aor = new ArchiveOrderRequest(mInfo, externalId); try { aor.send(); @@ -473,10 +473,10 @@ } } } - + return ServiceUtil.returnSuccess(); } - + public static Map<String, Object> sendUnarchiveOrderRequest(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String orderId = (String) context.get("orderId"); @@ -493,10 +493,10 @@ } } } - + return ServiceUtil.returnSuccess(); } - + // special service to tigger off of events which prevent editing orders public static Map<String, Object> catchEditGoogleOrder(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); @@ -506,8 +506,8 @@ Debug.log("Returning FAILURE; this IS an Google Checkout order and cannot be modified as requested!", module); return ServiceUtil.returnFailure("Google Checkout orders cannot be modified. You may cancel orders/items only!"); } - return ServiceUtil.returnSuccess(); - } + return ServiceUtil.returnSuccess(); + } private static void sendItemsShipped(Delegator delegator, String shipmentId) throws GeneralException { List<GenericValue> issued = delegator.findByAnd("ItemIssuance", UtilMisc.toMap("shipmentId", shipmentId)); @@ -517,7 +517,7 @@ ShipItemsRequest isr = null; for (GenericValue issue : issued) { GenericValue orderItem = issue.getRelatedOne("OrderItem"); - String shipmentItemSeqId = issue.getString("shipmentItemSeqId"); + String shipmentItemSeqId = issue.getString("shipmentItemSeqId"); String productId = orderItem.getString("productId"); String orderId = issue.getString("orderId"); googleOrder = findGoogleOrder(delegator, orderId); @@ -545,7 +545,7 @@ List<GenericValue> srs = packageRoute.getRelated("ShipmentRouteSegment"); GenericValue route = EntityUtil.getFirst(srs); String track = packageRoute.getString("trackingCode"); - if (UtilValidate.isNotEmpty(route)) { + if (UtilValidate.isNotEmpty(route)) { carrier = route.getString("carrierPartyId"); if (UtilValidate.isEmpty(track)) { track = route.getString("trackingIdNumber"); @@ -586,10 +586,10 @@ return order; } } - + return null; } - + public static String getProductStoreFromShipment(Delegator delegator, String shipmentId) { GenericValue shipment = null; try { @@ -603,14 +603,14 @@ } return null; } - + public static String getProductStoreFromOrder(GenericValue order) { if (order != null) { return order.getString("productStoreId"); } return null; } - + public static GenericValue getGoogleConfiguration(Delegator delegator, String productStoreId) { if (productStoreId == null) return null; GenericValue config = null; @@ -621,7 +621,7 @@ } return config; } - + public static MerchantInfo getMerchantInfo(Delegator delegator, String productStoreId) { // google configuration GenericValue config = getGoogleConfiguration(delegator, productStoreId); @@ -629,24 +629,24 @@ Debug.logError("No google configuration found for product store ID : " + productStoreId, module); return null; } - + // merchant information String merchantId = config.getString("merchantId"); String merchantKey = config.getString("merchantKey"); String envEnumId = config.getString("envEnumId"); String currencyCode = config.getString("currencyUomId"); - + if (UtilValidate.isEmpty(merchantId) || UtilValidate.isEmpty(merchantKey)) { return null; } - + // base URLs String productionRoot = UtilProperties.getPropertyValue("google-checkout.properties", "production.root.url"); String sandboxRoot = UtilProperties.getPropertyValue("google-checkout.properties", "sandbox.root.url"); - + // command strings String merchantCheckoutCommand = UtilProperties.getPropertyValue("google-checkout.properties", "merchant.checkout.command", "merchantCheckout"); - String checkoutCommand = UtilProperties.getPropertyValue("google-checkout.properties", "checkout.command", "checkout"); + String checkoutCommand = UtilProperties.getPropertyValue("google-checkout.properties", "checkout.command", "checkout"); String requestCommand = UtilProperties.getPropertyValue("google-checkout.properties", "request.command", "request"); String environment = null; @@ -657,18 +657,18 @@ // build the URLs based on the Environment type if ("GOOGLE_SANDBOX".equals(envEnumId)) { merchantCheckoutUrl = sandboxRoot + "/" + merchantCheckoutCommand + "/Merchant/" + merchantId; - checkoutUrl = sandboxRoot + "/" + checkoutCommand + "/Merchant/" + merchantId; + checkoutUrl = sandboxRoot + "/" + checkoutCommand + "/Merchant/" + merchantId; requestUrl = sandboxRoot + "/" + requestCommand + "/Merchant/" + merchantId; environment = EnvironmentType.Sandbox; } else if ("GOOGLE_PRODUCTION".equals(envEnumId)) { merchantCheckoutUrl = productionRoot + "/" + merchantCheckoutCommand + "/Merchant/" + merchantId; - checkoutUrl = productionRoot + "/" + checkoutCommand + "/Merchant/" + merchantId; + checkoutUrl = productionRoot + "/" + checkoutCommand + "/Merchant/" + merchantId; requestUrl = productionRoot + "/" + requestCommand + "/Merchant/" + merchantId; environment = EnvironmentType.Production; } else { Debug.logError("Environment must be one of " + EnvironmentType.Sandbox + " or " + EnvironmentType.Production + ".", module); return null; } - return new MerchantInfo(merchantId, merchantKey, environment, currencyCode, checkoutUrl, merchantCheckoutUrl, requestUrl); - } + return new MerchantInfo(merchantId, merchantKey, environment, currencyCode, checkoutUrl, merchantCheckoutUrl, requestUrl); + } } Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java?rev=899812&r1=899811&r2=899812&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Fri Jan 15 21:00:23 2010 @@ -129,8 +129,8 @@ this.productStoreId = (String) session.getAttribute("productStoreId"); this.facilityId = (String) session.getAttribute("facilityId"); this.currency = (String) session.getAttribute("currency"); -// this.locale = (Locale) session.getAttribute("locale"); This is legacy code and may come (demo) from ProductStore.defaultLocaleString defined in demoRetail and is incompatible with how localisation is handled in the POS - this.locale = Locale.getDefault(); +// this.locale = (Locale) session.getAttribute("locale"); This is legacy code and may come (demo) from ProductStore.defaultLocaleString defined in demoRetail and is incompatible with how localisation is handled in the POS + this.locale = Locale.getDefault(); this.cart = new ShoppingCart(session.getDelegator(), productStoreId, locale, currency); this.ch = new CheckOutHelper(session.getDispatcher(), session.getDelegator(), cart); @@ -168,11 +168,11 @@ public String getUserId() { return session.getUserId(); } - + public String getPartyId() { return partyId; } - + public void setPartyId(String partyId) { this.partyId = partyId; this.cart.setPlacingCustomerPartyId(partyId); @@ -182,7 +182,7 @@ Debug.logError(e, module); } } - + public int getDrawerNumber() { return drawerIdx + 1; } @@ -403,8 +403,8 @@ payInfo.put("cardNumber", cardStr); // masked cardNumber } else if ("GIFT_CARD".equals(paymentMethodTypeId)) { - @SuppressWarnings("unused") - GenericValue gc = null; + @SuppressWarnings("unused") + GenericValue gc = null; try { gc = infValue.getRelatedOne("GiftCard"); //FIXME is this really useful ? (Maybe later...) } catch (GenericEntityException e) { @@ -997,7 +997,7 @@ BigDecimal total = cart.getGrandTotal(); List<GenericValue> adjustments = cart.getAdjustments(); BigDecimal itemsAdjustmentsAmount = BigDecimal.ZERO; - + Iterator<?> i = cart.iterator(); while (i.hasNext()) { ShoppingCartItem item = (ShoppingCartItem) i.next(); @@ -1552,19 +1552,19 @@ if (UtilValidate.isNotEmpty(email)) { // ContactMech (email) - dynamicView.addMemberEntity("PM", "PartyContactMechPurpose"); + dynamicView.addMemberEntity("PM", "PartyContactMechPurpose"); dynamicView.addAlias("PM", "contactMechId"); - dynamicView.addAlias("PM", "contactMechPurposeTypeId"); + dynamicView.addAlias("PM", "contactMechPurposeTypeId"); dynamicView.addAlias("PM", "thruDate"); dynamicView.addMemberEntity("CM", "ContactMech"); - dynamicView.addAlias("CM", "infoString"); + dynamicView.addAlias("CM", "infoString"); dynamicView.addViewLink("PT", "PM", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId")); dynamicView.addViewLink("PM", "CM", Boolean.FALSE, ModelKeyMap.makeKeyMapList("contactMechId")); } else if (UtilValidate.isNotEmpty(phone)) { - dynamicView.addMemberEntity("PM", "PartyContactMechPurpose"); + dynamicView.addMemberEntity("PM", "PartyContactMechPurpose"); dynamicView.addAlias("PM", "contactMechId"); dynamicView.addAlias("PM", "thruDate"); - dynamicView.addAlias("PM", "contactMechPurposeTypeId"); + dynamicView.addAlias("PM", "contactMechPurposeTypeId"); dynamicView.addMemberEntity("TN", "TelecomNumber"); dynamicView.addAlias("TN", "contactNumber"); dynamicView.addViewLink("PT", "PM", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId")); @@ -1597,7 +1597,7 @@ } else { // andExprs.add(EntityCondition.makeCondition("lastName", EntityOperator.LIKE, "%"+name+"%")); // Less restrictive andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("lastName"), EntityOperator.LIKE, EntityFunction.UPPER("%"+name+"%"))); // Even less restrictive - } + } } if (UtilValidate.isNotEmpty(card)) { andExprs.add(EntityCondition.makeCondition("cardId", EntityOperator.EQUALS, card)); @@ -1611,7 +1611,7 @@ andExprs.add(EntityCondition.makeCondition("contactMechPurposeTypeId", EntityOperator.EQUALS, "PHONE_HOME")); andExprs.add(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null)); } - + mainCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND); orderBy.add("lastName"); @@ -1672,18 +1672,18 @@ } else { // both empty partyMap.put("infoString", ""); partyMap.put("contactNumber", ""); - + } resultList.add(partyMap); } - + if (UtilValidate.isNotEmpty(email)) { resultList = searchContactMechs(delegator, pos, resultList, phone, "TELECOM_NUMBER"); } else if (UtilValidate.isNotEmpty(phone)) { resultList = searchContactMechs(delegator, pos, resultList, "", "EMAIL_ADDRESS"); // "" is more clear than email which is by definition here is empty } else { // both empty resultList = searchContactMechs(delegator, pos, resultList, "", "TELECOM_NUMBER"); // "" is more clear than phone which is by definition here is empty - resultList = searchContactMechs(delegator, pos, resultList, "", "EMAIL_ADDRESS"); + resultList = searchContactMechs(delegator, pos, resultList, "", "EMAIL_ADDRESS"); } } else { resultList = FastList.newInstance(); @@ -1698,7 +1698,7 @@ // we suppose only one phone number (should be ok anyway because of the contactMechPurposeTypeId == "PHONE_HOME") LocalDispatcher dispatcher = session.getDispatcher(); GenericValue userLogin = session.getUserLogin(); - GenericValue partyUserLogin = null; + GenericValue partyUserLogin = null; String result = null; Map<String, Object> svcCtx = FastMap.newInstance(); @@ -1745,12 +1745,12 @@ if (ServiceUtil.isError(svcRes)) { pos.showDialog("dialog/error/exception", ServiceUtil.getErrorMessage(svcRes)); return result; - } + } partyId = (String) svcRes.get("partyId"); partyUserLogin = userLogin; } - if (UtilValidate.isNotEmpty(email)) { + if (UtilValidate.isNotEmpty(email)) { // createPartyEmailAddress trace("createPartyEmailAddress"); svcCtx.clear(); @@ -1773,7 +1773,7 @@ if (UtilValidate.isNotEmpty(phone)) { if (phone.length() < 5 ) { - pos.showDialog("dialog/error/exception", UtilProperties.getMessage(PosTransaction.resource, "PosPhoneField5Required", locale)); + pos.showDialog("dialog/error/exception", UtilProperties.getMessage(PosTransaction.resource, "PosPhoneField5Required", locale)); } else { // createPartyTelecomNumber trace("createPartyTelecomNumber"); @@ -1795,9 +1795,9 @@ } } } - + result = partyId; - + // Update } else if (UtilValidate.isNotEmpty(partyId)){ trace("Update a client profile"); @@ -1810,7 +1810,7 @@ pos.showDialog("dialog/error/exception", e.getMessage()); return null; } - + Boolean newLogin = true; try { List<GenericValue> userLogins = session.getDelegator().findByAnd("UserLogin", UtilMisc.toMap("partyId", partyId)); @@ -1833,7 +1833,7 @@ svcCtx.put("lastName", name); if (UtilValidate.isNotEmpty(card)) { svcCtx.put("cardId", card); - } + } try { // updatePerson trace("updatePerson"); @@ -1849,7 +1849,7 @@ } } - + if (UtilValidate.isNotEmpty(phone)) { // Create or update phone if (phone.length() < 5 ) { @@ -1859,11 +1859,11 @@ String contactMechId = null; svcCtx.clear(); svcCtx.put("partyId", partyId); - svcCtx.put("thruDate", null); // last one + svcCtx.put("thruDate", null); // last one try { List<GenericValue> PartyTelecomNumbers = session.getDelegator().findByAnd("PartyAndTelecomNumber", svcCtx); if (UtilValidate.isNotEmpty(PartyTelecomNumbers)) { - GenericValue PartyTelecomNumber = PartyTelecomNumbers.get(0); // There is only one phone number (contactMechPurposeTypeId == "PHONE_HOME") + GenericValue PartyTelecomNumber = PartyTelecomNumbers.get(0); // There is only one phone number (contactMechPurposeTypeId == "PHONE_HOME") contactNumber = PartyTelecomNumber.getString("contactNumber"); contactMechId = PartyTelecomNumber.getString("contactMechId"); } @@ -1871,7 +1871,7 @@ Debug.logError(e, module); pos.showDialog("dialog/error/exception", e.getMessage()); return null; - } + } // Create or update phone trace("createUpdatePartyTelecomNumber"); @@ -1893,7 +1893,7 @@ pos.showDialog("dialog/error/exception", ServiceUtil.getErrorMessage(svcRes)); return null; } - + // Handle login aspect where phone is taken as pwd if (UtilValidate.isNotEmpty(contactNumber) && !phone.equals(contactNumber)) { if (!newLogin) { // to create a new login we need also an email address @@ -1904,42 +1904,42 @@ try { passwordAcceptEncryptedAndPlain = UtilProperties.getPropertyValue("security.properties", "password.accept.encrypted.and.plain"); UtilProperties.setPropertyValueInMemory("security.properties", "password.accept.encrypted.and.plain", "true"); - svcRes = dispatcher.runSync("updatePassword", + svcRes = dispatcher.runSync("updatePassword", UtilMisc.toMap("userLogin", userLogin, - "userLoginId", userLogin.getString("userLoginId"), - "currentPassword", userLogin.getString("currentPassword"), - "newPassword", phone, - "newPasswordVerify", phone)); + "userLoginId", userLogin.getString("userLoginId"), + "currentPassword", userLogin.getString("currentPassword"), + "newPassword", phone, + "newPasswordVerify", phone)); } catch (GenericServiceException e) { Debug.logError(e, "Error calling updatePassword service", module); pos.showDialog("dialog/error/exception", e.getMessage()); - UtilProperties.setPropertyValueInMemory("security.properties", "password.accept.encrypted.and.plain", passwordAcceptEncryptedAndPlain); + UtilProperties.setPropertyValueInMemory("security.properties", "password.accept.encrypted.and.plain", passwordAcceptEncryptedAndPlain); return null; } finally { // Put back passwordAcceptEncryptedAndPlain value in memory UtilProperties.setPropertyValueInMemory("security.properties", "password.accept.encrypted.and.plain", passwordAcceptEncryptedAndPlain); - } + } if (ServiceUtil.isError(svcRes)) { pos.showDialog("dialog/error/exception", ServiceUtil.getErrorMessage(svcRes)); return null; } - } + } } } } if (UtilValidate.isNotEmpty(email)) { - // Update email + // Update email svcCtx.clear(); svcCtx.put("partyId", partyId); - svcCtx.put("thruDate", null); // last one - svcCtx.put("contactMechTypeId", "EMAIL_ADDRESS"); + svcCtx.put("thruDate", null); // last one + svcCtx.put("contactMechTypeId", "EMAIL_ADDRESS"); String contactMechId = null; String infoString = null; try { List<GenericValue> PartyEmails = session.getDelegator().findByAnd("PartyAndContactMech", svcCtx); if (UtilValidate.isNotEmpty(PartyEmails)) { - GenericValue PartyEmail = PartyEmails.get(0); // There is only one email address (contactMechPurposeTypeId == "PRIMARY_EMAIL") + GenericValue PartyEmail = PartyEmails.get(0); // There is only one email address (contactMechPurposeTypeId == "PRIMARY_EMAIL") contactMechId = PartyEmail.getString("contactMechId"); infoString = PartyEmail.getString("infoString"); } @@ -1950,7 +1950,7 @@ } svcCtx.remove("thruDate"); - svcCtx.remove("contactMechTypeId"); + svcCtx.remove("contactMechTypeId"); svcCtx.put("userLogin", userLogin); svcCtx.put("emailAddress", email); svcCtx.put("contactMechPurposeTypeId", "PRIMARY_EMAIL"); @@ -1959,7 +1959,7 @@ } if (UtilValidate.isNotEmpty(infoString) && !email.equals(infoString) || UtilValidate.isEmpty(infoString)) { - // Create or update email + // Create or update email trace("createUpdatePartyEmailAddress"); try { svcRes = dispatcher.runSync("createUpdatePartyEmailAddress", svcCtx); @@ -1991,14 +1991,14 @@ } } else if (newLogin && UtilValidate.isNotEmpty(phone)) { // createUserLogin - trace("createUserLogin"); + trace("createUserLogin"); try { - svcRes = dispatcher.runSync("createUserLogin", + svcRes = dispatcher.runSync("createUserLogin", UtilMisc.toMap("userLogin", userLogin, - "userLoginId", email, - "currentPassword", phone, + "userLoginId", email, + "currentPassword", phone, "currentPasswordVerify", phone, - "partyId", partyId)); + "partyId", partyId)); } catch (GenericServiceException e) { Debug.logError(e, "Error calling updatePassword service", module); pos.showDialog("dialog/error/exception", e.getMessage()); @@ -2012,7 +2012,7 @@ } } else { pos.showDialog("dialog/error/exception", UtilProperties.getMessage(resource, "PosNoClientProfile", locale)); - return null; + return null; } return null; } Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/PromoStatusBar.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/PromoStatusBar.java?rev=899812&r1=899811&r2=899812&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/PromoStatusBar.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/PromoStatusBar.java Fri Jan 15 21:00:23 2010 @@ -79,4 +79,3 @@ return statusbarClient; } } - \ No newline at end of file Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java?rev=899812&r1=899811&r2=899812&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/device/impl/Receipt.java Fri Jan 15 21:00:23 2010 @@ -120,7 +120,7 @@ } Debug.log("Print Report Requested", module); String[] report = this.readReportTemplate(resource); - + if (report != null) { for (int i = 0; i < report.length; i++) { if (report[i] != null) { Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java?rev=899812&r1=899811&r2=899812&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java Fri Jan 15 21:00:23 2010 @@ -377,7 +377,7 @@ pos.refresh(); } } - + public static synchronized void SwapKeyboard(PosScreen pos) { if (!mgrLoggedIn) { pos.showDialog("dialog/error/mgrnotloggedin"); @@ -387,12 +387,12 @@ if ("N".equalsIgnoreCase(showKeyboardInSaveSale)) { UtilProperties.setPropertyValueInMemory("parameters.properties", "ShowKeyboardInSaveSale", "Y"); } else { - UtilProperties.setPropertyValueInMemory("parameters.properties", "ShowKeyboardInSaveSale", "N"); + UtilProperties.setPropertyValueInMemory("parameters.properties", "ShowKeyboardInSaveSale", "N"); } } } - - + + public static synchronized void shutdown(PosScreen pos) { if (!mgrLoggedIn) { @@ -483,24 +483,24 @@ boolean beganTransaction = false; try { beganTransaction = TransactionUtil.begin(); - + Delegator delegator = pos.getSession().getDelegator(); List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("originFacilityId", EntityOperator.EQUALS, trans.getFacilityId()), EntityCondition.makeCondition("terminalId", EntityOperator.EQUALS, trans.getTerminalId())); EntityListIterator eli = null; - + try { eli = delegator.find("OrderHeaderAndPaymentPref", EntityCondition.makeCondition(exprs, EntityOperator.AND), null, null, null, null); } catch (GenericEntityException e) { Debug.logError(e, module); } - + Timestamp dayStart = state.getTimestamp("openedDate"); Timestamp dayEnd = state.getTimestamp("closedDate"); if (dayEnd == null) { dayEnd = UtilDateTime.nowTimestamp(); } - + if (eli != null) { GenericValue ohpp; while (((ohpp = (GenericValue) eli.next()) != null)) { @@ -508,7 +508,7 @@ if (orderDate.after(dayStart) && orderDate.before(dayEnd)) { String pmt = ohpp.getString("paymentMethodTypeId"); BigDecimal amt = ohpp.getBigDecimal("maxAmount"); - + if ("CASH".equals(pmt)) { cashTotal = cashTotal.add(amt); } else if ("PERSONAL_CHECK".equals(pmt)) { @@ -523,12 +523,12 @@ total = total.add(amt); } } - + try { eli.close(); } catch (GenericEntityException e) { Debug.logWarning(e, "Trouble closing ELI", module); - pos.showDialog("dialog/error/exception", e.getMessage()); + pos.showDialog("dialog/error/exception", e.getMessage()); } } } catch (GenericTransactionException e) { @@ -548,7 +548,7 @@ pos.showDialog("dialog/error/exception", e.getMessage()); } } - + Map<String, String> reportMap = FastMap.newInstance(); String reportTemplate = "totals.txt"; Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PromoEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PromoEvents.java?rev=899812&r1=899811&r2=899812&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PromoEvents.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PromoEvents.java Fri Jan 15 21:00:23 2010 @@ -60,9 +60,9 @@ } } } - + public static synchronized void clientProfile(PosScreen pos) { PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession()); trans.clientProfile(pos); - } + } } Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ConfigureItem.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ConfigureItem.java?rev=899812&r1=899811&r2=899812&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ConfigureItem.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ConfigureItem.java Fri Jan 15 21:00:23 2010 @@ -369,7 +369,7 @@ public void buttonClicked() { DefaultListModel listModel = new DefaultListModel(); List<ConfigOption> options = question.getOptions(); - + for (ConfigOption configoption : options) { listModel.addElement(configoption.getDescription()); //Debug.logInfo("Found option " + configoption.getDescription(), module); Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/NumericKeypad.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/NumericKeypad.java?rev=899812&r1=899811&r2=899812&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/NumericKeypad.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/NumericKeypad.java Fri Jan 15 21:00:23 2010 @@ -44,13 +44,13 @@ String originalText; public NumericKeypad(PosScreen pos) { - m_pos = pos; + m_pos = pos; m_pageSupport = pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/numerickeypad"); m_dialog = (XDialog) m_pageSupport; m_edit = (XEdit) m_pageSupport.findComponent("numeric_input"); m_edit.setText(""); m_dialog.setCaption(UtilProperties.getMessage(PosTransaction.resource, "PosVirtualNumPadTitle", Locale.getDefault())); - + } public String openDlg() { @@ -72,7 +72,7 @@ public String getText() { return m_edit.getText(); } - + //call before openDlg public void setMinus(boolean minus) { m_minus = minus; @@ -219,7 +219,7 @@ { cancel(); } - + public void triggerMinus() { prependUnique('-'); @@ -312,7 +312,7 @@ return; } } - + private synchronized void append(String c) { if (wasMouseClicked()) { String text = ""; Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PosScreen.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PosScreen.java?rev=899812&r1=899811&r2=899812&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PosScreen.java (original) +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PosScreen.java Fri Jan 15 21:00:23 2010 @@ -94,7 +94,7 @@ // setup the shared components this.session = XuiContainer.getSession(); - this.output = new Output(this); + this.output = new Output(this); this.input = new InputWithPassword(this); this.journal = new Journal(this); this.operator = new Operator(this); |
| Free forum by Nabble | Edit this page |
