Re: svn commit: r1061925 - in /ofbiz/trunk/applications/order: src/org/ofbiz/order/order/OrderReadHelper.java webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1061925 - in /ofbiz/trunk/applications/order: src/org/ofbiz/order/order/OrderReadHelper.java webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy

BJ Freeman
I am curious under what condition a product would not have an ID?

=========================
BJ Freeman
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>
Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man


[hidden email] sent the following on 1/21/2011 9:36 AM:

> Author: jaz
> Date: Fri Jan 21 17:36:32 2011
> New Revision: 1061925
>
> URL: http://svn.apache.org/viewvc?rev=1061925&view=rev
> Log:
> view minor adjustments to support order items without a product id
>
> Modified:
>      ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
>      ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
>
> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=1061925&r1=1061924&r2=1061925&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Fri Jan 21 17:36:32 2011
> @@ -1708,9 +1708,11 @@ public class OrderReadHelper {
>       /** Get a set of productIds in the order. */
>       public Collection<String>  getOrderProductIds() {
>           Set<String>  productIds = FastSet.newInstance();
> -        for (Iterator<GenericValue>  iter = getOrderItems().iterator(); iter.hasNext();) {
> -            productIds.add(iter.next().getString("productId"));
> -        }
> +        for (GenericValue orderItem : getOrderItems()) {
> +            if (orderItem.get("productId") != null) {
> +                productIds.add(orderItem.getString("productId"));
> +            }
> +        }
>           return productIds;
>       }
>
>
> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy?rev=1061925&r1=1061924&r2=1061925&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy (original)
> +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy Fri Jan 21 17:36:32 2011
> @@ -345,13 +345,18 @@ if (orderHeader) {
>       }
>       context.productionProductQuantityMap = productionMap;
>
> -    // INVENTORY: find the number of products in outstanding sales orders for the same product store
> -    requiredMap = InventoryWorker.getOutstandingProductQuantitiesForSalesOrders(productIds, delegator);
> -    context.requiredProductQuantityMap = requiredMap;
> -
> -    // INVENTORY: find the quantity of each product in outstanding purchase orders
> -    onOrderMap = InventoryWorker.getOutstandingProductQuantitiesForPurchaseOrders(productIds, delegator);
> -    context.onOrderProductQuantityMap = onOrderMap;
> +    if (productIds.size()>  0) {
> +        // INVENTORY: find the number of products in outstanding sales orders for the same product store
> +        requiredMap = InventoryWorker.getOutstandingProductQuantitiesForSalesOrders(productIds, delegator);
> +        context.requiredProductQuantityMap = requiredMap;
> +
> +        // INVENTORY: find the quantity of each product in outstanding purchase orders
> +        onOrderMap = InventoryWorker.getOutstandingProductQuantitiesForPurchaseOrders(productIds, delegator);
> +        context.onOrderProductQuantityMap = onOrderMap;
> +    } else {
> +        context.requiredProductQuantityMap = FastMap.newInstance();
> +        context.onOrderProductQuantityMap = FastMap.newInstance();
> +    }
>   }
>
>   paramString = "";
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1061925 - in /ofbiz/trunk/applications/order: src/org/ofbiz/order/order/OrderReadHelper.java webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy

Scott Gray-2
An order item without a product id not a product without an id.  OFBiz does support non-product order items.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 22/01/2011, at 8:04 PM, BJ Freeman wrote:

