You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Adrian Crum <ad...@sandglass-software.com> on 2011/12/29 21:32:51 UTC
Re: svn commit: r1225641 - in /ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order:
order/OrderServices.java shoppingcart/ShoppingCart.java
Is this a bug fix?
-Adrian
On 12/29/2011 8:30 PM, mor@apache.org wrote:
> Author: mor
> Date: Thu Dec 29 20:30:56 2011
> New Revision: 1225641
>
> URL: http://svn.apache.org/viewvc?rev=1225641&view=rev
> Log:
> Merged from trunk r1225639& r1225640. Log: Added support to associate ship groups of sales and drop ship purchase orders.
>
> Modified:
> ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/order/OrderServices.java
> ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
>
> Modified: ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/order/OrderServices.java
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1225641&r1=1225640&r2=1225641&view=diff
> ==============================================================================
> --- ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
> +++ ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/order/OrderServices.java Thu Dec 29 20:30:56 2011
> @@ -4803,7 +4803,6 @@ public class OrderServices {
> sci.setAssociatedOrderId(orderId);
> sci.setAssociatedOrderItemSeqId(item.getString("orderItemSeqId"));
> sci.setOrderItemAssocTypeId("DROP_SHIPMENT");
> - // TODO: we should consider also the ship group in the association between sales and purchase orders
> } catch (Exception e) {
> return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> "OrderOrderCreatingDropShipmentsError",
> @@ -4819,11 +4818,12 @@ public class OrderServices {
> cart.setDefaultCheckoutOptions(dispatcher);
> // the shipping address is the one of the customer
> cart.setShippingContactMechId(shipGroup.getString("contactMechId"));
> + // associate ship groups of sales and purchase orders
> + ShoppingCart.CartShipInfo cartShipInfo = cart.getShipGroups().get(0);
> + cartShipInfo.setAssociatedShipGroupSeqId(shipGroup.getString("shipGroupSeqId"));
> // create the order
> CheckOutHelper coh = new CheckOutHelper(dispatcher, delegator, cart);
> coh.createOrder(userLogin);
> -
> - // TODO: associate the new purchase order with the sales order (ship group)
> } else {
> // if there are no items to drop ship, then clear out the supplier partyId
> Debug.logWarning("No drop ship items found for order [" + shipGroup.getString("orderId") + "] and ship group [" + shipGroup.getString("shipGroupSeqId") + "] and supplier party [" + shipGroup.getString("supplierPartyId") + "]. Supplier party information will be cleared for this ship group", module);
>
> Modified: ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1225641&r1=1225640&r2=1225641&view=diff
> ==============================================================================
> --- ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
> +++ ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Thu Dec 29 20:30:56 2011
> @@ -4015,36 +4015,39 @@ public class ShoppingCart implements Ite
> public List<GenericValue> makeAllOrderItemAssociations() {
> List<GenericValue> allOrderItemAssociations = new LinkedList<GenericValue>();
>
> - for (ShoppingCartItem item : cartLines) {
> - String requirementId = item.getRequirementId();
> - if (requirementId != null) {
> - try {
> - List<GenericValue> commitments = getDelegator().findByAnd("OrderRequirementCommitment", UtilMisc.toMap("requirementId", requirementId));
> - // TODO: multiple commitments for the same requirement are still not supported
> - GenericValue commitment = EntityUtil.getFirst(commitments);
> - if (commitment != null) {
> - GenericValue orderItemAssociation = getDelegator().makeValue("OrderItemAssoc");
> - orderItemAssociation.set("orderId", commitment.getString("orderId"));
> - orderItemAssociation.set("orderItemSeqId", commitment.getString("orderItemSeqId"));
> - orderItemAssociation.set("shipGroupSeqId", "_NA_");
> - orderItemAssociation.set("toOrderItemSeqId", item.getOrderItemSeqId());
> - orderItemAssociation.set("toShipGroupSeqId", "_NA_");
> - orderItemAssociation.set("orderItemAssocTypeId", "PURCHASE_ORDER");
> - allOrderItemAssociations.add(orderItemAssociation);
> + for (CartShipInfo csi : shipInfo) {
> + Set<ShoppingCartItem> items = csi.getShipItems();
> + for (ShoppingCartItem item : items) {
> + String requirementId = item.getRequirementId();
> + if (requirementId != null) {
> + try {
> + List<GenericValue> commitments = getDelegator().findByAnd("OrderRequirementCommitment", UtilMisc.toMap("requirementId", requirementId));
> + // TODO: multiple commitments for the same requirement are still not supported
> + GenericValue commitment = EntityUtil.getFirst(commitments);
> + if (commitment != null) {
> + GenericValue orderItemAssociation = getDelegator().makeValue("OrderItemAssoc");
> + orderItemAssociation.set("orderId", commitment.getString("orderId"));
> + orderItemAssociation.set("orderItemSeqId", commitment.getString("orderItemSeqId"));
> + orderItemAssociation.set("shipGroupSeqId", "_NA_");
> + orderItemAssociation.set("toOrderItemSeqId", item.getOrderItemSeqId());
> + orderItemAssociation.set("toShipGroupSeqId", "_NA_");
> + orderItemAssociation.set("orderItemAssocTypeId", "PURCHASE_ORDER");
> + allOrderItemAssociations.add(orderItemAssociation);
> + }
> + } catch (GenericEntityException e) {
> + Debug.logError(e, "Unable to load OrderRequirementCommitment records for requirement ID : " + requirementId, module);
> }
> - } catch (GenericEntityException e) {
> - Debug.logError(e, "Unable to load OrderRequirementCommitment records for requirement ID : " + requirementId, module);
> }
> - }
> - if (item.getAssociatedOrderId() != null&& item.getAssociatedOrderItemSeqId() != null) {
> - GenericValue orderItemAssociation = getDelegator().makeValue("OrderItemAssoc");
> - orderItemAssociation.set("orderId", item.getAssociatedOrderId());
> - orderItemAssociation.set("orderItemSeqId", item.getAssociatedOrderItemSeqId());
> - orderItemAssociation.set("shipGroupSeqId", "_NA_");
> - orderItemAssociation.set("toOrderItemSeqId", item.getOrderItemSeqId());
> - orderItemAssociation.set("toShipGroupSeqId", "_NA_");
> - orderItemAssociation.set("orderItemAssocTypeId", item.getOrderItemAssocTypeId());
> - allOrderItemAssociations.add(orderItemAssociation);
> + if (item.getAssociatedOrderId() != null&& item.getAssociatedOrderItemSeqId() != null) {
> + GenericValue orderItemAssociation = getDelegator().makeValue("OrderItemAssoc");
> + orderItemAssociation.set("orderId", item.getAssociatedOrderId());
> + orderItemAssociation.set("orderItemSeqId", item.getAssociatedOrderItemSeqId());
> + orderItemAssociation.set("shipGroupSeqId", csi.getAssociatedShipGroupSeqId() != null ? csi.getAssociatedShipGroupSeqId() : "_NA_");
> + orderItemAssociation.set("toOrderItemSeqId", item.getOrderItemSeqId());
> + orderItemAssociation.set("toShipGroupSeqId", csi.getShipGroupSeqId() != null ? csi.getShipGroupSeqId() : "_NA_");
> + orderItemAssociation.set("orderItemAssocTypeId", item.getOrderItemAssocTypeId());
> + allOrderItemAssociations.add(orderItemAssociation);
> + }
> }
> }
> return allOrderItemAssociations;
> @@ -4417,6 +4420,7 @@ public class ShoppingCart implements Ite
> public Timestamp shipBeforeDate = null;
> public Timestamp shipAfterDate = null;
> private String shipGroupSeqId = null;
> + private String associatedShipGroupSeqId = null;
> public String vendorPartyId = null;
> public String productStoreShipMethId = null;
> public Map<String, Object> attributes = FastMap.newInstance();
> @@ -4451,6 +4455,11 @@ public class ShoppingCart implements Ite
> this.shipGroupSeqId = shipGroupSeqId;
> }
>
> + public String getAssociatedShipGroupSeqId() { return associatedShipGroupSeqId; }
> + public void setAssociatedShipGroupSeqId(String shipGroupSeqId) {
> + this.associatedShipGroupSeqId = shipGroupSeqId;
> + }
> +
> public String getFacilityId() { return facilityId; }
> public void setFacilityId(String facilityId) {
> this.facilityId = facilityId;
>
>
Re: svn commit: r1225641 - in /ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order:
order/OrderServices.java shoppingcart/ShoppingCart.java
Posted by Vikas Mayur <vi...@gmail.com>.
I think this is a fix to a certain extent as without the association you
can't really query the records with ship group.
Regards
Vikas
On Fri, Dec 30, 2011 at 2:02 AM, Adrian Crum <
adrian.crum@sandglass-software.com> wrote:
> Is this a bug fix?
>
> -Adrian
>
>
> On 12/29/2011 8:30 PM, mor@apache.org wrote:
>
>> Author: mor
>> Date: Thu Dec 29 20:30:56 2011
>> New Revision: 1225641
>>
>> URL: http://svn.apache.org/viewvc?**rev=1225641&view=rev<http://svn.apache.org/viewvc?rev=1225641&view=rev>
>> Log:
>> Merged from trunk r1225639& r1225640. Log: Added support to associate
>> ship groups of sales and drop ship purchase orders.
>>
>>
>> Modified:
>> ofbiz/branches/release11.04/**applications/order/src/org/**
>> ofbiz/order/order/**OrderServices.java
>> ofbiz/branches/release11.04/**applications/order/src/org/**
>> ofbiz/order/shoppingcart/**ShoppingCart.java
>>
>> Modified: ofbiz/branches/release11.04/**applications/order/src/org/**
>> ofbiz/order/order/**OrderServices.java
>> URL: http://svn.apache.org/viewvc/**ofbiz/branches/release11.04/**
>> applications/order/src/org/**ofbiz/order/order/**OrderServices.java?rev=*
>> *1225641&r1=1225640&r2=1225641&**view=diff<http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1225641&r1=1225640&r2=1225641&view=diff>
>> ==============================**==============================**
>> ==================
>> --- ofbiz/branches/release11.04/**applications/order/src/org/**
>> ofbiz/order/order/**OrderServices.java (original)
>> +++ ofbiz/branches/release11.04/**applications/order/src/org/**
>> ofbiz/order/order/**OrderServices.java Thu Dec 29 20:30:56 2011
>> @@ -4803,7 +4803,6 @@ public class OrderServices {
>> sci.setAssociatedOrderId(**orderId);
>> sci.**setAssociatedOrderItemSeqId(**
>> item.getString("**orderItemSeqId"));
>> sci.setOrderItemAssocTypeId("**
>> DROP_SHIPMENT");
>> - // TODO: we should consider also the
>> ship group in the association between sales and purchase orders
>> } catch (Exception e) {
>> return ServiceUtil.returnError(**
>> UtilProperties.getMessage(**resource,
>> "**
>> OrderOrderCreatingDropShipment**sError",
>> @@ -4819,11 +4818,12 @@ public class OrderServices {
>> cart.**setDefaultCheckoutOptions(**
>> dispatcher);
>> // the shipping address is the one of the
>> customer
>> cart.setShippingContactMechId(**
>> shipGroup.getString("**contactMechId"));
>> + // associate ship groups of sales and
>> purchase orders
>> + ShoppingCart.CartShipInfo cartShipInfo =
>> cart.getShipGroups().get(0);
>> + cartShipInfo.**setAssociatedShipGroupSeqId(*
>> *shipGroup.getString("**shipGroupSeqId"));
>> // create the order
>> CheckOutHelper coh = new
>> CheckOutHelper(dispatcher, delegator, cart);
>> coh.createOrder(userLogin);
>> -
>> - // TODO: associate the new purchase order
>> with the sales order (ship group)
>> } else {
>> // if there are no items to drop ship, then
>> clear out the supplier partyId
>> Debug.logWarning("No drop ship items found
>> for order [" + shipGroup.getString("orderId") + "] and ship group [" +
>> shipGroup.getString("**shipGroupSeqId") + "] and supplier party [" +
>> shipGroup.getString("**supplierPartyId") + "]. Supplier party
>> information will be cleared for this ship group", module);
>>
>> Modified: ofbiz/branches/release11.04/**applications/order/src/org/**
>> ofbiz/order/shoppingcart/**ShoppingCart.java
>> URL: http://svn.apache.org/viewvc/**ofbiz/branches/release11.04/**
>> applications/order/src/org/**ofbiz/order/shoppingcart/**
>> ShoppingCart.java?rev=1225641&**r1=1225640&r2=1225641&view=**diff<http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1225641&r1=1225640&r2=1225641&view=diff>
>> ==============================**==============================**
>> ==================
>> --- ofbiz/branches/release11.04/**applications/order/src/org/**
>> ofbiz/order/shoppingcart/**ShoppingCart.java (original)
>> +++ ofbiz/branches/release11.04/**applications/order/src/org/**
>> ofbiz/order/shoppingcart/**ShoppingCart.java Thu Dec 29 20:30:56 2011
>> @@ -4015,36 +4015,39 @@ public class ShoppingCart implements Ite
>> public List<GenericValue> makeAllOrderItemAssociations() {
>> List<GenericValue> allOrderItemAssociations = new
>> LinkedList<GenericValue>();
>>
>> - for (ShoppingCartItem item : cartLines) {
>> - String requirementId = item.getRequirementId();
>> - if (requirementId != null) {
>> - try {
>> - List<GenericValue> commitments =
>> getDelegator().findByAnd("**OrderRequirementCommitment",
>> UtilMisc.toMap("requirementId"**, requirementId));
>> - // TODO: multiple commitments for the same
>> requirement are still not supported
>> - GenericValue commitment = EntityUtil.getFirst(**
>> commitments);
>> - if (commitment != null) {
>> - GenericValue orderItemAssociation =
>> getDelegator().makeValue("**OrderItemAssoc");
>> - orderItemAssociation.set("**orderId",
>> commitment.getString("orderId"**));
>> - orderItemAssociation.set("**orderItemSeqId",
>> commitment.getString("**orderItemSeqId"));
>> - orderItemAssociation.set("**shipGroupSeqId",
>> "_NA_");
>> - orderItemAssociation.set("**toOrderItemSeqId",
>> item.getOrderItemSeqId());
>> - orderItemAssociation.set("**toShipGroupSeqId",
>> "_NA_");
>> - orderItemAssociation.set("**orderItemAssocTypeId",
>> "PURCHASE_ORDER");
>> - allOrderItemAssociations.add(**
>> orderItemAssociation);
>> + for (CartShipInfo csi : shipInfo) {
>> + Set<ShoppingCartItem> items = csi.getShipItems();
>> + for (ShoppingCartItem item : items) {
>> + String requirementId = item.getRequirementId();
>> + if (requirementId != null) {
>> + try {
>> + List<GenericValue> commitments =
>> getDelegator().findByAnd("**OrderRequirementCommitment",
>> UtilMisc.toMap("requirementId"**, requirementId));
>> + // TODO: multiple commitments for the same
>> requirement are still not supported
>> + GenericValue commitment = EntityUtil.getFirst(**
>> commitments);
>> + if (commitment != null) {
>> + GenericValue orderItemAssociation =
>> getDelegator().makeValue("**OrderItemAssoc");
>> + orderItemAssociation.set("**orderId",
>> commitment.getString("orderId"**));
>> + orderItemAssociation.set("**orderItemSeqId",
>> commitment.getString("**orderItemSeqId"));
>> + orderItemAssociation.set("**shipGroupSeqId",
>> "_NA_");
>> + orderItemAssociation.set("**toOrderItemSeqId",
>> item.getOrderItemSeqId());
>> + orderItemAssociation.set("**toShipGroupSeqId",
>> "_NA_");
>> + orderItemAssociation.set("**orderItemAssocTypeId",
>> "PURCHASE_ORDER");
>> + allOrderItemAssociations.add(**
>> orderItemAssociation);
>> + }
>> + } catch (GenericEntityException e) {
>> + Debug.logError(e, "Unable to load
>> OrderRequirementCommitment records for requirement ID : " + requirementId,
>> module);
>> }
>> - } catch (GenericEntityException e) {
>> - Debug.logError(e, "Unable to load
>> OrderRequirementCommitment records for requirement ID : " + requirementId,
>> module);
>> }
>> - }
>> - if (item.getAssociatedOrderId() != null&& item.**getAssociatedOrderItemSeqId()
>> != null) {
>>
>> - GenericValue orderItemAssociation =
>> getDelegator().makeValue("**OrderItemAssoc");
>> - orderItemAssociation.set("**orderId",
>> item.getAssociatedOrderId());
>> - orderItemAssociation.set("**orderItemSeqId", item.**
>> getAssociatedOrderItemSeqId())**;
>> - orderItemAssociation.set("**shipGroupSeqId", "_NA_");
>> - orderItemAssociation.set("**toOrderItemSeqId",
>> item.getOrderItemSeqId());
>> - orderItemAssociation.set("**toShipGroupSeqId", "_NA_");
>> - orderItemAssociation.set("**orderItemAssocTypeId",
>> item.getOrderItemAssocTypeId()**);
>> - allOrderItemAssociations.add(**orderItemAssociation);
>> + if (item.getAssociatedOrderId() != null&& item.**getAssociatedOrderItemSeqId()
>> != null) {
>>
>> + GenericValue orderItemAssociation =
>> getDelegator().makeValue("**OrderItemAssoc");
>> + orderItemAssociation.set("**orderId",
>> item.getAssociatedOrderId());
>> + orderItemAssociation.set("**orderItemSeqId", item.**
>> getAssociatedOrderItemSeqId())**;
>> + orderItemAssociation.set("**shipGroupSeqId", csi.**getAssociatedShipGroupSeqId()
>> != null ? csi.**getAssociatedShipGroupSeqId() : "_NA_");
>> + orderItemAssociation.set("**toOrderItemSeqId",
>> item.getOrderItemSeqId());
>> + orderItemAssociation.set("**toShipGroupSeqId",
>> csi.getShipGroupSeqId() != null ? csi.getShipGroupSeqId() : "_NA_");
>> + orderItemAssociation.set("**orderItemAssocTypeId",
>> item.getOrderItemAssocTypeId()**);
>> + allOrderItemAssociations.add(**
>> orderItemAssociation);
>> + }
>> }
>> }
>> return allOrderItemAssociations;
>> @@ -4417,6 +4420,7 @@ public class ShoppingCart implements Ite
>> public Timestamp shipBeforeDate = null;
>> public Timestamp shipAfterDate = null;
>> private String shipGroupSeqId = null;
>> + private String associatedShipGroupSeqId = null;
>> public String vendorPartyId = null;
>> public String productStoreShipMethId = null;
>> public Map<String, Object> attributes = FastMap.newInstance();
>> @@ -4451,6 +4455,11 @@ public class ShoppingCart implements Ite
>> this.shipGroupSeqId = shipGroupSeqId;
>> }
>>
>> + public String getAssociatedShipGroupSeqId() { return
>> associatedShipGroupSeqId; }
>> + public void setAssociatedShipGroupSeqId(**String
>> shipGroupSeqId) {
>> + this.associatedShipGroupSeqId = shipGroupSeqId;
>> + }
>> +
>> public String getFacilityId() { return facilityId; }
>> public void setFacilityId(String facilityId) {
>> this.facilityId = facilityId;
>>
>>
>>