svn commit: r614183 - in /ofbiz/trunk/applications/product: src/org/ofbiz/shipment/shipment/ShipmentEvents.java webapp/facility/WEB-INF/controller.xml webapp/facility/inventory/receiveInventory.ftl

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

svn commit: r614183 - in /ofbiz/trunk/applications/product: src/org/ofbiz/shipment/shipment/ShipmentEvents.java webapp/facility/WEB-INF/controller.xml webapp/facility/inventory/receiveInventory.ftl

jacopoc
Author: jacopoc
Date: Tue Jan 22 03:52:28 2008
New Revision: 614183

URL: http://svn.apache.org/viewvc?rev=614183&view=rev
Log:
New event and checkbox in the shipment receive screen to force the shipment as received.

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml
    ofbiz/trunk/applications/product/webapp/facility/inventory/receiveInventory.ftl

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java?rev=614183&r1=614182&r2=614183&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java Tue Jan 22 03:52:28 2008
@@ -19,6 +19,7 @@
 package org.ofbiz.shipment.shipment;
 
 import java.io.IOException;
+import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -26,9 +27,12 @@
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.service.GenericServiceException;
+import org.ofbiz.service.LocalDispatcher;
 
 /**
  * ShippingEvents - Events used for processing shipping fees
@@ -82,6 +86,27 @@
         }
         
         return "success";                                                
+    }
+
+    public static String checkForceShipmentReceived(HttpServletRequest request, HttpServletResponse response) {
+        LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
+        GenericValue userLogin = (GenericValue)request.getSession().getAttribute("userLogin");
+
+        String shipmentId = request.getParameter("shipmentIdReceived");
+        String forceShipmentReceived = request.getParameter("forceShipmentReceived");
+        String orderId = request.getParameter("orderId");
+        if (UtilValidate.isNotEmpty(shipmentId) && "Y".equals(forceShipmentReceived)) {
+            try {
+                Map inputMap = UtilMisc.toMap("shipmentId", shipmentId, "statusId", "PURCH_SHIP_RECEIVED");
+                inputMap.put("userLogin", userLogin);
+                dispatcher.runSync("updateShipment", inputMap);
+            } catch (GenericServiceException gse) {
+                String errMsg = "Error updating shipment [" + shipmentId + "]: " + gse.toString();
+                request.setAttribute("_ERROR_MESSAGE_", errMsg);
+                return "error";
+            }
+        }
+        return "success";
     }
 }
 

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml?rev=614183&r1=614182&r2=614183&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/controller.xml Tue Jan 22 03:52:28 2008
@@ -556,6 +556,12 @@
     <request-map uri="receiveInventoryProduct">
         <security https="true" auth="true"/>
         <event type="service-multi" path="" invoke="receiveInventoryProduct"/>
+        <response name="success" type="request" value="checkForceShipmentReceived"/>
+        <response name="error" type="view" value="ReceiveInventory"/>
+    </request-map>
+    <request-map uri="checkForceShipmentReceived">
+        <security https="true" auth="true"/>
+        <event type="java" path="org.ofbiz.shipment.shipment.ShipmentEvents" invoke="checkForceShipmentReceived"/>
         <response name="success" type="view" value="ReceiveInventory"/>
         <response name="error" type="view" value="ReceiveInventory"/>
     </request-map>

Modified: ofbiz/trunk/applications/product/webapp/facility/inventory/receiveInventory.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/inventory/receiveInventory.ftl?rev=614183&r1=614182&r2=614183&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/inventory/receiveInventory.ftl (original)
+++ ofbiz/trunk/applications/product/webapp/facility/inventory/receiveInventory.ftl Tue Jan 22 03:52:28 2008
@@ -303,6 +303,9 @@
             <input type="hidden" name="facilityId" value="${requestParameters.facilityId?if_exists}"/>
             <input type="hidden" name="purchaseOrderId" value="${requestParameters.purchaseOrderId?if_exists}"/>
             <input type="hidden" name="initialSelected" value="Y"/>
+            <#if shipment?has_content>
+            <input type="hidden" name="shipmentIdReceived" value="${shipment.shipmentId}"/>
+            </#if>
             <input type="hidden" name="_useRowSubmit" value="Y"/>
             <#assign now = Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp().toString()/>
             <#assign rowCount = 0/>
@@ -317,6 +320,8 @@
                     <h3>${uiLabelMap.ProductReceivePurchaseOrder} #${purchaseOrder.orderId}</h3>
                     <#if shipment?has_content>
                     <h3>${uiLabelMap.ProductShipmentId} #${shipment.shipmentId}</h3>
+                    <span class="tableheadtext">Set Shipment As Received</span>&nbsp;
+                    <input type="checkbox" name="forceShipmentReceived" value="Y"/>
                     </#if>
                   </td>
                   <td align="right">