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...@hlmksw.com> on 2007/06/25 17:41:33 UTC

Re: svn commit: r550445 - /ofbiz/branches/release4.0/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.bsh

I unsubscibed from the commits list but I continue to receive emails. I went through the entire 
challenge/response set of steps and I even received a confirmation email saying I was removed from 
the list. Could someone look into it please?

-Adrian

lektran@apache.org wrote:

> Author: lektran
> Date: Mon Jun 25 03:22:20 2007
> New Revision: 550445
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=550445
> Log:
> Applied fix from trunk for revision: 549648
> 
> Modified:
>     ofbiz/branches/release4.0/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.bsh
> 
> Modified: ofbiz/branches/release4.0/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.bsh
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.bsh?view=diff&rev=550445&r1=550444&r2=550445
> ==============================================================================
> --- ofbiz/branches/release4.0/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.bsh (original)
> +++ ofbiz/branches/release4.0/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.bsh Mon Jun 25 03:22:20 2007
> @@ -134,7 +134,7 @@
>      if (cancelled != null)
>          totalOrdered -= cancelled.doubleValue();
>  
> -    // Get the item quantity received from all shipments via the ShipmentReciept entity
> +    // Get the item quantity received from all shipments via the ShipmentReceipt entity
>      totalReceived = 0.0;
>      receipts = delegator.findByAnd("ShipmentReceipt", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItem.get("orderItemSeqId")));
>      fulfilledReservations = new ArrayList();
> @@ -195,31 +195,30 @@
>  // Handle any item product quantities to receive by adding to the map in session
>  productIdToReceive = request.getParameter("productId");
>  productQtyToReceive = request.getParameter("quantity");
> +context.put("newQuantity", productQtyToReceive);
> +
>  if (UtilValidate.isNotEmpty(productIdToReceive)) {
>  
> -    // Get the first order item with the productId
> -    orderItem = EntityUtil.getFirst(EntityUtil.filterByAnd(orderItems, UtilMisc.toMap("productId", productIdToReceive)));
> +    List candidateOrderItems = EntityUtil.filterByAnd(orderItems, UtilMisc.toMap("productId", productIdToReceive));
>  
>      // If the productId as given isn't found in the order, try any goodIdentifications and use the first match
> -    if (UtilValidate.isEmpty(orderItem)) {
> +    if (UtilValidate.isEmpty(candidateOrderItems)) {
>          goodIdentifications = delegator.findByAnd("GoodIdentification", UtilMisc.toMap("idValue", productIdToReceive));
>          if (! UtilValidate.isEmpty(goodIdentifications)) {
>              giit = goodIdentifications.iterator();
>              while (giit.hasNext()) {
>                  goodIdentification = giit.next();
> -                orderItem = EntityUtil.getFirst(EntityUtil.filterByAnd(orderItems, UtilMisc.toMap("productId", goodIdentification.get("productId"))));
> -                if (! UtilValidate.isEmpty(orderItem)) {
> +                candidateOrderItems = EntityUtil.filterByAnd(orderItems, UtilMisc.toMap("productId", goodIdentification.get("productId")));
> +                if (! UtilValidate.isEmpty(candidateOrderItems)) {
>                      productIdToReceive = goodIdentification.get("productId");
>                      break;
>                  }
>              }
>          }
>      }
> +    
> +    if (! UtilValidate.isEmpty(candidateOrderItems)) {
>  
> -    if (! UtilValidate.isEmpty(orderItem)) {
> -        orderItemSeqId = orderItem.getString("orderItemSeqId");
> -        oldQuantity = 0;
> -        newQuantity = 0;
>          quantity = 0;
>          if (! UtilValidate.isEmpty(productQtyToReceive)) {
>              try {
> @@ -227,38 +226,42 @@
>              } catch (Exception e) {
>                  // Ignore the quantity update if there's a problem parsing it
>              }
> +        }
> +
> +        totalQuantityUsed = 0;
> +        totalQuantityToReceiveBefore = 0;
> +        pqit = candidateOrderItems.iterator();
> +        while (pqit.hasNext() && totalQuantityUsed < quantity) {
> +            candidateOrderItem = pqit.next();
> +            orderItemSeqId = candidateOrderItem.getString("orderItemSeqId");
> +            qtyBefore = itemQuantitiesToReceive.containsKey(orderItemSeqId) ? itemQuantitiesToReceive.get(orderItemSeqId) : 0;
> +            totalQuantityToReceiveBefore += qtyBefore;
> +            qtyMaxAvailable = orderItemDatas.get(orderItemSeqId).get("availableToReceive") - qtyBefore;
>              
> -            if (itemQuantitiesToReceive.containsKey(orderItemSeqId)) {
> -                try {
> -                    oldQuantity = itemQuantitiesToReceive.get(orderItemSeqId);
> -                    newQuantity = oldQuantity + quantity;
> -                } catch (Exception e) {
> -                    // Ignore the quantity update if there's a problem parsing it
> -                }
> -            } else {
> -                newQuantity = quantity;
> +            if (qtyMaxAvailable <= 0) {
> +                continue;
>              }
> +            
> +            qtyUsedForItem  = quantity - totalQuantityUsed >= qtyMaxAvailable ? qtyMaxAvailable : quantity - totalQuantityUsed;
> +            itemQuantitiesToReceive.put(orderItemSeqId, qtyUsedForItem + qtyBefore);
> +            totalQuantityUsed += qtyUsedForItem;
>          }
> -
> -        if (newQuantity <= orderItemDatas.get(orderItemSeqId).get("availableToReceive")) {
> -            itemQuantitiesToReceive.put(orderItemSeqId, newQuantity);
> -        } else {
> -
> -            // If the new quantity would be more than the quantity left to receive for this purchase order item, add an error message to the context
> -            context.put("newQuantity", newQuantity);
> +        
> +        // If there's any quantity to receive left after using as much as possible for every relevant order item, add an error message to the context
> +        if (quantity > totalQuantityUsed) {
>              context.put("ProductReceiveInventoryAgainstPurchaseOrderQuantityExceedsAvailableToReceive", true);
> -            return;
>          }
>          
> -        // Notify if some or all of the quantity to receive for the item will go to a backorder
> -        oldBackOrderedQuantity = orderItemDatas.get(orderItemSeqId).get("backOrderedQuantity") - oldQuantity;
> -        if (oldBackOrderedQuantity < 0) oldBackOrderedQuantity = new Double(0).doubleValue();
> -        newBackOrderedQuantity = orderItemDatas.get(orderItemSeqId).get("backOrderedQuantity") - newQuantity;
> -        if (newBackOrderedQuantity < 0) newBackOrderedQuantity = new Double(0).doubleValue();
> -        if (oldBackOrderedQuantity != newBackOrderedQuantity) {
> -            context.put("quantityToReceive", quantity);
> -            context.put("quantityToBackOrder", (oldBackOrderedQuantity - newBackOrderedQuantity));
> -            context.put("ProductReceiveInventoryAgainstPurchaseOrderQuantityGoesToBackOrder", true);
> +        // Notify if some or all of the quantity just entered for the product will go to a backorder
> +        backOrderedQuantity = orderItemDatas.get(EntityUtil.getFirst(candidateOrderItems).get("orderItemSeqId")).get("backOrderedQuantity") - totalQuantityToReceiveBefore;
> +        
> +        if (backOrderedQuantity > 0) {
> +            totalQtyUsedForBackorders = backOrderedQuantity >= totalQuantityUsed ? totalQuantityUsed : backOrderedQuantity;
> +            if (totalQtyUsedForBackorders > 0) {
> +                context.put("quantityToReceive", totalQuantityUsed);
> +                context.put("quantityToBackOrder", totalQtyUsedForBackorders);
> +                context.put("ProductReceiveInventoryAgainstPurchaseOrderQuantityGoesToBackOrder", true);
> +            }
>          }
>      } else {
>  
> 
> 
> 

Re: Commit List Subscription

Posted by Adrian Crum <ad...@hlmksw.com>.
Understood. Thank you very much for the info!

David E Jones wrote:

> 
> You can't really unsubscribe that address, otherwise your commit 
> notifications won't go out.
> 
> Traditionally all committers should be subscribed to and also 
> occasionally review the commits list...
> 
> -David
> 
> 
> Adrian Crum wrote:
> 
>> David,
>>
>> I thought I had just one and I thought I removed it. My goal is to not 
>> receive any commit emails - I can check the log to get that information.
>>
>> It appears the commit emails I continue to receive are being sent to 
>> my apache.org address, which is then forwarded to my hlmksw.com 
>> address. I don't know how to unsubscribe my apache.org address.
>>
>> -Adrian
>>
>> David E Jones wrote:
>>
>>>
>>> Are you saying that you have multiple addresses on the commits list 
>>> and you'd like to remove just one, or that you think you have just 
>>> one and you removed it and you're still getting email?
>>>
>>> Because you are a committer your apache.org address is probably on 
>>> this list now, and you may be getting two copies of each message. 
>>> Those should be going to 2 different email addresses though.
>>>
>>> -David
>>>
>>>
>>> Adrian Crum wrote:
>>>
>>>> I unsubscibed from the commits list but I continue to receive 
>>>> emails. I went through the entire challenge/response set of steps 
>>>> and I even received a confirmation email saying I was removed from 
>>>> the list. Could someone look into it please?
>>>>
>>>> -Adrian
>>>>
>>>
>>>
> 

Re: Commit List Subscription

Posted by David E Jones <jo...@hotwaxmedia.com>.
You can't really unsubscribe that address, otherwise your commit notifications won't go out.

Traditionally all committers should be subscribed to and also occasionally review the commits list...

-David


Adrian Crum wrote:
> David,
> 
> I thought I had just one and I thought I removed it. My goal is to not 
> receive any commit emails - I can check the log to get that information.
> 
> It appears the commit emails I continue to receive are being sent to my 
> apache.org address, which is then forwarded to my hlmksw.com address. I 
> don't know how to unsubscribe my apache.org address.
> 
> -Adrian
> 
> David E Jones wrote:
> 
>>
>> Are you saying that you have multiple addresses on the commits list 
>> and you'd like to remove just one, or that you think you have just one 
>> and you removed it and you're still getting email?
>>
>> Because you are a committer your apache.org address is probably on 
>> this list now, and you may be getting two copies of each message. 
>> Those should be going to 2 different email addresses though.
>>
>> -David
>>
>>
>> Adrian Crum wrote:
>>
>>> I unsubscibed from the commits list but I continue to receive emails. 
>>> I went through the entire challenge/response set of steps and I even 
>>> received a confirmation email saying I was removed from the list. 
>>> Could someone look into it please?
>>>
>>> -Adrian
>>>
>>
>>

Re: Commit List Subscription

Posted by Adrian Crum <ad...@hlmksw.com>.
David,

I thought I had just one and I thought I removed it. My goal is to not receive any commit emails - I 
can check the log to get that information.

It appears the commit emails I continue to receive are being sent to my apache.org address, which is 
then forwarded to my hlmksw.com address. I don't know how to unsubscribe my apache.org address.

-Adrian

David E Jones wrote:

> 
> Are you saying that you have multiple addresses on the commits list and 
> you'd like to remove just one, or that you think you have just one and 
> you removed it and you're still getting email?
> 
> Because you are a committer your apache.org address is probably on this 
> list now, and you may be getting two copies of each message. Those 
> should be going to 2 different email addresses though.
> 
> -David
> 
> 
> Adrian Crum wrote:
> 
>> I unsubscibed from the commits list but I continue to receive emails. 
>> I went through the entire challenge/response set of steps and I even 
>> received a confirmation email saying I was removed from the list. 
>> Could someone look into it please?
>>
>> -Adrian
>>
> 
> 

Commit List Subscription

Posted by David E Jones <jo...@hotwaxmedia.com>.
Are you saying that you have multiple addresses on the commits list and you'd like to remove just one, or that you think you have just one and you removed it and you're still getting email?

Because you are a committer your apache.org address is probably on this list now, and you may be getting two copies of each message. Those should be going to 2 different email addresses though.

-David


Adrian Crum wrote:
> I unsubscibed from the commits list but I continue to receive emails. I 
> went through the entire challenge/response set of steps and I even 
> received a confirmation email saying I was removed from the list. Could 
> someone look into it please?
> 
> -Adrian
>