1 7 package org.openbravo.erpCommon.ad_callouts; 8 9 import org.openbravo.base.secureApp.HttpSecureAppServlet; 10 import org.openbravo.base.secureApp.VariablesSecureApp; 11 import org.openbravo.xmlEngine.XmlDocument; 12 import org.openbravo.erpCommon.utility.Utility; 13 import java.io.*; 14 import javax.servlet.*; 15 import javax.servlet.http.*; 16 import org.apache.log4j.Category; 17 18 19 public class SL_MovementAll_Locator extends HttpSecureAppServlet { 20 static Category log4jSL_MovementAll_Locator = Category.getInstance(SL_MovementAll_Locator.class); 21 22 public void init (ServletConfig config) { 23 super.init(config); 24 boolHist = false; 25 } 26 27 public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException { 28 VariablesSecureApp vars = new VariablesSecureApp(request); 29 if (vars.commandIn("DEFAULT")) { 30 String strChanged = vars.getStringParameter("inpLastFieldChanged"); 31 log4jSL_MovementAll_Locator.debug("CHANGED: " + strChanged); 32 String strLocator = vars.getStringParameter(strChanged); 33 String strWindowId = vars.getStringParameter("inpWindowId"); 35 String strmInoutId = vars.getStringParameter("inpmInoutId"); 36 String strIsSOTrx = Utility.getContext(this, vars, "isSOTrx", strWindowId); 37 String strTabId = vars.getStringParameter("inpTabId"); 38 39 try { 40 printPage(response, vars, strLocator, "N", strTabId, strmInoutId); 41 } catch (ServletException ex) { 42 pageErrorCallOut(response); 43 } 44 } else pageError(response); 45 } 46 47 void printPage(HttpServletResponse response, VariablesSecureApp vars, String strLocator, String strIsSOTrx, String strTabId, String strmInoutId) throws IOException, ServletException { 48 log4jSL_MovementAll_Locator.debug("Output: dataSheet"); 49 XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_callouts/CallOut").createXmlDocument(); 50 51 String locator = "0"; 52 String FilledLocator = "0"; 53 54 locator = SLInOutLineLocatorData.locator(this, strLocator); 55 FilledLocator = SLInOutLineLocatorData.filledLocator(this, strmInoutId, strLocator); 56 57 StringBuffer resultado = new StringBuffer (); 58 resultado.append("var calloutName='SL_MovementAll_Locator';\n\n"); 59 log4jSL_MovementAll_Locator.debug("IsSOTrx: " + strIsSOTrx + " - locator: " + locator + " - FilledLocator: " + FilledLocator); 60 if (strIsSOTrx.equals("N") && !locator.equals("0")) { 61 resultado.append("var respuesta = new Array("); 62 resultado.append("new Array(\"MESSAGE\", \"" + Utility.messageBD(this, "FilledWarehouseLocator", vars.getLanguage()) + "\")"); 63 resultado.append(");"); 64 } else if (strIsSOTrx.equals("N") && !FilledLocator.equals("0")) { 65 resultado.append("var respuesta = new Array("); 66 resultado.append("new Array(\"MESSAGE\", \"" + Utility.messageBD(this, "FilledLocatorInout", vars.getLanguage()) + "\")"); 67 resultado.append(");"); 68 } else resultado.append("var respuesta = null;\n"); 69 xmlDocument.setParameter("array", resultado.toString()); 70 xmlDocument.setParameter("frameName","frameButton" ); 71 response.setContentType("text/html"); 72 PrintWriter out = response.getWriter(); 73 out.println(xmlDocument.print()); 74 out.close(); 75 } 76 } 77 | Popular Tags |