Related to issue 25893 : Code review changes
authorPandeeswari Ramakrishnan <pandeeswari.ramakrishnan@openbravo.com>
Mon, 14 Apr 2014 18:00:50 +0530
changeset 22913 7b986e0bf0ef
parent 22912 f61bf8d6176d
child 22914 cae716b1b753
Related to issue 25893 : Code review changes
src/org/openbravo/erpCommon/ad_callouts/SE_InOut_Organization.java
--- a/src/org/openbravo/erpCommon/ad_callouts/SE_InOut_Organization.java	Mon Apr 14 14:12:57 2014 +0200
+++ b/src/org/openbravo/erpCommon/ad_callouts/SE_InOut_Organization.java	Mon Apr 14 18:00:50 2014 +0530
@@ -31,7 +31,8 @@
   @Override
   protected void execute(CalloutInfo info) throws ServletException {
     String strIsSOTrx = Utility.getContext(this, info.vars, "isSOTrx", info.getWindowId());
-    String strOrgId = info.vars.getStringParameter("inpadOrgId");
+    String strMWarehouseId = info.vars.getStringParameter("inpmWarehouseId");
+    boolean updateWarehouse = true;
     FieldProvider[] td = null;
     try {
       ComboTableData comboTableData = new ComboTableData(info.vars, this, "18", "M_Warehouse_ID",
@@ -46,7 +47,15 @@
     }
 
     if (td != null && td.length > 0) {
-      info.addResult("inpmWarehouseId", td[0].getField("id"));
+      for (int i = 0; i < td.length; i++) {
+        if (td[i].getField("id").equals(strMWarehouseId)) {
+          updateWarehouse = false;
+          break;
+        }
+      }
+      if (updateWarehouse) {
+        info.addResult("inpmWarehouseId", td[0].getField("id"));
+      }
     } else {
       info.addResult("inpmWarehouseId", null);
     }