> I am curious under what condition a product would not have an ID?
>
> =========================
> BJ Freeman
> Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
> Specialtymarket.com  <http://www.specialtymarket.com/>
> Systems Integrator-- Glad to Assist
>
> Chat  Y! messenger: bjfr33man
>
>
> [hidden email] sent the following on 1/21/2011 9:36 AM:
>> Author: jaz
>> Date: Fri Jan 21 17:36:32 2011
>> New Revision: 1061925
>>
>> URL: http://svn.apache.org/viewvc?rev=1061925&view=rev
>> Log:
>> view minor adjustments to support order items without a product id
>>
>> Modified:
>>     ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
>>     ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
>>
>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=1061925&r1=1061924&r2=1061925&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Fri Jan 21 17:36:32 2011
>> @@ -1708,9 +1708,11 @@ public class OrderReadHelper {
>>      /** Get a set of productIds in the order. */
>>      public Collection<String>  getOrderProductIds() {
>>          Set<String>  productIds = FastSet.newInstance();
>> -        for (Iterator<GenericValue>  iter = getOrderItems().iterator(); iter.hasNext();) {
>> -            productIds.add(iter.next().getString("productId"));
>> -        }
>> +        for (GenericValue orderItem : getOrderItems()) {
>> +            if (orderItem.get("productId") != null) {
>> +                productIds.add(orderItem.getString("productId"));
>> +            }
>> +        }
>>          return productIds;
>>      }
>>
>>
>> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy?rev=1061925&r1=1061924&r2=1061925&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy (original)
>> +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy Fri Jan 21 17:36:32 2011
>> @@ -345,13 +345,18 @@ if (orderHeader) {
>>      }
>>      context.productionProductQuantityMap = productionMap;
>>
>> -    // INVENTORY: find the number of products in outstanding sales orders for the same product store
>> -    requiredMap = InventoryWorker.getOutstandingProductQuantitiesForSalesOrders(productIds, delegator);
>> -    context.requiredProductQuantityMap = requiredMap;
>> -
>> -    // INVENTORY: find the quantity of each product in outstanding purchase orders
>> -    onOrderMap = InventoryWorker.getOutstandingProductQuantitiesForPurchaseOrders(productIds, delegator);
>> -    context.onOrderProductQuantityMap = onOrderMap;
>> +    if (productIds.size()>  0) {
>> +        // INVENTORY: find the number of products in outstanding sales orders for the same product store
>> +        requiredMap = InventoryWorker.getOutstandingProductQuantitiesForSalesOrders(productIds, delegator);
>> +        context.requiredProductQuantityMap = requiredMap;
>> +
>> +        // INVENTORY: find the quantity of each product in outstanding purchase orders
>> +        onOrderMap = InventoryWorker.getOutstandingProductQuantitiesForPurchaseOrders(productIds, delegator);
>> +        context.onOrderProductQuantityMap = onOrderMap;
>> +    } else {
>> +        context.requiredProductQuantityMap = FastMap.newInstance();
>> +        context.onOrderProductQuantityMap = FastMap.newInstance();
>> +    }
>>  }
>>
>>  paramString = "";
>>
>>
>>
>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1061925 - in /ofbiz/trunk/applications/order: src/org/ofbiz/order/order/OrderReadHelper.java webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy

BJ Freeman
I agree that a product should always have and ID.
so how does a product not have an ID, so that it must be checked for?

=========================
BJ Freeman
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>
Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man


Scott Gray sent the following on 1/21/2011 11:20 PM:

> An order item without a product id not a product without an id.  OFBiz does support non-product order items.
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 22/01/2011, at 8:04 PM, BJ Freeman wrote:
>
>> I am curious under what condition a product would not have an ID?
>>
>> =========================
>> BJ Freeman
>> Strategic Power Office with Supplier Automation<http://www.businessesnetwork.com/automation/viewforum.php?f=52>
>> Specialtymarket.com<http://www.specialtymarket.com/>
>> Systems Integrator-- Glad to Assist
>>
>> Chat  Y! messenger: bjfr33man
>>
>>
>> [hidden email] sent the following on 1/21/2011 9:36 AM:
>>> Author: jaz
>>> Date: Fri Jan 21 17:36:32 2011
>>> New Revision: 1061925
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1061925&view=rev
>>> Log:
>>> view minor adjustments to support order items without a product id
>>>
>>> Modified:
>>>      ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
>>>      ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
>>>
>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=1061925&r1=1061924&r2=1061925&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Fri Jan 21 17:36:32 2011
>>> @@ -1708,9 +1708,11 @@ public class OrderReadHelper {
>>>       /** Get a set of productIds in the order. */
>>>       public Collection<String>   getOrderProductIds() {
>>>           Set<String>   productIds = FastSet.newInstance();
>>> -        for (Iterator<GenericValue>   iter = getOrderItems().iterator(); iter.hasNext();) {
>>> -            productIds.add(iter.next().getString("productId"));
>>> -        }
>>> +        for (GenericValue orderItem : getOrderItems()) {
>>> +            if (orderItem.get("productId") != null) {
>>> +                productIds.add(orderItem.getString("productId"));
>>> +            }
>>> +        }
>>>           return productIds;
>>>       }
>>>
>>>
>>> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy?rev=1061925&r1=1061924&r2=1061925&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy (original)
>>> +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy Fri Jan 21 17:36:32 2011
>>> @@ -345,13 +345,18 @@ if (orderHeader) {
>>>       }
>>>       context.productionProductQuantityMap = productionMap;
>>>
>>> -    // INVENTORY: find the number of products in outstanding sales orders for the same product store
>>> -    requiredMap = InventoryWorker.getOutstandingProductQuantitiesForSalesOrders(productIds, delegator);
>>> -    context.requiredProductQuantityMap = requiredMap;
>>> -
>>> -    // INVENTORY: find the quantity of each product in outstanding purchase orders
>>> -    onOrderMap = InventoryWorker.getOutstandingProductQuantitiesForPurchaseOrders(productIds, delegator);
>>> -    context.onOrderProductQuantityMap = onOrderMap;
>>> +    if (productIds.size()>   0) {
>>> +        // INVENTORY: find the number of products in outstanding sales orders for the same product store
>>> +        requiredMap = InventoryWorker.getOutstandingProductQuantitiesForSalesOrders(productIds, delegator);
>>> +        context.requiredProductQuantityMap = requiredMap;
>>> +
>>> +        // INVENTORY: find the quantity of each product in outstanding purchase orders
>>> +        onOrderMap = InventoryWorker.getOutstandingProductQuantitiesForPurchaseOrders(productIds, delegator);
>>> +        context.onOrderProductQuantityMap = onOrderMap;
>>> +    } else {
>>> +        context.requiredProductQuantityMap = FastMap.newInstance();
>>> +        context.onOrderProductQuantityMap = FastMap.newInstance();
>>> +    }
>>>   }
>>>
>>>   paramString = "";
>>>
>>>
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1061925 - in /ofbiz/trunk/applications/order: src/org/ofbiz/order/order/OrderReadHelper.java webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy

