You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2010/09/17 08:22:20 UTC

svn commit: r997990 - /ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy

Author: ashish
Date: Fri Sep 17 06:22:20 2010
New Revision: 997990

URL: http://svn.apache.org/viewvc?rev=997990&view=rev
Log:
Bug fix. 
Purchase Order creation was not working from Quote if Parent Organization is being associated with the facility and the value passed from Quote is for Child Organisation. For this I had put a check on PartyRelationship, so that it will also check the relationship between parent & child organisation. If it exists then it will fetch companyId from there. 

  

Modified:
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy?rev=997990&r1=997989&r2=997990&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy Fri Sep 17 06:22:20 2010
@@ -22,6 +22,9 @@ import org.ofbiz.base.util.*;
 import org.ofbiz.order.shoppingcart.*;
 import org.ofbiz.party.contact.*;
 import org.ofbiz.product.catalog.*;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.util.EntityUtil;
 
 import javolution.util.FastMap;
 import javolution.util.FastList;
@@ -83,6 +86,15 @@ if ("SALES_ORDER".equals(cart.getOrderTy
     if (companyId) {
         facilityMaps = FastList.newInstance();
         facilities = delegator.findByAndCache("Facility", [ownerPartyId : companyId]);
+
+        // if facilites is null then check the PartyRelationship where there is a relationship set for Parent & Child organization. Then also fetch the value of companyId from there. 
+        if (UtilValidate.isEmpty(facilities)) {
+            partyRelationship = EntityUtil.getFirst(delegator.findList("PartyRelationship", EntityCondition.makeCondition(["roleTypeIdFrom": "PARENT_ORGANIZATION", "partyIdTo": companyId]), null, null, null, false));
+            if (UtilValidate.isNotEmpty(partyRelationship)) {
+                companyId = partyRelationship.partyIdFrom;
+                facilities = delegator.findByAndCache("Facility", [ownerPartyId : companyId]);
+            }
+        }     
         facilities.each { facility ->
             facilityMap = FastMap.newInstance();
             facilityContactMechValueMaps = ContactMechWorker.getFacilityContactMechValueMaps(delegator, facility.facilityId, false, null);



Re: svn commit: r997990 - /ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy

Posted by Ashish Vijaywargiya <vi...@gmail.com>.
Thanks BJ for the clarification. It helps!

--
Ashish

On Fri, Sep 17, 2010 at 9:35 PM, BJ Freeman <bj...@free-man.net> wrote:
> hi Ahish:
> based on your comment using "GROUP_ROLLUP" best to not do anything.
> apologize for bringing it up.
>
> Ashish Vijaywargiya sent the following on 9/17/2010 3:22 AM:
>>
>> I am sorry BJ, but I couldn't understand your comment. Could you
>> please provide the patch based on your comment so that I could
>> understand what you are saying?
>>
>> Are you saying to put additional check for PartyRelationshipTypeId(in
>> this case it would be "GROUP_ROLLUP")?
>> Thanks!
>>
>> --
>> Ashish
>>
>> On Fri, Sep 17, 2010 at 3:35 PM, BJ Freeman<bj...@free-man.net>  wrote:
>>>
>>> should not you also check for the PartyRelationshipType
>>> as well as the to and from roles?
>>>
>>> ashish@apache.org sent the following on 9/16/2010 11:22 PM:
>>>>
>>>> Author: ashish
>>>> Date: Fri Sep 17 06:22:20 2010
>>>> New Revision: 997990
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=997990&view=rev
>>>> Log:
>>>> Bug fix.
>>>> Purchase Order creation was not working from Quote if Parent
>>>> Organization
>>>> is being associated with the facility and the value passed from Quote is
>>>> for
>>>> Child Organisation. For this I had put a check on PartyRelationship, so
>>>> that
>>>> it will also check the relationship between parent&    child
>>>> organisation. If
>>>> it exists then it will fetch companyId from there.
>>>>
>>>>
>>>>
>>>> Modified:
>>>>
>>>>
>>>> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
>>>>
>>>> Modified:
>>>>
>>>> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
>>>> URL:
>>>>
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy?rev=997990&r1=997989&r2=997990&view=diff
>>>>
>>>>
>>>> ==============================================================================
>>>> ---
>>>>
>>>> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
>>>> (original)
>>>> +++
>>>>
>>>> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
>>>> Fri Sep 17 06:22:20 2010
>>>> @@ -22,6 +22,9 @@ import org.ofbiz.base.util.*;
>>>>  import org.ofbiz.order.shoppingcart.*;
>>>>  import org.ofbiz.party.contact.*;
>>>>  import org.ofbiz.product.catalog.*;
>>>> +import org.ofbiz.base.util.UtilValidate;
>>>> +import org.ofbiz.entity.condition.EntityCondition;
>>>> +import org.ofbiz.entity.util.EntityUtil;
>>>>
>>>>  import javolution.util.FastMap;
>>>>  import javolution.util.FastList;
>>>> @@ -83,6 +86,15 @@ if ("SALES_ORDER".equals(cart.getOrderTy
>>>>      if (companyId) {
>>>>          facilityMaps = FastList.newInstance();
>>>>          facilities = delegator.findByAndCache("Facility", [ownerPartyId
>>>> :
>>>> companyId]);
>>>> +
>>>> +        // if facilites is null then check the PartyRelationship where
>>>> there is a relationship set for Parent&    Child organization. Then also
>>>> fetch
>>>> the value of companyId from there.
>>>> +        if (UtilValidate.isEmpty(facilities)) {
>>>> +            partyRelationship =
>>>> EntityUtil.getFirst(delegator.findList("PartyRelationship",
>>>> EntityCondition.makeCondition(["roleTypeIdFrom": "PARENT_ORGANIZATION",
>>>> "partyIdTo": companyId]), null, null, null, false));
>>>> +            if (UtilValidate.isNotEmpty(partyRelationship)) {
>>>> +                companyId = partyRelationship.partyIdFrom;
>>>> +                facilities = delegator.findByAndCache("Facility",
>>>> [ownerPartyId : companyId]);
>>>> +            }
>>>> +        }
>>>>          facilities.each { facility ->
>>>>              facilityMap = FastMap.newInstance();
>>>>              facilityContactMechValueMaps =
>>>> ContactMechWorker.getFacilityContactMechValueMaps(delegator,
>>>> facility.facilityId, false, null);
>>>>
>>>>
>>>>
>>>
>>>
>>
>
>

Re: svn commit: r997990 - /ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy

Posted by BJ Freeman <bj...@free-man.net>.
hi Ahish:
based on your comment using "GROUP_ROLLUP" best to not do anything.
apologize for bringing it up.

Ashish Vijaywargiya sent the following on 9/17/2010 3:22 AM:
> I am sorry BJ, but I couldn't understand your comment. Could you
> please provide the patch based on your comment so that I could
> understand what you are saying?
>
> Are you saying to put additional check for PartyRelationshipTypeId(in
> this case it would be "GROUP_ROLLUP")?
> Thanks!
>
> --
> Ashish
>
> On Fri, Sep 17, 2010 at 3:35 PM, BJ Freeman<bj...@free-man.net>  wrote:
>>
>> should not you also check for the PartyRelationshipType
>> as well as the to and from roles?
>>
>> ashish@apache.org sent the following on 9/16/2010 11:22 PM:
>>>
>>> Author: ashish
>>> Date: Fri Sep 17 06:22:20 2010
>>> New Revision: 997990
>>>
>>> URL: http://svn.apache.org/viewvc?rev=997990&view=rev
>>> Log:
>>> Bug fix.
>>> Purchase Order creation was not working from Quote if Parent Organization
>>> is being associated with the facility and the value passed from Quote is for
>>> Child Organisation. For this I had put a check on PartyRelationship, so that
>>> it will also check the relationship between parent&    child organisation. If
>>> it exists then it will fetch companyId from there.
>>>
>>>
>>>
>>> Modified:
>>>
>>> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
>>>
>>> Modified:
>>> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy?rev=997990&r1=997989&r2=997990&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
>>> (original)
>>> +++
>>> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
>>> Fri Sep 17 06:22:20 2010
>>> @@ -22,6 +22,9 @@ import org.ofbiz.base.util.*;
>>>   import org.ofbiz.order.shoppingcart.*;
>>>   import org.ofbiz.party.contact.*;
>>>   import org.ofbiz.product.catalog.*;
>>> +import org.ofbiz.base.util.UtilValidate;
>>> +import org.ofbiz.entity.condition.EntityCondition;
>>> +import org.ofbiz.entity.util.EntityUtil;
>>>
>>>   import javolution.util.FastMap;
>>>   import javolution.util.FastList;
>>> @@ -83,6 +86,15 @@ if ("SALES_ORDER".equals(cart.getOrderTy
>>>       if (companyId) {
>>>           facilityMaps = FastList.newInstance();
>>>           facilities = delegator.findByAndCache("Facility", [ownerPartyId :
>>> companyId]);
>>> +
>>> +        // if facilites is null then check the PartyRelationship where
>>> there is a relationship set for Parent&    Child organization. Then also fetch
>>> the value of companyId from there.
>>> +        if (UtilValidate.isEmpty(facilities)) {
>>> +            partyRelationship =
>>> EntityUtil.getFirst(delegator.findList("PartyRelationship",
>>> EntityCondition.makeCondition(["roleTypeIdFrom": "PARENT_ORGANIZATION",
>>> "partyIdTo": companyId]), null, null, null, false));
>>> +            if (UtilValidate.isNotEmpty(partyRelationship)) {
>>> +                companyId = partyRelationship.partyIdFrom;
>>> +                facilities = delegator.findByAndCache("Facility",
>>> [ownerPartyId : companyId]);
>>> +            }
>>> +        }
>>>           facilities.each { facility ->
>>>               facilityMap = FastMap.newInstance();
>>>               facilityContactMechValueMaps =
>>> ContactMechWorker.getFacilityContactMechValueMaps(delegator,
>>> facility.facilityId, false, null);
>>>
>>>
>>>
>>
>>
>


Re: svn commit: r997990 - /ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy

Posted by Ashish Vijaywargiya <vi...@gmail.com>.
I am sorry BJ, but I couldn't understand your comment. Could you
please provide the patch based on your comment so that I could
understand what you are saying?

Are you saying to put additional check for PartyRelationshipTypeId(in
this case it would be "GROUP_ROLLUP")?
Thanks!

--
Ashish

On Fri, Sep 17, 2010 at 3:35 PM, BJ Freeman <bj...@free-man.net> wrote:
>
> should not you also check for the PartyRelationshipType
> as well as the to and from roles?
>
> ashish@apache.org sent the following on 9/16/2010 11:22 PM:
>>
>> Author: ashish
>> Date: Fri Sep 17 06:22:20 2010
>> New Revision: 997990
>>
>> URL: http://svn.apache.org/viewvc?rev=997990&view=rev
>> Log:
>> Bug fix.
>> Purchase Order creation was not working from Quote if Parent Organization
>> is being associated with the facility and the value passed from Quote is for
>> Child Organisation. For this I had put a check on PartyRelationship, so that
>> it will also check the relationship between parent&  child organisation. If
>> it exists then it will fetch companyId from there.
>>
>>
>>
>> Modified:
>>
>> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
>>
>> Modified:
>> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy?rev=997990&r1=997989&r2=997990&view=diff
>>
>> ==============================================================================
>> ---
>> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
>> (original)
>> +++
>> ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
>> Fri Sep 17 06:22:20 2010
>> @@ -22,6 +22,9 @@ import org.ofbiz.base.util.*;
>>  import org.ofbiz.order.shoppingcart.*;
>>  import org.ofbiz.party.contact.*;
>>  import org.ofbiz.product.catalog.*;
>> +import org.ofbiz.base.util.UtilValidate;
>> +import org.ofbiz.entity.condition.EntityCondition;
>> +import org.ofbiz.entity.util.EntityUtil;
>>
>>  import javolution.util.FastMap;
>>  import javolution.util.FastList;
>> @@ -83,6 +86,15 @@ if ("SALES_ORDER".equals(cart.getOrderTy
>>      if (companyId) {
>>          facilityMaps = FastList.newInstance();
>>          facilities = delegator.findByAndCache("Facility", [ownerPartyId :
>> companyId]);
>> +
>> +        // if facilites is null then check the PartyRelationship where
>> there is a relationship set for Parent&  Child organization. Then also fetch
>> the value of companyId from there.
>> +        if (UtilValidate.isEmpty(facilities)) {
>> +            partyRelationship =
>> EntityUtil.getFirst(delegator.findList("PartyRelationship",
>> EntityCondition.makeCondition(["roleTypeIdFrom": "PARENT_ORGANIZATION",
>> "partyIdTo": companyId]), null, null, null, false));
>> +            if (UtilValidate.isNotEmpty(partyRelationship)) {
>> +                companyId = partyRelationship.partyIdFrom;
>> +                facilities = delegator.findByAndCache("Facility",
>> [ownerPartyId : companyId]);
>> +            }
>> +        }
>>          facilities.each { facility ->
>>              facilityMap = FastMap.newInstance();
>>              facilityContactMechValueMaps =
>> ContactMechWorker.getFacilityContactMechValueMaps(delegator,
>> facility.facilityId, false, null);
>>
>>
>>
>
>

Re: svn commit: r997990 - /ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy

Posted by BJ Freeman <bj...@free-man.net>.
should not you also check for the PartyRelationshipType
as well as the to and from roles?

ashish@apache.org sent the following on 9/16/2010 11:22 PM:
> Author: ashish
> Date: Fri Sep 17 06:22:20 2010
> New Revision: 997990
>
> URL: http://svn.apache.org/viewvc?rev=997990&view=rev
> Log:
> Bug fix.
> Purchase Order creation was not working from Quote if Parent Organization is being associated with the facility and the value passed from Quote is for Child Organisation. For this I had put a check on PartyRelationship, so that it will also check the relationship between parent&  child organisation. If it exists then it will fetch companyId from there.
>
>
>
> Modified:
>      ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
>
> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy?rev=997990&r1=997989&r2=997990&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy (original)
> +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/ShipSettings.groovy Fri Sep 17 06:22:20 2010
> @@ -22,6 +22,9 @@ import org.ofbiz.base.util.*;
>   import org.ofbiz.order.shoppingcart.*;
>   import org.ofbiz.party.contact.*;
>   import org.ofbiz.product.catalog.*;
> +import org.ofbiz.base.util.UtilValidate;
> +import org.ofbiz.entity.condition.EntityCondition;
> +import org.ofbiz.entity.util.EntityUtil;
>
>   import javolution.util.FastMap;
>   import javolution.util.FastList;
> @@ -83,6 +86,15 @@ if ("SALES_ORDER".equals(cart.getOrderTy
>       if (companyId) {
>           facilityMaps = FastList.newInstance();
>           facilities = delegator.findByAndCache("Facility", [ownerPartyId : companyId]);
> +
> +        // if facilites is null then check the PartyRelationship where there is a relationship set for Parent&  Child organization. Then also fetch the value of companyId from there.
> +        if (UtilValidate.isEmpty(facilities)) {
> +            partyRelationship = EntityUtil.getFirst(delegator.findList("PartyRelationship", EntityCondition.makeCondition(["roleTypeIdFrom": "PARENT_ORGANIZATION", "partyIdTo": companyId]), null, null, null, false));
> +            if (UtilValidate.isNotEmpty(partyRelationship)) {
> +                companyId = partyRelationship.partyIdFrom;
> +                facilities = delegator.findByAndCache("Facility", [ownerPartyId : companyId]);
> +            }
> +        }
>           facilities.each { facility ->
>               facilityMap = FastMap.newInstance();
>               facilityContactMechValueMaps = ContactMechWorker.getFacilityContactMechValueMaps(delegator, facility.facilityId, false, null);
>
>
>