Author: jacopoc
Date: Thu Dec  9 11:37:18 2010
New Revision: 1043901

URL: http://svn.apache.org/viewvc?rev=1043901&view=rev
Log:
Improved error handling for the production run declaration screen; this fixes a 
bug where, if matarials were missing, the production run declaration screen was 
hiding the error message and the header fields in the screen were emptied.
Backported from rev. 982273 and 1043899

Modified:
    
ofbiz/branches/release10.04/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java
    
ofbiz/branches/release10.04/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
    
ofbiz/branches/release10.04/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml

Modified: 
ofbiz/branches/release10.04/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java?rev=1043901&r1=1043900&r2=1043901&view=diff
==============================================================================
--- 
ofbiz/branches/release10.04/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java
 (original)
+++ 
ofbiz/branches/release10.04/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java
 Thu Dec  9 11:37:18 2010
@@ -38,6 +38,7 @@ import org.ofbiz.entity.GenericPK;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ServiceUtil;
 
 import javolution.util.FastMap;
 
@@ -91,6 +92,10 @@ public class ProductionRunEvents {
             inputMap.put("lotId", parameters.get("lotId"));
             inputMap.put("userLogin", userLogin);
             Map result = dispatcher.runSync("productionRunDeclareAndProduce", 
inputMap);
+            if (ServiceUtil.isError(result)) {
+                request.setAttribute("_ERROR_MESSAGE_", 
ServiceUtil.getErrorMessage(result));
+                return "error";
+            }
         } catch (GenericServiceException e) {
             String errMsg = "Error issuing materials: " + e.toString();
             Debug.logError(e, errMsg, module);

Modified: 
ofbiz/branches/release10.04/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=1043901&r1=1043900&r2=1043901&view=diff
==============================================================================
--- 
ofbiz/branches/release10.04/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
 (original)
+++ 
ofbiz/branches/release10.04/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
 Thu Dec  9 11:37:18 2010
@@ -1823,6 +1823,9 @@ public class ProductionRunServices {
                         serviceContext.put("componentsLocationMap", 
componentsLocationMap);
                         serviceContext.put("userLogin", userLogin);
                         Map resultService = 
dispatcher.runSync("updateProductionRunTask", serviceContext);
+                        if (ServiceUtil.isError(resultService)) {
+                            return 
ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultService));
+                        }
                     } catch (GenericServiceException e) {
                         Debug.logError(e, "Problem calling the 
changeProductionRunTaskStatus service", module);
                         return 
ServiceUtil.returnError(UtilProperties.getMessage(resource, 
"ManufacturingProductionRunStatusNotChanged", locale));
@@ -2125,7 +2128,10 @@ public class ProductionRunServices {
                             }
                             serviceContext.put("userLogin", userLogin);
                             Map resultService = 
dispatcher.runSync("issueProductionRunTaskComponent", serviceContext);
-                        }
+                            if (ServiceUtil.isError(resultService)) {
+                                return 
ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultService));
+                            }
+                       }
                     }
                 } catch (GenericEntityException gee) {
 

Modified: 
ofbiz/branches/release10.04/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml?rev=1043901&r1=1043900&r2=1043901&view=diff
==============================================================================
--- 
ofbiz/branches/release10.04/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml
 (original)
+++ 
ofbiz/branches/release10.04/applications/manufacturing/webapp/manufacturing/jobshopmgt/ProductionRunForms.xml
 Thu Dec  9 11:37:18 2010
@@ -262,6 +262,9 @@ under the License.
     <!-- Production Run Declaration -->
     <form name="ShowProductionRun" type="single" target="productionRunProduce" 
title="" default-map-name="productionRunData"
         header-row-style="header-row" default-table-style="basic-table">
+        <actions>
+            <set field="useRequestParameters" value="false" type="Boolean"/>
+        </actions>
         <field name="workEffortId"><hidden/></field>
         <field name="productId" title="${uiLabelMap.ProductProductName}">
             <display-entity entity-name="Product" description="${internalName} 
[${productId}]"/>


Reply via email to