Jacopo Cappellato-4
the code committed by Jaz is checking if the *OrderItem* (and not the *Product* entity) has a productId: in fact, as Scott wrote, it is possible to order a non-product item.

Jacopo

On Jan 22, 2011, at 8:27 AM, BJ Freeman wrote:

> I agree that a product should always have and ID.
> so how does a product not have an ID, so that it must be checked for?
>
> =========================
> BJ Freeman
> Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
> Specialtymarket.com  <http://www.specialtymarket.com/>
> Systems Integrator-- Glad to Assist
>
> Chat  Y! messenger: bjfr33man
>
>
> Scott Gray sent the following on 1/21/2011 11:20 PM:
>> An order item without a product id not a product without an id.  OFBiz does support non-product order items.
>>
>> Regards
>> Scott
>>
>> HotWax Media
>> http://www.hotwaxmedia.com
>>
>> On 22/01/2011, at 8:04 PM, BJ Freeman wrote:
>>
>>> I am curious under what condition a product would not have an ID?
>>>
>>> =========================
>>> BJ Freeman
>>> Strategic Power Office with Supplier Automation<http://www.businessesnetwork.com/automation/viewforum.php?f=52>
>>> Specialtymarket.com<http://www.specialtymarket.com/>
>>> Systems Integrator-- Glad to Assist
>>>
>>> Chat  Y! messenger: bjfr33man
>>>
>>>
>>> [hidden email] sent the following on 1/21/2011 9:36 AM:
>>>> Author: jaz
>>>> Date: Fri Jan 21 17:36:32 2011
>>>> New Revision: 1061925
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1061925&view=rev
>>>> Log:
>>>> view minor adjustments to support order items without a product id
>>>>
>>>> Modified:
>>>>     ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
>>>>     ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
>>>>
>>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=1061925&r1=1061924&r2=1061925&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
>>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Fri Jan 21 17:36:32 2011
>>>> @@ -1708,9 +1708,11 @@ public class OrderReadHelper {
>>>>      /** Get a set of productIds in the order. */
>>>>      public Collection<String>   getOrderProductIds() {
>>>>          Set<String>   productIds = FastSet.newInstance();
>>>> -        for (Iterator<GenericValue>   iter = getOrderItems().iterator(); iter.hasNext();) {
>>>> -            productIds.add(iter.next().getString("productId"));
>>>> -        }
>>>> +        for (GenericValue orderItem : getOrderItems()) {
>>>> +            if (orderItem.get("productId") != null) {
>>>> +                productIds.add(orderItem.getString("productId"));
>>>> +            }
>>>> +        }
>>>>          return productIds;
>>>>      }
>>>>
>>>>
>>>> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy?rev=1061925&r1=1061924&r2=1061925&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy (original)
>>>> +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy Fri Jan 21 17:36:32 2011
>>>> @@ -345,13 +345,18 @@ if (orderHeader) {
>>>>      }
>>>>      context.productionProductQuantityMap = productionMap;
>>>>
>>>> -    // INVENTORY: find the number of products in outstanding sales orders for the same product store
>>>> -    requiredMap = InventoryWorker.getOutstandingProductQuantitiesForSalesOrders(productIds, delegator);
>>>> -    context.requiredProductQuantityMap = requiredMap;
>>>> -
>>>> -    // INVENTORY: find the quantity of each product in outstanding purchase orders
>>>> -    onOrderMap = InventoryWorker.getOutstandingProductQuantitiesForPurchaseOrders(productIds, delegator);
>>>> -    context.onOrderProductQuantityMap = onOrderMap;
>>>> +    if (productIds.size()>   0) {
>>>> +        // INVENTORY: find the number of products in outstanding sales orders for the same product store
>>>> +        requiredMap = InventoryWorker.getOutstandingProductQuantitiesForSalesOrders(productIds, delegator);
>>>> +        context.requiredProductQuantityMap = requiredMap;
>>>> +
>>>> +        // INVENTORY: find the quantity of each product in outstanding purchase orders
>>>> +        onOrderMap = InventoryWorker.getOutstandingProductQuantitiesForPurchaseOrders(productIds, delegator);
>>>> +        context.onOrderProductQuantityMap = onOrderMap;
>>>> +    } else {
>>>> +        context.requiredProductQuantityMap = FastMap.newInstance();
>>>> +        context.onOrderProductQuantityMap = FastMap.newInstance();
>>>> +    }
>>>>  }
>>>>
>>>>  paramString = "";
>>>>
>>>>
>>>>
>>>
>>
>