You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2007/01/19 08:57:23 UTC

Re: svn commit: r497618 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/order/ applications/order/src/org/ofbiz/order/shoppingcart/ applications/order/src/org/ofbiz/order/shoppinglist/ applications/product/src/org/ofbiz/product/store/ specialpurp

Si,

You will have to change
    \crmsfa\src\com\opensourcestrategies\crmsfa\orders\CrmsfaOrderEvents.java:181
and
    \crmsfa\src\com\opensourcestrategies\crmsfa\orders\CrmsfaOrderEvents.java:275

for
   cart.addOrIncreaseItem(productId, null, 1, null, null, null, null, null, null, null, null, null, null, null, dispatcher, null);
to
   cart.addOrIncreaseItem(productId, null, 1, null, null, null, null, null, null, null, null, null, null, null, null, dispatcher);

Thanks

Jacques

----- Original Message ----- 
From: <jl...@apache.org>
To: <co...@ofbiz.apache.org>
Sent: Thursday, January 18, 2007 11:55 PM
Subject: svn commit: r497618 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/order/
applications/order/src/org/ofbiz/order/shoppingcart/ applications/order/src/org/ofbiz/order/shoppinglist/
applications/product/src/org/ofbiz/product/store/ specialpurp...


> Author: jleroux
> Date: Thu Jan 18 14:55:50 2007
> New Revision: 497618
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=497618
> Log:
> Some enhancements suggested by Si for commit 495945
>
> Modified:
>     ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
>     ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
>     ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
>     ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
>     ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
>     ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
>     ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
>     ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/LoadSale.java
>     ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java
>
> 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=497618&r1=497617&r2=497618
> ==============================================================================
> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Thu Jan 18 14:55:50 2007
> @@ -3415,7 +3415,7 @@
>          Locale locale = (Locale) context.get("locale");
>          ShoppingCart cart = new ShoppingCart(dctx.getDelegator(), "9000", "webStore", locale, "USD");
>          try {
> -            cart.addOrIncreaseItem("GZ-1005", null, 1, null, null, null, null, null, null, null, "DemoCatalog", null, null, null,
dctx.getDispatcher(),null);
> +            cart.addOrIncreaseItem("GZ-1005", null, 1, null, null, null, null, null, null, null, "DemoCatalog", null, null, null,
null, dctx.getDispatcher());
>              } catch (CartItemModifyException e) {
>              Debug.logError(e, module);
>          } catch (ItemNotFoundException e) {
> @@ -3653,7 +3653,7 @@
>                                                                         item.getTimestamp("shipAfterDate"),
>                                                                         null, null, null,
>                                                                         null, null, null,
> -                                                                       dispatcher, null);
> +                                                                       null, dispatcher);
>                                  ShoppingCartItem sci = cart.findCartItem(itemIndex);
>                                  sci.setAssociatedOrderId(orderId);
>                                  sci.setAssociatedOrderItemSeqId(item.getString("orderItemSeqId"));
>
> 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=497618&r1=497617&r2=497618
> ==============================================================================
> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Thu Jan 18 14:55:50 2007
> @@ -444,7 +444,7 @@
>       */
>      public int addOrIncreaseItem(String productId, Double selectedAmountDbl, double quantity, Timestamp reservStart, Double
reservLengthDbl, Double reservPersonsDbl,
>              Timestamp shipBeforeDate, Timestamp shipAfterDate, Map features, Map attributes, String prodCatalogId,
> -            ProductConfigWrapper configWrapper, String itemType, String itemGroupNumber, LocalDispatcher dispatcher, String
parentProductId) throws CartItemModifyException, ItemNotFoundException {
> +            ProductConfigWrapper configWrapper, String itemType, String itemGroupNumber, String parentProductId, LocalDispatcher
dispatcher) throws CartItemModifyException, ItemNotFoundException {
>          if (isReadOnlyCart()) {
>             throw new CartItemModifyException("Cart items cannot be changed");
>          }
>
> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?view=diff&rev=497618&r1=497617&r2=497618
> ==============================================================================
> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java (original)
> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java Thu Jan 18 14:55:50 2007
> @@ -119,7 +119,7 @@
>              try {
>                  java.sql.Timestamp.valueOf((String) context.get("itemDesiredDeliveryDate"));
>              } catch (IllegalArgumentException e) {
> -            return
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderInvalidDesiredDeliveryDateSyntaxError",this.cart.getLocale())
);
> +                return
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderInvalidDesiredDeliveryDateSyntaxError",this.cart.getLocale())
);
>              }
>          } else {
>              context.remove("itemDesiredDeliveryDate");
> @@ -180,7 +180,7 @@
>              if (productId != null) {
>                  itemId = cart.addOrIncreaseItem(productId, amount, quantity, reservStart, reservLength,
>                                                  reservPersons, shipBeforeDate, shipAfterDate, null, attributes,
> -                                                catalogId, configWrapper, itemType, itemGroupNumber, dispatcher, pProductId);
> +                                                catalogId, configWrapper, itemType, itemGroupNumber, pProductId, dispatcher);
>              } else {
>                  itemId = cart.addNonProductItem(itemType, itemDescription, productCategoryId, price, quantity, attributes,
catalogId, itemGroupNumber, dispatcher);
>              }
> @@ -245,7 +245,7 @@
>                          Double amount = orderItem.getDouble("selectedAmount");
>                          try {
>                              this.cart.addOrIncreaseItem(orderItem.getString("productId"), amount,
orderItem.getDouble("quantity").doubleValue(),
> -                                    null, null, null, null, null, null, null, catalogId, null, orderItemTypeId, itemGroupNumber,
dispatcher,null);
> +                                    null, null, null, null, null, null, null, catalogId, null, orderItemTypeId, itemGroupNumber,
null, dispatcher);
>                              noItems = false;
>                          } catch (CartItemModifyException e) {
>                              errorMsgs.add(e.getMessage());
> @@ -283,7 +283,7 @@
>                              try {
>                                  this.cart.addOrIncreaseItem(orderItem.getString("productId"), amount,
>                                          orderItem.getDouble("quantity").doubleValue(), null, null, null, null, null, null, null,
> -                                        catalogId, null, orderItem.getString("orderItemTypeId"), itemGroupNumber, dispatcher,
null);
> +                                        catalogId, null, orderItem.getString("orderItemTypeId"), itemGroupNumber, null,
dispatcher);
>                                  noItems = false;
>                              } catch (CartItemModifyException e) {
>                                  errorMsgs.add(e.getMessage());
> @@ -372,7 +372,7 @@
>                  if (quantity > 0.0) {
>                      try {
>                          if (Debug.verboseOn()) Debug.logVerbose("Bulk Adding to cart [" + quantity + "] of [" + productId + "] in
Item Group [" + itemGroupNumber + "]", module);
> -                        this.cart.addOrIncreaseItem(productId, null, quantity, null, null, null, null, null, null, null,
catalogId, null, null, itemGroupNumberToUse, dispatcher, null);
> +                        this.cart.addOrIncreaseItem(productId, null, quantity, null, null, null, null, null, null, null,
catalogId, null, null, itemGroupNumberToUse, null, dispatcher);
>                      } catch (CartItemModifyException e) {
>                          return ServiceUtil.returnError(e.getMessage());
>                      } catch (ItemNotFoundException e) {
> @@ -451,7 +451,7 @@
>                          }
>                          try {
>                              if (Debug.verboseOn()) Debug.logVerbose("Bulk Adding to cart requirement [" + quantity + "] of [" +
productId + "]", module);
> -                            int index = this.cart.addOrIncreaseItem(productId, null, quantity, null, null, null, null, null,
null, null, catalogId, null, null, itemGroupNumber, dispatcher, null);
> +                            int index = this.cart.addOrIncreaseItem(productId, null, quantity, null, null, null, null, null,
null, null, catalogId, null, null, itemGroupNumber, null, dispatcher);
>                              ShoppingCartItem sci = (ShoppingCartItem)this.cart.items().get(index);
>                              sci.setRequirementId(requirementId);
>                          } catch (CartItemModifyException e) {
> @@ -478,7 +478,7 @@
>          String errMsg = null;
>
>          if (categoryId == null || categoryId.length() <= 0) {
> -        errMsg = UtilProperties.getMessage(resource,"cart.category_not_specified_to_add_from", this.cart.getLocale());
> +            errMsg = UtilProperties.getMessage(resource,"cart.category_not_specified_to_add_from", this.cart.getLocale());
>              result = ServiceUtil.returnError(errMsg);
>  //          result =
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderNoCategorySpecifiedToAddFrom.",this.cart.getLocale()));
>              return result;
> @@ -515,7 +515,7 @@
>                  try {
>                      this.cart.addOrIncreaseItem(productCategoryMember.getString("productId"),
>                              null, quantity.doubleValue(), null, null, null, null, null, null, null,
> -                            catalogId, null, null, itemGroupNumber, dispatcher, null);
> +                            catalogId, null, null, itemGroupNumber, null, dispatcher);
>                      totalQuantity += quantity.doubleValue();
>                  } catch (CartItemModifyException e) {
>                      errorMsgs.add(e.getMessage());
> @@ -870,12 +870,12 @@
>          GenericValue agreement = null;
>
>          if ((this.delegator == null) || (this.dispatcher == null) || (this.cart == null)) {
> -        result =
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderDispatcherOrDelegatorOrCartArgumentIsNull",this.cart.getLocal
e()));
> +            result =
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderDispatcherOrDelegatorOrCartArgumentIsNull",this.cart.getLocal
e()));
>              return result;
>          }
>
>          if ((agreementId == null) || (agreementId.length() <= 0)) {
> -        result =
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderNoAgreementSpecified",this.cart.getLocale()));
> +            result =
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderNoAgreementSpecified",this.cart.getLocale()));
>              return result;
>          }
>
> @@ -888,7 +888,7 @@
>          }
>
>          if (agreement == null) {
> -        result =
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderCouldNotGetAgreement",UtilMisc.toMap("agreementId",agreementI
d),this.cart.getLocale()));
> +            result =
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderCouldNotGetAgreement",UtilMisc.toMap("agreementId",agreementI
d),this.cart.getLocale()));
>          } else {
>              // set the agreement id in the cart
>              cart.setAgreementId(agreementId);
> @@ -901,7 +901,7 @@
>                         try {
>                              cart.setCurrency(dispatcher,currencyUomId);
>                         } catch (CartItemModifyException ex) {
> -                       result =
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderSetCurrencyError",this.cart.getLocale()) + ex.getMessage());
> +                           result =
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderSetCurrencyError",this.cart.getLocale()) + ex.getMessage());
>                              return result;
>                         }
>                   }
> @@ -941,7 +941,7 @@
>              this.cart.setCurrency(this.dispatcher,currencyUomId);
>              result = ServiceUtil.returnSuccess();
>           } catch (CartItemModifyException ex) {
> -         result = ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"Set currency error",this.cart.getLocale()) +
ex.getMessage());
> +             result = ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"Set currency
error",this.cart.getLocale()) + ex.getMessage());
>               return result;
>           }
>          return result;
> @@ -972,7 +972,7 @@
>                  productSupplier=(GenericValue) productSuppliers.get(0);
>              }
>          } catch (GenericServiceException e) {
> -        Debug.logWarning(UtilProperties.getMessage(resource_error,"OrderRunServiceGetSuppliersForProductError", cart.getLocale())
+ e.getMessage(), module);
> +            Debug.logWarning(UtilProperties.getMessage(resource_error,"OrderRunServiceGetSuppliersForProductError",
cart.getLocale()) + e.getMessage(), module);
>          }
>          return productSupplier;
>      }
>
> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java?view=diff&rev=497618&r1=497617&r2=497618
> ==============================================================================
> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java (original)
> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java Thu Jan 18 14:55:50 2007
> @@ -273,9 +273,9 @@
>
>                  // i cannot get the addOrDecrease function to accept a null reservStart field: i get a null pointer exception a
null constant works....
>                  if (reservStart == null) {
> -                    cart.addOrIncreaseItem(productId, null, quantity.doubleValue(), null, null, null, null, null, null,
attributes, prodCatalogId, null, null, null, dispatcher, null);
> +                    cart.addOrIncreaseItem(productId, null, quantity.doubleValue(), null, null, null, null, null, null,
attributes, prodCatalogId, null, null, null, null, dispatcher);
>                  } else {
> -                    cart.addOrIncreaseItem(productId, null, quantity.doubleValue(), reservStart, reservLength, reservPersons,
null, null, null, attributes, prodCatalogId, null, null, null, dispatcher, null);
> +                    cart.addOrIncreaseItem(productId, null, quantity.doubleValue(), reservStart, reservLength, reservPersons,
null, null, null, attributes, prodCatalogId, null, null, null, null, dispatcher);
>                  }
>                  Map messageMap = UtilMisc.toMap("productId", productId);
>                  errMsg = UtilProperties.getMessage(resource,"shoppinglistevents.added_product_to_cart", messageMap,
cart.getLocale());
>
> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java?view=diff&rev=497618&r1=497617&r2=497618
> ==============================================================================
> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java (original)
> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java Thu Jan 18 14:55:50 2007
> @@ -442,7 +442,7 @@
>                          Map attributes = UtilMisc.toMap("shoppingListId", listId, "shoppingListItemSeqId", itemId);
>
>                          try {
> -                            listCart.addOrIncreaseItem(productId, null, quantity.doubleValue(), reservStart, reservLength,
reservPersons, null, null, null, attributes, null, null, null, null, dispatcher, null);
> +                            listCart.addOrIncreaseItem(productId, null, quantity.doubleValue(), reservStart, reservLength,
reservPersons, null, null, null, attributes, null, null, null, null, null, dispatcher);
>                          } catch (CartItemModifyException e) {
>                              Debug.logError(e, "Unable to add product to List Cart - " + productId, module);
>                          } catch (ItemNotFoundException e) {
>
> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java?view=diff&rev=497618&r1=497617&r2=497618
> ==============================================================================
> --- ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java (original)
> +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java Thu Jan 18 14:55:50 2007
> @@ -470,10 +470,12 @@
>                  try {
>                      product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId));
>                      if ((product != null) && ("Y".equals(product.get("isVariant")))) {
> -                        if (parentProductId != null)
> +                        if (parentProductId != null) {
>                              virtualProductId = parentProductId;
> -                        else
> +                        }
> +                        else {
>                              virtualProductId = ProductWorker.getVariantVirtualId(product);
> +                        }
>                          Debug.log("getSurvey for virtual product " + virtualProductId,module);
>                      }
>                  } catch (GenericEntityException e) {
>
> 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?view=diff&rev=497618&r1=497617&r2=497618
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java (original)
> +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Thu Jan 18 14:55:50 2007
> @@ -355,7 +355,7 @@
>      public void addItem(String productId, double quantity) throws CartItemModifyException, ItemNotFoundException {
>          trace("add item", productId + "/" + quantity);
>          try {
> -            cart.addOrIncreaseItem(productId, null, quantity, null, null, null, null, null, null, null, null, null, null, null,
session.getDispatcher(), null);
> +            cart.addOrIncreaseItem(productId, null, quantity, null, null, null, null, null, null, null, null, null, null, null,
null, session.getDispatcher());
>          } catch (ItemNotFoundException e) {
>              trace("item not found", e);
>              throw e;
>
> Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/LoadSale.java
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/LoadSale.java?view=diff&rev=497618&r1=497617&r2=497618
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/LoadSale.java (original)
> +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/LoadSale.java Thu Jan 18 14:55:50 2007
> @@ -1,244 +1,244 @@
> -/*******************************************************************************
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements.  See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership.  The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License.  You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied.  See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *******************************************************************************/
> -package org.ofbiz.pos.screen;
> -
> -import java.util.Hashtable;
> -import java.util.Iterator;
> -import java.util.Locale;
> -import java.util.Map;
> -
> -import javax.swing.DefaultListModel;
> -import javax.swing.ListSelectionModel;
> -
> -import net.xoetrope.swing.XButton;
> -import net.xoetrope.swing.XDialog;
> -import net.xoetrope.swing.XList;
> -import net.xoetrope.xui.XPage;
> -
> -import org.ofbiz.base.util.Debug;
> -import org.ofbiz.base.util.UtilProperties;
> -import org.ofbiz.pos.PosTransaction;
> -
> -
> -public class LoadSale extends XPage {
> -
> -    /**
> -     * To load a sale from a shopping list. 2 modes : add to or replace the current sale. Also a button to delete a sale (aka
shopping list)
> -     */
> -    public static final String module = LoadSale.class.getName();
> -    protected static PosScreen m_pos = null;
> -    protected XDialog m_dialog = null;
> -    static protected Hashtable m_saleMap = new Hashtable();
> -    protected XList m_salesList = null;
> -    protected XButton m_cancel = null;
> -    protected XButton m_add = null;
> -    protected XButton m_replace = null;
> -    protected XButton m_delete = null;
> -    protected XButton m_replaceAndDelete = null;
> -    protected DefaultListModel m_listModel = null;
> -    protected static PosTransaction m_trans = null;
> -
> -    //TODO : make getter and setter for members (ie m_*) if needed (extern calls). For that in Eclipse use Source/Generate
Getters and setters
> -
> -    public LoadSale(Hashtable saleMap, PosTransaction trans, PosScreen page) {
> -        m_saleMap.putAll(saleMap);
> -        m_trans = trans;
> -        m_pos = page;
> -    }
> -
> -    public void openDlg() {
> -        m_dialog = (XDialog) pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/loadsale");
> -        m_dialog.setCaption(UtilProperties.getMessage("pos", "LoadASale", Locale.getDefault()));
> -        m_salesList = (XList) m_dialog.findComponent("salesList");
> -        addMouseHandler(m_salesList, "saleDoubleClick");
> -
> -        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
> -        m_add = (XButton) m_dialog.findComponent("BtnAdd");
> -        m_replace = (XButton) m_dialog.findComponent("BtnReplace");
> -        m_delete = (XButton) m_dialog.findComponent("BtnDelete");
> -        m_replaceAndDelete = (XButton) m_dialog.findComponent("BtnReplaceAndDelete");
> -        addMouseHandler(m_cancel, "cancel");
> -        addMouseHandler(m_add, "addSale");
> -        addMouseHandler(m_replace, "replaceSale");
> -        addMouseHandler(m_delete, "deleteShoppingList");
> -        addMouseHandler(m_replaceAndDelete, "replaceSaleAndDeleteShoppingList");
> -
> -        m_listModel = new DefaultListModel();
> -        for (Iterator i = m_saleMap.entrySet().iterator(); i.hasNext();) {
> -            Object o = i.next();
> -            Map.Entry entry = (Map.Entry)o;
> -            String val = entry.getValue().toString();
> -            m_listModel.addElement(val);
> -        }
> -        m_salesList.setModel(m_listModel);
> -        m_salesList.setVisibleRowCount(-1);
> -        m_salesList.ensureIndexIsVisible(m_salesList.getItemCount());
> -        m_salesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
> -        m_salesList.setToolTipText(UtilProperties.getMessage("pos", "LoadSaleListDblClickTip", Locale.getDefault()));
> -
> -        m_dialog.pack();
> -        m_salesList.requestFocusInWindow();
> -        m_dialog.showDialog(this);
> -    }
> -
> -    public synchronized void saleDoubleClick() {
> -        if (wasMouseDoubleClicked()) {
> -            String sale = selectedSale();
> -            if (null != sale) {
> -                replaceSaleAndDeleteShoppingList_();
> -            }
> -        }
> -    }
> -
> -    public synchronized void cancel() {
> -        if (wasMouseClicked()) {
> -            closeDlg();
> -        }
> -    }
> -
> -    public synchronized void addSale() {
> -        if (wasMouseClicked()) {
> -            addSale_();
> -        }
> -    }
> -
> -    private synchronized void addSale_() {
> -        String sale = selectedSale();
> -        if (null != sale) {
> -            addListToCart(sale, true);
> -        }
> -    }
> -
> -    public synchronized void replaceSale() {
> -        if (wasMouseClicked()) {
> -            replaceSale_();
> -        }
> -    }
> -
> -    private synchronized void replaceSale_() {
> -        String sale = selectedSale();
> -        if (null != sale) {
> -            addListToCart(sale, false);
> -        }
> -    }
> -
> -    public synchronized void deleteShoppingList() {
> -        if (wasMouseClicked()) {
> -            deleteShoppingList_();
> -        }
> -    }
> -
> -    private synchronized void deleteShoppingList_() {
> -        String sale= (String) m_salesList.getSelectedValue();
> -        if (null != sale) {
> -            String shoppingListId = selectedSale();
> -            final ClassLoader cl = this.getClassLoader(m_pos);
> -            Thread.currentThread().setContextClassLoader(cl);
> -            if (m_trans.clearList(shoppingListId, m_pos)) {
> -                int index = m_salesList.getSelectedIndex();
> -                m_saleMap.remove(shoppingListId);
> -                m_listModel = new DefaultListModel();
> -                for (Iterator i = m_saleMap.entrySet().iterator(); i.hasNext();) {
> -                    Object o = i.next();
> -                    Map.Entry entry = (Map.Entry)o;
> -                    String val = entry.getValue().toString();
> -                    m_listModel.addElement(val);
> -                }
> -                m_salesList.setModel(m_listModel);
> -                int size = m_listModel.getSize();
> -                if (size == 0) { //Nobody's left, nothing to do here
> -                    closeDlg();
> -                } else { //Select an index.
> -                    if (index == size) {
> -                        //removed item in last position
> -                        index--;
> -                    }
> -                }
> -                m_salesList.setSelectedIndex(index);
> -                m_salesList.ensureIndexIsVisible(index);
> -                m_salesList.repaint();
> -                repaint();
> -            }
> -        }
> -    }
> -
> -    public synchronized void replaceSaleAndDeleteShoppingList() {
> -        if (wasMouseClicked()) {
> -            replaceSaleAndDeleteShoppingList_();
> -        }
> -    }
> -
> -    public synchronized void replaceSaleAndDeleteShoppingList_() {
> -        replaceSale_();
> -        deleteShoppingList_();
> -    }
> -
> -    private String selectedSale() {
> -        String saleSelected = null;
> -        if (null != m_salesList.getSelectedValue()) {
> -            String sale = (String) m_salesList.getSelectedValue();
> -            Iterator i = m_saleMap.entrySet().iterator();
> -            while(i.hasNext()) {
> -                Object o = i.next();
> -                Map.Entry entry = (Map.Entry)o;
> -                String val = entry.getValue().toString();
> -                if (val.equals(sale)) {
> -                    saleSelected = entry.getKey().toString();
> -                }
> -            }
> -        }
> -        return saleSelected;
> -    }
> -
> -    private void addListToCart(String sale, boolean addToCart) {
> -        final ClassLoader cl = this.getClassLoader(m_pos);
> -        Thread.currentThread().setContextClassLoader(cl);
> -        if (!m_trans.addListToCart(sale, m_pos, addToCart)) {
> -            Debug.logError("Error while loading cart from shopping list : " + sale, module);
> -        }
> -        else {
> -            m_trans.calcTax();
> -            m_pos.refresh();
> -        }
> -        closeDlg();
> -    }
> -
> -    private ClassLoader getClassLoader(PosScreen pos) {
> -        ClassLoader cl = pos.getClassLoader();
> -        if (cl == null) {
> -            try {
> -                cl = Thread.currentThread().getContextClassLoader();
> -            } catch (Throwable t) {
> -            }
> -            if (cl == null) {
> -                Debug.log("No context classloader available; using class classloader", module);
> -                try {
> -                    cl = this.getClass().getClassLoader();
> -                } catch (Throwable t) {
> -                    Debug.logError(t, module);
> -                }
> -            }
> -        }
> -        return cl;
> -    }
> -
> -    private void closeDlg() {
> -        m_dialog.closeDlg();
> -    }
> +/*******************************************************************************
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License.  You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied.  See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + *******************************************************************************/
> +package org.ofbiz.pos.screen;
> +
> +import java.util.Hashtable;
> +import java.util.Iterator;
> +import java.util.Locale;
> +import java.util.Map;
> +
> +import javax.swing.DefaultListModel;
> +import javax.swing.ListSelectionModel;
> +
> +import net.xoetrope.swing.XButton;
> +import net.xoetrope.swing.XDialog;
> +import net.xoetrope.swing.XList;
> +import net.xoetrope.xui.XPage;
> +
> +import org.ofbiz.base.util.Debug;
> +import org.ofbiz.base.util.UtilProperties;
> +import org.ofbiz.pos.PosTransaction;
> +
> +
> +public class LoadSale extends XPage {
> +
> +    /**
> +     * To load a sale from a shopping list. 2 modes : add to or replace the current sale. Also a button to delete a sale (aka
shopping list)
> +     */
> +    public static final String module = LoadSale.class.getName();
> +    protected static PosScreen m_pos = null;
> +    protected XDialog m_dialog = null;
> +    static protected Hashtable m_saleMap = new Hashtable();
> +    protected XList m_salesList = null;
> +    protected XButton m_cancel = null;
> +    protected XButton m_add = null;
> +    protected XButton m_replace = null;
> +    protected XButton m_delete = null;
> +    protected XButton m_replaceAndDelete = null;
> +    protected DefaultListModel m_listModel = null;
> +    protected static PosTransaction m_trans = null;
> +
> +    //TODO : make getter and setter for members (ie m_*) if needed (extern calls). For that in Eclipse use Source/Generate
Getters and setters
> +
> +    public LoadSale(Hashtable saleMap, PosTransaction trans, PosScreen page) {
> +        m_saleMap.putAll(saleMap);
> +        m_trans = trans;
> +        m_pos = page;
> +    }
> +
> +    public void openDlg() {
> +        m_dialog = (XDialog) pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/loadsale");
> +        m_dialog.setCaption(UtilProperties.getMessage("pos", "LoadASale", Locale.getDefault()));
> +        m_salesList = (XList) m_dialog.findComponent("salesList");
> +        addMouseHandler(m_salesList, "saleDoubleClick");
> +
> +        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
> +        m_add = (XButton) m_dialog.findComponent("BtnAdd");
> +        m_replace = (XButton) m_dialog.findComponent("BtnReplace");
> +        m_delete = (XButton) m_dialog.findComponent("BtnDelete");
> +        m_replaceAndDelete = (XButton) m_dialog.findComponent("BtnReplaceAndDelete");
> +        addMouseHandler(m_cancel, "cancel");
> +        addMouseHandler(m_add, "addSale");
> +        addMouseHandler(m_replace, "replaceSale");
> +        addMouseHandler(m_delete, "deleteShoppingList");
> +        addMouseHandler(m_replaceAndDelete, "replaceSaleAndDeleteShoppingList");
> +
> +        m_listModel = new DefaultListModel();
> +        for (Iterator i = m_saleMap.entrySet().iterator(); i.hasNext();) {
> +            Object o = i.next();
> +            Map.Entry entry = (Map.Entry)o;
> +            String val = entry.getValue().toString();
> +            m_listModel.addElement(val);
> +        }
> +        m_salesList.setModel(m_listModel);
> +        m_salesList.setVisibleRowCount(-1);
> +        m_salesList.ensureIndexIsVisible(m_salesList.getItemCount());
> +        m_salesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
> +        m_salesList.setToolTipText(UtilProperties.getMessage("pos", "LoadSaleListDblClickTip", Locale.getDefault()));
> +
> +        m_dialog.pack();
> +        m_salesList.requestFocusInWindow();
> +        m_dialog.showDialog(this);
> +    }
> +
> +    public synchronized void saleDoubleClick() {
> +        if (wasMouseDoubleClicked()) {
> +            String sale = selectedSale();
> +            if (null != sale) {
> +                replaceSaleAndDeleteShoppingList_();
> +            }
> +        }
> +    }
> +
> +    public synchronized void cancel() {
> +        if (wasMouseClicked()) {
> +            closeDlg();
> +        }
> +    }
> +
> +    public synchronized void addSale() {
> +        if (wasMouseClicked()) {
> +            addSale_();
> +        }
> +    }
> +
> +    private synchronized void addSale_() {
> +        String sale = selectedSale();
> +        if (null != sale) {
> +            addListToCart(sale, true);
> +        }
> +    }
> +
> +    public synchronized void replaceSale() {
> +        if (wasMouseClicked()) {
> +            replaceSale_();
> +        }
> +    }
> +
> +    private synchronized void replaceSale_() {
> +        String sale = selectedSale();
> +        if (null != sale) {
> +            addListToCart(sale, false);
> +        }
> +    }
> +
> +    public synchronized void deleteShoppingList() {
> +        if (wasMouseClicked()) {
> +            deleteShoppingList_();
> +        }
> +    }
> +
> +    private synchronized void deleteShoppingList_() {
> +        String sale= (String) m_salesList.getSelectedValue();
> +        if (null != sale) {
> +            String shoppingListId = selectedSale();
> +            final ClassLoader cl = this.getClassLoader(m_pos);
> +            Thread.currentThread().setContextClassLoader(cl);
> +            if (m_trans.clearList(shoppingListId, m_pos)) {
> +                int index = m_salesList.getSelectedIndex();
> +                m_saleMap.remove(shoppingListId);
> +                m_listModel = new DefaultListModel();
> +                for (Iterator i = m_saleMap.entrySet().iterator(); i.hasNext();) {
> +                    Object o = i.next();
> +                    Map.Entry entry = (Map.Entry)o;
> +                    String val = entry.getValue().toString();
> +                    m_listModel.addElement(val);
> +                }
> +                m_salesList.setModel(m_listModel);
> +                int size = m_listModel.getSize();
> +                if (size == 0) { //Nobody's left, nothing to do here
> +                    closeDlg();
> +                } else { //Select an index.
> +                    if (index == size) {
> +                        //removed item in last position
> +                        index--;
> +                    }
> +                }
> +                m_salesList.setSelectedIndex(index);
> +                m_salesList.ensureIndexIsVisible(index);
> +                m_salesList.repaint();
> +                repaint();
> +            }
> +        }
> +    }
> +
> +    public synchronized void replaceSaleAndDeleteShoppingList() {
> +        if (wasMouseClicked()) {
> +            replaceSaleAndDeleteShoppingList_();
> +        }
> +    }
> +
> +    public synchronized void replaceSaleAndDeleteShoppingList_() {
> +        replaceSale_();
> +        deleteShoppingList_();
> +    }
> +
> +    private String selectedSale() {
> +        String saleSelected = null;
> +        if (null != m_salesList.getSelectedValue()) {
> +            String sale = (String) m_salesList.getSelectedValue();
> +            Iterator i = m_saleMap.entrySet().iterator();
> +            while(i.hasNext()) {
> +                Object o = i.next();
> +                Map.Entry entry = (Map.Entry)o;
> +                String val = entry.getValue().toString();
> +                if (val.equals(sale)) {
> +                    saleSelected = entry.getKey().toString();
> +                }
> +            }
> +        }
> +        return saleSelected;
> +    }
> +
> +    private void addListToCart(String sale, boolean addToCart) {
> +        final ClassLoader cl = this.getClassLoader(m_pos);
> +        Thread.currentThread().setContextClassLoader(cl);
> +        if (!m_trans.addListToCart(sale, m_pos, addToCart)) {
> +            Debug.logError("Error while loading cart from shopping list : " + sale, module);
> +        }
> +        else {
> +            m_trans.calcTax();
> +            m_pos.refresh();
> +        }
> +        closeDlg();
> +    }
> +
> +    private ClassLoader getClassLoader(PosScreen pos) {
> +        ClassLoader cl = pos.getClassLoader();
> +        if (cl == null) {
> +            try {
> +                cl = Thread.currentThread().getContextClassLoader();
> +            } catch (Throwable t) {
> +            }
> +            if (cl == null) {
> +                Debug.log("No context classloader available; using class classloader", module);
> +                try {
> +                    cl = this.getClass().getClassLoader();
> +                } catch (Throwable t) {
> +                    Debug.logError(t, module);
> +                }
> +            }
> +        }
> +        return cl;
> +    }
> +
> +    private void closeDlg() {
> +        m_dialog.closeDlg();
> +    }
>  }
>
> Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java?view=diff&rev=497618&r1=497617&r2=497618
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java (original)
> +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java Thu Jan 18 14:55:50 2007
> @@ -1,129 +1,129 @@
> -/*******************************************************************************
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements.  See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership.  The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License.  You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied.  See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *******************************************************************************/
> -package org.ofbiz.pos.screen;
> -
> -import java.text.SimpleDateFormat;
> -import java.util.Date;
> -import java.util.Locale;
> -
> -import net.xoetrope.swing.XButton;
> -//import org.ofbiz.pos.screen.XFocusDialog;
> -import net.xoetrope.swing.XEdit;
> -import net.xoetrope.swing.XDialog;
> -import net.xoetrope.xui.XPage;
> -
> -import org.ofbiz.base.util.Debug;
> -import org.ofbiz.base.util.UtilProperties;
> -import org.ofbiz.pos.PosTransaction;
> -
> -
> -public class SaveSale extends XPage {
> -
> -    /**
> -     * To save a sale. 2 modes : save and keep the current sale or save and clear the current sale.
> -     */
> -    public static final String module = SaveSale.class.getName();
> -    protected static PosScreen m_pos = null;
> -    protected XDialog m_dialog = null;
> -    protected XEdit m_saleName = null;
> -    protected XButton m_cancel = null;
> -    protected XButton m_save = null;
> -    protected XButton m_saveAndClear = null;
> -    protected static PosTransaction m_trans = null;
> -    public static SimpleDateFormat sdf = new
SimpleDateFormat(UtilProperties.getMessage("pos","DateTimeFormat",Locale.getDefault()));
> -
> -    //TODO : make getter and setter for members (ie m_*) if needed (extern calls).  For that in Eclipse use Source/Generate
Getters and setters
> -
> -    public SaveSale(PosTransaction trans, PosScreen page) {
> -        m_trans = trans;
> -        m_pos = page;
> -    }
> -
> -    public void openDlg() {
> -        m_dialog = (XDialog) pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/savesale");
> -        m_saleName = (XEdit) m_dialog.findComponent("saleName");
> -        //m_dialog.setM_focused(m_saleName);
> -        m_saleName.setText(m_pos.session.getUserId() + " " + sdf.format(new Date()));
> -        m_dialog.setCaption(UtilProperties.getMessage("pos", "SaveASale", Locale.getDefault()));
> -
> -        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
> -        m_save = (XButton) m_dialog.findComponent("BtnSave");
> -        m_saveAndClear = (XButton) m_dialog.findComponent("BtnSaveAndClear");
> -
> -        addMouseHandler(m_cancel, "cancel");
> -        addMouseHandler(m_save, "save");
> -        addMouseHandler(m_saveAndClear, "saveAndClear");
> -
> -        m_dialog.pack();
> -        m_dialog.showDialog(this);
> -    }
> -
> -    public synchronized void cancel()
> -    {
> -        if (wasMouseClicked()) {
> -            this.m_dialog.closeDlg();
> -        }
> -    }
> -
> -    public synchronized void save() {
> -        if (wasMouseClicked()) {
> -            String sale = m_saleName.getText();
> -            if (null != sale) {
> -                saveSale(sale);
> -            }
> -        }
> -    }
> -
> -    public synchronized void saveAndClear() {
> -        if (wasMouseClicked()) {
> -            String sale = m_saleName.getText();
> -            if (null != sale) {
> -                saveSale(sale);
> -                m_trans.voidSale();
> -                m_pos.refresh();
> -            }
> -        }
> -    }
> -
> -    private void saveSale(String sale) {
> -        final ClassLoader cl = this.getClassLoader(m_pos);
> -        Thread.currentThread().setContextClassLoader(cl);
> -        m_trans.saveSale(sale, m_pos);
> -        this.m_dialog.closeDlg();
> -    }
> -
> -    private ClassLoader getClassLoader(PosScreen pos) {
> -        ClassLoader cl = pos.getClassLoader();
> -        if (cl == null) {
> -            try {
> -                cl = Thread.currentThread().getContextClassLoader();
> -            } catch (Throwable t) {
> -            }
> -            if (cl == null) {
> -                Debug.log("No context classloader available; using class classloader", module);
> -                try {
> -                    cl = this.getClass().getClassLoader();
> -                } catch (Throwable t) {
> -                    Debug.logError(t, module);
> -                }
> -            }
> -        }
> -        return cl;
> -    }
> +/*******************************************************************************
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License.  You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied.  See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + *******************************************************************************/
> +package org.ofbiz.pos.screen;
> +
> +import java.text.SimpleDateFormat;
> +import java.util.Date;
> +import java.util.Locale;
> +
> +import net.xoetrope.swing.XButton;
> +//import org.ofbiz.pos.screen.XFocusDialog;
> +import net.xoetrope.swing.XEdit;
> +import net.xoetrope.swing.XDialog;
> +import net.xoetrope.xui.XPage;
> +
> +import org.ofbiz.base.util.Debug;
> +import org.ofbiz.base.util.UtilProperties;
> +import org.ofbiz.pos.PosTransaction;
> +
> +
> +public class SaveSale extends XPage {
> +
> +    /**
> +     * To save a sale. 2 modes : save and keep the current sale or save and clear the current sale.
> +     */
> +    public static final String module = SaveSale.class.getName();
> +    protected static PosScreen m_pos = null;
> +    protected XDialog m_dialog = null;
> +    protected XEdit m_saleName = null;
> +    protected XButton m_cancel = null;
> +    protected XButton m_save = null;
> +    protected XButton m_saveAndClear = null;
> +    protected static PosTransaction m_trans = null;
> +    public static SimpleDateFormat sdf = new
SimpleDateFormat(UtilProperties.getMessage("pos","DateTimeFormat",Locale.getDefault()));
> +
> +    //TODO : make getter and setter for members (ie m_*) if needed (extern calls).  For that in Eclipse use Source/Generate
Getters and setters
> +
> +    public SaveSale(PosTransaction trans, PosScreen page) {
> +        m_trans = trans;
> +        m_pos = page;
> +    }
> +
> +    public void openDlg() {
> +        m_dialog = (XDialog) pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/savesale");
> +        m_saleName = (XEdit) m_dialog.findComponent("saleName");
> +        //m_dialog.setM_focused(m_saleName);
> +        m_saleName.setText(m_pos.session.getUserId() + " " + sdf.format(new Date()));
> +        m_dialog.setCaption(UtilProperties.getMessage("pos", "SaveASale", Locale.getDefault()));
> +
> +        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
> +        m_save = (XButton) m_dialog.findComponent("BtnSave");
> +        m_saveAndClear = (XButton) m_dialog.findComponent("BtnSaveAndClear");
> +
> +        addMouseHandler(m_cancel, "cancel");
> +        addMouseHandler(m_save, "save");
> +        addMouseHandler(m_saveAndClear, "saveAndClear");
> +
> +        m_dialog.pack();
> +        m_dialog.showDialog(this);
> +    }
> +
> +    public synchronized void cancel()
> +    {
> +        if (wasMouseClicked()) {
> +            this.m_dialog.closeDlg();
> +        }
> +    }
> +
> +    public synchronized void save() {
> +        if (wasMouseClicked()) {
> +            String sale = m_saleName.getText();
> +            if (null != sale) {
> +                saveSale(sale);
> +            }
> +        }
> +    }
> +
> +    public synchronized void saveAndClear() {
> +        if (wasMouseClicked()) {
> +            String sale = m_saleName.getText();
> +            if (null != sale) {
> +                saveSale(sale);
> +                m_trans.voidSale();
> +                m_pos.refresh();
> +            }
> +        }
> +    }
> +
> +    private void saveSale(String sale) {
> +        final ClassLoader cl = this.getClassLoader(m_pos);
> +        Thread.currentThread().setContextClassLoader(cl);
> +        m_trans.saveSale(sale, m_pos);
> +        this.m_dialog.closeDlg();
> +    }
> +
> +    private ClassLoader getClassLoader(PosScreen pos) {
> +        ClassLoader cl = pos.getClassLoader();
> +        if (cl == null) {
> +            try {
> +                cl = Thread.currentThread().getContextClassLoader();
> +            } catch (Throwable t) {
> +            }
> +            if (cl == null) {
> +                Debug.log("No context classloader available; using class classloader", module);
> +                try {
> +                    cl = this.getClass().getClassLoader();
> +                } catch (Throwable t) {
> +                    Debug.logError(t, module);
> +                }
> +            }
> +        }
> +        return cl;
> +    }
>  }
>


Re: svn commit: r497618 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/order/ applications/order/src/org/ofbiz/order/shoppingcart/ applications/order/src/org/ofbiz/order/shoppinglist/ applications/product/src/org/ofbiz/product/store/ specialpurp

Posted by Jacques Le Roux <ja...@les7arts.com>.
Jonathon,

Have to be done now, depends on changes made in main trunk, trivial anyway.

Jacques

----- Original Message ----- 
From: "Jonathon -- Improov" <jo...@improov.com>
To: <de...@ofbiz.apache.org>
Cc: "Tom Anderson" <to...@spaceagecontrol.com>
Sent: Friday, January 19, 2007 11:25 AM
Subject: Re: svn commit: r497618 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/order/
applications/order/src/org/ofbiz/order/shoppingcart/ applications/order/src/org/ofbiz/order/shoppinglist/
applications/product/src/org/ofbiz/product/store/ specialpurp


> Hey no! Don't! David's right. Add a layer of indirection. Add an overloaded method. Insulate the
> change. Please.
>
> Hmm. David, any plans to start effort on testing and auditing OFBiz to roll out release branches?
> Couldn't... couldn't we work on experimental branches for a short time before merging back to trunk?
>
> Jonathon
>
> David E. Jones wrote:
> >
> > Seriously though, what was the point of switching those parameters? Was
> > it really worth breaking backward compatibility? My opinion: no, it's
> > not worth it.
> >
> > -David
> >
> >
> > On Jan 19, 2007, at 12:57 AM, Jacques Le Roux wrote:
> >
> >> Si,
> >>
> >> You will have to change
> >>
> >> \crmsfa\src\com\opensourcestrategies\crmsfa\orders\CrmsfaOrderEvents.java:181
> >>
> >> and
> >>
> >> \crmsfa\src\com\opensourcestrategies\crmsfa\orders\CrmsfaOrderEvents.java:275
> >>
> >>
> >> for
> >>    cart.addOrIncreaseItem(productId, null, 1, null, null, null, null,
> >> null, null, null, null, null, null, null, dispatcher, null);
> >> to
> >>    cart.addOrIncreaseItem(productId, null, 1, null, null, null, null,
> >> null, null, null, null, null, null, null, null, dispatcher);
> >>
> >> Thanks
> >>
> >> Jacques
> >>
> >> ----- Original Message -----
> >> From: <jl...@apache.org>
> >> To: <co...@ofbiz.apache.org>
> >> Sent: Thursday, January 18, 2007 11:55 PM
> >> Subject: svn commit: r497618 - in /ofbiz/trunk:
> >> applications/order/src/org/ofbiz/order/order/
> >> applications/order/src/org/ofbiz/order/shoppingcart/
> >> applications/order/src/org/ofbiz/order/shoppinglist/
> >> applications/product/src/org/ofbiz/product/store/ specialpurp...
> >>
> >>
> >>> Author: jleroux
> >>> Date: Thu Jan 18 14:55:50 2007
> >>> New Revision: 497618
> >>>
> >>> URL: http://svn.apache.org/viewvc?view=rev&rev=497618
> >>> Log:
> >>> Some enhancements suggested by Si for commit 495945
> >>>
> >>> Modified:
> >>>
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
> >>>
> >>>
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
> >>>
> >>>
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
> >>>
> >>>
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
> >>>
> >>>
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
> >>>
> >>>
> >>> ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
> >>>
> >>>     ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
> >>>
> >>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/LoadSale.java
> >>>
> >>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java
> >>>
> >>> 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=497618&r1=497617&r2=497618
> >>
> >>> ==============================================================================
> >>>
> >>> --- 
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
> >>> (original)
> >>> +++
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
> >>> Thu Jan 18 14:55:50 2007
> >>> @@ -3415,7 +3415,7 @@
> >>>          Locale locale = (Locale) context.get("locale");
> >>>          ShoppingCart cart = new ShoppingCart(dctx.getDelegator(),
> >>> "9000", "webStore", locale, "USD");
> >>>          try {
> >>> -            cart.addOrIncreaseItem("GZ-1005", null, 1, null, null,
> >>> null, null, null, null, null, "DemoCatalog", null, null, null,
> >> dctx.getDispatcher(),null);
> >>> +            cart.addOrIncreaseItem("GZ-1005", null, 1, null, null,
> >>> null, null, null, null, null, "DemoCatalog", null, null, null,
> >> null, dctx.getDispatcher());
> >>>              } catch (CartItemModifyException e) {
> >>>              Debug.logError(e, module);
> >>>          } catch (ItemNotFoundException e) {
> >>> @@ -3653,7 +3653,7 @@
> >>>
> >>>    item.getTimestamp("shipAfterDate"),
> >>>
> >>>    null, null, null,
> >>>
> >>>    null, null, null,
> >>> -
> >>>    dispatcher, null);
> >>> +
> >>>    null, dispatcher);
> >>>                                  ShoppingCartItem sci =
> >>> cart.findCartItem(itemIndex);
> >>>                                  sci.setAssociatedOrderId(orderId);
> >>>
> >>> sci.setAssociatedOrderItemSeqId(item.getString("orderItemSeqId"));
> >>>
> >>> 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=497618&r1=497617&r2=497618
> >>
> >>> ==============================================================================
> >>>
> >>> --- 
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
> >>> (original)
> >>> +++
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
> >>> Thu Jan 18 14:55:50 2007
> >>> @@ -444,7 +444,7 @@
> >>>       */
> >>>      public int addOrIncreaseItem(String productId, Double
> >>> selectedAmountDbl, double quantity, Timestamp reservStart, Double
> >> reservLengthDbl, Double reservPersonsDbl,
> >>>              Timestamp shipBeforeDate, Timestamp shipAfterDate, Map
> >>> features, Map attributes, String prodCatalogId,
> >>> -            ProductConfigWrapper configWrapper, String itemType,
> >>> String itemGroupNumber, LocalDispatcher dispatcher, String
> >> parentProductId) throws CartItemModifyException, ItemNotFoundException {
> >>> +            ProductConfigWrapper configWrapper, String itemType,
> >>> String itemGroupNumber, String parentProductId, LocalDispatcher
> >> dispatcher) throws CartItemModifyException, ItemNotFoundException {
> >>>          if (isReadOnlyCart()) {
> >>>             throw new CartItemModifyException("Cart items cannot be
> >>> changed");
> >>>          }
> >>>
> >>> Modified:
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
> >>>
> >>> URL:
> >>
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?view=diff&rev=497618&r1=497617&r2=497618
> >>
> >>> ==============================================================================
> >>>
> >>> --- 
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
> >>> (original)
> >>> +++
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
> >>> Thu Jan 18 14:55:50 2007
> >>> @@ -119,7 +119,7 @@
> >>>              try {
> >>>                  java.sql.Timestamp.valueOf((String)
> >>> context.get("itemDesiredDeliveryDate"));
> >>>              } catch (IllegalArgumentException e) {
> >>> -            return
> >>
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderInvalidDesiredDeliveryDateSyntaxError",this.cart.getLocale())
> >>
> >> );
> >>> +                return
> >>
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderInvalidDesiredDeliveryDateSyntaxError",this.cart.getLocale())
> >>
> >> );
> >>>              }
> >>>          } else {
> >>>              context.remove("itemDesiredDeliveryDate");
> >>> @@ -180,7 +180,7 @@
> >>>              if (productId != null) {
> >>>                  itemId = cart.addOrIncreaseItem(productId, amount,
> >>> quantity, reservStart, reservLength,
> >>>                                                  reservPersons,
> >>> shipBeforeDate, shipAfterDate, null, attributes,
> >>> -                                                catalogId,
> >>> configWrapper, itemType, itemGroupNumber, dispatcher, pProductId);
> >>> +                                                catalogId,
> >>> configWrapper, itemType, itemGroupNumber, pProductId, dispatcher);
> >>>              } else {
> >>>                  itemId = cart.addNonProductItem(itemType,
> >>> itemDescription, productCategoryId, price, quantity, attributes,
> >> catalogId, itemGroupNumber, dispatcher);
> >>>              }
> >>> @@ -245,7 +245,7 @@
> >>>                          Double amount =
> >>> orderItem.getDouble("selectedAmount");
> >>>                          try {
> >>>
> >>> this.cart.addOrIncreaseItem(orderItem.getString("productId"), amount,
> >> orderItem.getDouble("quantity").doubleValue(),
> >>> -                                    null, null, null, null, null,
> >>> null, null, catalogId, null, orderItemTypeId, itemGroupNumber,
> >> dispatcher,null);
> >>> +                                    null, null, null, null, null,
> >>> null, null, catalogId, null, orderItemTypeId, itemGroupNumber,
> >> null, dispatcher);
> >>>                              noItems = false;
> >>>                          } catch (CartItemModifyException e) {
> >>>                              errorMsgs.add(e.getMessage());
> >>> @@ -283,7 +283,7 @@
> >>>                              try {
> >>>
> >>> this.cart.addOrIncreaseItem(orderItem.getString("productId"), amount,
> >>>
> >>> orderItem.getDouble("quantity").doubleValue(), null, null, null,
> >>> null, null, null, null,
> >>> -                                        catalogId, null,
> >>> orderItem.getString("orderItemTypeId"), itemGroupNumber, dispatcher,
> >> null);
> >>> +                                        catalogId, null,
> >>> orderItem.getString("orderItemTypeId"), itemGroupNumber, null,
> >> dispatcher);
> >>>                                  noItems = false;
> >>>                              } catch (CartItemModifyException e) {
> >>>                                  errorMsgs.add(e.getMessage());
> >>> @@ -372,7 +372,7 @@
> >>>                  if (quantity > 0.0) {
> >>>                      try {
> >>>                          if (Debug.verboseOn())
> >>> Debug.logVerbose("Bulk Adding to cart [" + quantity + "] of [" +
> >>> productId + "] in
> >> Item Group [" + itemGroupNumber + "]", module);
> >>> -                        this.cart.addOrIncreaseItem(productId, null,
> >>> quantity, null, null, null, null, null, null, null,
> >> catalogId, null, null, itemGroupNumberToUse, dispatcher, null);
> >>> +                        this.cart.addOrIncreaseItem(productId, null,
> >>> quantity, null, null, null, null, null, null, null,
> >> catalogId, null, null, itemGroupNumberToUse, null, dispatcher);
> >>>                      } catch (CartItemModifyException e) {
> >>>                          return ServiceUtil.returnError(e.getMessage());
> >>>                      } catch (ItemNotFoundException e) {
> >>> @@ -451,7 +451,7 @@
> >>>                          }
> >>>                          try {
> >>>                              if (Debug.verboseOn())
> >>> Debug.logVerbose("Bulk Adding to cart requirement [" + quantity + "]
> >>> of [" +
> >> productId + "]", module);
> >>> -                            int index =
> >>> this.cart.addOrIncreaseItem(productId, null, quantity, null, null,
> >>> null, null, null,
> >> null, null, catalogId, null, null, itemGroupNumber, dispatcher, null);
> >>> +                            int index =
> >>> this.cart.addOrIncreaseItem(productId, null, quantity, null, null,
> >>> null, null, null,
> >> null, null, catalogId, null, null, itemGroupNumber, null, dispatcher);
> >>>                              ShoppingCartItem sci =
> >>> (ShoppingCartItem)this.cart.items().get(index);
> >>>                              sci.setRequirementId(requirementId);
> >>>                          } catch (CartItemModifyException e) {
> >>> @@ -478,7 +478,7 @@
> >>>          String errMsg = null;
> >>>
> >>>          if (categoryId == null || categoryId.length() <= 0) {
> >>> -        errMsg =
> >>> UtilProperties.getMessage(resource,"cart.category_not_specified_to_add_from",
> >>> this.cart.getLocale());
> >>> +            errMsg =
> >>> UtilProperties.getMessage(resource,"cart.category_not_specified_to_add_from",
> >>> this.cart.getLocale());
> >>>              result = ServiceUtil.returnError(errMsg);
> >>>  //          result =
> >> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderNoCategorySpecifiedToAddFrom.",this.cart.getLocale()));
> >>
> >>>              return result;
> >>> @@ -515,7 +515,7 @@
> >>>                  try {
> >>>
> >>> this.cart.addOrIncreaseItem(productCategoryMember.getString("productId"),
> >>>
> >>>                              null, quantity.doubleValue(), null,
> >>> null, null, null, null, null, null,
> >>> -                            catalogId, null, null, itemGroupNumber,
> >>> dispatcher, null);
> >>> +                            catalogId, null, null, itemGroupNumber,
> >>> null, dispatcher);
> >>>                      totalQuantity += quantity.doubleValue();
> >>>                  } catch (CartItemModifyException e) {
> >>>                      errorMsgs.add(e.getMessage());
> >>> @@ -870,12 +870,12 @@
> >>>          GenericValue agreement = null;
> >>>
> >>>          if ((this.delegator == null) || (this.dispatcher == null) ||
> >>> (this.cart == null)) {
> >>> -        result =
> >>
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderDispatcherOrDelegatorOrCartArgumentIsNull",this.cart.getLocal
> >>
> >> e()));
> >>> +            result =
> >>
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderDispatcherOrDelegatorOrCartArgumentIsNull",this.cart.getLocal
> >>
> >> e()));
> >>>              return result;
> >>>          }
> >>>
> >>>          if ((agreementId == null) || (agreementId.length() <= 0)) {
> >>> -        result =
> >> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderNoAgreementSpecified",this.cart.getLocale()));
> >>
> >>> +            result =
> >> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderNoAgreementSpecified",this.cart.getLocale()));
> >>
> >>>              return result;
> >>>          }
> >>>
> >>> @@ -888,7 +888,7 @@
> >>>          }
> >>>
> >>>          if (agreement == null) {
> >>> -        result =
> >>
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderCouldNotGetAgreement",UtilMisc.toMap("agreementId",agreementI
> >>
> >> d),this.cart.getLocale()));
> >>> +            result =
> >>
ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderCouldNotGetAgreement",UtilMisc.toMap("agreementId",agreementI
> >>
> >> d),this.cart.getLocale()));
> >>>          } else {
> >>>              // set the agreement id in the cart
> >>>              cart.setAgreementId(agreementId);
> >>> @@ -901,7 +901,7 @@
> >>>                         try {
> >>>                              cart.setCurrency(dispatcher,currencyUomId);
> >>>                         } catch (CartItemModifyException ex) {
> >>> -                       result =
> >> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderSetCurrencyError",this.cart.getLocale())
> >> + ex.getMessage());
> >>> +                           result =
> >> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderSetCurrencyError",this.cart.getLocale())
> >> + ex.getMessage());
> >>>                              return result;
> >>>                         }
> >>>                   }
> >>> @@ -941,7 +941,7 @@
> >>>              this.cart.setCurrency(this.dispatcher,currencyUomId);
> >>>              result = ServiceUtil.returnSuccess();
> >>>           } catch (CartItemModifyException ex) {
> >>> -         result =
> >>> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"Set
> >>> currency error",this.cart.getLocale()) +
> >> ex.getMessage());
> >>> +             result =
> >>> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"Set
> >>> currency
> >> error",this.cart.getLocale()) + ex.getMessage());
> >>>               return result;
> >>>           }
> >>>          return result;
> >>> @@ -972,7 +972,7 @@
> >>>                  productSupplier=(GenericValue) productSuppliers.get(0);
> >>>              }
> >>>          } catch (GenericServiceException e) {
> >>> -
> >>> Debug.logWarning(UtilProperties.getMessage(resource_error,"OrderRunServiceGetSuppliersForProductError",
> >>> cart.getLocale())
> >> + e.getMessage(), module);
> >>> +
> >>> Debug.logWarning(UtilProperties.getMessage(resource_error,"OrderRunServiceGetSuppliersForProductError",
> >>>
> >> cart.getLocale()) + e.getMessage(), module);
> >>>          }
> >>>          return productSupplier;
> >>>      }
> >>>
> >>> Modified:
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
> >>>
> >>> URL:
> >>
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java?view=diff&rev=497618&r1=497617&r2=497618
> >>
> >>> ==============================================================================
> >>>
> >>> --- 
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
> >>> (original)
> >>> +++
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
> >>> Thu Jan 18 14:55:50 2007
> >>> @@ -273,9 +273,9 @@
> >>>
> >>>                  // i cannot get the addOrDecrease function to accept
> >>> a null reservStart field: i get a null pointer exception a
> >> null constant works....
> >>>                  if (reservStart == null) {
> >>> -                    cart.addOrIncreaseItem(productId, null,
> >>> quantity.doubleValue(), null, null, null, null, null, null,
> >> attributes, prodCatalogId, null, null, null, dispatcher, null);
> >>> +                    cart.addOrIncreaseItem(productId, null,
> >>> quantity.doubleValue(), null, null, null, null, null, null,
> >> attributes, prodCatalogId, null, null, null, null, dispatcher);
> >>>                  } else {
> >>> -                    cart.addOrIncreaseItem(productId, null,
> >>> quantity.doubleValue(), reservStart, reservLength, reservPersons,
> >> null, null, null, attributes, prodCatalogId, null, null, null,
> >> dispatcher, null);
> >>> +                    cart.addOrIncreaseItem(productId, null,
> >>> quantity.doubleValue(), reservStart, reservLength, reservPersons,
> >> null, null, null, attributes, prodCatalogId, null, null, null, null,
> >> dispatcher);
> >>>                  }
> >>>                  Map messageMap = UtilMisc.toMap("productId",
> >>> productId);
> >>>                  errMsg =
> >>> UtilProperties.getMessage(resource,"shoppinglistevents.added_product_to_cart",
> >>> messageMap,
> >> cart.getLocale());
> >>>
> >>> Modified:
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
> >>>
> >>> URL:
> >>
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java?view=diff&rev=497618&r1=497617&r2=497618
> >>
> >>> ==============================================================================
> >>>
> >>> --- 
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
> >>> (original)
> >>> +++
> >>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
> >>> Thu Jan 18 14:55:50 2007
> >>> @@ -442,7 +442,7 @@
> >>>                          Map attributes =
> >>> UtilMisc.toMap("shoppingListId", listId, "shoppingListItemSeqId",
> >>> itemId);
> >>>
> >>>                          try {
> >>> -                            listCart.addOrIncreaseItem(productId,
> >>> null, quantity.doubleValue(), reservStart, reservLength,
> >> reservPersons, null, null, null, attributes, null, null, null, null,
> >> dispatcher, null);
> >>> +                            listCart.addOrIncreaseItem(productId,
> >>> null, quantity.doubleValue(), reservStart, reservLength,
> >> reservPersons, null, null, null, attributes, null, null, null, null,
> >> null, dispatcher);
> >>>                          } catch (CartItemModifyException e) {
> >>>                              Debug.logError(e, "Unable to add product
> >>> to List Cart - " + productId, module);
> >>>                          } catch (ItemNotFoundException e) {
> >>>
> >>> Modified:
> >>> ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
> >>>
> >>> URL:
> >>
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java?view=diff&rev=497618&r1=497617&r2=497618
> >>
> >>> ==============================================================================
> >>>
> >>> --- 
> >>> ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
> >>> (original)
> >>> +++
> >>> ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
> >>> Thu Jan 18 14:55:50 2007
> >>> @@ -470,10 +470,12 @@
> >>>                  try {
> >>>                      product =
> >>> delegator.findByPrimaryKeyCache("Product",
> >>> UtilMisc.toMap("productId", productId));
> >>>                      if ((product != null) &&
> >>> ("Y".equals(product.get("isVariant")))) {
> >>> -                        if (parentProductId != null)
> >>> +                        if (parentProductId != null) {
> >>>                              virtualProductId = parentProductId;
> >>> -                        else
> >>> +                        }
> >>> +                        else {
> >>>                              virtualProductId =
> >>> ProductWorker.getVariantVirtualId(product);
> >>> +                        }
> >>>                          Debug.log("getSurvey for virtual product " +
> >>> virtualProductId,module);
> >>>                      }
> >>>                  } catch (GenericEntityException e) {
> >>>
> >>> 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?view=diff&rev=497618&r1=497617&r2=497618
> >>
> >>> ==============================================================================
> >>>
> >>> --- 
> >>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
> >>> (original)
> >>> +++
> >>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
> >>> Thu Jan 18 14:55:50 2007
> >>> @@ -355,7 +355,7 @@
> >>>      public void addItem(String productId, double quantity) throws
> >>> CartItemModifyException, ItemNotFoundException {
> >>>          trace("add item", productId + "/" + quantity);
> >>>          try {
> >>> -            cart.addOrIncreaseItem(productId, null, quantity, null,
> >>> null, null, null, null, null, null, null, null, null, null,
> >> session.getDispatcher(), null);
> >>> +            cart.addOrIncreaseItem(productId, null, quantity, null,
> >>> null, null, null, null, null, null, null, null, null, null,
> >> null, session.getDispatcher());
> >>>          } catch (ItemNotFoundException e) {
> >>>              trace("item not found", e);
> >>>              throw e;
> >>>
> >>> Modified:
> >>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/LoadSale.java
> >>> URL:
> >>
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/LoadSale.java?view=diff&rev=497618&r1=497617&r2=497618
> >>
> >>> ==============================================================================
> >>>
> >>> --- 
> >>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/LoadSale.java
> >>> (original)
> >>> +++
> >>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/LoadSale.java
> >>> Thu Jan 18 14:55:50 2007
> >>> @@ -1,244 +1,244 @@
> >>> -/*******************************************************************************
> >>>
> >>> - * Licensed to the Apache Software Foundation (ASF) under one
> >>> - * or more contributor license agreements.  See the NOTICE file
> >>> - * distributed with this work for additional information
> >>> - * regarding copyright ownership.  The ASF licenses this file
> >>> - * to you under the Apache License, Version 2.0 (the
> >>> - * "License"); you may not use this file except in compliance
> >>> - * with the License.  You may obtain a copy of the License at
> >>> - *
> >>> - * http://www.apache.org/licenses/LICENSE-2.0
> >>> - *
> >>> - * Unless required by applicable law or agreed to in writing,
> >>> - * software distributed under the License is distributed on an
> >>> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> >>> - * KIND, either express or implied.  See the License for the
> >>> - * specific language governing permissions and limitations
> >>> - * under the License.
> >>> -
> >>> *******************************************************************************/
> >>>
> >>> -package org.ofbiz.pos.screen;
> >>> -
> >>> -import java.util.Hashtable;
> >>> -import java.util.Iterator;
> >>> -import java.util.Locale;
> >>> -import java.util.Map;
> >>> -
> >>> -import javax.swing.DefaultListModel;
> >>> -import javax.swing.ListSelectionModel;
> >>> -
> >>> -import net.xoetrope.swing.XButton;
> >>> -import net.xoetrope.swing.XDialog;
> >>> -import net.xoetrope.swing.XList;
> >>> -import net.xoetrope.xui.XPage;
> >>> -
> >>> -import org.ofbiz.base.util.Debug;
> >>> -import org.ofbiz.base.util.UtilProperties;
> >>> -import org.ofbiz.pos.PosTransaction;
> >>> -
> >>> -
> >>> -public class LoadSale extends XPage {
> >>> -
> >>> -    /**
> >>> -     * To load a sale from a shopping list. 2 modes : add to or
> >>> replace the current sale. Also a button to delete a sale (aka
> >> shopping list)
> >>> -     */
> >>> -    public static final String module = LoadSale.class.getName();
> >>> -    protected static PosScreen m_pos = null;
> >>> -    protected XDialog m_dialog = null;
> >>> -    static protected Hashtable m_saleMap = new Hashtable();
> >>> -    protected XList m_salesList = null;
> >>> -    protected XButton m_cancel = null;
> >>> -    protected XButton m_add = null;
> >>> -    protected XButton m_replace = null;
> >>> -    protected XButton m_delete = null;
> >>> -    protected XButton m_replaceAndDelete = null;
> >>> -    protected DefaultListModel m_listModel = null;
> >>> -    protected static PosTransaction m_trans = null;
> >>> -
> >>> -    //TODO : make getter and setter for members (ie m_*) if needed
> >>> (extern calls). For that in Eclipse use Source/Generate
> >> Getters and setters
> >>> -
> >>> -    public LoadSale(Hashtable saleMap, PosTransaction trans,
> >>> PosScreen page) {
> >>> -        m_saleMap.putAll(saleMap);
> >>> -        m_trans = trans;
> >>> -        m_pos = page;
> >>> -    }
> >>> -
> >>> -    public void openDlg() {
> >>> -        m_dialog = (XDialog)
> >>> pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/loadsale");
> >>> -        m_dialog.setCaption(UtilProperties.getMessage("pos",
> >>> "LoadASale", Locale.getDefault()));
> >>> -        m_salesList = (XList) m_dialog.findComponent("salesList");
> >>> -        addMouseHandler(m_salesList, "saleDoubleClick");
> >>> -
> >>> -        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
> >>> -        m_add = (XButton) m_dialog.findComponent("BtnAdd");
> >>> -        m_replace = (XButton) m_dialog.findComponent("BtnReplace");
> >>> -        m_delete = (XButton) m_dialog.findComponent("BtnDelete");
> >>> -        m_replaceAndDelete = (XButton)
> >>> m_dialog.findComponent("BtnReplaceAndDelete");
> >>> -        addMouseHandler(m_cancel, "cancel");
> >>> -        addMouseHandler(m_add, "addSale");
> >>> -        addMouseHandler(m_replace, "replaceSale");
> >>> -        addMouseHandler(m_delete, "deleteShoppingList");
> >>> -        addMouseHandler(m_replaceAndDelete,
> >>> "replaceSaleAndDeleteShoppingList");
> >>> -
> >>> -        m_listModel = new DefaultListModel();
> >>> -        for (Iterator i = m_saleMap.entrySet().iterator();
> >>> i.hasNext();) {
> >>> -            Object o = i.next();
> >>> -            Map.Entry entry = (Map.Entry)o;
> >>> -            String val = entry.getValue().toString();
> >>> -            m_listModel.addElement(val);
> >>> -        }
> >>> -        m_salesList.setModel(m_listModel);
> >>> -        m_salesList.setVisibleRowCount(-1);
> >>> -        m_salesList.ensureIndexIsVisible(m_salesList.getItemCount());
> >>> -
> >>> m_salesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
> >>> -        m_salesList.setToolTipText(UtilProperties.getMessage("pos",
> >>> "LoadSaleListDblClickTip", Locale.getDefault()));
> >>> -
> >>> -        m_dialog.pack();
> >>> -        m_salesList.requestFocusInWindow();
> >>> -        m_dialog.showDialog(this);
> >>> -    }
> >>> -
> >>> -    public synchronized void saleDoubleClick() {
> >>> -        if (wasMouseDoubleClicked()) {
> >>> -            String sale = selectedSale();
> >>> -            if (null != sale) {
> >>> -                replaceSaleAndDeleteShoppingList_();
> >>> -            }
> >>> -        }
> >>> -    }
> >>> -
> >>> -    public synchronized void cancel() {
> >>> -        if (wasMouseClicked()) {
> >>> -            closeDlg();
> >>> -        }
> >>> -    }
> >>> -
> >>> -    public synchronized void addSale() {
> >>> -        if (wasMouseClicked()) {
> >>> -            addSale_();
> >>> -        }
> >>> -    }
> >>> -
> >>> -    private synchronized void addSale_() {
> >>> -        String sale = selectedSale();
> >>> -        if (null != sale) {
> >>> -            addListToCart(sale, true);
> >>> -        }
> >>> -    }
> >>> -
> >>> -    public synchronized void replaceSale() {
> >>> -        if (wasMouseClicked()) {
> >>> -            replaceSale_();
> >>> -        }
> >>> -    }
> >>> -
> >>> -    private synchronized void replaceSale_() {
> >>> -        String sale = selectedSale();
> >>> -        if (null != sale) {
> >>> -            addListToCart(sale, false);
> >>> -        }
> >>> -    }
> >>> -
> >>> -    public synchronized void deleteShoppingList() {
> >>> -        if (wasMouseClicked()) {
> >>> -            deleteShoppingList_();
> >>> -        }
> >>> -    }
> >>> -
> >>> -    private synchronized void deleteShoppingList_() {
> >>> -        String sale= (String) m_salesList.getSelectedValue();
> >>> -        if (null != sale) {
> >>> -            String shoppingListId = selectedSale();
> >>> -            final ClassLoader cl = this.getClassLoader(m_pos);
> >>> -            Thread.currentThread().setContextClassLoader(cl);
> >>> -            if (m_trans.clearList(shoppingListId, m_pos)) {
> >>> -                int index = m_salesList.getSelectedIndex();
> >>> -                m_saleMap.remove(shoppingListId);
> >>> -                m_listModel = new DefaultListModel();
> >>> -                for (Iterator i = m_saleMap.entrySet().iterator();
> >>> i.hasNext();) {
> >>> -                    Object o = i.next();
> >>> -                    Map.Entry entry = (Map.Entry)o;
> >>> -                    String val = entry.getValue().toString();
> >>> -                    m_listModel.addElement(val);
> >>> -                }
> >>> -                m_salesList.setModel(m_listModel);
> >>> -                int size = m_listModel.getSize();
> >>> -                if (size == 0) { //Nobody's left, nothing to do here
> >>> -                    closeDlg();
> >>> -                } else { //Select an index.
> >>> -                    if (index == size) {
> >>> -                        //removed item in last position
> >>> -                        index--;
> >>> -                    }
> >>> -                }
> >>> -                m_salesList.setSelectedIndex(index);
> >>> -                m_salesList.ensureIndexIsVisible(index);
> >>> -                m_salesList.repaint();
> >>> -                repaint();
> >>> -            }
> >>> -        }
> >>> -    }
> >>> -
> >>> -    public synchronized void replaceSaleAndDeleteShoppingList() {
> >>> -        if (wasMouseClicked()) {
> >>> -            replaceSaleAndDeleteShoppingList_();
> >>> -        }
> >>> -    }
> >>> -
> >>> -    public synchronized void replaceSaleAndDeleteShoppingList_() {
> >>> -        replaceSale_();
> >>> -        deleteShoppingList_();
> >>> -    }
> >>> -
> >>> -    private String selectedSale() {
> >>> -        String saleSelected = null;
> >>> -        if (null != m_salesList.getSelectedValue()) {
> >>> -            String sale = (String) m_salesList.getSelectedValue();
> >>> -            Iterator i = m_saleMap.entrySet().iterator();
> >>> -            while(i.hasNext()) {
> >>> -                Object o = i.next();
> >>> -                Map.Entry entry = (Map.Entry)o;
> >>> -                String val = entry.getValue().toString();
> >>> -                if (val.equals(sale)) {
> >>> -                    saleSelected = entry.getKey().toString();
> >>> -                }
> >>> -            }
> >>> -        }
> >>> -        return saleSelected;
> >>> -    }
> >>> -
> >>> -    private void addListToCart(String sale, boolean addToCart) {
> >>> -        final ClassLoader cl = this.getClassLoader(m_pos);
> >>> -        Thread.currentThread().setContextClassLoader(cl);
> >>> -        if (!m_trans.addListToCart(sale, m_pos, addToCart)) {
> >>> -            Debug.logError("Error while loading cart from shopping
> >>> list : " + sale, module);
> >>> -        }
> >>> -        else {
> >>> -            m_trans.calcTax();
> >>> -            m_pos.refresh();
> >>> -        }
> >>> -        closeDlg();
> >>> -    }
> >>> -
> >>> -    private ClassLoader getClassLoader(PosScreen pos) {
> >>> -        ClassLoader cl = pos.getClassLoader();
> >>> -        if (cl == null) {
> >>> -            try {
> >>> -                cl = Thread.currentThread().getContextClassLoader();
> >>> -            } catch (Throwable t) {
> >>> -            }
> >>> -            if (cl == null) {
> >>> -                Debug.log("No context classloader available; using
> >>> class classloader", module);
> >>> -                try {
> >>> -                    cl = this.getClass().getClassLoader();
> >>> -                } catch (Throwable t) {
> >>> -                    Debug.logError(t, module);
> >>> -                }
> >>> -            }
> >>> -        }
> >>> -        return cl;
> >>> -    }
> >>> -
> >>> -    private void closeDlg() {
> >>> -        m_dialog.closeDlg();
> >>> -    }
> >>> +/*******************************************************************************
> >>>
> >>> + * Licensed to the Apache Software Foundation (ASF) under one
> >>> + * or more contributor license agreements.  See the NOTICE file
> >>> + * distributed with this work for additional information
> >>> + * regarding copyright ownership.  The ASF licenses this file
> >>> + * to you under the Apache License, Version 2.0 (the
> >>> + * "License"); you may not use this file except in compliance
> >>> + * with the License.  You may obtain a copy of the License at
> >>> + *
> >>> + * http://www.apache.org/licenses/LICENSE-2.0
> >>> + *
> >>> + * Unless required by applicable law or agreed to in writing,
> >>> + * software distributed under the License is distributed on an
> >>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> >>> + * KIND, either express or implied.  See the License for the
> >>> + * specific language governing permissions and limitations
> >>> + * under the License.
> >>> +
> >>> *******************************************************************************/
> >>>
> >>> +package org.ofbiz.pos.screen;
> >>> +
> >>> +import java.util.Hashtable;
> >>> +import java.util.Iterator;
> >>> +import java.util.Locale;
> >>> +import java.util.Map;
> >>> +
> >>> +import javax.swing.DefaultListModel;
> >>> +import javax.swing.ListSelectionModel;
> >>> +
> >>> +import net.xoetrope.swing.XButton;
> >>> +import net.xoetrope.swing.XDialog;
> >>> +import net.xoetrope.swing.XList;
> >>> +import net.xoetrope.xui.XPage;
> >>> +
> >>> +import org.ofbiz.base.util.Debug;
> >>> +import org.ofbiz.base.util.UtilProperties;
> >>> +import org.ofbiz.pos.PosTransaction;
> >>> +
> >>> +
> >>> +public class LoadSale extends XPage {
> >>> +
> >>> +    /**
> >>> +     * To load a sale from a shopping list. 2 modes : add to or
> >>> replace the current sale. Also a button to delete a sale (aka
> >> shopping list)
> >>> +     */
> >>> +    public static final String module = LoadSale.class.getName();
> >>> +    protected static PosScreen m_pos = null;
> >>> +    protected XDialog m_dialog = null;
> >>> +    static protected Hashtable m_saleMap = new Hashtable();
> >>> +    protected XList m_salesList = null;
> >>> +    protected XButton m_cancel = null;
> >>> +    protected XButton m_add = null;
> >>> +    protected XButton m_replace = null;
> >>> +    protected XButton m_delete = null;
> >>> +    protected XButton m_replaceAndDelete = null;
> >>> +    protected DefaultListModel m_listModel = null;
> >>> +    protected static PosTransaction m_trans = null;
> >>> +
> >>> +    //TODO : make getter and setter for members (ie m_*) if needed
> >>> (extern calls). For that in Eclipse use Source/Generate
> >> Getters and setters
> >>> +
> >>> +    public LoadSale(Hashtable saleMap, PosTransaction trans,
> >>> PosScreen page) {
> >>> +        m_saleMap.putAll(saleMap);
> >>> +        m_trans = trans;
> >>> +        m_pos = page;
> >>> +    }
> >>> +
> >>> +    public void openDlg() {
> >>> +        m_dialog = (XDialog)
> >>> pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/loadsale");
> >>> +        m_dialog.setCaption(UtilProperties.getMessage("pos",
> >>> "LoadASale", Locale.getDefault()));
> >>> +        m_salesList = (XList) m_dialog.findComponent("salesList");
> >>> +        addMouseHandler(m_salesList, "saleDoubleClick");
> >>> +
> >>> +        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
> >>> +        m_add = (XButton) m_dialog.findComponent("BtnAdd");
> >>> +        m_replace = (XButton) m_dialog.findComponent("BtnReplace");
> >>> +        m_delete = (XButton) m_dialog.findComponent("BtnDelete");
> >>> +        m_replaceAndDelete = (XButton)
> >>> m_dialog.findComponent("BtnReplaceAndDelete");
> >>> +        addMouseHandler(m_cancel, "cancel");
> >>> +        addMouseHandler(m_add, "addSale");
> >>> +        addMouseHandler(m_replace, "replaceSale");
> >>> +        addMouseHandler(m_delete, "deleteShoppingList");
> >>> +        addMouseHandler(m_replaceAndDelete,
> >>> "replaceSaleAndDeleteShoppingList");
> >>> +
> >>> +        m_listModel = new DefaultListModel();
> >>> +        for (Iterator i = m_saleMap.entrySet().iterator();
> >>> i.hasNext();) {
> >>> +            Object o = i.next();
> >>> +            Map.Entry entry = (Map.Entry)o;
> >>> +            String val = entry.getValue().toString();
> >>> +            m_listModel.addElement(val);
> >>> +        }
> >>> +        m_salesList.setModel(m_listModel);
> >>> +        m_salesList.setVisibleRowCount(-1);
> >>> +        m_salesList.ensureIndexIsVisible(m_salesList.getItemCount());
> >>> +
> >>> m_salesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
> >>> +        m_salesList.setToolTipText(UtilProperties.getMessage("pos",
> >>> "LoadSaleListDblClickTip", Locale.getDefault()));
> >>> +
> >>> +        m_dialog.pack();
> >>> +        m_salesList.requestFocusInWindow();
> >>> +        m_dialog.showDialog(this);
> >>> +    }
> >>> +
> >>> +    public synchronized void saleDoubleClick() {
> >>> +        if (wasMouseDoubleClicked()) {
> >>> +            String sale = selectedSale();
> >>> +            if (null != sale) {
> >>> +                replaceSaleAndDeleteShoppingList_();
> >>> +            }
> >>> +        }
> >>> +    }
> >>> +
> >>> +    public synchronized void cancel() {
> >>> +        if (wasMouseClicked()) {
> >>> +            closeDlg();
> >>> +        }
> >>> +    }
> >>> +
> >>> +    public synchronized void addSale() {
> >>> +        if (wasMouseClicked()) {
> >>> +            addSale_();
> >>> +        }
> >>> +    }
> >>> +
> >>> +    private synchronized void addSale_() {
> >>> +        String sale = selectedSale();
> >>> +        if (null != sale) {
> >>> +            addListToCart(sale, true);
> >>> +        }
> >>> +    }
> >>> +
> >>> +    public synchronized void replaceSale() {
> >>> +        if (wasMouseClicked()) {
> >>> +            replaceSale_();
> >>> +        }
> >>> +    }
> >>> +
> >>> +    private synchronized void replaceSale_() {
> >>> +        String sale = selectedSale();
> >>> +        if (null != sale) {
> >>> +            addListToCart(sale, false);
> >>> +        }
> >>> +    }
> >>> +
> >>> +    public synchronized void deleteShoppingList() {
> >>> +        if (wasMouseClicked()) {
> >>> +            deleteShoppingList_();
> >>> +        }
> >>> +    }
> >>> +
> >>> +    private synchronized void deleteShoppingList_() {
> >>> +        String sale= (String) m_salesList.getSelectedValue();
> >>> +        if (null != sale) {
> >>> +            String shoppingListId = selectedSale();
> >>> +            final ClassLoader cl = this.getClassLoader(m_pos);
> >>> +            Thread.currentThread().setContextClassLoader(cl);
> >>> +            if (m_trans.clearList(shoppingListId, m_pos)) {
> >>> +                int index = m_salesList.getSelectedIndex();
> >>> +                m_saleMap.remove(shoppingListId);
> >>> +                m_listModel = new DefaultListModel();
> >>> +                for (Iterator i = m_saleMap.entrySet().iterator();
> >>> i.hasNext();) {
> >>> +                    Object o = i.next();
> >>> +                    Map.Entry entry = (Map.Entry)o;
> >>> +                    String val = entry.getValue().toString();
> >>> +                    m_listModel.addElement(val);
> >>> +                }
> >>> +                m_salesList.setModel(m_listModel);
> >>> +                int size = m_listModel.getSize();
> >>> +                if (size == 0) { //Nobody's left, nothing to do here
> >>> +                    closeDlg();
> >>> +                } else { //Select an index.
> >>> +                    if (index == size) {
> >>> +                        //removed item in last position
> >>> +                        index--;
> >>> +                    }
> >>> +                }
> >>> +                m_salesList.setSelectedIndex(index);
> >>> +                m_salesList.ensureIndexIsVisible(index);
> >>> +                m_salesList.repaint();
> >>> +                repaint();
> >>> +            }
> >>> +        }
> >>> +    }
> >>> +
> >>> +    public synchronized void replaceSaleAndDeleteShoppingList() {
> >>> +        if (wasMouseClicked()) {
> >>> +            replaceSaleAndDeleteShoppingList_();
> >>> +        }
> >>> +    }
> >>> +
> >>> +    public synchronized void replaceSaleAndDeleteShoppingList_() {
> >>> +        replaceSale_();
> >>> +        deleteShoppingList_();
> >>> +    }
> >>> +
> >>> +    private String selectedSale() {
> >>> +        String saleSelected = null;
> >>> +        if (null != m_salesList.getSelectedValue()) {
> >>> +            String sale = (String) m_salesList.getSelectedValue();
> >>> +            Iterator i = m_saleMap.entrySet().iterator();
> >>> +            while(i.hasNext()) {
> >>> +                Object o = i.next();
> >>> +                Map.Entry entry = (Map.Entry)o;
> >>> +                String val = entry.getValue().toString();
> >>> +                if (val.equals(sale)) {
> >>> +                    saleSelected = entry.getKey().toString();
> >>> +                }
> >>> +            }
> >>> +        }
> >>> +        return saleSelected;
> >>> +    }
> >>> +
> >>> +    private void addListToCart(String sale, boolean addToCart) {
> >>> +        final ClassLoader cl = this.getClassLoader(m_pos);
> >>> +        Thread.currentThread().setContextClassLoader(cl);
> >>> +        if (!m_trans.addListToCart(sale, m_pos, addToCart)) {
> >>> +            Debug.logError("Error while loading cart from shopping
> >>> list : " + sale, module);
> >>> +        }
> >>> +        else {
> >>> +            m_trans.calcTax();
> >>> +            m_pos.refresh();
> >>> +        }
> >>> +        closeDlg();
> >>> +    }
> >>> +
> >>> +    private ClassLoader getClassLoader(PosScreen pos) {
> >>> +        ClassLoader cl = pos.getClassLoader();
> >>> +        if (cl == null) {
> >>> +            try {
> >>> +                cl = Thread.currentThread().getContextClassLoader();
> >>> +            } catch (Throwable t) {
> >>> +            }
> >>> +            if (cl == null) {
> >>> +                Debug.log("No context classloader available; using
> >>> class classloader", module);
> >>> +                try {
> >>> +                    cl = this.getClass().getClassLoader();
> >>> +                } catch (Throwable t) {
> >>> +                    Debug.logError(t, module);
> >>> +                }
> >>> +            }
> >>> +        }
> >>> +        return cl;
> >>> +    }
> >>> +
> >>> +    private void closeDlg() {
> >>> +        m_dialog.closeDlg();
> >>> +    }
> >>>  }
> >>>
> >>> Modified:
> >>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java
> >>> URL:
> >>
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java?view=diff&rev=497618&r1=497617&r2=497618
> >>
> >>> ==============================================================================
> >>>
> >>> --- 
> >>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java
> >>> (original)
> >>> +++
> >>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java
> >>> Thu Jan 18 14:55:50 2007
> >>> @@ -1,129 +1,129 @@
> >>> -/*******************************************************************************
> >>>
> >>> - * Licensed to the Apache Software Foundation (ASF) under one
> >>> - * or more contributor license agreements.  See the NOTICE file
> >>> - * distributed with this work for additional information
> >>> - * regarding copyright ownership.  The ASF licenses this file
> >>> - * to you under the Apache License, Version 2.0 (the
> >>> - * "License"); you may not use this file except in compliance
> >>> - * with the License.  You may obtain a copy of the License at
> >>> - *
> >>> - * http://www.apache.org/licenses/LICENSE-2.0
> >>> - *
> >>> - * Unless required by applicable law or agreed to in writing,
> >>> - * software distributed under the License is distributed on an
> >>> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> >>> - * KIND, either express or implied.  See the License for the
> >>> - * specific language governing permissions and limitations
> >>> - * under the License.
> >>> -
> >>> *******************************************************************************/
> >>>
> >>> -package org.ofbiz.pos.screen;
> >>> -
> >>> -import java.text.SimpleDateFormat;
> >>> -import java.util.Date;
> >>> -import java.util.Locale;
> >>> -
> >>> -import net.xoetrope.swing.XButton;
> >>> -//import org.ofbiz.pos.screen.XFocusDialog;
> >>> -import net.xoetrope.swing.XEdit;
> >>> -import net.xoetrope.swing.XDialog;
> >>> -import net.xoetrope.xui.XPage;
> >>> -
> >>> -import org.ofbiz.base.util.Debug;
> >>> -import org.ofbiz.base.util.UtilProperties;
> >>> -import org.ofbiz.pos.PosTransaction;
> >>> -
> >>> -
> >>> -public class SaveSale extends XPage {
> >>> -
> >>> -    /**
> >>> -     * To save a sale. 2 modes : save and keep the current sale or
> >>> save and clear the current sale.
> >>> -     */
> >>> -    public static final String module = SaveSale.class.getName();
> >>> -    protected static PosScreen m_pos = null;
> >>> -    protected XDialog m_dialog = null;
> >>> -    protected XEdit m_saleName = null;
> >>> -    protected XButton m_cancel = null;
> >>> -    protected XButton m_save = null;
> >>> -    protected XButton m_saveAndClear = null;
> >>> -    protected static PosTransaction m_trans = null;
> >>> -    public static SimpleDateFormat sdf = new
> >> SimpleDateFormat(UtilProperties.getMessage("pos","DateTimeFormat",Locale.getDefault()));
> >>
> >>> -
> >>> -    //TODO : make getter and setter for members (ie m_*) if needed
> >>> (extern calls).  For that in Eclipse use Source/Generate
> >> Getters and setters
> >>> -
> >>> -    public SaveSale(PosTransaction trans, PosScreen page) {
> >>> -        m_trans = trans;
> >>> -        m_pos = page;
> >>> -    }
> >>> -
> >>> -    public void openDlg() {
> >>> -        m_dialog = (XDialog)
> >>> pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/savesale");
> >>> -        m_saleName = (XEdit) m_dialog.findComponent("saleName");
> >>> -        //m_dialog.setM_focused(m_saleName);
> >>> -        m_saleName.setText(m_pos.session.getUserId() + " " +
> >>> sdf.format(new Date()));
> >>> -        m_dialog.setCaption(UtilProperties.getMessage("pos",
> >>> "SaveASale", Locale.getDefault()));
> >>> -
> >>> -        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
> >>> -        m_save = (XButton) m_dialog.findComponent("BtnSave");
> >>> -        m_saveAndClear = (XButton)
> >>> m_dialog.findComponent("BtnSaveAndClear");
> >>> -
> >>> -        addMouseHandler(m_cancel, "cancel");
> >>> -        addMouseHandler(m_save, "save");
> >>> -        addMouseHandler(m_saveAndClear, "saveAndClear");
> >>> -
> >>> -        m_dialog.pack();
> >>> -        m_dialog.showDialog(this);
> >>> -    }
> >>> -
> >>> -    public synchronized void cancel()
> >>> -    {
> >>> -        if (wasMouseClicked()) {
> >>> -            this.m_dialog.closeDlg();
> >>> -        }
> >>> -    }
> >>> -
> >>> -    public synchronized void save() {
> >>> -        if (wasMouseClicked()) {
> >>> -            String sale = m_saleName.getText();
> >>> -            if (null != sale) {
> >>> -                saveSale(sale);
> >>> -            }
> >>> -        }
> >>> -    }
> >>> -
> >>> -    public synchronized void saveAndClear() {
> >>> -        if (wasMouseClicked()) {
> >>> -            String sale = m_saleName.getText();
> >>> -            if (null != sale) {
> >>> -                saveSale(sale);
> >>> -                m_trans.voidSale();
> >>> -                m_pos.refresh();
> >>> -            }
> >>> -        }
> >>> -    }
> >>> -
> >>> -    private void saveSale(String sale) {
> >>> -        final ClassLoader cl = this.getClassLoader(m_pos);
> >>> -        Thread.currentThread().setContextClassLoader(cl);
> >>> -        m_trans.saveSale(sale, m_pos);
> >>> -        this.m_dialog.closeDlg();
> >>> -    }
> >>> -
> >>> -    private ClassLoader getClassLoader(PosScreen pos) {
> >>> -        ClassLoader cl = pos.getClassLoader();
> >>> -        if (cl == null) {
> >>> -            try {
> >>> -                cl = Thread.currentThread().getContextClassLoader();
> >>> -            } catch (Throwable t) {
> >>> -            }
> >>> -            if (cl == null) {
> >>> -                Debug.log("No context classloader available; using
> >>> class classloader", module);
> >>> -                try {
> >>> -                    cl = this.getClass().getClassLoader();
> >>> -                } catch (Throwable t) {
> >>> -                    Debug.logError(t, module);
> >>> -                }
> >>> -            }
> >>> -        }
> >>> -        return cl;
> >>> -    }
> >>> +/*******************************************************************************
> >>>
> >>> + * Licensed to the Apache Software Foundation (ASF) under one
> >>> + * or more contributor license agreements.  See the NOTICE file
> >>> + * distributed with this work for additional information
> >>> + * regarding copyright ownership.  The ASF licenses this file
> >>> + * to you under the Apache License, Version 2.0 (the
> >>> + * "License"); you may not use this file except in compliance
> >>> + * with the License.  You may obtain a copy of the License at
> >>> + *
> >>> + * http://www.apache.org/licenses/LICENSE-2.0
> >>> + *
> >>> + * Unless required by applicable law or agreed to in writing,
> >>> + * software distributed under the License is distributed on an
> >>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> >>> + * KIND, either express or implied.  See the License for the
> >>> + * specific language governing permissions and limitations
> >>> + * under the License.
> >>> +
> >>> *******************************************************************************/
> >>>
> >>> +package org.ofbiz.pos.screen;
> >>> +
> >>> +import java.text.SimpleDateFormat;
> >>> +import java.util.Date;
> >>> +import java.util.Locale;
> >>> +
> >>> +import net.xoetrope.swing.XButton;
> >>> +//import org.ofbiz.pos.screen.XFocusDialog;
> >>> +import net.xoetrope.swing.XEdit;
> >>> +import net.xoetrope.swing.XDialog;
> >>> +import net.xoetrope.xui.XPage;
> >>> +
> >>> +import org.ofbiz.base.util.Debug;
> >>> +import org.ofbiz.base.util.UtilProperties;
> >>> +import org.ofbiz.pos.PosTransaction;
> >>> +
> >>> +
> >>> +public class SaveSale extends XPage {
> >>> +
> >>> +    /**
> >>> +     * To save a sale. 2 modes : save and keep the current sale or
> >>> save and clear the current sale.
> >>> +     */
> >>> +    public static final String module = SaveSale.class.getName();
> >>> +    protected static PosScreen m_pos = null;
> >>> +    protected XDialog m_dialog = null;
> >>> +    protected XEdit m_saleName = null;
> >>> +    protected XButton m_cancel = null;
> >>> +    protected XButton m_save = null;
> >>> +    protected XButton m_saveAndClear = null;
> >>> +    protected static PosTransaction m_trans = null;
> >>> +    public static SimpleDateFormat sdf = new
> >> SimpleDateFormat(UtilProperties.getMessage("pos","DateTimeFormat",Locale.getDefault()));
> >>
> >>> +
> >>> +    //TODO : make getter and setter for members (ie m_*) if needed
> >>> (extern calls).  For that in Eclipse use Source/Generate
> >> Getters and setters
> >>> +
> >>> +    public SaveSale(PosTransaction trans, PosScreen page) {
> >>> +        m_trans = trans;
> >>> +        m_pos = page;
> >>> +    }
> >>> +
> >>> +    public void openDlg() {
> >>> +        m_dialog = (XDialog)
> >>> pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/savesale");
> >>> +        m_saleName = (XEdit) m_dialog.findComponent("saleName");
> >>> +        //m_dialog.setM_focused(m_saleName);
> >>> +        m_saleName.setText(m_pos.session.getUserId() + " " +
> >>> sdf.format(new Date()));
> >>> +        m_dialog.setCaption(UtilProperties.getMessage("pos",
> >>> "SaveASale", Locale.getDefault()));
> >>> +
> >>> +        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
> >>> +        m_save = (XButton) m_dialog.findComponent("BtnSave");
> >>> +        m_saveAndClear = (XButton)
> >>> m_dialog.findComponent("BtnSaveAndClear");
> >>> +
> >>> +        addMouseHandler(m_cancel, "cancel");
> >>> +        addMouseHandler(m_save, "save");
> >>> +        addMouseHandler(m_saveAndClear, "saveAndClear");
> >>> +
> >>> +        m_dialog.pack();
> >>> +        m_dialog.showDialog(this);
> >>> +    }
> >>> +
> >>> +    public synchronized void cancel()
> >>> +    {
> >>> +        if (wasMouseClicked()) {
> >>> +            this.m_dialog.closeDlg();
> >>> +        }
> >>> +    }
> >>> +
> >>> +    public synchronized void save() {
> >>> +        if (wasMouseClicked()) {
> >>> +            String sale = m_saleName.getText();
> >>> +            if (null != sale) {
> >>> +                saveSale(sale);
> >>> +            }
> >>> +        }
> >>> +    }
> >>> +
> >>> +    public synchronized void saveAndClear() {
> >>> +        if (wasMouseClicked()) {
> >>> +            String sale = m_saleName.getText();
> >>> +            if (null != sale) {
> >>> +                saveSale(sale);
> >>> +                m_trans.voidSale();
> >>> +                m_pos.refresh();
> >>> +            }
> >>> +        }
> >>> +    }
> >>> +
> >>> +    private void saveSale(String sale) {
> >>> +        final ClassLoader cl = this.getClassLoader(m_pos);
> >>> +        Thread.currentThread().setContextClassLoader(cl);
> >>> +        m_trans.saveSale(sale, m_pos);
> >>> +        this.m_dialog.closeDlg();
> >>> +    }
> >>> +
> >>> +    private ClassLoader getClassLoader(PosScreen pos) {
> >>> +        ClassLoader cl = pos.getClassLoader();
> >>> +        if (cl == null) {
> >>> +            try {
> >>> +                cl = Thread.currentThread().getContextClassLoader();
> >>> +            } catch (Throwable t) {
> >>> +            }
> >>> +            if (cl == null) {
> >>> +                Debug.log("No context classloader available; using
> >>> class classloader", module);
> >>> +                try {
> >>> +                    cl = this.getClass().getClassLoader();
> >>> +                } catch (Throwable t) {
> >>> +                    Debug.logError(t, module);
> >>> +                }
> >>> +            }
> >>> +        }
> >>> +        return cl;
> >>> +    }
> >>>  }
> >>>
> >>
> >


Re: svn commit: r497618 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/order/ applications/order/src/org/ofbiz/order/shoppingcart/ applications/order/src/org/ofbiz/order/shoppinglist/ applications/product/src/org/ofbiz/product/store/ specialpurp

Posted by Jonathon -- Improov <jo...@improov.com>.
Hey no! Don't! David's right. Add a layer of indirection. Add an overloaded method. Insulate the 
change. Please.

Hmm. David, any plans to start effort on testing and auditing OFBiz to roll out release branches? 
Couldn't... couldn't we work on experimental branches for a short time before merging back to trunk?

Jonathon

David E. Jones wrote:
> 
> Seriously though, what was the point of switching those parameters? Was 
> it really worth breaking backward compatibility? My opinion: no, it's 
> not worth it.
> 
> -David
> 
> 
> On Jan 19, 2007, at 12:57 AM, Jacques Le Roux wrote:
> 
>> Si,
>>
>> You will have to change
>>     
>> \crmsfa\src\com\opensourcestrategies\crmsfa\orders\CrmsfaOrderEvents.java:181 
>>
>> and
>>     
>> \crmsfa\src\com\opensourcestrategies\crmsfa\orders\CrmsfaOrderEvents.java:275 
>>
>>
>> for
>>    cart.addOrIncreaseItem(productId, null, 1, null, null, null, null, 
>> null, null, null, null, null, null, null, dispatcher, null);
>> to
>>    cart.addOrIncreaseItem(productId, null, 1, null, null, null, null, 
>> null, null, null, null, null, null, null, null, dispatcher);
>>
>> Thanks
>>
>> Jacques
>>
>> ----- Original Message -----
>> From: <jl...@apache.org>
>> To: <co...@ofbiz.apache.org>
>> Sent: Thursday, January 18, 2007 11:55 PM
>> Subject: svn commit: r497618 - in /ofbiz/trunk: 
>> applications/order/src/org/ofbiz/order/order/
>> applications/order/src/org/ofbiz/order/shoppingcart/ 
>> applications/order/src/org/ofbiz/order/shoppinglist/
>> applications/product/src/org/ofbiz/product/store/ specialpurp...
>>
>>
>>> Author: jleroux
>>> Date: Thu Jan 18 14:55:50 2007
>>> New Revision: 497618
>>>
>>> URL: http://svn.apache.org/viewvc?view=rev&rev=497618
>>> Log:
>>> Some enhancements suggested by Si for commit 495945
>>>
>>> Modified:
>>>     
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java 
>>>
>>>     
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java 
>>>
>>>     
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java 
>>>
>>>     
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java 
>>>
>>>     
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java 
>>>
>>>     
>>> ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java 
>>>
>>>     ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
>>>     
>>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/LoadSale.java
>>>     
>>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java
>>>
>>> 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=497618&r1=497617&r2=497618 
>>
>>> ============================================================================== 
>>>
>>> --- 
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java 
>>> (original)
>>> +++ 
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java 
>>> Thu Jan 18 14:55:50 2007
>>> @@ -3415,7 +3415,7 @@
>>>          Locale locale = (Locale) context.get("locale");
>>>          ShoppingCart cart = new ShoppingCart(dctx.getDelegator(), 
>>> "9000", "webStore", locale, "USD");
>>>          try {
>>> -            cart.addOrIncreaseItem("GZ-1005", null, 1, null, null, 
>>> null, null, null, null, null, "DemoCatalog", null, null, null,
>> dctx.getDispatcher(),null);
>>> +            cart.addOrIncreaseItem("GZ-1005", null, 1, null, null, 
>>> null, null, null, null, null, "DemoCatalog", null, null, null,
>> null, dctx.getDispatcher());
>>>              } catch (CartItemModifyException e) {
>>>              Debug.logError(e, module);
>>>          } catch (ItemNotFoundException e) {
>>> @@ -3653,7 +3653,7 @@
>>>                                                                      
>>>    item.getTimestamp("shipAfterDate"),
>>>                                                                      
>>>    null, null, null,
>>>                                                                      
>>>    null, null, null,
>>> -                                                                    
>>>    dispatcher, null);
>>> +                                                                    
>>>    null, dispatcher);
>>>                                  ShoppingCartItem sci = 
>>> cart.findCartItem(itemIndex);
>>>                                  sci.setAssociatedOrderId(orderId);
>>>                                  
>>> sci.setAssociatedOrderItemSeqId(item.getString("orderItemSeqId"));
>>>
>>> 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=497618&r1=497617&r2=497618 
>>
>>> ============================================================================== 
>>>
>>> --- 
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java 
>>> (original)
>>> +++ 
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java 
>>> Thu Jan 18 14:55:50 2007
>>> @@ -444,7 +444,7 @@
>>>       */
>>>      public int addOrIncreaseItem(String productId, Double 
>>> selectedAmountDbl, double quantity, Timestamp reservStart, Double
>> reservLengthDbl, Double reservPersonsDbl,
>>>              Timestamp shipBeforeDate, Timestamp shipAfterDate, Map 
>>> features, Map attributes, String prodCatalogId,
>>> -            ProductConfigWrapper configWrapper, String itemType, 
>>> String itemGroupNumber, LocalDispatcher dispatcher, String
>> parentProductId) throws CartItemModifyException, ItemNotFoundException {
>>> +            ProductConfigWrapper configWrapper, String itemType, 
>>> String itemGroupNumber, String parentProductId, LocalDispatcher
>> dispatcher) throws CartItemModifyException, ItemNotFoundException {
>>>          if (isReadOnlyCart()) {
>>>             throw new CartItemModifyException("Cart items cannot be 
>>> changed");
>>>          }
>>>
>>> Modified: 
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java 
>>>
>>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?view=diff&rev=497618&r1=497617&r2=497618 
>>
>>> ============================================================================== 
>>>
>>> --- 
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java 
>>> (original)
>>> +++ 
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java 
>>> Thu Jan 18 14:55:50 2007
>>> @@ -119,7 +119,7 @@
>>>              try {
>>>                  java.sql.Timestamp.valueOf((String) 
>>> context.get("itemDesiredDeliveryDate"));
>>>              } catch (IllegalArgumentException e) {
>>> -            return
>> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderInvalidDesiredDeliveryDateSyntaxError",this.cart.getLocale()) 
>>
>> );
>>> +                return
>> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderInvalidDesiredDeliveryDateSyntaxError",this.cart.getLocale()) 
>>
>> );
>>>              }
>>>          } else {
>>>              context.remove("itemDesiredDeliveryDate");
>>> @@ -180,7 +180,7 @@
>>>              if (productId != null) {
>>>                  itemId = cart.addOrIncreaseItem(productId, amount, 
>>> quantity, reservStart, reservLength,
>>>                                                  reservPersons, 
>>> shipBeforeDate, shipAfterDate, null, attributes,
>>> -                                                catalogId, 
>>> configWrapper, itemType, itemGroupNumber, dispatcher, pProductId);
>>> +                                                catalogId, 
>>> configWrapper, itemType, itemGroupNumber, pProductId, dispatcher);
>>>              } else {
>>>                  itemId = cart.addNonProductItem(itemType, 
>>> itemDescription, productCategoryId, price, quantity, attributes,
>> catalogId, itemGroupNumber, dispatcher);
>>>              }
>>> @@ -245,7 +245,7 @@
>>>                          Double amount = 
>>> orderItem.getDouble("selectedAmount");
>>>                          try {
>>>                              
>>> this.cart.addOrIncreaseItem(orderItem.getString("productId"), amount,
>> orderItem.getDouble("quantity").doubleValue(),
>>> -                                    null, null, null, null, null, 
>>> null, null, catalogId, null, orderItemTypeId, itemGroupNumber,
>> dispatcher,null);
>>> +                                    null, null, null, null, null, 
>>> null, null, catalogId, null, orderItemTypeId, itemGroupNumber,
>> null, dispatcher);
>>>                              noItems = false;
>>>                          } catch (CartItemModifyException e) {
>>>                              errorMsgs.add(e.getMessage());
>>> @@ -283,7 +283,7 @@
>>>                              try {
>>>                                  
>>> this.cart.addOrIncreaseItem(orderItem.getString("productId"), amount,
>>>                                          
>>> orderItem.getDouble("quantity").doubleValue(), null, null, null, 
>>> null, null, null, null,
>>> -                                        catalogId, null, 
>>> orderItem.getString("orderItemTypeId"), itemGroupNumber, dispatcher,
>> null);
>>> +                                        catalogId, null, 
>>> orderItem.getString("orderItemTypeId"), itemGroupNumber, null,
>> dispatcher);
>>>                                  noItems = false;
>>>                              } catch (CartItemModifyException e) {
>>>                                  errorMsgs.add(e.getMessage());
>>> @@ -372,7 +372,7 @@
>>>                  if (quantity > 0.0) {
>>>                      try {
>>>                          if (Debug.verboseOn()) 
>>> Debug.logVerbose("Bulk Adding to cart [" + quantity + "] of [" + 
>>> productId + "] in
>> Item Group [" + itemGroupNumber + "]", module);
>>> -                        this.cart.addOrIncreaseItem(productId, null, 
>>> quantity, null, null, null, null, null, null, null,
>> catalogId, null, null, itemGroupNumberToUse, dispatcher, null);
>>> +                        this.cart.addOrIncreaseItem(productId, null, 
>>> quantity, null, null, null, null, null, null, null,
>> catalogId, null, null, itemGroupNumberToUse, null, dispatcher);
>>>                      } catch (CartItemModifyException e) {
>>>                          return ServiceUtil.returnError(e.getMessage());
>>>                      } catch (ItemNotFoundException e) {
>>> @@ -451,7 +451,7 @@
>>>                          }
>>>                          try {
>>>                              if (Debug.verboseOn()) 
>>> Debug.logVerbose("Bulk Adding to cart requirement [" + quantity + "] 
>>> of [" +
>> productId + "]", module);
>>> -                            int index = 
>>> this.cart.addOrIncreaseItem(productId, null, quantity, null, null, 
>>> null, null, null,
>> null, null, catalogId, null, null, itemGroupNumber, dispatcher, null);
>>> +                            int index = 
>>> this.cart.addOrIncreaseItem(productId, null, quantity, null, null, 
>>> null, null, null,
>> null, null, catalogId, null, null, itemGroupNumber, null, dispatcher);
>>>                              ShoppingCartItem sci = 
>>> (ShoppingCartItem)this.cart.items().get(index);
>>>                              sci.setRequirementId(requirementId);
>>>                          } catch (CartItemModifyException e) {
>>> @@ -478,7 +478,7 @@
>>>          String errMsg = null;
>>>
>>>          if (categoryId == null || categoryId.length() <= 0) {
>>> -        errMsg = 
>>> UtilProperties.getMessage(resource,"cart.category_not_specified_to_add_from", 
>>> this.cart.getLocale());
>>> +            errMsg = 
>>> UtilProperties.getMessage(resource,"cart.category_not_specified_to_add_from", 
>>> this.cart.getLocale());
>>>              result = ServiceUtil.returnError(errMsg);
>>>  //          result =
>> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderNoCategorySpecifiedToAddFrom.",this.cart.getLocale())); 
>>
>>>              return result;
>>> @@ -515,7 +515,7 @@
>>>                  try {
>>>                      
>>> this.cart.addOrIncreaseItem(productCategoryMember.getString("productId"), 
>>>
>>>                              null, quantity.doubleValue(), null, 
>>> null, null, null, null, null, null,
>>> -                            catalogId, null, null, itemGroupNumber, 
>>> dispatcher, null);
>>> +                            catalogId, null, null, itemGroupNumber, 
>>> null, dispatcher);
>>>                      totalQuantity += quantity.doubleValue();
>>>                  } catch (CartItemModifyException e) {
>>>                      errorMsgs.add(e.getMessage());
>>> @@ -870,12 +870,12 @@
>>>          GenericValue agreement = null;
>>>
>>>          if ((this.delegator == null) || (this.dispatcher == null) || 
>>> (this.cart == null)) {
>>> -        result =
>> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderDispatcherOrDelegatorOrCartArgumentIsNull",this.cart.getLocal 
>>
>> e()));
>>> +            result =
>> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderDispatcherOrDelegatorOrCartArgumentIsNull",this.cart.getLocal 
>>
>> e()));
>>>              return result;
>>>          }
>>>
>>>          if ((agreementId == null) || (agreementId.length() <= 0)) {
>>> -        result =
>> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderNoAgreementSpecified",this.cart.getLocale())); 
>>
>>> +            result =
>> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderNoAgreementSpecified",this.cart.getLocale())); 
>>
>>>              return result;
>>>          }
>>>
>>> @@ -888,7 +888,7 @@
>>>          }
>>>
>>>          if (agreement == null) {
>>> -        result =
>> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderCouldNotGetAgreement",UtilMisc.toMap("agreementId",agreementI 
>>
>> d),this.cart.getLocale()));
>>> +            result =
>> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderCouldNotGetAgreement",UtilMisc.toMap("agreementId",agreementI 
>>
>> d),this.cart.getLocale()));
>>>          } else {
>>>              // set the agreement id in the cart
>>>              cart.setAgreementId(agreementId);
>>> @@ -901,7 +901,7 @@
>>>                         try {
>>>                              cart.setCurrency(dispatcher,currencyUomId);
>>>                         } catch (CartItemModifyException ex) {
>>> -                       result =
>> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderSetCurrencyError",this.cart.getLocale()) 
>> + ex.getMessage());
>>> +                           result =
>> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderSetCurrencyError",this.cart.getLocale()) 
>> + ex.getMessage());
>>>                              return result;
>>>                         }
>>>                   }
>>> @@ -941,7 +941,7 @@
>>>              this.cart.setCurrency(this.dispatcher,currencyUomId);
>>>              result = ServiceUtil.returnSuccess();
>>>           } catch (CartItemModifyException ex) {
>>> -         result = 
>>> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"Set 
>>> currency error",this.cart.getLocale()) +
>> ex.getMessage());
>>> +             result = 
>>> ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"Set 
>>> currency
>> error",this.cart.getLocale()) + ex.getMessage());
>>>               return result;
>>>           }
>>>          return result;
>>> @@ -972,7 +972,7 @@
>>>                  productSupplier=(GenericValue) productSuppliers.get(0);
>>>              }
>>>          } catch (GenericServiceException e) {
>>> -        
>>> Debug.logWarning(UtilProperties.getMessage(resource_error,"OrderRunServiceGetSuppliersForProductError", 
>>> cart.getLocale())
>> + e.getMessage(), module);
>>> +            
>>> Debug.logWarning(UtilProperties.getMessage(resource_error,"OrderRunServiceGetSuppliersForProductError", 
>>>
>> cart.getLocale()) + e.getMessage(), module);
>>>          }
>>>          return productSupplier;
>>>      }
>>>
>>> Modified: 
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java 
>>>
>>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java?view=diff&rev=497618&r1=497617&r2=497618 
>>
>>> ============================================================================== 
>>>
>>> --- 
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java 
>>> (original)
>>> +++ 
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java 
>>> Thu Jan 18 14:55:50 2007
>>> @@ -273,9 +273,9 @@
>>>
>>>                  // i cannot get the addOrDecrease function to accept 
>>> a null reservStart field: i get a null pointer exception a
>> null constant works....
>>>                  if (reservStart == null) {
>>> -                    cart.addOrIncreaseItem(productId, null, 
>>> quantity.doubleValue(), null, null, null, null, null, null,
>> attributes, prodCatalogId, null, null, null, dispatcher, null);
>>> +                    cart.addOrIncreaseItem(productId, null, 
>>> quantity.doubleValue(), null, null, null, null, null, null,
>> attributes, prodCatalogId, null, null, null, null, dispatcher);
>>>                  } else {
>>> -                    cart.addOrIncreaseItem(productId, null, 
>>> quantity.doubleValue(), reservStart, reservLength, reservPersons,
>> null, null, null, attributes, prodCatalogId, null, null, null, 
>> dispatcher, null);
>>> +                    cart.addOrIncreaseItem(productId, null, 
>>> quantity.doubleValue(), reservStart, reservLength, reservPersons,
>> null, null, null, attributes, prodCatalogId, null, null, null, null, 
>> dispatcher);
>>>                  }
>>>                  Map messageMap = UtilMisc.toMap("productId", 
>>> productId);
>>>                  errMsg = 
>>> UtilProperties.getMessage(resource,"shoppinglistevents.added_product_to_cart", 
>>> messageMap,
>> cart.getLocale());
>>>
>>> Modified: 
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java 
>>>
>>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java?view=diff&rev=497618&r1=497617&r2=497618 
>>
>>> ============================================================================== 
>>>
>>> --- 
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java 
>>> (original)
>>> +++ 
>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java 
>>> Thu Jan 18 14:55:50 2007
>>> @@ -442,7 +442,7 @@
>>>                          Map attributes = 
>>> UtilMisc.toMap("shoppingListId", listId, "shoppingListItemSeqId", 
>>> itemId);
>>>
>>>                          try {
>>> -                            listCart.addOrIncreaseItem(productId, 
>>> null, quantity.doubleValue(), reservStart, reservLength,
>> reservPersons, null, null, null, attributes, null, null, null, null, 
>> dispatcher, null);
>>> +                            listCart.addOrIncreaseItem(productId, 
>>> null, quantity.doubleValue(), reservStart, reservLength,
>> reservPersons, null, null, null, attributes, null, null, null, null, 
>> null, dispatcher);
>>>                          } catch (CartItemModifyException e) {
>>>                              Debug.logError(e, "Unable to add product 
>>> to List Cart - " + productId, module);
>>>                          } catch (ItemNotFoundException e) {
>>>
>>> Modified: 
>>> ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java 
>>>
>>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java?view=diff&rev=497618&r1=497617&r2=497618 
>>
>>> ============================================================================== 
>>>
>>> --- 
>>> ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java 
>>> (original)
>>> +++ 
>>> ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java 
>>> Thu Jan 18 14:55:50 2007
>>> @@ -470,10 +470,12 @@
>>>                  try {
>>>                      product = 
>>> delegator.findByPrimaryKeyCache("Product", 
>>> UtilMisc.toMap("productId", productId));
>>>                      if ((product != null) && 
>>> ("Y".equals(product.get("isVariant")))) {
>>> -                        if (parentProductId != null)
>>> +                        if (parentProductId != null) {
>>>                              virtualProductId = parentProductId;
>>> -                        else
>>> +                        }
>>> +                        else {
>>>                              virtualProductId = 
>>> ProductWorker.getVariantVirtualId(product);
>>> +                        }
>>>                          Debug.log("getSurvey for virtual product " + 
>>> virtualProductId,module);
>>>                      }
>>>                  } catch (GenericEntityException e) {
>>>
>>> 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?view=diff&rev=497618&r1=497617&r2=497618 
>>
>>> ============================================================================== 
>>>
>>> --- 
>>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java 
>>> (original)
>>> +++ 
>>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java 
>>> Thu Jan 18 14:55:50 2007
>>> @@ -355,7 +355,7 @@
>>>      public void addItem(String productId, double quantity) throws 
>>> CartItemModifyException, ItemNotFoundException {
>>>          trace("add item", productId + "/" + quantity);
>>>          try {
>>> -            cart.addOrIncreaseItem(productId, null, quantity, null, 
>>> null, null, null, null, null, null, null, null, null, null,
>> session.getDispatcher(), null);
>>> +            cart.addOrIncreaseItem(productId, null, quantity, null, 
>>> null, null, null, null, null, null, null, null, null, null,
>> null, session.getDispatcher());
>>>          } catch (ItemNotFoundException e) {
>>>              trace("item not found", e);
>>>              throw e;
>>>
>>> Modified: 
>>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/LoadSale.java
>>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/LoadSale.java?view=diff&rev=497618&r1=497617&r2=497618 
>>
>>> ============================================================================== 
>>>
>>> --- 
>>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/LoadSale.java 
>>> (original)
>>> +++ 
>>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/LoadSale.java 
>>> Thu Jan 18 14:55:50 2007
>>> @@ -1,244 +1,244 @@
>>> -/******************************************************************************* 
>>>
>>> - * Licensed to the Apache Software Foundation (ASF) under one
>>> - * or more contributor license agreements.  See the NOTICE file
>>> - * distributed with this work for additional information
>>> - * regarding copyright ownership.  The ASF licenses this file
>>> - * to you under the Apache License, Version 2.0 (the
>>> - * "License"); you may not use this file except in compliance
>>> - * with the License.  You may obtain a copy of the License at
>>> - *
>>> - * http://www.apache.org/licenses/LICENSE-2.0
>>> - *
>>> - * Unless required by applicable law or agreed to in writing,
>>> - * software distributed under the License is distributed on an
>>> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>> - * KIND, either express or implied.  See the License for the
>>> - * specific language governing permissions and limitations
>>> - * under the License.
>>> - 
>>> *******************************************************************************/ 
>>>
>>> -package org.ofbiz.pos.screen;
>>> -
>>> -import java.util.Hashtable;
>>> -import java.util.Iterator;
>>> -import java.util.Locale;
>>> -import java.util.Map;
>>> -
>>> -import javax.swing.DefaultListModel;
>>> -import javax.swing.ListSelectionModel;
>>> -
>>> -import net.xoetrope.swing.XButton;
>>> -import net.xoetrope.swing.XDialog;
>>> -import net.xoetrope.swing.XList;
>>> -import net.xoetrope.xui.XPage;
>>> -
>>> -import org.ofbiz.base.util.Debug;
>>> -import org.ofbiz.base.util.UtilProperties;
>>> -import org.ofbiz.pos.PosTransaction;
>>> -
>>> -
>>> -public class LoadSale extends XPage {
>>> -
>>> -    /**
>>> -     * To load a sale from a shopping list. 2 modes : add to or 
>>> replace the current sale. Also a button to delete a sale (aka
>> shopping list)
>>> -     */
>>> -    public static final String module = LoadSale.class.getName();
>>> -    protected static PosScreen m_pos = null;
>>> -    protected XDialog m_dialog = null;
>>> -    static protected Hashtable m_saleMap = new Hashtable();
>>> -    protected XList m_salesList = null;
>>> -    protected XButton m_cancel = null;
>>> -    protected XButton m_add = null;
>>> -    protected XButton m_replace = null;
>>> -    protected XButton m_delete = null;
>>> -    protected XButton m_replaceAndDelete = null;
>>> -    protected DefaultListModel m_listModel = null;
>>> -    protected static PosTransaction m_trans = null;
>>> -
>>> -    //TODO : make getter and setter for members (ie m_*) if needed 
>>> (extern calls). For that in Eclipse use Source/Generate
>> Getters and setters
>>> -
>>> -    public LoadSale(Hashtable saleMap, PosTransaction trans, 
>>> PosScreen page) {
>>> -        m_saleMap.putAll(saleMap);
>>> -        m_trans = trans;
>>> -        m_pos = page;
>>> -    }
>>> -
>>> -    public void openDlg() {
>>> -        m_dialog = (XDialog) 
>>> pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/loadsale");
>>> -        m_dialog.setCaption(UtilProperties.getMessage("pos", 
>>> "LoadASale", Locale.getDefault()));
>>> -        m_salesList = (XList) m_dialog.findComponent("salesList");
>>> -        addMouseHandler(m_salesList, "saleDoubleClick");
>>> -
>>> -        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
>>> -        m_add = (XButton) m_dialog.findComponent("BtnAdd");
>>> -        m_replace = (XButton) m_dialog.findComponent("BtnReplace");
>>> -        m_delete = (XButton) m_dialog.findComponent("BtnDelete");
>>> -        m_replaceAndDelete = (XButton) 
>>> m_dialog.findComponent("BtnReplaceAndDelete");
>>> -        addMouseHandler(m_cancel, "cancel");
>>> -        addMouseHandler(m_add, "addSale");
>>> -        addMouseHandler(m_replace, "replaceSale");
>>> -        addMouseHandler(m_delete, "deleteShoppingList");
>>> -        addMouseHandler(m_replaceAndDelete, 
>>> "replaceSaleAndDeleteShoppingList");
>>> -
>>> -        m_listModel = new DefaultListModel();
>>> -        for (Iterator i = m_saleMap.entrySet().iterator(); 
>>> i.hasNext();) {
>>> -            Object o = i.next();
>>> -            Map.Entry entry = (Map.Entry)o;
>>> -            String val = entry.getValue().toString();
>>> -            m_listModel.addElement(val);
>>> -        }
>>> -        m_salesList.setModel(m_listModel);
>>> -        m_salesList.setVisibleRowCount(-1);
>>> -        m_salesList.ensureIndexIsVisible(m_salesList.getItemCount());
>>> -        
>>> m_salesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
>>> -        m_salesList.setToolTipText(UtilProperties.getMessage("pos", 
>>> "LoadSaleListDblClickTip", Locale.getDefault()));
>>> -
>>> -        m_dialog.pack();
>>> -        m_salesList.requestFocusInWindow();
>>> -        m_dialog.showDialog(this);
>>> -    }
>>> -
>>> -    public synchronized void saleDoubleClick() {
>>> -        if (wasMouseDoubleClicked()) {
>>> -            String sale = selectedSale();
>>> -            if (null != sale) {
>>> -                replaceSaleAndDeleteShoppingList_();
>>> -            }
>>> -        }
>>> -    }
>>> -
>>> -    public synchronized void cancel() {
>>> -        if (wasMouseClicked()) {
>>> -            closeDlg();
>>> -        }
>>> -    }
>>> -
>>> -    public synchronized void addSale() {
>>> -        if (wasMouseClicked()) {
>>> -            addSale_();
>>> -        }
>>> -    }
>>> -
>>> -    private synchronized void addSale_() {
>>> -        String sale = selectedSale();
>>> -        if (null != sale) {
>>> -            addListToCart(sale, true);
>>> -        }
>>> -    }
>>> -
>>> -    public synchronized void replaceSale() {
>>> -        if (wasMouseClicked()) {
>>> -            replaceSale_();
>>> -        }
>>> -    }
>>> -
>>> -    private synchronized void replaceSale_() {
>>> -        String sale = selectedSale();
>>> -        if (null != sale) {
>>> -            addListToCart(sale, false);
>>> -        }
>>> -    }
>>> -
>>> -    public synchronized void deleteShoppingList() {
>>> -        if (wasMouseClicked()) {
>>> -            deleteShoppingList_();
>>> -        }
>>> -    }
>>> -
>>> -    private synchronized void deleteShoppingList_() {
>>> -        String sale= (String) m_salesList.getSelectedValue();
>>> -        if (null != sale) {
>>> -            String shoppingListId = selectedSale();
>>> -            final ClassLoader cl = this.getClassLoader(m_pos);
>>> -            Thread.currentThread().setContextClassLoader(cl);
>>> -            if (m_trans.clearList(shoppingListId, m_pos)) {
>>> -                int index = m_salesList.getSelectedIndex();
>>> -                m_saleMap.remove(shoppingListId);
>>> -                m_listModel = new DefaultListModel();
>>> -                for (Iterator i = m_saleMap.entrySet().iterator(); 
>>> i.hasNext();) {
>>> -                    Object o = i.next();
>>> -                    Map.Entry entry = (Map.Entry)o;
>>> -                    String val = entry.getValue().toString();
>>> -                    m_listModel.addElement(val);
>>> -                }
>>> -                m_salesList.setModel(m_listModel);
>>> -                int size = m_listModel.getSize();
>>> -                if (size == 0) { //Nobody's left, nothing to do here
>>> -                    closeDlg();
>>> -                } else { //Select an index.
>>> -                    if (index == size) {
>>> -                        //removed item in last position
>>> -                        index--;
>>> -                    }
>>> -                }
>>> -                m_salesList.setSelectedIndex(index);
>>> -                m_salesList.ensureIndexIsVisible(index);
>>> -                m_salesList.repaint();
>>> -                repaint();
>>> -            }
>>> -        }
>>> -    }
>>> -
>>> -    public synchronized void replaceSaleAndDeleteShoppingList() {
>>> -        if (wasMouseClicked()) {
>>> -            replaceSaleAndDeleteShoppingList_();
>>> -        }
>>> -    }
>>> -
>>> -    public synchronized void replaceSaleAndDeleteShoppingList_() {
>>> -        replaceSale_();
>>> -        deleteShoppingList_();
>>> -    }
>>> -
>>> -    private String selectedSale() {
>>> -        String saleSelected = null;
>>> -        if (null != m_salesList.getSelectedValue()) {
>>> -            String sale = (String) m_salesList.getSelectedValue();
>>> -            Iterator i = m_saleMap.entrySet().iterator();
>>> -            while(i.hasNext()) {
>>> -                Object o = i.next();
>>> -                Map.Entry entry = (Map.Entry)o;
>>> -                String val = entry.getValue().toString();
>>> -                if (val.equals(sale)) {
>>> -                    saleSelected = entry.getKey().toString();
>>> -                }
>>> -            }
>>> -        }
>>> -        return saleSelected;
>>> -    }
>>> -
>>> -    private void addListToCart(String sale, boolean addToCart) {
>>> -        final ClassLoader cl = this.getClassLoader(m_pos);
>>> -        Thread.currentThread().setContextClassLoader(cl);
>>> -        if (!m_trans.addListToCart(sale, m_pos, addToCart)) {
>>> -            Debug.logError("Error while loading cart from shopping 
>>> list : " + sale, module);
>>> -        }
>>> -        else {
>>> -            m_trans.calcTax();
>>> -            m_pos.refresh();
>>> -        }
>>> -        closeDlg();
>>> -    }
>>> -
>>> -    private ClassLoader getClassLoader(PosScreen pos) {
>>> -        ClassLoader cl = pos.getClassLoader();
>>> -        if (cl == null) {
>>> -            try {
>>> -                cl = Thread.currentThread().getContextClassLoader();
>>> -            } catch (Throwable t) {
>>> -            }
>>> -            if (cl == null) {
>>> -                Debug.log("No context classloader available; using 
>>> class classloader", module);
>>> -                try {
>>> -                    cl = this.getClass().getClassLoader();
>>> -                } catch (Throwable t) {
>>> -                    Debug.logError(t, module);
>>> -                }
>>> -            }
>>> -        }
>>> -        return cl;
>>> -    }
>>> -
>>> -    private void closeDlg() {
>>> -        m_dialog.closeDlg();
>>> -    }
>>> +/******************************************************************************* 
>>>
>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>> + * or more contributor license agreements.  See the NOTICE file
>>> + * distributed with this work for additional information
>>> + * regarding copyright ownership.  The ASF licenses this file
>>> + * to you under the Apache License, Version 2.0 (the
>>> + * "License"); you may not use this file except in compliance
>>> + * with the License.  You may obtain a copy of the License at
>>> + *
>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>> + *
>>> + * Unless required by applicable law or agreed to in writing,
>>> + * software distributed under the License is distributed on an
>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>> + * KIND, either express or implied.  See the License for the
>>> + * specific language governing permissions and limitations
>>> + * under the License.
>>> + 
>>> *******************************************************************************/ 
>>>
>>> +package org.ofbiz.pos.screen;
>>> +
>>> +import java.util.Hashtable;
>>> +import java.util.Iterator;
>>> +import java.util.Locale;
>>> +import java.util.Map;
>>> +
>>> +import javax.swing.DefaultListModel;
>>> +import javax.swing.ListSelectionModel;
>>> +
>>> +import net.xoetrope.swing.XButton;
>>> +import net.xoetrope.swing.XDialog;
>>> +import net.xoetrope.swing.XList;
>>> +import net.xoetrope.xui.XPage;
>>> +
>>> +import org.ofbiz.base.util.Debug;
>>> +import org.ofbiz.base.util.UtilProperties;
>>> +import org.ofbiz.pos.PosTransaction;
>>> +
>>> +
>>> +public class LoadSale extends XPage {
>>> +
>>> +    /**
>>> +     * To load a sale from a shopping list. 2 modes : add to or 
>>> replace the current sale. Also a button to delete a sale (aka
>> shopping list)
>>> +     */
>>> +    public static final String module = LoadSale.class.getName();
>>> +    protected static PosScreen m_pos = null;
>>> +    protected XDialog m_dialog = null;
>>> +    static protected Hashtable m_saleMap = new Hashtable();
>>> +    protected XList m_salesList = null;
>>> +    protected XButton m_cancel = null;
>>> +    protected XButton m_add = null;
>>> +    protected XButton m_replace = null;
>>> +    protected XButton m_delete = null;
>>> +    protected XButton m_replaceAndDelete = null;
>>> +    protected DefaultListModel m_listModel = null;
>>> +    protected static PosTransaction m_trans = null;
>>> +
>>> +    //TODO : make getter and setter for members (ie m_*) if needed 
>>> (extern calls). For that in Eclipse use Source/Generate
>> Getters and setters
>>> +
>>> +    public LoadSale(Hashtable saleMap, PosTransaction trans, 
>>> PosScreen page) {
>>> +        m_saleMap.putAll(saleMap);
>>> +        m_trans = trans;
>>> +        m_pos = page;
>>> +    }
>>> +
>>> +    public void openDlg() {
>>> +        m_dialog = (XDialog) 
>>> pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/loadsale");
>>> +        m_dialog.setCaption(UtilProperties.getMessage("pos", 
>>> "LoadASale", Locale.getDefault()));
>>> +        m_salesList = (XList) m_dialog.findComponent("salesList");
>>> +        addMouseHandler(m_salesList, "saleDoubleClick");
>>> +
>>> +        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
>>> +        m_add = (XButton) m_dialog.findComponent("BtnAdd");
>>> +        m_replace = (XButton) m_dialog.findComponent("BtnReplace");
>>> +        m_delete = (XButton) m_dialog.findComponent("BtnDelete");
>>> +        m_replaceAndDelete = (XButton) 
>>> m_dialog.findComponent("BtnReplaceAndDelete");
>>> +        addMouseHandler(m_cancel, "cancel");
>>> +        addMouseHandler(m_add, "addSale");
>>> +        addMouseHandler(m_replace, "replaceSale");
>>> +        addMouseHandler(m_delete, "deleteShoppingList");
>>> +        addMouseHandler(m_replaceAndDelete, 
>>> "replaceSaleAndDeleteShoppingList");
>>> +
>>> +        m_listModel = new DefaultListModel();
>>> +        for (Iterator i = m_saleMap.entrySet().iterator(); 
>>> i.hasNext();) {
>>> +            Object o = i.next();
>>> +            Map.Entry entry = (Map.Entry)o;
>>> +            String val = entry.getValue().toString();
>>> +            m_listModel.addElement(val);
>>> +        }
>>> +        m_salesList.setModel(m_listModel);
>>> +        m_salesList.setVisibleRowCount(-1);
>>> +        m_salesList.ensureIndexIsVisible(m_salesList.getItemCount());
>>> +        
>>> m_salesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
>>> +        m_salesList.setToolTipText(UtilProperties.getMessage("pos", 
>>> "LoadSaleListDblClickTip", Locale.getDefault()));
>>> +
>>> +        m_dialog.pack();
>>> +        m_salesList.requestFocusInWindow();
>>> +        m_dialog.showDialog(this);
>>> +    }
>>> +
>>> +    public synchronized void saleDoubleClick() {
>>> +        if (wasMouseDoubleClicked()) {
>>> +            String sale = selectedSale();
>>> +            if (null != sale) {
>>> +                replaceSaleAndDeleteShoppingList_();
>>> +            }
>>> +        }
>>> +    }
>>> +
>>> +    public synchronized void cancel() {
>>> +        if (wasMouseClicked()) {
>>> +            closeDlg();
>>> +        }
>>> +    }
>>> +
>>> +    public synchronized void addSale() {
>>> +        if (wasMouseClicked()) {
>>> +            addSale_();
>>> +        }
>>> +    }
>>> +
>>> +    private synchronized void addSale_() {
>>> +        String sale = selectedSale();
>>> +        if (null != sale) {
>>> +            addListToCart(sale, true);
>>> +        }
>>> +    }
>>> +
>>> +    public synchronized void replaceSale() {
>>> +        if (wasMouseClicked()) {
>>> +            replaceSale_();
>>> +        }
>>> +    }
>>> +
>>> +    private synchronized void replaceSale_() {
>>> +        String sale = selectedSale();
>>> +        if (null != sale) {
>>> +            addListToCart(sale, false);
>>> +        }
>>> +    }
>>> +
>>> +    public synchronized void deleteShoppingList() {
>>> +        if (wasMouseClicked()) {
>>> +            deleteShoppingList_();
>>> +        }
>>> +    }
>>> +
>>> +    private synchronized void deleteShoppingList_() {
>>> +        String sale= (String) m_salesList.getSelectedValue();
>>> +        if (null != sale) {
>>> +            String shoppingListId = selectedSale();
>>> +            final ClassLoader cl = this.getClassLoader(m_pos);
>>> +            Thread.currentThread().setContextClassLoader(cl);
>>> +            if (m_trans.clearList(shoppingListId, m_pos)) {
>>> +                int index = m_salesList.getSelectedIndex();
>>> +                m_saleMap.remove(shoppingListId);
>>> +                m_listModel = new DefaultListModel();
>>> +                for (Iterator i = m_saleMap.entrySet().iterator(); 
>>> i.hasNext();) {
>>> +                    Object o = i.next();
>>> +                    Map.Entry entry = (Map.Entry)o;
>>> +                    String val = entry.getValue().toString();
>>> +                    m_listModel.addElement(val);
>>> +                }
>>> +                m_salesList.setModel(m_listModel);
>>> +                int size = m_listModel.getSize();
>>> +                if (size == 0) { //Nobody's left, nothing to do here
>>> +                    closeDlg();
>>> +                } else { //Select an index.
>>> +                    if (index == size) {
>>> +                        //removed item in last position
>>> +                        index--;
>>> +                    }
>>> +                }
>>> +                m_salesList.setSelectedIndex(index);
>>> +                m_salesList.ensureIndexIsVisible(index);
>>> +                m_salesList.repaint();
>>> +                repaint();
>>> +            }
>>> +        }
>>> +    }
>>> +
>>> +    public synchronized void replaceSaleAndDeleteShoppingList() {
>>> +        if (wasMouseClicked()) {
>>> +            replaceSaleAndDeleteShoppingList_();
>>> +        }
>>> +    }
>>> +
>>> +    public synchronized void replaceSaleAndDeleteShoppingList_() {
>>> +        replaceSale_();
>>> +        deleteShoppingList_();
>>> +    }
>>> +
>>> +    private String selectedSale() {
>>> +        String saleSelected = null;
>>> +        if (null != m_salesList.getSelectedValue()) {
>>> +            String sale = (String) m_salesList.getSelectedValue();
>>> +            Iterator i = m_saleMap.entrySet().iterator();
>>> +            while(i.hasNext()) {
>>> +                Object o = i.next();
>>> +                Map.Entry entry = (Map.Entry)o;
>>> +                String val = entry.getValue().toString();
>>> +                if (val.equals(sale)) {
>>> +                    saleSelected = entry.getKey().toString();
>>> +                }
>>> +            }
>>> +        }
>>> +        return saleSelected;
>>> +    }
>>> +
>>> +    private void addListToCart(String sale, boolean addToCart) {
>>> +        final ClassLoader cl = this.getClassLoader(m_pos);
>>> +        Thread.currentThread().setContextClassLoader(cl);
>>> +        if (!m_trans.addListToCart(sale, m_pos, addToCart)) {
>>> +            Debug.logError("Error while loading cart from shopping 
>>> list : " + sale, module);
>>> +        }
>>> +        else {
>>> +            m_trans.calcTax();
>>> +            m_pos.refresh();
>>> +        }
>>> +        closeDlg();
>>> +    }
>>> +
>>> +    private ClassLoader getClassLoader(PosScreen pos) {
>>> +        ClassLoader cl = pos.getClassLoader();
>>> +        if (cl == null) {
>>> +            try {
>>> +                cl = Thread.currentThread().getContextClassLoader();
>>> +            } catch (Throwable t) {
>>> +            }
>>> +            if (cl == null) {
>>> +                Debug.log("No context classloader available; using 
>>> class classloader", module);
>>> +                try {
>>> +                    cl = this.getClass().getClassLoader();
>>> +                } catch (Throwable t) {
>>> +                    Debug.logError(t, module);
>>> +                }
>>> +            }
>>> +        }
>>> +        return cl;
>>> +    }
>>> +
>>> +    private void closeDlg() {
>>> +        m_dialog.closeDlg();
>>> +    }
>>>  }
>>>
>>> Modified: 
>>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java
>>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java?view=diff&rev=497618&r1=497617&r2=497618 
>>
>>> ============================================================================== 
>>>
>>> --- 
>>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java 
>>> (original)
>>> +++ 
>>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/SaveSale.java 
>>> Thu Jan 18 14:55:50 2007
>>> @@ -1,129 +1,129 @@
>>> -/******************************************************************************* 
>>>
>>> - * Licensed to the Apache Software Foundation (ASF) under one
>>> - * or more contributor license agreements.  See the NOTICE file
>>> - * distributed with this work for additional information
>>> - * regarding copyright ownership.  The ASF licenses this file
>>> - * to you under the Apache License, Version 2.0 (the
>>> - * "License"); you may not use this file except in compliance
>>> - * with the License.  You may obtain a copy of the License at
>>> - *
>>> - * http://www.apache.org/licenses/LICENSE-2.0
>>> - *
>>> - * Unless required by applicable law or agreed to in writing,
>>> - * software distributed under the License is distributed on an
>>> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>> - * KIND, either express or implied.  See the License for the
>>> - * specific language governing permissions and limitations
>>> - * under the License.
>>> - 
>>> *******************************************************************************/ 
>>>
>>> -package org.ofbiz.pos.screen;
>>> -
>>> -import java.text.SimpleDateFormat;
>>> -import java.util.Date;
>>> -import java.util.Locale;
>>> -
>>> -import net.xoetrope.swing.XButton;
>>> -//import org.ofbiz.pos.screen.XFocusDialog;
>>> -import net.xoetrope.swing.XEdit;
>>> -import net.xoetrope.swing.XDialog;
>>> -import net.xoetrope.xui.XPage;
>>> -
>>> -import org.ofbiz.base.util.Debug;
>>> -import org.ofbiz.base.util.UtilProperties;
>>> -import org.ofbiz.pos.PosTransaction;
>>> -
>>> -
>>> -public class SaveSale extends XPage {
>>> -
>>> -    /**
>>> -     * To save a sale. 2 modes : save and keep the current sale or 
>>> save and clear the current sale.
>>> -     */
>>> -    public static final String module = SaveSale.class.getName();
>>> -    protected static PosScreen m_pos = null;
>>> -    protected XDialog m_dialog = null;
>>> -    protected XEdit m_saleName = null;
>>> -    protected XButton m_cancel = null;
>>> -    protected XButton m_save = null;
>>> -    protected XButton m_saveAndClear = null;
>>> -    protected static PosTransaction m_trans = null;
>>> -    public static SimpleDateFormat sdf = new
>> SimpleDateFormat(UtilProperties.getMessage("pos","DateTimeFormat",Locale.getDefault())); 
>>
>>> -
>>> -    //TODO : make getter and setter for members (ie m_*) if needed 
>>> (extern calls).  For that in Eclipse use Source/Generate
>> Getters and setters
>>> -
>>> -    public SaveSale(PosTransaction trans, PosScreen page) {
>>> -        m_trans = trans;
>>> -        m_pos = page;
>>> -    }
>>> -
>>> -    public void openDlg() {
>>> -        m_dialog = (XDialog) 
>>> pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/savesale");
>>> -        m_saleName = (XEdit) m_dialog.findComponent("saleName");
>>> -        //m_dialog.setM_focused(m_saleName);
>>> -        m_saleName.setText(m_pos.session.getUserId() + " " + 
>>> sdf.format(new Date()));
>>> -        m_dialog.setCaption(UtilProperties.getMessage("pos", 
>>> "SaveASale", Locale.getDefault()));
>>> -
>>> -        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
>>> -        m_save = (XButton) m_dialog.findComponent("BtnSave");
>>> -        m_saveAndClear = (XButton) 
>>> m_dialog.findComponent("BtnSaveAndClear");
>>> -
>>> -        addMouseHandler(m_cancel, "cancel");
>>> -        addMouseHandler(m_save, "save");
>>> -        addMouseHandler(m_saveAndClear, "saveAndClear");
>>> -
>>> -        m_dialog.pack();
>>> -        m_dialog.showDialog(this);
>>> -    }
>>> -
>>> -    public synchronized void cancel()
>>> -    {
>>> -        if (wasMouseClicked()) {
>>> -            this.m_dialog.closeDlg();
>>> -        }
>>> -    }
>>> -
>>> -    public synchronized void save() {
>>> -        if (wasMouseClicked()) {
>>> -            String sale = m_saleName.getText();
>>> -            if (null != sale) {
>>> -                saveSale(sale);
>>> -            }
>>> -        }
>>> -    }
>>> -
>>> -    public synchronized void saveAndClear() {
>>> -        if (wasMouseClicked()) {
>>> -            String sale = m_saleName.getText();
>>> -            if (null != sale) {
>>> -                saveSale(sale);
>>> -                m_trans.voidSale();
>>> -                m_pos.refresh();
>>> -            }
>>> -        }
>>> -    }
>>> -
>>> -    private void saveSale(String sale) {
>>> -        final ClassLoader cl = this.getClassLoader(m_pos);
>>> -        Thread.currentThread().setContextClassLoader(cl);
>>> -        m_trans.saveSale(sale, m_pos);
>>> -        this.m_dialog.closeDlg();
>>> -    }
>>> -
>>> -    private ClassLoader getClassLoader(PosScreen pos) {
>>> -        ClassLoader cl = pos.getClassLoader();
>>> -        if (cl == null) {
>>> -            try {
>>> -                cl = Thread.currentThread().getContextClassLoader();
>>> -            } catch (Throwable t) {
>>> -            }
>>> -            if (cl == null) {
>>> -                Debug.log("No context classloader available; using 
>>> class classloader", module);
>>> -                try {
>>> -                    cl = this.getClass().getClassLoader();
>>> -                } catch (Throwable t) {
>>> -                    Debug.logError(t, module);
>>> -                }
>>> -            }
>>> -        }
>>> -        return cl;
>>> -    }
>>> +/******************************************************************************* 
>>>
>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>> + * or more contributor license agreements.  See the NOTICE file
>>> + * distributed with this work for additional information
>>> + * regarding copyright ownership.  The ASF licenses this file
>>> + * to you under the Apache License, Version 2.0 (the
>>> + * "License"); you may not use this file except in compliance
>>> + * with the License.  You may obtain a copy of the License at
>>> + *
>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>> + *
>>> + * Unless required by applicable law or agreed to in writing,
>>> + * software distributed under the License is distributed on an
>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>> + * KIND, either express or implied.  See the License for the
>>> + * specific language governing permissions and limitations
>>> + * under the License.
>>> + 
>>> *******************************************************************************/ 
>>>
>>> +package org.ofbiz.pos.screen;
>>> +
>>> +import java.text.SimpleDateFormat;
>>> +import java.util.Date;
>>> +import java.util.Locale;
>>> +
>>> +import net.xoetrope.swing.XButton;
>>> +//import org.ofbiz.pos.screen.XFocusDialog;
>>> +import net.xoetrope.swing.XEdit;
>>> +import net.xoetrope.swing.XDialog;
>>> +import net.xoetrope.xui.XPage;
>>> +
>>> +import org.ofbiz.base.util.Debug;
>>> +import org.ofbiz.base.util.UtilProperties;
>>> +import org.ofbiz.pos.PosTransaction;
>>> +
>>> +
>>> +public class SaveSale extends XPage {
>>> +
>>> +    /**
>>> +     * To save a sale. 2 modes : save and keep the current sale or 
>>> save and clear the current sale.
>>> +     */
>>> +    public static final String module = SaveSale.class.getName();
>>> +    protected static PosScreen m_pos = null;
>>> +    protected XDialog m_dialog = null;
>>> +    protected XEdit m_saleName = null;
>>> +    protected XButton m_cancel = null;
>>> +    protected XButton m_save = null;
>>> +    protected XButton m_saveAndClear = null;
>>> +    protected static PosTransaction m_trans = null;
>>> +    public static SimpleDateFormat sdf = new
>> SimpleDateFormat(UtilProperties.getMessage("pos","DateTimeFormat",Locale.getDefault())); 
>>
>>> +
>>> +    //TODO : make getter and setter for members (ie m_*) if needed 
>>> (extern calls).  For that in Eclipse use Source/Generate
>> Getters and setters
>>> +
>>> +    public SaveSale(PosTransaction trans, PosScreen page) {
>>> +        m_trans = trans;
>>> +        m_pos = page;
>>> +    }
>>> +
>>> +    public void openDlg() {
>>> +        m_dialog = (XDialog) 
>>> pageMgr.loadPage(m_pos.getScreenLocation() + "/dialog/savesale");
>>> +        m_saleName = (XEdit) m_dialog.findComponent("saleName");
>>> +        //m_dialog.setM_focused(m_saleName);
>>> +        m_saleName.setText(m_pos.session.getUserId() + " " + 
>>> sdf.format(new Date()));
>>> +        m_dialog.setCaption(UtilProperties.getMessage("pos", 
>>> "SaveASale", Locale.getDefault()));
>>> +
>>> +        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
>>> +        m_save = (XButton) m_dialog.findComponent("BtnSave");
>>> +        m_saveAndClear = (XButton) 
>>> m_dialog.findComponent("BtnSaveAndClear");
>>> +
>>> +        addMouseHandler(m_cancel, "cancel");
>>> +        addMouseHandler(m_save, "save");
>>> +        addMouseHandler(m_saveAndClear, "saveAndClear");
>>> +
>>> +        m_dialog.pack();
>>> +        m_dialog.showDialog(this);
>>> +    }
>>> +
>>> +    public synchronized void cancel()
>>> +    {
>>> +        if (wasMouseClicked()) {
>>> +            this.m_dialog.closeDlg();
>>> +        }
>>> +    }
>>> +
>>> +    public synchronized void save() {
>>> +        if (wasMouseClicked()) {
>>> +            String sale = m_saleName.getText();
>>> +            if (null != sale) {
>>> +                saveSale(sale);
>>> +            }
>>> +        }
>>> +    }
>>> +
>>> +    public synchronized void saveAndClear() {
>>> +        if (wasMouseClicked()) {
>>> +            String sale = m_saleName.getText();
>>> +            if (null != sale) {
>>> +                saveSale(sale);
>>> +                m_trans.voidSale();
>>> +                m_pos.refresh();
>>> +            }
>>> +        }
>>> +    }
>>> +
>>> +    private void saveSale(String sale) {
>>> +        final ClassLoader cl = this.getClassLoader(m_pos);
>>> +        Thread.currentThread().setContextClassLoader(cl);
>>> +        m_trans.saveSale(sale, m_pos);
>>> +        this.m_dialog.closeDlg();
>>> +    }
>>> +
>>> +    private ClassLoader getClassLoader(PosScreen pos) {
>>> +        ClassLoader cl = pos.getClassLoader();
>>> +        if (cl == null) {
>>> +            try {
>>> +                cl = Thread.currentThread().getContextClassLoader();
>>> +            } catch (Throwable t) {
>>> +            }
>>> +            if (cl == null) {
>>> +                Debug.log("No context classloader available; using 
>>> class classloader", module);
>>> +                try {
>>> +                    cl = this.getClass().getClassLoader();
>>> +                } catch (Throwable t) {
>>> +                    Debug.logError(t, module);
>>> +                }
>>> +            }
>>> +        }
>>> +        return cl;
>>> +    }
>>>  }
>>>
>>
> 


Re: svn commit: r497618 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/order/ applications/order/src/org/ofbiz/order/shoppingcart/ applications/order/src/org/ofbiz/order/shoppinglist/ applications/product/src/org/ofbiz/product/store/ specialpurp

Posted by Jacques Le Roux <ja...@les7arts.com>.
Yes this part of the changes was questionable, I agree. Si had a point though having dispatcher at end is easier  to use. Anyway
it's not a big deal.

Jacques


----- Original Message ----- 
From: "David E. Jones" <jo...@hotwaxmedia.com>
To: <de...@ofbiz.apache.org>
Sent: Friday, January 19, 2007 9:12 AM
Subject: Re: svn commit: r497618 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/order/
applications/order/src/org/ofbiz/order/shoppingcart/ applications/order/src/org/ofbiz/order/shoppinglist/
applications/product/src/org/ofbiz/product/store/ specialpurp


>
> Seriously though, what was the point of switching those parameters?
> Was it really worth breaking backward compatibility? My opinion: no,
> it's not worth it.
>
> -David
>
>
> On Jan 19, 2007, at 12:57 AM, Jacques Le Roux wrote:
>
> > Si,
> >
> > You will have to change
> >     \crmsfa\src\com\opensourcestrategies\crmsfa\orders
> > \CrmsfaOrderEvents.java:181
> > and
> >     \crmsfa\src\com\opensourcestrategies\crmsfa\orders
> > \CrmsfaOrderEvents.java:275
> >
> > for
> >    cart.addOrIncreaseItem(productId, null, 1, null, null, null,
> > null, null, null, null, null, null, null, null, dispatcher, null);
> > to
> >    cart.addOrIncreaseItem(productId, null, 1, null, null, null,
> > null, null, null, null, null, null, null, null, null, dispatcher);
> >
> > Thanks
> >
> > Jacques
> >
> > ----- Original Message -----
> > From: <jl...@apache.org>
> > To: <co...@ofbiz.apache.org>
> > Sent: Thursday, January 18, 2007 11:55 PM
> > Subject: svn commit: r497618 - in /ofbiz/trunk: applications/order/
> > src/org/ofbiz/order/order/
> > applications/order/src/org/ofbiz/order/shoppingcart/ applications/
> > order/src/org/ofbiz/order/shoppinglist/
> > applications/product/src/org/ofbiz/product/store/ specialpurp...
> >
> >
> >> Author: jleroux
> >> Date: Thu Jan 18 14:55:50 2007
> >> New Revision: 497618
> >>
> >> URL: http://svn.apache.org/viewvc?view=rev&rev=497618
> >> Log:
> >> Some enhancements suggested by Si for commit 495945
> >>
> >> Modified:
> >>     ofbiz/trunk/applications/order/src/org/ofbiz/order/order/
> >> OrderServices.java
> >>     ofbiz/trunk/applications/order/src/org/ofbiz/order/
> >> shoppingcart/ShoppingCart.java
> >>     ofbiz/trunk/applications/order/src/org/ofbiz/order/
> >> shoppingcart/ShoppingCartHelper.java
> >>     ofbiz/trunk/applications/order/src/org/ofbiz/order/
> >> shoppinglist/ShoppingListEvents.java
> >>     ofbiz/trunk/applications/order/src/org/ofbiz/order/
> >> shoppinglist/ShoppingListServices.java
> >>     ofbiz/trunk/applications/product/src/org/ofbiz/product/store/
> >> ProductStoreWorker.java
> >>     ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/
> >> PosTransaction.java
> >>     ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/
> >> LoadSale.java
> >>     ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/
> >> SaveSale.java
> >>
> >> 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=497618&r1=497617&r2=497618
> >> =====================================================================
> >> =========
> >> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/
> >> OrderServices.java (original)
> >> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/
> >> OrderServices.java Thu Jan 18 14:55:50 2007
> >> @@ -3415,7 +3415,7 @@
> >>          Locale locale = (Locale) context.get("locale");
> >>          ShoppingCart cart = new ShoppingCart(dctx.getDelegator(),
> >> "9000", "webStore", locale, "USD");
> >>          try {
> >> -            cart.addOrIncreaseItem("GZ-1005", null, 1, null,
> >> null, null, null, null, null, null, "DemoCatalog", null, null, null,
> > dctx.getDispatcher(),null);
> >> +            cart.addOrIncreaseItem("GZ-1005", null, 1, null,
> >> null, null, null, null, null, null, "DemoCatalog", null, null, null,
> > null, dctx.getDispatcher());
> >>              } catch (CartItemModifyException e) {
> >>              Debug.logError(e, module);
> >>          } catch (ItemNotFoundException e) {
> >> @@ -3653,7 +3653,7 @@
> >>
> >>    item.getTimestamp("shipAfterDate"),
> >>
> >>    null, null, null,
> >>
> >>    null, null, null,
> >> -
> >>    dispatcher, null);
> >> +
> >>    null, dispatcher);
> >>                                  ShoppingCartItem sci =
> >> cart.findCartItem(itemIndex);
> >>                                  sci.setAssociatedOrderId(orderId);
> >>                                  sci.setAssociatedOrderItemSeqId
> >> (item.getString("orderItemSeqId"));
> >>
> >> 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=497618&r1=497617&r2=497618
> >> =====================================================================
> >> =========
> >> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/
> >> shoppingcart/ShoppingCart.java (original)
> >> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/
> >> shoppingcart/ShoppingCart.java Thu Jan 18 14:55:50 2007
> >> @@ -444,7 +444,7 @@
> >>       */
> >>      public int addOrIncreaseItem(String productId, Double
> >> selectedAmountDbl, double quantity, Timestamp reservStart, Double
> > reservLengthDbl, Double reservPersonsDbl,
> >>              Timestamp shipBeforeDate, Timestamp shipAfterDate,
> >> Map features, Map attributes, String prodCatalogId,
> >> -            ProductConfigWrapper configWrapper, String itemType,
> >> String itemGroupNumber, LocalDispatcher dispatcher, String
> > parentProductId) throws CartItemModifyException,
> > ItemNotFoundException {
> >> +            ProductConfigWrapper configWrapper, String itemType,
> >> String itemGroupNumber, String parentProductId, LocalDispatcher
> > dispatcher) throws CartItemModifyException, ItemNotFoundException {
> >>          if (isReadOnlyCart()) {
> >>             throw new CartItemModifyException("Cart items cannot
> >> be changed");
> >>          }
> >>
> >> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/
> >> shoppingcart/ShoppingCartHelper.java
> >> URL:
> > http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/
> > ofbiz/order/shoppingcart/ShoppingCartHelper.java?
> > view=diff&rev=497618&r1=497617&r2=497618
> >> =====================================================================
> >> =========
> >> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/
> >> shoppingcart/ShoppingCartHelper.java (original)
> >> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/
> >> shoppingcart/ShoppingCartHelper.java Thu Jan 18 14:55:50 2007
> >> @@ -119,7 +119,7 @@
> >>              try {
> >>                  java.sql.Timestamp.valueOf((String) context.get
> >> ("itemDesiredDeliveryDate"));
> >>              } catch (IllegalArgumentException e) {
> >> -            return
> > ServiceUtil.returnError(UtilProperties.getMessage
> > (resource_error,"OrderInvalidDesiredDeliveryDateSyntaxError",this.cart
> > .getLocale())
> > );
> >> +                return
> > ServiceUtil.returnError(UtilProperties.getMessage
> > (resource_error,"OrderInvalidDesiredDeliveryDateSyntaxError",this.cart
> > .getLocale())
> > );
> >>              }
> >>          } else {
> >>              context.remove("itemDesiredDeliveryDate");
> >> @@ -180,7 +180,7 @@
> >>              if (productId != null) {
> >>                  itemId = cart.addOrIncreaseItem(productId,
> >> amount, quantity, reservStart, reservLength,
> >>                                                  reservPersons,
> >> shipBeforeDate, shipAfterDate, null, attributes,
> >> -                                                catalogId,
> >> configWrapper, itemType, itemGroupNumber, dispatcher, pProductId);
> >> +                                                catalogId,
> >> configWrapper, itemType, itemGroupNumber, pProductId, dispatcher);
> >>              } else {
> >>                  itemId = cart.addNonProductItem(itemType,
> >> itemDescription, productCategoryId, price, quantity, attributes,
> > catalogId, itemGroupNumber, dispatcher);
> >>              }
> >> @@ -245,7 +245,7 @@
> >>                          Double amount = orderItem.getDouble
> >> ("selectedAmount");
> >>                          try {
> >>                              this.cart.addOrIncreaseItem
> >> (orderItem.getString("productId"), amount,
> > orderItem.getDouble("quantity").doubleValue(),
> >> -                                    null, null, null, null, null,
> >> null, null, catalogId, null, orderItemTypeId, itemGroupNumber,
> > dispatcher,null);
> >> +                                    null, null, null, null, null,
> >> null, null, catalogId, null, orderItemTypeId, itemGroupNumber,
> > null, dispatcher);
> >>                              noItems = false;
> >>                          } catch (CartItemModifyException e) {
> >>                              errorMsgs.add(e.getMessage());
> >> @@ -283,7 +283,7 @@
> >>                              try {
> >>                                  this.cart.addOrIncreaseItem
> >> (orderItem.getString("productId"), amount,
> >>                                          orderItem.getDouble
> >> ("quantity").doubleValue(), null, null, null, null, null, null, null,
> >> -                                        catalogId, null,
> >> orderItem.getString("orderItemTypeId"), itemGroupNumber, dispatcher,
> > null);
> >> +                                        catalogId, null,
> >> orderItem.getString("orderItemTypeId"), itemGroupNumber, null,
> > dispatcher);
> >>                                  noItems = false;
> >>                              } catch (CartItemModifyException e) {
> >>                                  errorMsgs.add(e.getMessage());
> >> @@ -372,7 +372,7 @@
> >>                  if (quantity > 0.0) {
> >>                      try {
> >>                          if (Debug.verboseOn()) Debug.logVerbose
> >> ("Bulk Adding to cart [" + quantity + "] of [" + productId + "] in
> > Item Group [" + itemGroupNumber + "]", module);
> >> -                        this.cart.addOrIncreaseItem(productId,
> >> null, quantity, null, null, null, null, null, null, null,
> > catalogId, null, null, itemGroupNumberToUse, dispatcher, null);
> >> +                        this.cart.addOrIncreaseItem(productId,
> >> null, quantity, null, null, null, null, null, null, null,
> > catalogId, null, null, itemGroupNumberToUse, null, dispatcher);
> >>                      } catch (CartItemModifyException e) {
> >>                          return ServiceUtil.returnError
> >> (e.getMessage());
> >>                      } catch (ItemNotFoundException e) {
> >> @@ -451,7 +451,7 @@
> >>                          }
> >>                          try {
> >>                              if (Debug.verboseOn())
> >> Debug.logVerbose("Bulk Adding to cart requirement [" + quantity +
> >> "] of [" +
> > productId + "]", module);
> >> -                            int index =
> >> this.cart.addOrIncreaseItem(productId, null, quantity, null, null,
> >> null, null, null,
> > null, null, catalogId, null, null, itemGroupNumber, dispatcher, null);
> >> +                            int index =
> >> this.cart.addOrIncreaseItem(productId, null, quantity, null, null,
> >> null, null, null,
> > null, null, catalogId, null, null, itemGroupNumber, null, dispatcher);
> >>                              ShoppingCartItem sci =
> >> (ShoppingCartItem)this.cart.items().get(index);
> >>                              sci.setRequirementId(requirementId);
> >>                          } catch (CartItemModifyException e) {
> >> @@ -478,7 +478,7 @@
> >>          String errMsg = null;
> >>
> >>          if (categoryId == null || categoryId.length() <= 0) {
> >> -        errMsg = UtilProperties.getMessage
> >> (resource,"cart.category_not_specified_to_add_from",
> >> this.cart.getLocale());
> >> +            errMsg = UtilProperties.getMessage
> >> (resource,"cart.category_not_specified_to_add_from",
> >> this.cart.getLocale());
> >>              result = ServiceUtil.returnError(errMsg);
> >>  //          result =
> > ServiceUtil.returnError(UtilProperties.getMessage
> > (resource_error,"OrderNoCategorySpecifiedToAddFrom.",this.cart.getLoca
> > le()));
> >>              return result;
> >> @@ -515,7 +515,7 @@
> >>                  try {
> >>                      this.cart.addOrIncreaseItem
> >> (productCategoryMember.getString("productId"),
> >>                              null, quantity.doubleValue(), null,
> >> null, null, null, null, null, null,
> >> -                            catalogId, null, null,
> >> itemGroupNumber, dispatcher, null);
> >> +                            catalogId, null, null,
> >> itemGroupNumber, null, dispatcher);
> >>                      totalQuantity += quantity.doubleValue();
> >>                  } catch (CartItemModifyException e) {
> >>                      errorMsgs.add(e.getMessage());
> >> @@ -870,12 +870,12 @@
> >>          GenericValue agreement = null;
> >>
> >>          if ((this.delegator == null) || (this.dispatcher == null)
> >> || (this.cart == null)) {
> >> -        result =
> > ServiceUtil.returnError(UtilProperties.getMessage
> > (resource_error,"OrderDispatcherOrDelegatorOrCartArgumentIsNull",this.
> > cart.getLocal
> > e()));
> >> +            result =
> > ServiceUtil.returnError(UtilProperties.getMessage
> > (resource_error,"OrderDispatcherOrDelegatorOrCartArgumentIsNull",this.
> > cart.getLocal
> > e()));
> >>              return result;
> >>          }
> >>
> >>          if ((agreementId == null) || (agreementId.length() <= 0)) {
> >> -        result =
> > ServiceUtil.returnError(UtilProperties.getMessage
> > (resource_error,"OrderNoAgreementSpecified",this.cart.getLocale()));
> >> +            result =
> > ServiceUtil.returnError(UtilProperties.getMessage
> > (resource_error,"OrderNoAgreementSpecified",this.cart.getLocale()));
> >>              return result;
> >>          }
> >>
> >> @@ -888,7 +888,7 @@
> >>          }
> >>
> >>          if (agreement == null) {
> >> -        result =
> > ServiceUtil.returnError(UtilProperties.getMessage
> > (resource_error,"OrderCouldNotGetAgreement",UtilMisc.toMap
> > ("agreementId",agreementI
> > d),this.cart.getLocale()));
> >> +            result =
> > ServiceUtil.returnError(UtilProperties.getMessage
> > (resource_error,"OrderCouldNotGetAgreement",UtilMisc.toMap
> > ("agreementId",agreementI
> > d),this.cart.getLocale()));
> >>          } else {
> >>              // set the agreement id in the cart
> >>              cart.setAgreementId(agreementId);
> >> @@ -901,7 +901,7 @@
> >>                         try {
> >>                              cart.setCurrency
> >> (dispatcher,currencyUomId);
> >>                         } catch (CartItemModifyException ex) {
> >> -                       result =
> > ServiceUtil.returnError(UtilProperties.getMessage
> > (resource_error,"OrderSetCurrencyError",this.cart.getLocale()) +
> > ex.getMessage());
> >> +                           result =
> > ServiceUtil.returnError(UtilProperties.getMessage
> > (resource_error,"OrderSetCurrencyError",this.cart.getLocale()) +
> > ex.getMessage());
> >>                              return result;
> >>                         }
> >>                   }
> >> @@ -941,7 +941,7 @@
> >>              this.cart.setCurrency(this.dispatcher,currencyUomId);
> >>              result = ServiceUtil.returnSuccess();
> >>           } catch (CartItemModifyException ex) {
> >> -         result = ServiceUtil.returnError
> >> (UtilProperties.getMessage(resource_error,"Set currency
> >> error",this.cart.getLocale()) +
> > ex.getMessage());
> >> +             result = ServiceUtil.returnError
> >> (UtilProperties.getMessage(resource_error,"Set currency
> > error",this.cart.getLocale()) + ex.getMessage());
> >>               return result;
> >>           }
> >>          return result;
> >> @@ -972,7 +972,7 @@
> >>                  productSupplier=(GenericValue)
> >> productSuppliers.get(0);
> >>              }
> >>          } catch (GenericServiceException e) {
> >> -        Debug.logWarning(UtilProperties.getMessage
> >> (resource_error,"OrderRunServiceGetSuppliersForProductError",
> >> cart.getLocale())
> > + e.getMessage(), module);
> >> +            Debug.logWarning(UtilProperties.getMessage
> >> (resource_error,"OrderRunServiceGetSuppliersForProductError",
> > cart.getLocale()) + e.getMessage(), module);
> >>          }
> >>          return productSupplier;
> >>      }
> >>
> >> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/
> >> shoppinglist/ShoppingListEvents.java
> >> URL:
> > http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/
> > ofbiz/order/shoppinglist/ShoppingListEvents.java?
> > view=diff&rev=497618&r1=497617&r2=497618
> >> =====================================================================
> >> =========
> >> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/
> >> shoppinglist/ShoppingListEvents.java (original)
> >> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/
> >> shoppinglist/ShoppingListEvents.java Thu Jan 18 14:55:50 2007
> >> @@ -273,9 +273,9 @@
> >>
> >>                  // i cannot get the addOrDecrease function to
> >> accept a null reservStart field: i get a null pointer exception a
> > null constant works....
> >>                  if (reservStart == null) {
> >> -                    cart.addOrIncreaseItem(productId, null,
> >> quantity.doubleValue(), null, null, null, null, null, null,
> > attributes, prodCatalogId, null, null, null, dispatcher, null);
> >> +                    cart.addOrIncreaseItem(productId, null,
> >> quantity.doubleValue(), null, null, null, null, null, null,
> > attributes, prodCatalogId, null, null, null, null, dispatcher);
> >>                  } else {
> >> -                    cart.addOrIncreaseItem(productId, null,
> >> quantity.doubleValue(), reservStart, reservLength, reservPersons,
> > null, null, null, attributes, prodCatalogId, null, null, null,
> > dispatcher, null);
> >> +                    cart.addOrIncreaseItem(productId, null,
> >> quantity.doubleValue(), reservStart, reservLength, reservPersons,
> > null, null, null, attributes, prodCatalogId, null, null, null,
> > null, dispatcher);
> >>                  }
> >>                  Map messageMap = UtilMisc.toMap("productId",
> >> productId);
> >>                  errMsg = UtilProperties.getMessage
> >> (resource,"shoppinglistevents.added_product_to_cart", messageMap,
> > cart.getLocale());
> >>
> >> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/
> >> shoppinglist/ShoppingListServices.java
> >> URL:
> > http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/
> > ofbiz/order/shoppinglist/ShoppingListServices.java?
> > view=diff&rev=497618&r1=497617&r2=497618
> >> =====================================================================
> >> =========
> >> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/
> >> shoppinglist/ShoppingListServices.java (original)
> >> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/
> >> shoppinglist/ShoppingListServices.java Thu Jan 18 14:55:50 2007
> >> @@ -442,7 +442,7 @@
> >>                          Map attributes = UtilMisc.toMap
> >> ("shoppingListId", listId, "shoppingListItemSeqId", itemId);
> >>
> >>                          try {
> >> -                            listCart.addOrIncreaseItem(productId,
> >> null, quantity.doubleValue(), reservStart, reservLength,
> > reservPersons, null, null, null, attributes, null, null, null,
> > null, dispatcher, null);
> >> +                            listCart.addOrIncreaseItem(productId,
> >> null, quantity.doubleValue(), reservStart, reservLength,
> > reservPersons, null, null, null, attributes, null, null, null,
> > null, null, dispatcher);
> >>                          } catch (CartItemModifyException e) {
> >>                              Debug.logError(e, "Unable to add
> >> product to List Cart - " + productId, module);
> >>                          } catch (ItemNotFoundException e) {
> >>
> >> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/
> >> store/ProductStoreWorker.java
> >> URL:
> > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/
> > org/ofbiz/product/store/ProductStoreWorker.java?
> > view=diff&rev=497618&r1=497617&r2=497618
> >> =====================================================================
> >> =========
> >> --- ofbiz/trunk/applications/product/src/org/ofbiz/product/store/
> >> ProductStoreWorker.java (original)
> >> +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/store/
> >> ProductStoreWorker.java Thu Jan 18 14:55:50 2007
> >> @@ -470,10 +470,12 @@
> >>                  try {
> >>                      product = delegator.findByPrimaryKeyCache
> >> ("Product", UtilMisc.toMap("productId", productId));
> >>                      if ((product != null) && ("Y".equals
> >> (product.get("isVariant")))) {
> >> -                        if (parentProductId != null)
> >> +                        if (parentProductId != null) {
> >>                              virtualProductId = parentProductId;
> >> -                        else
> >> +                        }
> >> +                        else {
> >>                              virtualProductId =
> >> ProductWorker.getVariantVirtualId(product);
> >> +                        }
> >>                          Debug.log("getSurvey for virtual product
> >> " + virtualProductId,module);
> >>                      }
> >>                  } catch (GenericEntityException e) {
> >>
> >> 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?view=diff&rev=497618&r1=497617&r2=497618
> >> =====================================================================
> >> =========
> >> --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/
> >> PosTransaction.java (original)
> >> +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/
> >> PosTransaction.java Thu Jan 18 14:55:50 2007
> >> @@ -355,7 +355,7 @@
> >>      public void addItem(String productId, double quantity) throws
> >> CartItemModifyException, ItemNotFoundException {
> >>          trace("add item", productId + "/" + quantity);
> >>          try {
> >> -            cart.addOrIncreaseItem(productId, null, quantity,
> >> null, null, null, null, null, null, null, null, null, null, null,
> > session.getDispatcher(), null);
> >> +            cart.addOrIncreaseItem(productId, null, quantity,
> >> null, null, null, null, null, null, null, null, null, null, null,
> > null, session.getDispatcher());
> >>          } catch (ItemNotFoundException e) {
> >>              trace("item not found", e);
> >>              throw e;
> >>
> >> Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/
> >> LoadSale.java
> >> URL:
> > http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/
> > ofbiz/pos/screen/LoadSale.java?
> > view=diff&rev=497618&r1=497617&r2=497618
> >> =====================================================================
> >> =========
> >> --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/
> >> LoadSale.java (original)
> >> +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/
> >> LoadSale.java Thu Jan 18 14:55:50 2007
> >> @@ -1,244 +1,244 @@
> >> -/
> >> *********************************************************************
> >> **********
> >> - * Licensed to the Apache Software Foundation (ASF) under one
> >> - * or more contributor license agreements.  See the NOTICE file
> >> - * distributed with this work for additional information
> >> - * regarding copyright ownership.  The ASF licenses this file
> >> - * to you under the Apache License, Version 2.0 (the
> >> - * "License"); you may not use this file except in compliance
> >> - * with the License.  You may obtain a copy of the License at
> >> - *
> >> - * http://www.apache.org/licenses/LICENSE-2.0
> >> - *
> >> - * Unless required by applicable law or agreed to in writing,
> >> - * software distributed under the License is distributed on an
> >> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> >> - * KIND, either express or implied.  See the License for the
> >> - * specific language governing permissions and limitations
> >> - * under the License.
> >> -
> >> *********************************************************************
> >> **********/
> >> -package org.ofbiz.pos.screen;
> >> -
> >> -import java.util.Hashtable;
> >> -import java.util.Iterator;
> >> -import java.util.Locale;
> >> -import java.util.Map;
> >> -
> >> -import javax.swing.DefaultListModel;
> >> -import javax.swing.ListSelectionModel;
> >> -
> >> -import net.xoetrope.swing.XButton;
> >> -import net.xoetrope.swing.XDialog;
> >> -import net.xoetrope.swing.XList;
> >> -import net.xoetrope.xui.XPage;
> >> -
> >> -import org.ofbiz.base.util.Debug;
> >> -import org.ofbiz.base.util.UtilProperties;
> >> -import org.ofbiz.pos.PosTransaction;
> >> -
> >> -
> >> -public class LoadSale extends XPage {
> >> -
> >> -    /**
> >> -     * To load a sale from a shopping list. 2 modes : add to or
> >> replace the current sale. Also a button to delete a sale (aka
> > shopping list)
> >> -     */
> >> -    public static final String module = LoadSale.class.getName();
> >> -    protected static PosScreen m_pos = null;
> >> -    protected XDialog m_dialog = null;
> >> -    static protected Hashtable m_saleMap = new Hashtable();
> >> -    protected XList m_salesList = null;
> >> -    protected XButton m_cancel = null;
> >> -    protected XButton m_add = null;
> >> -    protected XButton m_replace = null;
> >> -    protected XButton m_delete = null;
> >> -    protected XButton m_replaceAndDelete = null;
> >> -    protected DefaultListModel m_listModel = null;
> >> -    protected static PosTransaction m_trans = null;
> >> -
> >> -    //TODO : make getter and setter for members (ie m_*) if
> >> needed (extern calls). For that in Eclipse use Source/Generate
> > Getters and setters
> >> -
> >> -    public LoadSale(Hashtable saleMap, PosTransaction trans,
> >> PosScreen page) {
> >> -        m_saleMap.putAll(saleMap);
> >> -        m_trans = trans;
> >> -        m_pos = page;
> >> -    }
> >> -
> >> -    public void openDlg() {
> >> -        m_dialog = (XDialog) pageMgr.loadPage
> >> (m_pos.getScreenLocation() + "/dialog/loadsale");
> >> -        m_dialog.setCaption(UtilProperties.getMessage("pos",
> >> "LoadASale", Locale.getDefault()));
> >> -        m_salesList = (XList) m_dialog.findComponent("salesList");
> >> -        addMouseHandler(m_salesList, "saleDoubleClick");
> >> -
> >> -        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
> >> -        m_add = (XButton) m_dialog.findComponent("BtnAdd");
> >> -        m_replace = (XButton) m_dialog.findComponent("BtnReplace");
> >> -        m_delete = (XButton) m_dialog.findComponent("BtnDelete");
> >> -        m_replaceAndDelete = (XButton) m_dialog.findComponent
> >> ("BtnReplaceAndDelete");
> >> -        addMouseHandler(m_cancel, "cancel");
> >> -        addMouseHandler(m_add, "addSale");
> >> -        addMouseHandler(m_replace, "replaceSale");
> >> -        addMouseHandler(m_delete, "deleteShoppingList");
> >> -        addMouseHandler(m_replaceAndDelete,
> >> "replaceSaleAndDeleteShoppingList");
> >> -
> >> -        m_listModel = new DefaultListModel();
> >> -        for (Iterator i = m_saleMap.entrySet().iterator();
> >> i.hasNext();) {
> >> -            Object o = i.next();
> >> -            Map.Entry entry = (Map.Entry)o;
> >> -            String val = entry.getValue().toString();
> >> -            m_listModel.addElement(val);
> >> -        }
> >> -        m_salesList.setModel(m_listModel);
> >> -        m_salesList.setVisibleRowCount(-1);
> >> -        m_salesList.ensureIndexIsVisible(m_salesList.getItemCount
> >> ());
> >> -        m_salesList.setSelectionMode
> >> (ListSelectionModel.SINGLE_SELECTION);
> >> -        m_salesList.setToolTipText(UtilProperties.getMessage
> >> ("pos", "LoadSaleListDblClickTip", Locale.getDefault()));
> >> -
> >> -        m_dialog.pack();
> >> -        m_salesList.requestFocusInWindow();
> >> -        m_dialog.showDialog(this);
> >> -    }
> >> -
> >> -    public synchronized void saleDoubleClick() {
> >> -        if (wasMouseDoubleClicked()) {
> >> -            String sale = selectedSale();
> >> -            if (null != sale) {
> >> -                replaceSaleAndDeleteShoppingList_();
> >> -            }
> >> -        }
> >> -    }
> >> -
> >> -    public synchronized void cancel() {
> >> -        if (wasMouseClicked()) {
> >> -            closeDlg();
> >> -        }
> >> -    }
> >> -
> >> -    public synchronized void addSale() {
> >> -        if (wasMouseClicked()) {
> >> -            addSale_();
> >> -        }
> >> -    }
> >> -
> >> -    private synchronized void addSale_() {
> >> -        String sale = selectedSale();
> >> -        if (null != sale) {
> >> -            addListToCart(sale, true);
> >> -        }
> >> -    }
> >> -
> >> -    public synchronized void replaceSale() {
> >> -        if (wasMouseClicked()) {
> >> -            replaceSale_();
> >> -        }
> >> -    }
> >> -
> >> -    private synchronized void replaceSale_() {
> >> -        String sale = selectedSale();
> >> -        if (null != sale) {
> >> -            addListToCart(sale, false);
> >> -        }
> >> -    }
> >> -
> >> -    public synchronized void deleteShoppingList() {
> >> -        if (wasMouseClicked()) {
> >> -            deleteShoppingList_();
> >> -        }
> >> -    }
> >> -
> >> -    private synchronized void deleteShoppingList_() {
> >> -        String sale= (String) m_salesList.getSelectedValue();
> >> -        if (null != sale) {
> >> -            String shoppingListId = selectedSale();
> >> -            final ClassLoader cl = this.getClassLoader(m_pos);
> >> -            Thread.currentThread().setContextClassLoader(cl);
> >> -            if (m_trans.clearList(shoppingListId, m_pos)) {
> >> -                int index = m_salesList.getSelectedIndex();
> >> -                m_saleMap.remove(shoppingListId);
> >> -                m_listModel = new DefaultListModel();
> >> -                for (Iterator i = m_saleMap.entrySet().iterator
> >> (); i.hasNext();) {
> >> -                    Object o = i.next();
> >> -                    Map.Entry entry = (Map.Entry)o;
> >> -                    String val = entry.getValue().toString();
> >> -                    m_listModel.addElement(val);
> >> -                }
> >> -                m_salesList.setModel(m_listModel);
> >> -                int size = m_listModel.getSize();
> >> -                if (size == 0) { //Nobody's left, nothing to do here
> >> -                    closeDlg();
> >> -                } else { //Select an index.
> >> -                    if (index == size) {
> >> -                        //removed item in last position
> >> -                        index--;
> >> -                    }
> >> -                }
> >> -                m_salesList.setSelectedIndex(index);
> >> -                m_salesList.ensureIndexIsVisible(index);
> >> -                m_salesList.repaint();
> >> -                repaint();
> >> -            }
> >> -        }
> >> -    }
> >> -
> >> -    public synchronized void replaceSaleAndDeleteShoppingList() {
> >> -        if (wasMouseClicked()) {
> >> -            replaceSaleAndDeleteShoppingList_();
> >> -        }
> >> -    }
> >> -
> >> -    public synchronized void replaceSaleAndDeleteShoppingList_() {
> >> -        replaceSale_();
> >> -        deleteShoppingList_();
> >> -    }
> >> -
> >> -    private String selectedSale() {
> >> -        String saleSelected = null;
> >> -        if (null != m_salesList.getSelectedValue()) {
> >> -            String sale = (String) m_salesList.getSelectedValue();
> >> -            Iterator i = m_saleMap.entrySet().iterator();
> >> -            while(i.hasNext()) {
> >> -                Object o = i.next();
> >> -                Map.Entry entry = (Map.Entry)o;
> >> -                String val = entry.getValue().toString();
> >> -                if (val.equals(sale)) {
> >> -                    saleSelected = entry.getKey().toString();
> >> -                }
> >> -            }
> >> -        }
> >> -        return saleSelected;
> >> -    }
> >> -
> >> -    private void addListToCart(String sale, boolean addToCart) {
> >> -        final ClassLoader cl = this.getClassLoader(m_pos);
> >> -        Thread.currentThread().setContextClassLoader(cl);
> >> -        if (!m_trans.addListToCart(sale, m_pos, addToCart)) {
> >> -            Debug.logError("Error while loading cart from
> >> shopping list : " + sale, module);
> >> -        }
> >> -        else {
> >> -            m_trans.calcTax();
> >> -            m_pos.refresh();
> >> -        }
> >> -        closeDlg();
> >> -    }
> >> -
> >> -    private ClassLoader getClassLoader(PosScreen pos) {
> >> -        ClassLoader cl = pos.getClassLoader();
> >> -        if (cl == null) {
> >> -            try {
> >> -                cl = Thread.currentThread().getContextClassLoader();
> >> -            } catch (Throwable t) {
> >> -            }
> >> -            if (cl == null) {
> >> -                Debug.log("No context classloader available;
> >> using class classloader", module);
> >> -                try {
> >> -                    cl = this.getClass().getClassLoader();
> >> -                } catch (Throwable t) {
> >> -                    Debug.logError(t, module);
> >> -                }
> >> -            }
> >> -        }
> >> -        return cl;
> >> -    }
> >> -
> >> -    private void closeDlg() {
> >> -        m_dialog.closeDlg();
> >> -    }
> >> +/
> >> *********************************************************************
> >> **********
> >> + * Licensed to the Apache Software Foundation (ASF) under one
> >> + * or more contributor license agreements.  See the NOTICE file
> >> + * distributed with this work for additional information
> >> + * regarding copyright ownership.  The ASF licenses this file
> >> + * to you under the Apache License, Version 2.0 (the
> >> + * "License"); you may not use this file except in compliance
> >> + * with the License.  You may obtain a copy of the License at
> >> + *
> >> + * http://www.apache.org/licenses/LICENSE-2.0
> >> + *
> >> + * Unless required by applicable law or agreed to in writing,
> >> + * software distributed under the License is distributed on an
> >> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> >> + * KIND, either express or implied.  See the License for the
> >> + * specific language governing permissions and limitations
> >> + * under the License.
> >> +
> >> *********************************************************************
> >> **********/
> >> +package org.ofbiz.pos.screen;
> >> +
> >> +import java.util.Hashtable;
> >> +import java.util.Iterator;
> >> +import java.util.Locale;
> >> +import java.util.Map;
> >> +
> >> +import javax.swing.DefaultListModel;
> >> +import javax.swing.ListSelectionModel;
> >> +
> >> +import net.xoetrope.swing.XButton;
> >> +import net.xoetrope.swing.XDialog;
> >> +import net.xoetrope.swing.XList;
> >> +import net.xoetrope.xui.XPage;
> >> +
> >> +import org.ofbiz.base.util.Debug;
> >> +import org.ofbiz.base.util.UtilProperties;
> >> +import org.ofbiz.pos.PosTransaction;
> >> +
> >> +
> >> +public class LoadSale extends XPage {
> >> +
> >> +    /**
> >> +     * To load a sale from a shopping list. 2 modes : add to or
> >> replace the current sale. Also a button to delete a sale (aka
> > shopping list)
> >> +     */
> >> +    public static final String module = LoadSale.class.getName();
> >> +    protected static PosScreen m_pos = null;
> >> +    protected XDialog m_dialog = null;
> >> +    static protected Hashtable m_saleMap = new Hashtable();
> >> +    protected XList m_salesList = null;
> >> +    protected XButton m_cancel = null;
> >> +    protected XButton m_add = null;
> >> +    protected XButton m_replace = null;
> >> +    protected XButton m_delete = null;
> >> +    protected XButton m_replaceAndDelete = null;
> >> +    protected DefaultListModel m_listModel = null;
> >> +    protected static PosTransaction m_trans = null;
> >> +
> >> +    //TODO : make getter and setter for members (ie m_*) if
> >> needed (extern calls). For that in Eclipse use Source/Generate
> > Getters and setters
> >> +
> >> +    public LoadSale(Hashtable saleMap, PosTransaction trans,
> >> PosScreen page) {
> >> +        m_saleMap.putAll(saleMap);
> >> +        m_trans = trans;
> >> +        m_pos = page;
> >> +    }
> >> +
> >> +    public void openDlg() {
> >> +        m_dialog = (XDialog) pageMgr.loadPage
> >> (m_pos.getScreenLocation() + "/dialog/loadsale");
> >> +        m_dialog.setCaption(UtilProperties.getMessage("pos",
> >> "LoadASale", Locale.getDefault()));
> >> +        m_salesList = (XList) m_dialog.findComponent("salesList");
> >> +        addMouseHandler(m_salesList, "saleDoubleClick");
> >> +
> >> +        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
> >> +        m_add = (XButton) m_dialog.findComponent("BtnAdd");
> >> +        m_replace = (XButton) m_dialog.findComponent("BtnReplace");
> >> +        m_delete = (XButton) m_dialog.findComponent("BtnDelete");
> >> +        m_replaceAndDelete = (XButton) m_dialog.findComponent
> >> ("BtnReplaceAndDelete");
> >> +        addMouseHandler(m_cancel, "cancel");
> >> +        addMouseHandler(m_add, "addSale");
> >> +        addMouseHandler(m_replace, "replaceSale");
> >> +        addMouseHandler(m_delete, "deleteShoppingList");
> >> +        addMouseHandler(m_replaceAndDelete,
> >> "replaceSaleAndDeleteShoppingList");
> >> +
> >> +        m_listModel = new DefaultListModel();
> >> +        for (Iterator i = m_saleMap.entrySet().iterator();
> >> i.hasNext();) {
> >> +            Object o = i.next();
> >> +            Map.Entry entry = (Map.Entry)o;
> >> +            String val = entry.getValue().toString();
> >> +            m_listModel.addElement(val);
> >> +        }
> >> +        m_salesList.setModel(m_listModel);
> >> +        m_salesList.setVisibleRowCount(-1);
> >> +        m_salesList.ensureIndexIsVisible(m_salesList.getItemCount
> >> ());
> >> +        m_salesList.setSelectionMode
> >> (ListSelectionModel.SINGLE_SELECTION);
> >> +        m_salesList.setToolTipText(UtilProperties.getMessage
> >> ("pos", "LoadSaleListDblClickTip", Locale.getDefault()));
> >> +
> >> +        m_dialog.pack();
> >> +        m_salesList.requestFocusInWindow();
> >> +        m_dialog.showDialog(this);
> >> +    }
> >> +
> >> +    public synchronized void saleDoubleClick() {
> >> +        if (wasMouseDoubleClicked()) {
> >> +            String sale = selectedSale();
> >> +            if (null != sale) {
> >> +                replaceSaleAndDeleteShoppingList_();
> >> +            }
> >> +        }
> >> +    }
> >> +
> >> +    public synchronized void cancel() {
> >> +        if (wasMouseClicked()) {
> >> +            closeDlg();
> >> +        }
> >> +    }
> >> +
> >> +    public synchronized void addSale() {
> >> +        if (wasMouseClicked()) {
> >> +            addSale_();
> >> +        }
> >> +    }
> >> +
> >> +    private synchronized void addSale_() {
> >> +        String sale = selectedSale();
> >> +        if (null != sale) {
> >> +            addListToCart(sale, true);
> >> +        }
> >> +    }
> >> +
> >> +    public synchronized void replaceSale() {
> >> +        if (wasMouseClicked()) {
> >> +            replaceSale_();
> >> +        }
> >> +    }
> >> +
> >> +    private synchronized void replaceSale_() {
> >> +        String sale = selectedSale();
> >> +        if (null != sale) {
> >> +            addListToCart(sale, false);
> >> +        }
> >> +    }
> >> +
> >> +    public synchronized void deleteShoppingList() {
> >> +        if (wasMouseClicked()) {
> >> +            deleteShoppingList_();
> >> +        }
> >> +    }
> >> +
> >> +    private synchronized void deleteShoppingList_() {
> >> +        String sale= (String) m_salesList.getSelectedValue();
> >> +        if (null != sale) {
> >> +            String shoppingListId = selectedSale();
> >> +            final ClassLoader cl = this.getClassLoader(m_pos);
> >> +            Thread.currentThread().setContextClassLoader(cl);
> >> +            if (m_trans.clearList(shoppingListId, m_pos)) {
> >> +                int index = m_salesList.getSelectedIndex();
> >> +                m_saleMap.remove(shoppingListId);
> >> +                m_listModel = new DefaultListModel();
> >> +                for (Iterator i = m_saleMap.entrySet().iterator
> >> (); i.hasNext();) {
> >> +                    Object o = i.next();
> >> +                    Map.Entry entry = (Map.Entry)o;
> >> +                    String val = entry.getValue().toString();
> >> +                    m_listModel.addElement(val);
> >> +                }
> >> +                m_salesList.setModel(m_listModel);
> >> +                int size = m_listModel.getSize();
> >> +                if (size == 0) { //Nobody's left, nothing to do here
> >> +                    closeDlg();
> >> +                } else { //Select an index.
> >> +                    if (index == size) {
> >> +                        //removed item in last position
> >> +                        index--;
> >> +                    }
> >> +                }
> >> +                m_salesList.setSelectedIndex(index);
> >> +                m_salesList.ensureIndexIsVisible(index);
> >> +                m_salesList.repaint();
> >> +                repaint();
> >> +            }
> >> +        }
> >> +    }
> >> +
> >> +    public synchronized void replaceSaleAndDeleteShoppingList() {
> >> +        if (wasMouseClicked()) {
> >> +            replaceSaleAndDeleteShoppingList_();
> >> +        }
> >> +    }
> >> +
> >> +    public synchronized void replaceSaleAndDeleteShoppingList_() {
> >> +        replaceSale_();
> >> +        deleteShoppingList_();
> >> +    }
> >> +
> >> +    private String selectedSale() {
> >> +        String saleSelected = null;
> >> +        if (null != m_salesList.getSelectedValue()) {
> >> +            String sale = (String) m_salesList.getSelectedValue();
> >> +            Iterator i = m_saleMap.entrySet().iterator();
> >> +            while(i.hasNext()) {
> >> +                Object o = i.next();
> >> +                Map.Entry entry = (Map.Entry)o;
> >> +                String val = entry.getValue().toString();
> >> +                if (val.equals(sale)) {
> >> +                    saleSelected = entry.getKey().toString();
> >> +                }
> >> +            }
> >> +        }
> >> +        return saleSelected;
> >> +    }
> >> +
> >> +    private void addListToCart(String sale, boolean addToCart) {
> >> +        final ClassLoader cl = this.getClassLoader(m_pos);
> >> +        Thread.currentThread().setContextClassLoader(cl);
> >> +        if (!m_trans.addListToCart(sale, m_pos, addToCart)) {
> >> +            Debug.logError("Error while loading cart from
> >> shopping list : " + sale, module);
> >> +        }
> >> +        else {
> >> +            m_trans.calcTax();
> >> +            m_pos.refresh();
> >> +        }
> >> +        closeDlg();
> >> +    }
> >> +
> >> +    private ClassLoader getClassLoader(PosScreen pos) {
> >> +        ClassLoader cl = pos.getClassLoader();
> >> +        if (cl == null) {
> >> +            try {
> >> +                cl = Thread.currentThread().getContextClassLoader();
> >> +            } catch (Throwable t) {
> >> +            }
> >> +            if (cl == null) {
> >> +                Debug.log("No context classloader available;
> >> using class classloader", module);
> >> +                try {
> >> +                    cl = this.getClass().getClassLoader();
> >> +                } catch (Throwable t) {
> >> +                    Debug.logError(t, module);
> >> +                }
> >> +            }
> >> +        }
> >> +        return cl;
> >> +    }
> >> +
> >> +    private void closeDlg() {
> >> +        m_dialog.closeDlg();
> >> +    }
> >>  }
> >>
> >> Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/
> >> SaveSale.java
> >> URL:
> > http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/
> > ofbiz/pos/screen/SaveSale.java?
> > view=diff&rev=497618&r1=497617&r2=497618
> >> =====================================================================
> >> =========
> >> --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/
> >> SaveSale.java (original)
> >> +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/
> >> SaveSale.java Thu Jan 18 14:55:50 2007
> >> @@ -1,129 +1,129 @@
> >> -/
> >> *********************************************************************
> >> **********
> >> - * Licensed to the Apache Software Foundation (ASF) under one
> >> - * or more contributor license agreements.  See the NOTICE file
> >> - * distributed with this work for additional information
> >> - * regarding copyright ownership.  The ASF licenses this file
> >> - * to you under the Apache License, Version 2.0 (the
> >> - * "License"); you may not use this file except in compliance
> >> - * with the License.  You may obtain a copy of the License at
> >> - *
> >> - * http://www.apache.org/licenses/LICENSE-2.0
> >> - *
> >> - * Unless required by applicable law or agreed to in writing,
> >> - * software distributed under the License is distributed on an
> >> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> >> - * KIND, either express or implied.  See the License for the
> >> - * specific language governing permissions and limitations
> >> - * under the License.
> >> -
> >> *********************************************************************
> >> **********/
> >> -package org.ofbiz.pos.screen;
> >> -
> >> -import java.text.SimpleDateFormat;
> >> -import java.util.Date;
> >> -import java.util.Locale;
> >> -
> >> -import net.xoetrope.swing.XButton;
> >> -//import org.ofbiz.pos.screen.XFocusDialog;
> >> -import net.xoetrope.swing.XEdit;
> >> -import net.xoetrope.swing.XDialog;
> >> -import net.xoetrope.xui.XPage;
> >> -
> >> -import org.ofbiz.base.util.Debug;
> >> -import org.ofbiz.base.util.UtilProperties;
> >> -import org.ofbiz.pos.PosTransaction;
> >> -
> >> -
> >> -public class SaveSale extends XPage {
> >> -
> >> -    /**
> >> -     * To save a sale. 2 modes : save and keep the current sale
> >> or save and clear the current sale.
> >> -     */
> >> -    public static final String module = SaveSale.class.getName();
> >> -    protected static PosScreen m_pos = null;
> >> -    protected XDialog m_dialog = null;
> >> -    protected XEdit m_saleName = null;
> >> -    protected XButton m_cancel = null;
> >> -    protected XButton m_save = null;
> >> -    protected XButton m_saveAndClear = null;
> >> -    protected static PosTransaction m_trans = null;
> >> -    public static SimpleDateFormat sdf = new
> > SimpleDateFormat(UtilProperties.getMessage
> > ("pos","DateTimeFormat",Locale.getDefault()));
> >> -
> >> -    //TODO : make getter and setter for members (ie m_*) if
> >> needed (extern calls).  For that in Eclipse use Source/Generate
> > Getters and setters
> >> -
> >> -    public SaveSale(PosTransaction trans, PosScreen page) {
> >> -        m_trans = trans;
> >> -        m_pos = page;
> >> -    }
> >> -
> >> -    public void openDlg() {
> >> -        m_dialog = (XDialog) pageMgr.loadPage
> >> (m_pos.getScreenLocation() + "/dialog/savesale");
> >> -        m_saleName = (XEdit) m_dialog.findComponent("saleName");
> >> -        //m_dialog.setM_focused(m_saleName);
> >> -        m_saleName.setText(m_pos.session.getUserId() + " " +
> >> sdf.format(new Date()));
> >> -        m_dialog.setCaption(UtilProperties.getMessage("pos",
> >> "SaveASale", Locale.getDefault()));
> >> -
> >> -        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
> >> -        m_save = (XButton) m_dialog.findComponent("BtnSave");
> >> -        m_saveAndClear = (XButton) m_dialog.findComponent
> >> ("BtnSaveAndClear");
> >> -
> >> -        addMouseHandler(m_cancel, "cancel");
> >> -        addMouseHandler(m_save, "save");
> >> -        addMouseHandler(m_saveAndClear, "saveAndClear");
> >> -
> >> -        m_dialog.pack();
> >> -        m_dialog.showDialog(this);
> >> -    }
> >> -
> >> -    public synchronized void cancel()
> >> -    {
> >> -        if (wasMouseClicked()) {
> >> -            this.m_dialog.closeDlg();
> >> -        }
> >> -    }
> >> -
> >> -    public synchronized void save() {
> >> -        if (wasMouseClicked()) {
> >> -            String sale = m_saleName.getText();
> >> -            if (null != sale) {
> >> -                saveSale(sale);
> >> -            }
> >> -        }
> >> -    }
> >> -
> >> -    public synchronized void saveAndClear() {
> >> -        if (wasMouseClicked()) {
> >> -            String sale = m_saleName.getText();
> >> -            if (null != sale) {
> >> -                saveSale(sale);
> >> -                m_trans.voidSale();
> >> -                m_pos.refresh();
> >> -            }
> >> -        }
> >> -    }
> >> -
> >> -    private void saveSale(String sale) {
> >> -        final ClassLoader cl = this.getClassLoader(m_pos);
> >> -        Thread.currentThread().setContextClassLoader(cl);
> >> -        m_trans.saveSale(sale, m_pos);
> >> -        this.m_dialog.closeDlg();
> >> -    }
> >> -
> >> -    private ClassLoader getClassLoader(PosScreen pos) {
> >> -        ClassLoader cl = pos.getClassLoader();
> >> -        if (cl == null) {
> >> -            try {
> >> -                cl = Thread.currentThread().getContextClassLoader();
> >> -            } catch (Throwable t) {
> >> -            }
> >> -            if (cl == null) {
> >> -                Debug.log("No context classloader available;
> >> using class classloader", module);
> >> -                try {
> >> -                    cl = this.getClass().getClassLoader();
> >> -                } catch (Throwable t) {
> >> -                    Debug.logError(t, module);
> >> -                }
> >> -            }
> >> -        }
> >> -        return cl;
> >> -    }
> >> +/
> >> *********************************************************************
> >> **********
> >> + * Licensed to the Apache Software Foundation (ASF) under one
> >> + * or more contributor license agreements.  See the NOTICE file
> >> + * distributed with this work for additional information
> >> + * regarding copyright ownership.  The ASF licenses this file
> >> + * to you under the Apache License, Version 2.0 (the
> >> + * "License"); you may not use this file except in compliance
> >> + * with the License.  You may obtain a copy of the License at
> >> + *
> >> + * http://www.apache.org/licenses/LICENSE-2.0
> >> + *
> >> + * Unless required by applicable law or agreed to in writing,
> >> + * software distributed under the License is distributed on an
> >> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> >> + * KIND, either express or implied.  See the License for the
> >> + * specific language governing permissions and limitations
> >> + * under the License.
> >> +
> >> *********************************************************************
> >> **********/
> >> +package org.ofbiz.pos.screen;
> >> +
> >> +import java.text.SimpleDateFormat;
> >> +import java.util.Date;
> >> +import java.util.Locale;
> >> +
> >> +import net.xoetrope.swing.XButton;
> >> +//import org.ofbiz.pos.screen.XFocusDialog;
> >> +import net.xoetrope.swing.XEdit;
> >> +import net.xoetrope.swing.XDialog;
> >> +import net.xoetrope.xui.XPage;
> >> +
> >> +import org.ofbiz.base.util.Debug;
> >> +import org.ofbiz.base.util.UtilProperties;
> >> +import org.ofbiz.pos.PosTransaction;
> >> +
> >> +
> >> +public class SaveSale extends XPage {
> >> +
> >> +    /**
> >> +     * To save a sale. 2 modes : save and keep the current sale
> >> or save and clear the current sale.
> >> +     */
> >> +    public static final String module = SaveSale.class.getName();
> >> +    protected static PosScreen m_pos = null;
> >> +    protected XDialog m_dialog = null;
> >> +    protected XEdit m_saleName = null;
> >> +    protected XButton m_cancel = null;
> >> +    protected XButton m_save = null;
> >> +    protected XButton m_saveAndClear = null;
> >> +    protected static PosTransaction m_trans = null;
> >> +    public static SimpleDateFormat sdf = new
> > SimpleDateFormat(UtilProperties.getMessage
> > ("pos","DateTimeFormat",Locale.getDefault()));
> >> +
> >> +    //TODO : make getter and setter for members (ie m_*) if
> >> needed (extern calls).  For that in Eclipse use Source/Generate
> > Getters and setters
> >> +
> >> +    public SaveSale(PosTransaction trans, PosScreen page) {
> >> +        m_trans = trans;
> >> +        m_pos = page;
> >> +    }
> >> +
> >> +    public void openDlg() {
> >> +        m_dialog = (XDialog) pageMgr.loadPage
> >> (m_pos.getScreenLocation() + "/dialog/savesale");
> >> +        m_saleName = (XEdit) m_dialog.findComponent("saleName");
> >> +        //m_dialog.setM_focused(m_saleName);
> >> +        m_saleName.setText(m_pos.session.getUserId() + " " +
> >> sdf.format(new Date()));
> >> +        m_dialog.setCaption(UtilProperties.getMessage("pos",
> >> "SaveASale", Locale.getDefault()));
> >> +
> >> +        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
> >> +        m_save = (XButton) m_dialog.findComponent("BtnSave");
> >> +        m_saveAndClear = (XButton) m_dialog.findComponent
> >> ("BtnSaveAndClear");
> >> +
> >> +        addMouseHandler(m_cancel, "cancel");
> >> +        addMouseHandler(m_save, "save");
> >> +        addMouseHandler(m_saveAndClear, "saveAndClear");
> >> +
> >> +        m_dialog.pack();
> >> +        m_dialog.showDialog(this);
> >> +    }
> >> +
> >> +    public synchronized void cancel()
> >> +    {
> >> +        if (wasMouseClicked()) {
> >> +            this.m_dialog.closeDlg();
> >> +        }
> >> +    }
> >> +
> >> +    public synchronized void save() {
> >> +        if (wasMouseClicked()) {
> >> +            String sale = m_saleName.getText();
> >> +            if (null != sale) {
> >> +                saveSale(sale);
> >> +            }
> >> +        }
> >> +    }
> >> +
> >> +    public synchronized void saveAndClear() {
> >> +        if (wasMouseClicked()) {
> >> +            String sale = m_saleName.getText();
> >> +            if (null != sale) {
> >> +                saveSale(sale);
> >> +                m_trans.voidSale();
> >> +                m_pos.refresh();
> >> +            }
> >> +        }
> >> +    }
> >> +
> >> +    private void saveSale(String sale) {
> >> +        final ClassLoader cl = this.getClassLoader(m_pos);
> >> +        Thread.currentThread().setContextClassLoader(cl);
> >> +        m_trans.saveSale(sale, m_pos);
> >> +        this.m_dialog.closeDlg();
> >> +    }
> >> +
> >> +    private ClassLoader getClassLoader(PosScreen pos) {
> >> +        ClassLoader cl = pos.getClassLoader();
> >> +        if (cl == null) {
> >> +            try {
> >> +                cl = Thread.currentThread().getContextClassLoader();
> >> +            } catch (Throwable t) {
> >> +            }
> >> +            if (cl == null) {
> >> +                Debug.log("No context classloader available;
> >> using class classloader", module);
> >> +                try {
> >> +                    cl = this.getClass().getClassLoader();
> >> +                } catch (Throwable t) {
> >> +                    Debug.logError(t, module);
> >> +                }
> >> +            }
> >> +        }
> >> +        return cl;
> >> +    }
> >>  }
> >>
> >
>
>


Re: svn commit: r497618 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/order/ applications/order/src/org/ofbiz/order/shoppingcart/ applications/order/src/org/ofbiz/order/shoppinglist/ applications/product/src/org/ofbiz/product/store/ specialpurp

Posted by "David E. Jones" <jo...@hotwaxmedia.com>.
Seriously though, what was the point of switching those parameters?  
Was it really worth breaking backward compatibility? My opinion: no,  
it's not worth it.

-David


On Jan 19, 2007, at 12:57 AM, Jacques Le Roux wrote:

> Si,
>
> You will have to change
>     \crmsfa\src\com\opensourcestrategies\crmsfa\orders 
> \CrmsfaOrderEvents.java:181
> and
>     \crmsfa\src\com\opensourcestrategies\crmsfa\orders 
> \CrmsfaOrderEvents.java:275
>
> for
>    cart.addOrIncreaseItem(productId, null, 1, null, null, null,  
> null, null, null, null, null, null, null, null, dispatcher, null);
> to
>    cart.addOrIncreaseItem(productId, null, 1, null, null, null,  
> null, null, null, null, null, null, null, null, null, dispatcher);
>
> Thanks
>
> Jacques
>
> ----- Original Message -----
> From: <jl...@apache.org>
> To: <co...@ofbiz.apache.org>
> Sent: Thursday, January 18, 2007 11:55 PM
> Subject: svn commit: r497618 - in /ofbiz/trunk: applications/order/ 
> src/org/ofbiz/order/order/
> applications/order/src/org/ofbiz/order/shoppingcart/ applications/ 
> order/src/org/ofbiz/order/shoppinglist/
> applications/product/src/org/ofbiz/product/store/ specialpurp...
>
>
>> Author: jleroux
>> Date: Thu Jan 18 14:55:50 2007
>> New Revision: 497618
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=497618
>> Log:
>> Some enhancements suggested by Si for commit 495945
>>
>> Modified:
>>     ofbiz/trunk/applications/order/src/org/ofbiz/order/order/ 
>> OrderServices.java
>>     ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>> shoppingcart/ShoppingCart.java
>>     ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>> shoppingcart/ShoppingCartHelper.java
>>     ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>> shoppinglist/ShoppingListEvents.java
>>     ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>> shoppinglist/ShoppingListServices.java
>>     ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ 
>> ProductStoreWorker.java
>>     ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/ 
>> PosTransaction.java
>>     ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ 
>> LoadSale.java
>>     ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ 
>> SaveSale.java
>>
>> 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=497618&r1=497617&r2=497618
>> ===================================================================== 
>> =========
>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/ 
>> OrderServices.java (original)
>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/ 
>> OrderServices.java Thu Jan 18 14:55:50 2007
>> @@ -3415,7 +3415,7 @@
>>          Locale locale = (Locale) context.get("locale");
>>          ShoppingCart cart = new ShoppingCart(dctx.getDelegator(),  
>> "9000", "webStore", locale, "USD");
>>          try {
>> -            cart.addOrIncreaseItem("GZ-1005", null, 1, null,  
>> null, null, null, null, null, null, "DemoCatalog", null, null, null,
> dctx.getDispatcher(),null);
>> +            cart.addOrIncreaseItem("GZ-1005", null, 1, null,  
>> null, null, null, null, null, null, "DemoCatalog", null, null, null,
> null, dctx.getDispatcher());
>>              } catch (CartItemModifyException e) {
>>              Debug.logError(e, module);
>>          } catch (ItemNotFoundException e) {
>> @@ -3653,7 +3653,7 @@
>>                                                                       
>>    item.getTimestamp("shipAfterDate"),
>>                                                                       
>>    null, null, null,
>>                                                                       
>>    null, null, null,
>> -                                                                     
>>    dispatcher, null);
>> +                                                                     
>>    null, dispatcher);
>>                                  ShoppingCartItem sci =  
>> cart.findCartItem(itemIndex);
>>                                  sci.setAssociatedOrderId(orderId);
>>                                  sci.setAssociatedOrderItemSeqId 
>> (item.getString("orderItemSeqId"));
>>
>> 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=497618&r1=497617&r2=497618
>> ===================================================================== 
>> =========
>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>> shoppingcart/ShoppingCart.java (original)
>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>> shoppingcart/ShoppingCart.java Thu Jan 18 14:55:50 2007
>> @@ -444,7 +444,7 @@
>>       */
>>      public int addOrIncreaseItem(String productId, Double  
>> selectedAmountDbl, double quantity, Timestamp reservStart, Double
> reservLengthDbl, Double reservPersonsDbl,
>>              Timestamp shipBeforeDate, Timestamp shipAfterDate,  
>> Map features, Map attributes, String prodCatalogId,
>> -            ProductConfigWrapper configWrapper, String itemType,  
>> String itemGroupNumber, LocalDispatcher dispatcher, String
> parentProductId) throws CartItemModifyException,  
> ItemNotFoundException {
>> +            ProductConfigWrapper configWrapper, String itemType,  
>> String itemGroupNumber, String parentProductId, LocalDispatcher
> dispatcher) throws CartItemModifyException, ItemNotFoundException {
>>          if (isReadOnlyCart()) {
>>             throw new CartItemModifyException("Cart items cannot  
>> be changed");
>>          }
>>
>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>> shoppingcart/ShoppingCartHelper.java
>> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ 
> ofbiz/order/shoppingcart/ShoppingCartHelper.java? 
> view=diff&rev=497618&r1=497617&r2=497618
>> ===================================================================== 
>> =========
>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>> shoppingcart/ShoppingCartHelper.java (original)
>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>> shoppingcart/ShoppingCartHelper.java Thu Jan 18 14:55:50 2007
>> @@ -119,7 +119,7 @@
>>              try {
>>                  java.sql.Timestamp.valueOf((String) context.get 
>> ("itemDesiredDeliveryDate"));
>>              } catch (IllegalArgumentException e) {
>> -            return
> ServiceUtil.returnError(UtilProperties.getMessage 
> (resource_error,"OrderInvalidDesiredDeliveryDateSyntaxError",this.cart 
> .getLocale())
> );
>> +                return
> ServiceUtil.returnError(UtilProperties.getMessage 
> (resource_error,"OrderInvalidDesiredDeliveryDateSyntaxError",this.cart 
> .getLocale())
> );
>>              }
>>          } else {
>>              context.remove("itemDesiredDeliveryDate");
>> @@ -180,7 +180,7 @@
>>              if (productId != null) {
>>                  itemId = cart.addOrIncreaseItem(productId,  
>> amount, quantity, reservStart, reservLength,
>>                                                  reservPersons,  
>> shipBeforeDate, shipAfterDate, null, attributes,
>> -                                                catalogId,  
>> configWrapper, itemType, itemGroupNumber, dispatcher, pProductId);
>> +                                                catalogId,  
>> configWrapper, itemType, itemGroupNumber, pProductId, dispatcher);
>>              } else {
>>                  itemId = cart.addNonProductItem(itemType,  
>> itemDescription, productCategoryId, price, quantity, attributes,
> catalogId, itemGroupNumber, dispatcher);
>>              }
>> @@ -245,7 +245,7 @@
>>                          Double amount = orderItem.getDouble 
>> ("selectedAmount");
>>                          try {
>>                              this.cart.addOrIncreaseItem 
>> (orderItem.getString("productId"), amount,
> orderItem.getDouble("quantity").doubleValue(),
>> -                                    null, null, null, null, null,  
>> null, null, catalogId, null, orderItemTypeId, itemGroupNumber,
> dispatcher,null);
>> +                                    null, null, null, null, null,  
>> null, null, catalogId, null, orderItemTypeId, itemGroupNumber,
> null, dispatcher);
>>                              noItems = false;
>>                          } catch (CartItemModifyException e) {
>>                              errorMsgs.add(e.getMessage());
>> @@ -283,7 +283,7 @@
>>                              try {
>>                                  this.cart.addOrIncreaseItem 
>> (orderItem.getString("productId"), amount,
>>                                          orderItem.getDouble 
>> ("quantity").doubleValue(), null, null, null, null, null, null, null,
>> -                                        catalogId, null,  
>> orderItem.getString("orderItemTypeId"), itemGroupNumber, dispatcher,
> null);
>> +                                        catalogId, null,  
>> orderItem.getString("orderItemTypeId"), itemGroupNumber, null,
> dispatcher);
>>                                  noItems = false;
>>                              } catch (CartItemModifyException e) {
>>                                  errorMsgs.add(e.getMessage());
>> @@ -372,7 +372,7 @@
>>                  if (quantity > 0.0) {
>>                      try {
>>                          if (Debug.verboseOn()) Debug.logVerbose 
>> ("Bulk Adding to cart [" + quantity + "] of [" + productId + "] in
> Item Group [" + itemGroupNumber + "]", module);
>> -                        this.cart.addOrIncreaseItem(productId,  
>> null, quantity, null, null, null, null, null, null, null,
> catalogId, null, null, itemGroupNumberToUse, dispatcher, null);
>> +                        this.cart.addOrIncreaseItem(productId,  
>> null, quantity, null, null, null, null, null, null, null,
> catalogId, null, null, itemGroupNumberToUse, null, dispatcher);
>>                      } catch (CartItemModifyException e) {
>>                          return ServiceUtil.returnError 
>> (e.getMessage());
>>                      } catch (ItemNotFoundException e) {
>> @@ -451,7 +451,7 @@
>>                          }
>>                          try {
>>                              if (Debug.verboseOn())  
>> Debug.logVerbose("Bulk Adding to cart requirement [" + quantity +  
>> "] of [" +
> productId + "]", module);
>> -                            int index =  
>> this.cart.addOrIncreaseItem(productId, null, quantity, null, null,  
>> null, null, null,
> null, null, catalogId, null, null, itemGroupNumber, dispatcher, null);
>> +                            int index =  
>> this.cart.addOrIncreaseItem(productId, null, quantity, null, null,  
>> null, null, null,
> null, null, catalogId, null, null, itemGroupNumber, null, dispatcher);
>>                              ShoppingCartItem sci =  
>> (ShoppingCartItem)this.cart.items().get(index);
>>                              sci.setRequirementId(requirementId);
>>                          } catch (CartItemModifyException e) {
>> @@ -478,7 +478,7 @@
>>          String errMsg = null;
>>
>>          if (categoryId == null || categoryId.length() <= 0) {
>> -        errMsg = UtilProperties.getMessage 
>> (resource,"cart.category_not_specified_to_add_from",  
>> this.cart.getLocale());
>> +            errMsg = UtilProperties.getMessage 
>> (resource,"cart.category_not_specified_to_add_from",  
>> this.cart.getLocale());
>>              result = ServiceUtil.returnError(errMsg);
>>  //          result =
> ServiceUtil.returnError(UtilProperties.getMessage 
> (resource_error,"OrderNoCategorySpecifiedToAddFrom.",this.cart.getLoca 
> le()));
>>              return result;
>> @@ -515,7 +515,7 @@
>>                  try {
>>                      this.cart.addOrIncreaseItem 
>> (productCategoryMember.getString("productId"),
>>                              null, quantity.doubleValue(), null,  
>> null, null, null, null, null, null,
>> -                            catalogId, null, null,  
>> itemGroupNumber, dispatcher, null);
>> +                            catalogId, null, null,  
>> itemGroupNumber, null, dispatcher);
>>                      totalQuantity += quantity.doubleValue();
>>                  } catch (CartItemModifyException e) {
>>                      errorMsgs.add(e.getMessage());
>> @@ -870,12 +870,12 @@
>>          GenericValue agreement = null;
>>
>>          if ((this.delegator == null) || (this.dispatcher == null)  
>> || (this.cart == null)) {
>> -        result =
> ServiceUtil.returnError(UtilProperties.getMessage 
> (resource_error,"OrderDispatcherOrDelegatorOrCartArgumentIsNull",this. 
> cart.getLocal
> e()));
>> +            result =
> ServiceUtil.returnError(UtilProperties.getMessage 
> (resource_error,"OrderDispatcherOrDelegatorOrCartArgumentIsNull",this. 
> cart.getLocal
> e()));
>>              return result;
>>          }
>>
>>          if ((agreementId == null) || (agreementId.length() <= 0)) {
>> -        result =
> ServiceUtil.returnError(UtilProperties.getMessage 
> (resource_error,"OrderNoAgreementSpecified",this.cart.getLocale()));
>> +            result =
> ServiceUtil.returnError(UtilProperties.getMessage 
> (resource_error,"OrderNoAgreementSpecified",this.cart.getLocale()));
>>              return result;
>>          }
>>
>> @@ -888,7 +888,7 @@
>>          }
>>
>>          if (agreement == null) {
>> -        result =
> ServiceUtil.returnError(UtilProperties.getMessage 
> (resource_error,"OrderCouldNotGetAgreement",UtilMisc.toMap 
> ("agreementId",agreementI
> d),this.cart.getLocale()));
>> +            result =
> ServiceUtil.returnError(UtilProperties.getMessage 
> (resource_error,"OrderCouldNotGetAgreement",UtilMisc.toMap 
> ("agreementId",agreementI
> d),this.cart.getLocale()));
>>          } else {
>>              // set the agreement id in the cart
>>              cart.setAgreementId(agreementId);
>> @@ -901,7 +901,7 @@
>>                         try {
>>                              cart.setCurrency 
>> (dispatcher,currencyUomId);
>>                         } catch (CartItemModifyException ex) {
>> -                       result =
> ServiceUtil.returnError(UtilProperties.getMessage 
> (resource_error,"OrderSetCurrencyError",this.cart.getLocale()) +  
> ex.getMessage());
>> +                           result =
> ServiceUtil.returnError(UtilProperties.getMessage 
> (resource_error,"OrderSetCurrencyError",this.cart.getLocale()) +  
> ex.getMessage());
>>                              return result;
>>                         }
>>                   }
>> @@ -941,7 +941,7 @@
>>              this.cart.setCurrency(this.dispatcher,currencyUomId);
>>              result = ServiceUtil.returnSuccess();
>>           } catch (CartItemModifyException ex) {
>> -         result = ServiceUtil.returnError 
>> (UtilProperties.getMessage(resource_error,"Set currency  
>> error",this.cart.getLocale()) +
> ex.getMessage());
>> +             result = ServiceUtil.returnError 
>> (UtilProperties.getMessage(resource_error,"Set currency
> error",this.cart.getLocale()) + ex.getMessage());
>>               return result;
>>           }
>>          return result;
>> @@ -972,7 +972,7 @@
>>                  productSupplier=(GenericValue)  
>> productSuppliers.get(0);
>>              }
>>          } catch (GenericServiceException e) {
>> -        Debug.logWarning(UtilProperties.getMessage 
>> (resource_error,"OrderRunServiceGetSuppliersForProductError",  
>> cart.getLocale())
> + e.getMessage(), module);
>> +            Debug.logWarning(UtilProperties.getMessage 
>> (resource_error,"OrderRunServiceGetSuppliersForProductError",
> cart.getLocale()) + e.getMessage(), module);
>>          }
>>          return productSupplier;
>>      }
>>
>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>> shoppinglist/ShoppingListEvents.java
>> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ 
> ofbiz/order/shoppinglist/ShoppingListEvents.java? 
> view=diff&rev=497618&r1=497617&r2=497618
>> ===================================================================== 
>> =========
>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>> shoppinglist/ShoppingListEvents.java (original)
>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>> shoppinglist/ShoppingListEvents.java Thu Jan 18 14:55:50 2007
>> @@ -273,9 +273,9 @@
>>
>>                  // i cannot get the addOrDecrease function to  
>> accept a null reservStart field: i get a null pointer exception a
> null constant works....
>>                  if (reservStart == null) {
>> -                    cart.addOrIncreaseItem(productId, null,  
>> quantity.doubleValue(), null, null, null, null, null, null,
> attributes, prodCatalogId, null, null, null, dispatcher, null);
>> +                    cart.addOrIncreaseItem(productId, null,  
>> quantity.doubleValue(), null, null, null, null, null, null,
> attributes, prodCatalogId, null, null, null, null, dispatcher);
>>                  } else {
>> -                    cart.addOrIncreaseItem(productId, null,  
>> quantity.doubleValue(), reservStart, reservLength, reservPersons,
> null, null, null, attributes, prodCatalogId, null, null, null,  
> dispatcher, null);
>> +                    cart.addOrIncreaseItem(productId, null,  
>> quantity.doubleValue(), reservStart, reservLength, reservPersons,
> null, null, null, attributes, prodCatalogId, null, null, null,  
> null, dispatcher);
>>                  }
>>                  Map messageMap = UtilMisc.toMap("productId",  
>> productId);
>>                  errMsg = UtilProperties.getMessage 
>> (resource,"shoppinglistevents.added_product_to_cart", messageMap,
> cart.getLocale());
>>
>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>> shoppinglist/ShoppingListServices.java
>> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ 
> ofbiz/order/shoppinglist/ShoppingListServices.java? 
> view=diff&rev=497618&r1=497617&r2=497618
>> ===================================================================== 
>> =========
>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>> shoppinglist/ShoppingListServices.java (original)
>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>> shoppinglist/ShoppingListServices.java Thu Jan 18 14:55:50 2007
>> @@ -442,7 +442,7 @@
>>                          Map attributes = UtilMisc.toMap 
>> ("shoppingListId", listId, "shoppingListItemSeqId", itemId);
>>
>>                          try {
>> -                            listCart.addOrIncreaseItem(productId,  
>> null, quantity.doubleValue(), reservStart, reservLength,
> reservPersons, null, null, null, attributes, null, null, null,  
> null, dispatcher, null);
>> +                            listCart.addOrIncreaseItem(productId,  
>> null, quantity.doubleValue(), reservStart, reservLength,
> reservPersons, null, null, null, attributes, null, null, null,  
> null, null, dispatcher);
>>                          } catch (CartItemModifyException e) {
>>                              Debug.logError(e, "Unable to add  
>> product to List Cart - " + productId, module);
>>                          } catch (ItemNotFoundException e) {
>>
>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/ 
>> store/ProductStoreWorker.java
>> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/ 
> org/ofbiz/product/store/ProductStoreWorker.java? 
> view=diff&rev=497618&r1=497617&r2=497618
>> ===================================================================== 
>> =========
>> --- ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ 
>> ProductStoreWorker.java (original)
>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ 
>> ProductStoreWorker.java Thu Jan 18 14:55:50 2007
>> @@ -470,10 +470,12 @@
>>                  try {
>>                      product = delegator.findByPrimaryKeyCache 
>> ("Product", UtilMisc.toMap("productId", productId));
>>                      if ((product != null) && ("Y".equals 
>> (product.get("isVariant")))) {
>> -                        if (parentProductId != null)
>> +                        if (parentProductId != null) {
>>                              virtualProductId = parentProductId;
>> -                        else
>> +                        }
>> +                        else {
>>                              virtualProductId =  
>> ProductWorker.getVariantVirtualId(product);
>> +                        }
>>                          Debug.log("getSurvey for virtual product  
>> " + virtualProductId,module);
>>                      }
>>                  } catch (GenericEntityException e) {
>>
>> 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?view=diff&rev=497618&r1=497617&r2=497618
>> ===================================================================== 
>> =========
>> --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/ 
>> PosTransaction.java (original)
>> +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/ 
>> PosTransaction.java Thu Jan 18 14:55:50 2007
>> @@ -355,7 +355,7 @@
>>      public void addItem(String productId, double quantity) throws  
>> CartItemModifyException, ItemNotFoundException {
>>          trace("add item", productId + "/" + quantity);
>>          try {
>> -            cart.addOrIncreaseItem(productId, null, quantity,  
>> null, null, null, null, null, null, null, null, null, null, null,
> session.getDispatcher(), null);
>> +            cart.addOrIncreaseItem(productId, null, quantity,  
>> null, null, null, null, null, null, null, null, null, null, null,
> null, session.getDispatcher());
>>          } catch (ItemNotFoundException e) {
>>              trace("item not found", e);
>>              throw e;
>>
>> Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ 
>> LoadSale.java
>> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ 
> ofbiz/pos/screen/LoadSale.java? 
> view=diff&rev=497618&r1=497617&r2=497618
>> ===================================================================== 
>> =========
>> --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ 
>> LoadSale.java (original)
>> +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ 
>> LoadSale.java Thu Jan 18 14:55:50 2007
>> @@ -1,244 +1,244 @@
>> -/ 
>> ********************************************************************* 
>> **********
>> - * Licensed to the Apache Software Foundation (ASF) under one
>> - * or more contributor license agreements.  See the NOTICE file
>> - * distributed with this work for additional information
>> - * regarding copyright ownership.  The ASF licenses this file
>> - * to you under the Apache License, Version 2.0 (the
>> - * "License"); you may not use this file except in compliance
>> - * with the License.  You may obtain a copy of the License at
>> - *
>> - * http://www.apache.org/licenses/LICENSE-2.0
>> - *
>> - * Unless required by applicable law or agreed to in writing,
>> - * software distributed under the License is distributed on an
>> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> - * KIND, either express or implied.  See the License for the
>> - * specific language governing permissions and limitations
>> - * under the License.
>> -  
>> ********************************************************************* 
>> **********/
>> -package org.ofbiz.pos.screen;
>> -
>> -import java.util.Hashtable;
>> -import java.util.Iterator;
>> -import java.util.Locale;
>> -import java.util.Map;
>> -
>> -import javax.swing.DefaultListModel;
>> -import javax.swing.ListSelectionModel;
>> -
>> -import net.xoetrope.swing.XButton;
>> -import net.xoetrope.swing.XDialog;
>> -import net.xoetrope.swing.XList;
>> -import net.xoetrope.xui.XPage;
>> -
>> -import org.ofbiz.base.util.Debug;
>> -import org.ofbiz.base.util.UtilProperties;
>> -import org.ofbiz.pos.PosTransaction;
>> -
>> -
>> -public class LoadSale extends XPage {
>> -
>> -    /**
>> -     * To load a sale from a shopping list. 2 modes : add to or  
>> replace the current sale. Also a button to delete a sale (aka
> shopping list)
>> -     */
>> -    public static final String module = LoadSale.class.getName();
>> -    protected static PosScreen m_pos = null;
>> -    protected XDialog m_dialog = null;
>> -    static protected Hashtable m_saleMap = new Hashtable();
>> -    protected XList m_salesList = null;
>> -    protected XButton m_cancel = null;
>> -    protected XButton m_add = null;
>> -    protected XButton m_replace = null;
>> -    protected XButton m_delete = null;
>> -    protected XButton m_replaceAndDelete = null;
>> -    protected DefaultListModel m_listModel = null;
>> -    protected static PosTransaction m_trans = null;
>> -
>> -    //TODO : make getter and setter for members (ie m_*) if  
>> needed (extern calls). For that in Eclipse use Source/Generate
> Getters and setters
>> -
>> -    public LoadSale(Hashtable saleMap, PosTransaction trans,  
>> PosScreen page) {
>> -        m_saleMap.putAll(saleMap);
>> -        m_trans = trans;
>> -        m_pos = page;
>> -    }
>> -
>> -    public void openDlg() {
>> -        m_dialog = (XDialog) pageMgr.loadPage 
>> (m_pos.getScreenLocation() + "/dialog/loadsale");
>> -        m_dialog.setCaption(UtilProperties.getMessage("pos",  
>> "LoadASale", Locale.getDefault()));
>> -        m_salesList = (XList) m_dialog.findComponent("salesList");
>> -        addMouseHandler(m_salesList, "saleDoubleClick");
>> -
>> -        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
>> -        m_add = (XButton) m_dialog.findComponent("BtnAdd");
>> -        m_replace = (XButton) m_dialog.findComponent("BtnReplace");
>> -        m_delete = (XButton) m_dialog.findComponent("BtnDelete");
>> -        m_replaceAndDelete = (XButton) m_dialog.findComponent 
>> ("BtnReplaceAndDelete");
>> -        addMouseHandler(m_cancel, "cancel");
>> -        addMouseHandler(m_add, "addSale");
>> -        addMouseHandler(m_replace, "replaceSale");
>> -        addMouseHandler(m_delete, "deleteShoppingList");
>> -        addMouseHandler(m_replaceAndDelete,  
>> "replaceSaleAndDeleteShoppingList");
>> -
>> -        m_listModel = new DefaultListModel();
>> -        for (Iterator i = m_saleMap.entrySet().iterator();  
>> i.hasNext();) {
>> -            Object o = i.next();
>> -            Map.Entry entry = (Map.Entry)o;
>> -            String val = entry.getValue().toString();
>> -            m_listModel.addElement(val);
>> -        }
>> -        m_salesList.setModel(m_listModel);
>> -        m_salesList.setVisibleRowCount(-1);
>> -        m_salesList.ensureIndexIsVisible(m_salesList.getItemCount 
>> ());
>> -        m_salesList.setSelectionMode 
>> (ListSelectionModel.SINGLE_SELECTION);
>> -        m_salesList.setToolTipText(UtilProperties.getMessage 
>> ("pos", "LoadSaleListDblClickTip", Locale.getDefault()));
>> -
>> -        m_dialog.pack();
>> -        m_salesList.requestFocusInWindow();
>> -        m_dialog.showDialog(this);
>> -    }
>> -
>> -    public synchronized void saleDoubleClick() {
>> -        if (wasMouseDoubleClicked()) {
>> -            String sale = selectedSale();
>> -            if (null != sale) {
>> -                replaceSaleAndDeleteShoppingList_();
>> -            }
>> -        }
>> -    }
>> -
>> -    public synchronized void cancel() {
>> -        if (wasMouseClicked()) {
>> -            closeDlg();
>> -        }
>> -    }
>> -
>> -    public synchronized void addSale() {
>> -        if (wasMouseClicked()) {
>> -            addSale_();
>> -        }
>> -    }
>> -
>> -    private synchronized void addSale_() {
>> -        String sale = selectedSale();
>> -        if (null != sale) {
>> -            addListToCart(sale, true);
>> -        }
>> -    }
>> -
>> -    public synchronized void replaceSale() {
>> -        if (wasMouseClicked()) {
>> -            replaceSale_();
>> -        }
>> -    }
>> -
>> -    private synchronized void replaceSale_() {
>> -        String sale = selectedSale();
>> -        if (null != sale) {
>> -            addListToCart(sale, false);
>> -        }
>> -    }
>> -
>> -    public synchronized void deleteShoppingList() {
>> -        if (wasMouseClicked()) {
>> -            deleteShoppingList_();
>> -        }
>> -    }
>> -
>> -    private synchronized void deleteShoppingList_() {
>> -        String sale= (String) m_salesList.getSelectedValue();
>> -        if (null != sale) {
>> -            String shoppingListId = selectedSale();
>> -            final ClassLoader cl = this.getClassLoader(m_pos);
>> -            Thread.currentThread().setContextClassLoader(cl);
>> -            if (m_trans.clearList(shoppingListId, m_pos)) {
>> -                int index = m_salesList.getSelectedIndex();
>> -                m_saleMap.remove(shoppingListId);
>> -                m_listModel = new DefaultListModel();
>> -                for (Iterator i = m_saleMap.entrySet().iterator 
>> (); i.hasNext();) {
>> -                    Object o = i.next();
>> -                    Map.Entry entry = (Map.Entry)o;
>> -                    String val = entry.getValue().toString();
>> -                    m_listModel.addElement(val);
>> -                }
>> -                m_salesList.setModel(m_listModel);
>> -                int size = m_listModel.getSize();
>> -                if (size == 0) { //Nobody's left, nothing to do here
>> -                    closeDlg();
>> -                } else { //Select an index.
>> -                    if (index == size) {
>> -                        //removed item in last position
>> -                        index--;
>> -                    }
>> -                }
>> -                m_salesList.setSelectedIndex(index);
>> -                m_salesList.ensureIndexIsVisible(index);
>> -                m_salesList.repaint();
>> -                repaint();
>> -            }
>> -        }
>> -    }
>> -
>> -    public synchronized void replaceSaleAndDeleteShoppingList() {
>> -        if (wasMouseClicked()) {
>> -            replaceSaleAndDeleteShoppingList_();
>> -        }
>> -    }
>> -
>> -    public synchronized void replaceSaleAndDeleteShoppingList_() {
>> -        replaceSale_();
>> -        deleteShoppingList_();
>> -    }
>> -
>> -    private String selectedSale() {
>> -        String saleSelected = null;
>> -        if (null != m_salesList.getSelectedValue()) {
>> -            String sale = (String) m_salesList.getSelectedValue();
>> -            Iterator i = m_saleMap.entrySet().iterator();
>> -            while(i.hasNext()) {
>> -                Object o = i.next();
>> -                Map.Entry entry = (Map.Entry)o;
>> -                String val = entry.getValue().toString();
>> -                if (val.equals(sale)) {
>> -                    saleSelected = entry.getKey().toString();
>> -                }
>> -            }
>> -        }
>> -        return saleSelected;
>> -    }
>> -
>> -    private void addListToCart(String sale, boolean addToCart) {
>> -        final ClassLoader cl = this.getClassLoader(m_pos);
>> -        Thread.currentThread().setContextClassLoader(cl);
>> -        if (!m_trans.addListToCart(sale, m_pos, addToCart)) {
>> -            Debug.logError("Error while loading cart from  
>> shopping list : " + sale, module);
>> -        }
>> -        else {
>> -            m_trans.calcTax();
>> -            m_pos.refresh();
>> -        }
>> -        closeDlg();
>> -    }
>> -
>> -    private ClassLoader getClassLoader(PosScreen pos) {
>> -        ClassLoader cl = pos.getClassLoader();
>> -        if (cl == null) {
>> -            try {
>> -                cl = Thread.currentThread().getContextClassLoader();
>> -            } catch (Throwable t) {
>> -            }
>> -            if (cl == null) {
>> -                Debug.log("No context classloader available;  
>> using class classloader", module);
>> -                try {
>> -                    cl = this.getClass().getClassLoader();
>> -                } catch (Throwable t) {
>> -                    Debug.logError(t, module);
>> -                }
>> -            }
>> -        }
>> -        return cl;
>> -    }
>> -
>> -    private void closeDlg() {
>> -        m_dialog.closeDlg();
>> -    }
>> +/ 
>> ********************************************************************* 
>> **********
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements.  See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership.  The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License.  You may obtain a copy of the License at
>> + *
>> + * http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing,
>> + * software distributed under the License is distributed on an
>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + * KIND, either express or implied.  See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> +  
>> ********************************************************************* 
>> **********/
>> +package org.ofbiz.pos.screen;
>> +
>> +import java.util.Hashtable;
>> +import java.util.Iterator;
>> +import java.util.Locale;
>> +import java.util.Map;
>> +
>> +import javax.swing.DefaultListModel;
>> +import javax.swing.ListSelectionModel;
>> +
>> +import net.xoetrope.swing.XButton;
>> +import net.xoetrope.swing.XDialog;
>> +import net.xoetrope.swing.XList;
>> +import net.xoetrope.xui.XPage;
>> +
>> +import org.ofbiz.base.util.Debug;
>> +import org.ofbiz.base.util.UtilProperties;
>> +import org.ofbiz.pos.PosTransaction;
>> +
>> +
>> +public class LoadSale extends XPage {
>> +
>> +    /**
>> +     * To load a sale from a shopping list. 2 modes : add to or  
>> replace the current sale. Also a button to delete a sale (aka
> shopping list)
>> +     */
>> +    public static final String module = LoadSale.class.getName();
>> +    protected static PosScreen m_pos = null;
>> +    protected XDialog m_dialog = null;
>> +    static protected Hashtable m_saleMap = new Hashtable();
>> +    protected XList m_salesList = null;
>> +    protected XButton m_cancel = null;
>> +    protected XButton m_add = null;
>> +    protected XButton m_replace = null;
>> +    protected XButton m_delete = null;
>> +    protected XButton m_replaceAndDelete = null;
>> +    protected DefaultListModel m_listModel = null;
>> +    protected static PosTransaction m_trans = null;
>> +
>> +    //TODO : make getter and setter for members (ie m_*) if  
>> needed (extern calls). For that in Eclipse use Source/Generate
> Getters and setters
>> +
>> +    public LoadSale(Hashtable saleMap, PosTransaction trans,  
>> PosScreen page) {
>> +        m_saleMap.putAll(saleMap);
>> +        m_trans = trans;
>> +        m_pos = page;
>> +    }
>> +
>> +    public void openDlg() {
>> +        m_dialog = (XDialog) pageMgr.loadPage 
>> (m_pos.getScreenLocation() + "/dialog/loadsale");
>> +        m_dialog.setCaption(UtilProperties.getMessage("pos",  
>> "LoadASale", Locale.getDefault()));
>> +        m_salesList = (XList) m_dialog.findComponent("salesList");
>> +        addMouseHandler(m_salesList, "saleDoubleClick");
>> +
>> +        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
>> +        m_add = (XButton) m_dialog.findComponent("BtnAdd");
>> +        m_replace = (XButton) m_dialog.findComponent("BtnReplace");
>> +        m_delete = (XButton) m_dialog.findComponent("BtnDelete");
>> +        m_replaceAndDelete = (XButton) m_dialog.findComponent 
>> ("BtnReplaceAndDelete");
>> +        addMouseHandler(m_cancel, "cancel");
>> +        addMouseHandler(m_add, "addSale");
>> +        addMouseHandler(m_replace, "replaceSale");
>> +        addMouseHandler(m_delete, "deleteShoppingList");
>> +        addMouseHandler(m_replaceAndDelete,  
>> "replaceSaleAndDeleteShoppingList");
>> +
>> +        m_listModel = new DefaultListModel();
>> +        for (Iterator i = m_saleMap.entrySet().iterator();  
>> i.hasNext();) {
>> +            Object o = i.next();
>> +            Map.Entry entry = (Map.Entry)o;
>> +            String val = entry.getValue().toString();
>> +            m_listModel.addElement(val);
>> +        }
>> +        m_salesList.setModel(m_listModel);
>> +        m_salesList.setVisibleRowCount(-1);
>> +        m_salesList.ensureIndexIsVisible(m_salesList.getItemCount 
>> ());
>> +        m_salesList.setSelectionMode 
>> (ListSelectionModel.SINGLE_SELECTION);
>> +        m_salesList.setToolTipText(UtilProperties.getMessage 
>> ("pos", "LoadSaleListDblClickTip", Locale.getDefault()));
>> +
>> +        m_dialog.pack();
>> +        m_salesList.requestFocusInWindow();
>> +        m_dialog.showDialog(this);
>> +    }
>> +
>> +    public synchronized void saleDoubleClick() {
>> +        if (wasMouseDoubleClicked()) {
>> +            String sale = selectedSale();
>> +            if (null != sale) {
>> +                replaceSaleAndDeleteShoppingList_();
>> +            }
>> +        }
>> +    }
>> +
>> +    public synchronized void cancel() {
>> +        if (wasMouseClicked()) {
>> +            closeDlg();
>> +        }
>> +    }
>> +
>> +    public synchronized void addSale() {
>> +        if (wasMouseClicked()) {
>> +            addSale_();
>> +        }
>> +    }
>> +
>> +    private synchronized void addSale_() {
>> +        String sale = selectedSale();
>> +        if (null != sale) {
>> +            addListToCart(sale, true);
>> +        }
>> +    }
>> +
>> +    public synchronized void replaceSale() {
>> +        if (wasMouseClicked()) {
>> +            replaceSale_();
>> +        }
>> +    }
>> +
>> +    private synchronized void replaceSale_() {
>> +        String sale = selectedSale();
>> +        if (null != sale) {
>> +            addListToCart(sale, false);
>> +        }
>> +    }
>> +
>> +    public synchronized void deleteShoppingList() {
>> +        if (wasMouseClicked()) {
>> +            deleteShoppingList_();
>> +        }
>> +    }
>> +
>> +    private synchronized void deleteShoppingList_() {
>> +        String sale= (String) m_salesList.getSelectedValue();
>> +        if (null != sale) {
>> +            String shoppingListId = selectedSale();
>> +            final ClassLoader cl = this.getClassLoader(m_pos);
>> +            Thread.currentThread().setContextClassLoader(cl);
>> +            if (m_trans.clearList(shoppingListId, m_pos)) {
>> +                int index = m_salesList.getSelectedIndex();
>> +                m_saleMap.remove(shoppingListId);
>> +                m_listModel = new DefaultListModel();
>> +                for (Iterator i = m_saleMap.entrySet().iterator 
>> (); i.hasNext();) {
>> +                    Object o = i.next();
>> +                    Map.Entry entry = (Map.Entry)o;
>> +                    String val = entry.getValue().toString();
>> +                    m_listModel.addElement(val);
>> +                }
>> +                m_salesList.setModel(m_listModel);
>> +                int size = m_listModel.getSize();
>> +                if (size == 0) { //Nobody's left, nothing to do here
>> +                    closeDlg();
>> +                } else { //Select an index.
>> +                    if (index == size) {
>> +                        //removed item in last position
>> +                        index--;
>> +                    }
>> +                }
>> +                m_salesList.setSelectedIndex(index);
>> +                m_salesList.ensureIndexIsVisible(index);
>> +                m_salesList.repaint();
>> +                repaint();
>> +            }
>> +        }
>> +    }
>> +
>> +    public synchronized void replaceSaleAndDeleteShoppingList() {
>> +        if (wasMouseClicked()) {
>> +            replaceSaleAndDeleteShoppingList_();
>> +        }
>> +    }
>> +
>> +    public synchronized void replaceSaleAndDeleteShoppingList_() {
>> +        replaceSale_();
>> +        deleteShoppingList_();
>> +    }
>> +
>> +    private String selectedSale() {
>> +        String saleSelected = null;
>> +        if (null != m_salesList.getSelectedValue()) {
>> +            String sale = (String) m_salesList.getSelectedValue();
>> +            Iterator i = m_saleMap.entrySet().iterator();
>> +            while(i.hasNext()) {
>> +                Object o = i.next();
>> +                Map.Entry entry = (Map.Entry)o;
>> +                String val = entry.getValue().toString();
>> +                if (val.equals(sale)) {
>> +                    saleSelected = entry.getKey().toString();
>> +                }
>> +            }
>> +        }
>> +        return saleSelected;
>> +    }
>> +
>> +    private void addListToCart(String sale, boolean addToCart) {
>> +        final ClassLoader cl = this.getClassLoader(m_pos);
>> +        Thread.currentThread().setContextClassLoader(cl);
>> +        if (!m_trans.addListToCart(sale, m_pos, addToCart)) {
>> +            Debug.logError("Error while loading cart from  
>> shopping list : " + sale, module);
>> +        }
>> +        else {
>> +            m_trans.calcTax();
>> +            m_pos.refresh();
>> +        }
>> +        closeDlg();
>> +    }
>> +
>> +    private ClassLoader getClassLoader(PosScreen pos) {
>> +        ClassLoader cl = pos.getClassLoader();
>> +        if (cl == null) {
>> +            try {
>> +                cl = Thread.currentThread().getContextClassLoader();
>> +            } catch (Throwable t) {
>> +            }
>> +            if (cl == null) {
>> +                Debug.log("No context classloader available;  
>> using class classloader", module);
>> +                try {
>> +                    cl = this.getClass().getClassLoader();
>> +                } catch (Throwable t) {
>> +                    Debug.logError(t, module);
>> +                }
>> +            }
>> +        }
>> +        return cl;
>> +    }
>> +
>> +    private void closeDlg() {
>> +        m_dialog.closeDlg();
>> +    }
>>  }
>>
>> Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ 
>> SaveSale.java
>> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ 
> ofbiz/pos/screen/SaveSale.java? 
> view=diff&rev=497618&r1=497617&r2=497618
>> ===================================================================== 
>> =========
>> --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ 
>> SaveSale.java (original)
>> +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ 
>> SaveSale.java Thu Jan 18 14:55:50 2007
>> @@ -1,129 +1,129 @@
>> -/ 
>> ********************************************************************* 
>> **********
>> - * Licensed to the Apache Software Foundation (ASF) under one
>> - * or more contributor license agreements.  See the NOTICE file
>> - * distributed with this work for additional information
>> - * regarding copyright ownership.  The ASF licenses this file
>> - * to you under the Apache License, Version 2.0 (the
>> - * "License"); you may not use this file except in compliance
>> - * with the License.  You may obtain a copy of the License at
>> - *
>> - * http://www.apache.org/licenses/LICENSE-2.0
>> - *
>> - * Unless required by applicable law or agreed to in writing,
>> - * software distributed under the License is distributed on an
>> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> - * KIND, either express or implied.  See the License for the
>> - * specific language governing permissions and limitations
>> - * under the License.
>> -  
>> ********************************************************************* 
>> **********/
>> -package org.ofbiz.pos.screen;
>> -
>> -import java.text.SimpleDateFormat;
>> -import java.util.Date;
>> -import java.util.Locale;
>> -
>> -import net.xoetrope.swing.XButton;
>> -//import org.ofbiz.pos.screen.XFocusDialog;
>> -import net.xoetrope.swing.XEdit;
>> -import net.xoetrope.swing.XDialog;
>> -import net.xoetrope.xui.XPage;
>> -
>> -import org.ofbiz.base.util.Debug;
>> -import org.ofbiz.base.util.UtilProperties;
>> -import org.ofbiz.pos.PosTransaction;
>> -
>> -
>> -public class SaveSale extends XPage {
>> -
>> -    /**
>> -     * To save a sale. 2 modes : save and keep the current sale  
>> or save and clear the current sale.
>> -     */
>> -    public static final String module = SaveSale.class.getName();
>> -    protected static PosScreen m_pos = null;
>> -    protected XDialog m_dialog = null;
>> -    protected XEdit m_saleName = null;
>> -    protected XButton m_cancel = null;
>> -    protected XButton m_save = null;
>> -    protected XButton m_saveAndClear = null;
>> -    protected static PosTransaction m_trans = null;
>> -    public static SimpleDateFormat sdf = new
> SimpleDateFormat(UtilProperties.getMessage 
> ("pos","DateTimeFormat",Locale.getDefault()));
>> -
>> -    //TODO : make getter and setter for members (ie m_*) if  
>> needed (extern calls).  For that in Eclipse use Source/Generate
> Getters and setters
>> -
>> -    public SaveSale(PosTransaction trans, PosScreen page) {
>> -        m_trans = trans;
>> -        m_pos = page;
>> -    }
>> -
>> -    public void openDlg() {
>> -        m_dialog = (XDialog) pageMgr.loadPage 
>> (m_pos.getScreenLocation() + "/dialog/savesale");
>> -        m_saleName = (XEdit) m_dialog.findComponent("saleName");
>> -        //m_dialog.setM_focused(m_saleName);
>> -        m_saleName.setText(m_pos.session.getUserId() + " " +  
>> sdf.format(new Date()));
>> -        m_dialog.setCaption(UtilProperties.getMessage("pos",  
>> "SaveASale", Locale.getDefault()));
>> -
>> -        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
>> -        m_save = (XButton) m_dialog.findComponent("BtnSave");
>> -        m_saveAndClear = (XButton) m_dialog.findComponent 
>> ("BtnSaveAndClear");
>> -
>> -        addMouseHandler(m_cancel, "cancel");
>> -        addMouseHandler(m_save, "save");
>> -        addMouseHandler(m_saveAndClear, "saveAndClear");
>> -
>> -        m_dialog.pack();
>> -        m_dialog.showDialog(this);
>> -    }
>> -
>> -    public synchronized void cancel()
>> -    {
>> -        if (wasMouseClicked()) {
>> -            this.m_dialog.closeDlg();
>> -        }
>> -    }
>> -
>> -    public synchronized void save() {
>> -        if (wasMouseClicked()) {
>> -            String sale = m_saleName.getText();
>> -            if (null != sale) {
>> -                saveSale(sale);
>> -            }
>> -        }
>> -    }
>> -
>> -    public synchronized void saveAndClear() {
>> -        if (wasMouseClicked()) {
>> -            String sale = m_saleName.getText();
>> -            if (null != sale) {
>> -                saveSale(sale);
>> -                m_trans.voidSale();
>> -                m_pos.refresh();
>> -            }
>> -        }
>> -    }
>> -
>> -    private void saveSale(String sale) {
>> -        final ClassLoader cl = this.getClassLoader(m_pos);
>> -        Thread.currentThread().setContextClassLoader(cl);
>> -        m_trans.saveSale(sale, m_pos);
>> -        this.m_dialog.closeDlg();
>> -    }
>> -
>> -    private ClassLoader getClassLoader(PosScreen pos) {
>> -        ClassLoader cl = pos.getClassLoader();
>> -        if (cl == null) {
>> -            try {
>> -                cl = Thread.currentThread().getContextClassLoader();
>> -            } catch (Throwable t) {
>> -            }
>> -            if (cl == null) {
>> -                Debug.log("No context classloader available;  
>> using class classloader", module);
>> -                try {
>> -                    cl = this.getClass().getClassLoader();
>> -                } catch (Throwable t) {
>> -                    Debug.logError(t, module);
>> -                }
>> -            }
>> -        }
>> -        return cl;
>> -    }
>> +/ 
>> ********************************************************************* 
>> **********
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements.  See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership.  The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License.  You may obtain a copy of the License at
>> + *
>> + * http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing,
>> + * software distributed under the License is distributed on an
>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + * KIND, either express or implied.  See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> +  
>> ********************************************************************* 
>> **********/
>> +package org.ofbiz.pos.screen;
>> +
>> +import java.text.SimpleDateFormat;
>> +import java.util.Date;
>> +import java.util.Locale;
>> +
>> +import net.xoetrope.swing.XButton;
>> +//import org.ofbiz.pos.screen.XFocusDialog;
>> +import net.xoetrope.swing.XEdit;
>> +import net.xoetrope.swing.XDialog;
>> +import net.xoetrope.xui.XPage;
>> +
>> +import org.ofbiz.base.util.Debug;
>> +import org.ofbiz.base.util.UtilProperties;
>> +import org.ofbiz.pos.PosTransaction;
>> +
>> +
>> +public class SaveSale extends XPage {
>> +
>> +    /**
>> +     * To save a sale. 2 modes : save and keep the current sale  
>> or save and clear the current sale.
>> +     */
>> +    public static final String module = SaveSale.class.getName();
>> +    protected static PosScreen m_pos = null;
>> +    protected XDialog m_dialog = null;
>> +    protected XEdit m_saleName = null;
>> +    protected XButton m_cancel = null;
>> +    protected XButton m_save = null;
>> +    protected XButton m_saveAndClear = null;
>> +    protected static PosTransaction m_trans = null;
>> +    public static SimpleDateFormat sdf = new
> SimpleDateFormat(UtilProperties.getMessage 
> ("pos","DateTimeFormat",Locale.getDefault()));
>> +
>> +    //TODO : make getter and setter for members (ie m_*) if  
>> needed (extern calls).  For that in Eclipse use Source/Generate
> Getters and setters
>> +
>> +    public SaveSale(PosTransaction trans, PosScreen page) {
>> +        m_trans = trans;
>> +        m_pos = page;
>> +    }
>> +
>> +    public void openDlg() {
>> +        m_dialog = (XDialog) pageMgr.loadPage 
>> (m_pos.getScreenLocation() + "/dialog/savesale");
>> +        m_saleName = (XEdit) m_dialog.findComponent("saleName");
>> +        //m_dialog.setM_focused(m_saleName);
>> +        m_saleName.setText(m_pos.session.getUserId() + " " +  
>> sdf.format(new Date()));
>> +        m_dialog.setCaption(UtilProperties.getMessage("pos",  
>> "SaveASale", Locale.getDefault()));
>> +
>> +        m_cancel = (XButton) m_dialog.findComponent("BtnCancel");
>> +        m_save = (XButton) m_dialog.findComponent("BtnSave");
>> +        m_saveAndClear = (XButton) m_dialog.findComponent 
>> ("BtnSaveAndClear");
>> +
>> +        addMouseHandler(m_cancel, "cancel");
>> +        addMouseHandler(m_save, "save");
>> +        addMouseHandler(m_saveAndClear, "saveAndClear");
>> +
>> +        m_dialog.pack();
>> +        m_dialog.showDialog(this);
>> +    }
>> +
>> +    public synchronized void cancel()
>> +    {
>> +        if (wasMouseClicked()) {
>> +            this.m_dialog.closeDlg();
>> +        }
>> +    }
>> +
>> +    public synchronized void save() {
>> +        if (wasMouseClicked()) {
>> +            String sale = m_saleName.getText();
>> +            if (null != sale) {
>> +                saveSale(sale);
>> +            }
>> +        }
>> +    }
>> +
>> +    public synchronized void saveAndClear() {
>> +        if (wasMouseClicked()) {
>> +            String sale = m_saleName.getText();
>> +            if (null != sale) {
>> +                saveSale(sale);
>> +                m_trans.voidSale();
>> +                m_pos.refresh();
>> +            }
>> +        }
>> +    }
>> +
>> +    private void saveSale(String sale) {
>> +        final ClassLoader cl = this.getClassLoader(m_pos);
>> +        Thread.currentThread().setContextClassLoader(cl);
>> +        m_trans.saveSale(sale, m_pos);
>> +        this.m_dialog.closeDlg();
>> +    }
>> +
>> +    private ClassLoader getClassLoader(PosScreen pos) {
>> +        ClassLoader cl = pos.getClassLoader();
>> +        if (cl == null) {
>> +            try {
>> +                cl = Thread.currentThread().getContextClassLoader();
>> +            } catch (Throwable t) {
>> +            }
>> +            if (cl == null) {
>> +                Debug.log("No context classloader available;  
>> using class classloader", module);
>> +                try {
>> +                    cl = this.getClass().getClassLoader();
>> +                } catch (Throwable t) {
>> +                    Debug.logError(t, module);
>> +                }
>> +            }
>> +        }
>> +        return cl;
>> +    }
>>  }
>>
>