|
Modified: ofbiz/branches/20120329_portletWidget/applications/order/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/order/entitydef/entitymodel.xml?rev=1408976&r1=1408975&r2=1408976&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/order/entitydef/entitymodel.xml (original) +++ ofbiz/branches/20120329_portletWidget/applications/order/entitydef/entitymodel.xml Tue Nov 13 21:47:18 2012 @@ -93,6 +93,8 @@ under the License. <field name="includeInShipping" type="indicator"></field> <field name="createdDate" type="date-time"></field> <field name="createdByUserLogin" type="id-vlong"></field> + <field name="lastModifiedDate" type="date-time"></field> + <field name="lastModifiedByUserLogin" type="id-vlong"></field> <field name="originalAdjustmentId" type="id"> <description>specifies relation to source OrderAdjustment - eg. for tax on shipping charges</description> </field> @@ -1061,6 +1063,8 @@ under the License. <field name="needsNsfRetry" type="indicator"></field> <field name="createdDate" type="date-time"></field> <field name="createdByUserLogin" type="id-vlong"></field> + <field name="lastModifiedDate" type="date-time"></field> + <field name="lastModifiedByUserLogin" type="id-vlong"></field> <prim-key field="orderPaymentPreferenceId"/> <relation type="one" fk-name="ORDER_PMPRF_OHDR" rel-entity-name="OrderHeader"> <key-map field-name="orderId"/> @@ -1641,6 +1645,8 @@ under the License. <field name="includeInShipping" type="indicator"></field> <field name="createdDate" type="date-time"></field> <field name="createdByUserLogin" type="id-vlong"></field> + <field name="lastModifiedDate" type="date-time"></field> + <field name="lastModifiedByUserLogin" type="id-vlong"></field> <prim-key field="quoteAdjustmentId"/> <relation type="one" fk-name="QUOTE_ADJ_TYPE" rel-entity-name="OrderAdjustmentType"> <key-map field-name="quoteAdjustmentTypeId" rel-field-name="orderAdjustmentTypeId"/> @@ -2338,6 +2344,8 @@ under the License. <field name="includeInShipping" type="indicator"></field> <field name="createdDate" type="date-time"></field> <field name="createdByUserLogin" type="id-vlong"></field> + <field name="lastModifiedDate" type="date-time"></field> + <field name="lastModifiedByUserLogin" type="id-vlong"></field> <prim-key field="returnAdjustmentId"/> <relation type="one" fk-name="RETURN_ADJ_TYPE" rel-entity-name="ReturnAdjustmentType"> <key-map field-name="returnAdjustmentTypeId"/> Modified: ofbiz/branches/20120329_portletWidget/applications/order/script/org/ofbiz/order/test/ShoppingCartTests.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/order/script/org/ofbiz/order/test/ShoppingCartTests.xml?rev=1408976&r1=1408975&r2=1408976&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/order/script/org/ofbiz/order/test/ShoppingCartTests.xml (original) +++ ofbiz/branches/20120329_portletWidget/applications/order/script/org/ofbiz/order/test/ShoppingCartTests.xml Tue Nov 13 21:47:18 2012 @@ -194,31 +194,31 @@ under the License. <!-- Shopping Cart Set ShippingContactMechId--> <set field="contactMechId" value="9015"/> - <call-object-method method-name="setShippingContactMechId" obj-field="shoppingCart"> + <call-object-method method-name="setAllShippingContactMechId" obj-field="shoppingCart"> <field field="contactMechId" type="String"/> </call-object-method> <!-- Shopping Cart Set Method Type ID--> <set field="shipmentMethodTypeId" value="NEXT_DAY" type="String"/> - <call-object-method method-name="setShipmentMethodTypeId" obj-field="shoppingCart"> + <call-object-method method-name="setAllShipmentMethodTypeId" obj-field="shoppingCart"> <field field="shipmentMethodTypeId" type="String"/> </call-object-method> <!-- Shopping Cart Set Carrier Party ID--> <set field="carrierPartyId" value="UPS" type="String"/> - <call-object-method method-name="setCarrierPartyId" obj-field="shoppingCart"> + <call-object-method method-name="setAllCarrierPartyId" obj-field="shoppingCart"> <field field="carrierPartyId" type="String"/> </call-object-method> <!-- Shopping Cart Set Is Gift--> <set field="isGift" value="false" type="Boolean"/> - <call-object-method method-name="setIsGift" obj-field="shoppingCart"> + <call-object-method method-name="setAllIsGift" obj-field="shoppingCart"> <field field="isGift" type="Boolean"/> </call-object-method> <!-- Shopping Cart Set May Split--> <set field="maySplit" value="false" type="Boolean"/> - <call-object-method method-name="setMaySplit" obj-field="shoppingCart"> + <call-object-method method-name="setAllMaySplit" obj-field="shoppingCart"> <field field="maySplit" type="Boolean"/> </call-object-method> Modified: ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1408976&r1=1408975&r2=1408976&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderServices.java Tue Nov 13 21:47:18 2012 @@ -4874,7 +4874,7 @@ public class OrderServices { // set checkout options cart.setDefaultCheckoutOptions(dispatcher); // the shipping address is the one of the customer - cart.setShippingContactMechId(shipGroup.getString("contactMechId")); + cart.setAllShippingContactMechId(shipGroup.getString("contactMechId")); // associate ship groups of sales and purchase orders ShoppingCart.CartShipInfo cartShipInfo = cart.getShipGroups().get(0); cartShipInfo.setAssociatedShipGroupSeqId(shipGroup.getString("shipGroupSeqId")); Modified: ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?rev=1408976&r1=1408975&r2=1408976&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Tue Nov 13 21:47:18 2012 @@ -235,8 +235,8 @@ public class CheckOutEvents { // if no shipping applies, set the no shipment method and skip to payment if (!cart.shippingApplies()) { - cart.setShipmentMethodTypeId("NO_SHIPPING"); - cart.setCarrierPartyId("_NA_"); + cart.setAllShipmentMethodTypeId("NO_SHIPPING"); + cart.setAllCarrierPartyId("_NA_"); page = "payment"; } @@ -274,7 +274,7 @@ public class CheckOutEvents { ShoppingCart cart = (ShoppingCart) request.getSession().getAttribute("shoppingCart"); String shipToCustomerPartyId = request.getParameter("shipToCustomerPartyId"); cart.setShipToCustomerPartyId(shipToCustomerPartyId); - cart.setShippingContactMechId(null); + cart.setAllShippingContactMechId(null); return "success"; } Modified: ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1408976&r1=1408975&r2=1408976&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Tue Nov 13 21:47:18 2012 @@ -115,7 +115,7 @@ public class CheckOutHelper { // set the shipping address if (UtilValidate.isNotEmpty(shippingContactMechId)) { - this.cart.setShippingContactMechId(shippingContactMechId); + this.cart.setAllShippingContactMechId(shippingContactMechId); } else if (cart.shippingApplies()) { // only return an error if shipping is required for this purchase errMsg = UtilProperties.getMessage(resource_error,"checkhelper.select_shipping_destination", (cart != null ? cart.getLocale() : Locale.getDefault())); @@ -166,8 +166,8 @@ public class CheckOutHelper { carrierPartyId = shippingMethod.substring(delimiterPos + 1); } - this.cart.setShipmentMethodTypeId(shipmentMethodTypeId); - this.cart.setCarrierPartyId(carrierPartyId); + this.cart.setAllShipmentMethodTypeId(shipmentMethodTypeId); + this.cart.setAllCarrierPartyId(carrierPartyId); } else if (cart.shippingApplies()) { // only return an error if shipping is required for this purchase errMsg = UtilProperties.getMessage(resource_error,"checkhelper.select_shipping_method", (cart != null ? cart.getLocale() : Locale.getDefault())); @@ -175,20 +175,20 @@ public class CheckOutHelper { } // set the shipping instructions - this.cart.setShippingInstructions(shippingInstructions); + this.cart.setAllShippingInstructions(shippingInstructions); if (UtilValidate.isNotEmpty(maySplit)) { - cart.setMaySplit(Boolean.valueOf(maySplit)); + cart.setAllMaySplit(Boolean.valueOf(maySplit)); } else { errMsg = UtilProperties.getMessage(resource_error,"checkhelper.select_splitting_preference", (cart != null ? cart.getLocale() : Locale.getDefault())); errorMessages.add(errMsg); } // set the gift message - this.cart.setGiftMessage(giftMessage); + this.cart.setAllGiftMessage(giftMessage); if (UtilValidate.isNotEmpty(isGift)) { - cart.setIsGift(Boolean.valueOf(isGift)); + cart.setAllIsGift(Boolean.valueOf(isGift)); } else { errMsg = UtilProperties.getMessage(resource_error, "checkhelper.specify_if_order_is_gift", (cart != null ? cart.getLocale() : Locale.getDefault())); errorMessages.add(errMsg); Modified: ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1408976&r1=1408975&r2=1408976&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Tue Nov 13 21:47:18 2012 @@ -18,10 +18,39 @@ *******************************************************************************/ package org.ofbiz.order.shoppingcart; +import java.io.Serializable; +import java.math.BigDecimal; +import java.math.MathContext; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.TreeMap; + import javolution.util.FastList; import javolution.util.FastMap; -import org.ofbiz.base.util.*; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.GeneralRuntimeException; +import org.ofbiz.base.util.UtilDateTime; +import org.ofbiz.base.util.UtilFormatOut; +import org.ofbiz.base.util.UtilGenerics; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilNumber; +import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.DelegatorFactory; import org.ofbiz.entity.GenericEntityException; @@ -46,13 +75,6 @@ import org.ofbiz.product.store.ProductSt import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ServiceUtil; -import java.io.Serializable; -import java.math.BigDecimal; -import java.math.MathContext; -import java.sql.Timestamp; -import java.util.*; -import java.util.Map.Entry; - /** * Shopping Cart Object */ @@ -2217,11 +2239,19 @@ public class ShoppingCart implements Ite } csi.setContactMechId(shippingContactMechId); } - - public void setShippingContactMechId(String shippingContactMechId) { - this.setShippingContactMechId(0, shippingContactMechId); + + /** + * Sets @param shippingContactMechId in all ShipInfo(ShipGroups) associated + * with this ShoppingCart + * <p> + * @param shippingContactMechId + */ + public void setAllShippingContactMechId(String shippingContactMechId) { + for(int x=0; x < shipInfo.size(); x++) { + this.setShippingContactMechId(x, shippingContactMechId); + } } - + /** Returns the shipping contact mech id. */ public String getShippingContactMechId(int idx) { CartShipInfo csi = this.getShipInfo(idx); @@ -2237,11 +2267,19 @@ public class ShoppingCart implements Ite CartShipInfo csi = this.getShipInfo(idx); csi.shipmentMethodTypeId = shipmentMethodTypeId; } - - public void setShipmentMethodTypeId(String shipmentMethodTypeId) { - this.setShipmentMethodTypeId(0, shipmentMethodTypeId); + + /** + * Sets @param shipmentMethodTypeId in all ShipInfo(ShipGroups) associated + * with this ShoppingCart + * <p> + * @param shipmentMethodTypeId + */ + public void setAllShipmentMethodTypeId(String shipmentMethodTypeId) { + for(int x=0; x < shipInfo.size(); x++) { + this.setShipmentMethodTypeId(x, shipmentMethodTypeId); + } } - + /** Returns the shipment method type ID */ public String getShipmentMethodTypeId(int idx) { CartShipInfo csi = this.getShipInfo(idx); @@ -2285,9 +2323,17 @@ public class ShoppingCart implements Ite CartShipInfo csi = this.getShipInfo(idx); csi.shippingInstructions = shippingInstructions; } - - public void setShippingInstructions(String shippingInstructions) { - this.setShippingInstructions(0, shippingInstructions); + + /** + * Sets @param shippingInstructions in all ShipInfo(ShipGroups) associated + * with this ShoppingCart + * <p> + * @param shippingInstructions + */ + public void setAllShippingInstructions(String shippingInstructions) { + for(int x=0; x < shipInfo.size(); x++) { + this.setShippingInstructions(x, shippingInstructions); + } } /** Returns the shipping instructions. */ @@ -2306,10 +2352,19 @@ public class ShoppingCart implements Ite csi.setMaySplit(maySplit); } } - - public void setMaySplit(Boolean maySplit) { - this.setMaySplit(0, maySplit); + + /** + * Sets @param maySplit in all ShipInfo(ShipGroups) associated + * with this ShoppingCart + * <p> + * @param maySplit + */ + public void setAllMaySplit(Boolean maySplit) { + for(int x=0; x < shipInfo.size(); x++) { + this.setMaySplit(x, maySplit); + } } + /** Returns Boolean.TRUE if the order may be split (null if unspecified) */ public String getMaySplit(int idx) { @@ -2326,10 +2381,18 @@ public class ShoppingCart implements Ite csi.giftMessage = giftMessage; } - public void setGiftMessage(String giftMessage) { - this.setGiftMessage(0, giftMessage); + /** + * Sets @param giftMessage in all ShipInfo(ShipGroups) associated + * with this ShoppingCart + * <p> + * @param giftMessage + */ + public void setAllGiftMessage(String giftMessage) { + for(int x=0; x < shipInfo.size(); x++) { + this.setGiftMessage(x, giftMessage); + } } - + public String getGiftMessage(int idx) { CartShipInfo csi = this.getShipInfo(idx); return csi.giftMessage; @@ -2346,10 +2409,18 @@ public class ShoppingCart implements Ite } } - public void setIsGift(Boolean isGift) { - this.setIsGift(0, isGift); + /** + * Sets @param isGift in all ShipInfo(ShipGroups) associated + * with this ShoppingCart + * <p> + * @param isGift + */ + public void setAllIsGift(Boolean isGift) { + for(int x=0; x < shipInfo.size(); x++) { + this.setIsGift(x, isGift); + } } - + public String getIsGift(int idx) { CartShipInfo csi = this.getShipInfo(idx); return csi.isGift; @@ -2363,11 +2434,19 @@ public class ShoppingCart implements Ite CartShipInfo csi = this.getShipInfo(idx); csi.carrierPartyId = carrierPartyId; } - - public void setCarrierPartyId(String carrierPartyId) { - this.setCarrierPartyId(0, carrierPartyId); + + /** + * Sets @param carrierPartyId in all ShipInfo(ShipGroups) associated + * with this ShoppingCart + * <p> + * @param carrierPartyId + */ + public void setAllCarrierPartyId(String carrierPartyId) { + for(int x=0; x < shipInfo.size(); x++) { + this.setCarrierPartyId(x, carrierPartyId); + } } - + public String getCarrierPartyId(int idx) { CartShipInfo csi = this.getShipInfo(idx); return csi.carrierPartyId; @@ -2390,9 +2469,17 @@ public class ShoppingCart implements Ite CartShipInfo csi = this.getShipInfo(idx); csi.productStoreShipMethId = productStoreShipMethId; } - - public void setProductStoreShipMethId(String productStoreShipMethId) { - this.setProductStoreShipMethId(0, productStoreShipMethId); + + /** + * Sets @param productStoreShipMethId in all ShipInfo(ShipGroups) associated + * with this ShoppingCart + * <p> + * @param productStoreShipMethId + */ + public void setAllProductStoreShipMethId(String productStoreShipMethId) { + for(int x=0; x < shipInfo.size(); x++) { + this.setProductStoreShipMethId(x, productStoreShipMethId); + } } public void setShipGroupFacilityId(int idx, String facilityId) { @@ -2490,7 +2577,7 @@ public class ShoppingCart implements Ite Collection<GenericValue> shippingContactMechList = ContactHelper.getContactMech(orderParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false); if (UtilValidate.isNotEmpty(shippingContactMechList)) { GenericValue shippingContactMech = (shippingContactMechList.iterator()).next(); - this.setShippingContactMechId(shippingContactMech.getString("contactMechId")); + this.setAllShippingContactMechId(shippingContactMech.getString("contactMechId")); } } catch (GenericEntityException e) { Debug.logError(e, "Error setting shippingContactMechId in setDefaultCheckoutOptions() method.", module); @@ -2500,8 +2587,8 @@ public class ShoppingCart implements Ite ShippingEstimateWrapper shipEstimateWrapper = org.ofbiz.order.shoppingcart.shipping.ShippingEstimateWrapper.getWrapper(dispatcher, this, 0); GenericValue carrierShipmentMethod = EntityUtil.getFirst(shipEstimateWrapper.getShippingMethods()); if (carrierShipmentMethod != null) { - this.setShipmentMethodTypeId(carrierShipmentMethod.getString("shipmentMethodTypeId")); - this.setCarrierPartyId(carrierShipmentMethod.getString("partyId")); + this.setAllShipmentMethodTypeId(carrierShipmentMethod.getString("shipmentMethodTypeId")); + this.setAllCarrierPartyId(carrierShipmentMethod.getString("partyId")); } } else { // checkout options for purchase orders @@ -2521,12 +2608,12 @@ public class ShoppingCart implements Ite } } // shipping options - this.setShipmentMethodTypeId(0, "NO_SHIPPING"); - this.setCarrierPartyId(0, "_NA_"); - this.setShippingInstructions(0, ""); - this.setGiftMessage(0, ""); - this.setMaySplit(0, Boolean.TRUE); - this.setIsGift(0, Boolean.FALSE); + this.setAllShipmentMethodTypeId("NO_SHIPPING"); + this.setAllCarrierPartyId("_NA_"); + this.setAllShippingInstructions(""); + this.setAllGiftMessage(""); + this.setAllMaySplit(Boolean.TRUE); + this.setAllIsGift(Boolean.FALSE); //this.setInternalCode(internalCode); } } Modified: ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1408976&r1=1408975&r2=1408976&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Tue Nov 13 21:47:18 2012 @@ -1349,6 +1349,10 @@ public class ShoppingCartEvents { UtilMisc.<String, Object>toMap("quoteId", quoteId, "applyQuoteAdjustments", "true", "userLogin", userLogin)); + if (!ServiceUtil.isSuccess(outMap)) { + request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(outMap)); + return "error"; + } cart = (ShoppingCart) outMap.get("shoppingCart"); } catch (GenericServiceException exc) { request.setAttribute("_ERROR_MESSAGE_", exc.getMessage()); Modified: ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java?rev=1408976&r1=1408975&r2=1408976&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java Tue Nov 13 21:47:18 2012 @@ -20,9 +20,9 @@ package org.ofbiz.order.shoppinglist; import java.math.BigDecimal; import java.sql.Timestamp; +import java.util.Date; import java.util.List; import java.util.Locale; -import java.util.Date; import java.util.Map; import javolution.util.FastMap; @@ -515,13 +515,13 @@ public class ShoppingListServices { listCart.addPayment(shoppingList.getString("paymentMethodId")); } if (UtilValidate.isNotEmpty(shoppingList.get("contactMechId"))) { - listCart.setShippingContactMechId(0, shoppingList.getString("contactMechId")); + listCart.setAllShippingContactMechId(shoppingList.getString("contactMechId")); } if (UtilValidate.isNotEmpty(shoppingList.get("shipmentMethodTypeId"))) { - listCart.setShipmentMethodTypeId(0, shoppingList.getString("shipmentMethodTypeId")); + listCart.setAllShipmentMethodTypeId(shoppingList.getString("shipmentMethodTypeId")); } if (UtilValidate.isNotEmpty(shoppingList.get("carrierPartyId"))) { - listCart.setCarrierPartyId(0, shoppingList.getString("carrierPartyId")); + listCart.setAllCarrierPartyId(shoppingList.getString("carrierPartyId")); } if (UtilValidate.isNotEmpty(shoppingList.getString("productPromoCodeId"))) { listCart.addProductPromoCode(shoppingList.getString("productPromoCodeId"), dispatcher); |
| Free forum by Nabble | Edit this page |
