Package org.openbravo.xmlEngine

Examples of org.openbravo.xmlEngine.XmlDocument


    }*/
   
   
    String strCommand = null;
    CheckPointSetData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
    String strParamMA_CCP_Group_ID = vars.getSessionValue(tabId + "|paramMA_CCP_Group_ID");
String strParamMA_Measure_Shift_ID = vars.getSessionValue(tabId + "|paramMA_Measure_Shift_ID");

    boolean hasSearchCondition=false;
    if (!(strParamMA_CCP_Group_ID.equals("") && strParamMA_Measure_Shift_ID.equals(""))) hasSearchCondition=true;

       String strParamSessionDate = vars.getGlobalVariable("inpParamSessionDate", Utility.getTransactionalDate(this, vars, windowId), "");
      String buscador = "";
      String[] discard = {"", "isNotTest"};
     
      if (vars.getSessionValue("#ShowTest", "N").equals("Y")) discard[1] = new String("isTest");
    if (dataField==null) {
      if (!boolNew) {
        discard[0] = new String("newDiscard");
        data = CheckPointSetData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strPMA_Measure_Shift_ID, strMA_Measure_Group_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strMA_Measure_Group_ID.equals("") && (data == null || data.length==0)) {
          response.sendRedirect(strDireccion + request.getServletPath() + "?Command=RELATION");
          return;
        }
        refreshSessionEdit(vars, data);
        strCommand = "EDIT";
      }

      if (boolNew || data==null || data.length==0) {
        discard[0] = new String ("editDiscard");
        strCommand = "NEW";
        data = new CheckPointSetData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("maMeasureGroupId") == null || dataField.getField("maMeasureGroupId").equals("")) {
        discard[0] = new String ("editDiscard");
        strCommand = "NEW";
        boolNew = true;
      } else {
        discard[0] = new String ("newDiscard");
        strCommand = "EDIT";
      }
    }
   
   
   
    if (dataField==null) {
      if (boolNew || data==null || data.length==0) {
        refreshSessionNew(vars, strPMA_Measure_Shift_ID);
        data = CheckPointSetData.set(strPMA_Measure_Shift_ID, "", Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "800064", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_ORG_ID@", "800064", "", dataField), "Y", Utility.getDefault(this, vars, "Createdby", "", "800064", "", dataField), CheckPointSetData.selectDef802237_0(this, Utility.getDefault(this, vars, "Createdby", "", "800064", "", dataField)), Utility.getDefault(this, vars, "Updatedby", "", "800064", "", dataField), CheckPointSetData.selectDef802239_1(this, Utility.getDefault(this, vars, "Updatedby", "", "800064", "", dataField)), Utility.getDefault(this, vars, "MA_CCP_Group_ID", "", "800064", "", dataField), CheckPointSetData.selectDef802375(this, strPMA_Measure_Shift_ID));
       
      }
     }
     
    String currentPOrg=DateandShiftData.selectOrg(this, strPMA_Measure_Shift_ID);
    String currentOrg = (boolNew?"":(dataField!=null?dataField.getField("adOrgId"):data[0].getField("adOrgId")));
    if (!currentOrg.equals("") && !currentOrg.startsWith("'")) currentOrg = "'"+currentOrg+"'";
    String currentClient = (boolNew?"":(dataField!=null?dataField.getField("adClientId"):data[0].getField("adClientId")));
    if (!currentClient.equals("") && !currentClient.startsWith("'")) currentClient = "'"+currentClient+"'";
   
    boolean editableTab = (!org.openbravo.erpCommon.utility.WindowAccessData.hasReadOnlyAccess(this, vars.getRole(), tabId) && (currentOrg.equals("") || Utility.isElementInList(Utility.getContext(this, vars, "#User_Org", windowId, accesslevel),currentOrg)) && (currentClient.equals("") || Utility.isElementInList(Utility.getContext(this, vars, "#User_Client", windowId, accesslevel), currentClient)));
    if (editableTab)
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/QualityControlReport/CheckPointSet_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/QualityControlReport/CheckPointSet_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "CheckPointSet", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inpmaMeasureGroupId", "", "..", "".equals("Y"), "QualityControlReport", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strMA_Measure_Group_ID));
    toolbar.prepareEditionTemplate("N".equals("Y"), hasSearchCondition, vars.getSessionValue("#ShowTest", "N").equals("Y"), "STD", Utility.getContext(this, vars, "ShowAudit", windowId).equals("Y"));
    xmlDocument.setParameter("toolbar", toolbar.toString());

    try {
      WindowTabs tabs = new WindowTabs(this, vars, tabId, windowId, true, (strCommand.equalsIgnoreCase("NEW")));
      xmlDocument.setParameter("parentTabContainer", tabs.parentTabs());
      xmlDocument.setParameter("mainTabContainer", tabs.mainTabs());
      // if (!strMA_Measure_Group_ID.equals("")) xmlDocument.setParameter("childTabContainer", tabs.childTabs(false));
    // else xmlDocument.setParameter("childTabContainer", tabs.childTabs(true));
    xmlDocument.setParameter("childTabContainer", tabs.childTabs(false));
      NavigationBar nav = new NavigationBar(this, vars.getLanguage(), "CheckPointSet_Relation.html", "QualityControlReport", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "CheckPointSet_Relation.html", strReplaceWith);
      xmlDocument.setParameter("leftTabs", lBar.editionTemplate(strCommand.equals("NEW")));
    } catch (Exception ex) {
      throw new ServletException(ex);
    }
   
   
    xmlDocument.setParameter("parentOrg", currentPOrg);
    xmlDocument.setParameter("commandType", strCommand);
    xmlDocument.setParameter("buscador",buscador);
    xmlDocument.setParameter("windowId", windowId);
    xmlDocument.setParameter("changed", "");
    xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
    xmlDocument.setParameter("theme", vars.getTheme());
    final String strMappingName = UtilityData.selectObjectMapping(this, tabId);
    xmlDocument.setParameter("mappingName", strMappingName);
    xmlDocument.setParameter("confirmOnChanges", Utility.getJSConfirmOnChanges(vars, windowId));
    //xmlDocument.setParameter("buttonReference", Utility.messageBD(this, "Reference", vars.getLanguage()));

    xmlDocument.setParameter("paramSessionDate", strParamSessionDate);

    xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
    OBError myMessage = vars.getMessage(tabId);
    vars.removeMessage(tabId);
    if (myMessage!=null) {
      xmlDocument.setParameter("messageType", myMessage.getType());
      xmlDocument.setParameter("messageTitle", myMessage.getTitle());
      xmlDocument.setParameter("messageMessage", myMessage.getMessage());
    }
    xmlDocument.setParameter("displayLogic", getDisplayLogicContext(vars, boolNew));
   
   
     if (dataField==null) {
      xmlDocument.setData("structure1",data);
     
    } else {
     
        FieldProvider[] dataAux = new FieldProvider[1];
        dataAux[0] = dataField;
       
        xmlDocument.setData("structure1",dataAux);
     
    }
   
     
  
    try {
      ComboTableData comboTableData = null;
String userClientList = "";
if (editableTab)
  userClientList=Utility.getContext(this, vars, "#User_Client", windowId, accesslevel); //editable record
else
  userClientList=currentClient;
comboTableData = new ComboTableData(vars, this, "19", "AD_Client_ID", "", "", null, userClientList, 0);
Utility.fillSQLParameters(this, vars, (dataField==null?data[0]:dataField), comboTableData, windowId, (dataField==null?data[0].getField("adClientId"):dataField.getField("adClientId")));
xmlDocument.setData("reportAD_Client_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
String userOrgList = "";
if (editableTab)
  userOrgList= Utility.getReferenceableOrg(this, vars, currentPOrg, windowId, accesslevel); //referenceable from parent org, only the writeable orgs
else
  userOrgList=currentOrg;
comboTableData = new ComboTableData(vars, this, "19", "AD_Org_ID", "", "", userOrgList, Utility.getContext(this, vars, "#User_Client", windowId), 0);
Utility.fillSQLParameters(this, vars, (dataField==null?data[0]:dataField), comboTableData, windowId, (dataField==null?data[0].getField("adOrgId"):dataField.getField("adOrgId")));
xmlDocument.setData("reportAD_Org_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "19", "MA_Measure_Shift_ID", "", "", Utility.getReferenceableOrg(vars, (dataField!=null?dataField.getField("adOrgId"):data[0].getField("adOrgId").equals("")?vars.getOrg():data[0].getField("adOrgId"))), Utility.getContext(this, vars, "#User_Client", windowId), 0);
Utility.fillSQLParameters(this, vars, (dataField==null?data[0]:dataField), comboTableData, windowId, (dataField==null?data[0].getField("maMeasureShiftId"):dataField.getField("maMeasureShiftId")));
xmlDocument.setData("reportMA_Measure_Shift_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "19", "MA_CCP_Group_ID", "", "", Utility.getReferenceableOrg(vars, (dataField!=null?dataField.getField("adOrgId"):data[0].getField("adOrgId").equals("")?vars.getOrg():data[0].getField("adOrgId"))), Utility.getContext(this, vars, "#User_Client", windowId), 0);
Utility.fillSQLParameters(this, vars, (dataField==null?data[0]:dataField), comboTableData, windowId, (dataField==null?data[0].getField("maCcpGroupId"):dataField.getField("maCcpGroupId")));
xmlDocument.setData("reportMA_CCP_Group_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("Created_Format", vars.getSessionValue("#AD_SqlDateTimeFormat"));xmlDocument.setParameter("Created_Maxlength", Integer.toString(vars.getSessionValue("#AD_SqlDateTimeFormat").length()));
xmlDocument.setParameter("Updated_Format", vars.getSessionValue("#AD_SqlDateTimeFormat"));xmlDocument.setParameter("Updated_Maxlength", Integer.toString(vars.getSessionValue("#AD_SqlDateTimeFormat").length()));
    } catch (Exception ex) {
      ex.printStackTrace();
      throw new ServletException(ex);
    }

    xmlDocument.setParameter("scriptOnLoad", getShortcutScript(usedButtonShortCuts));
   
    final String refererURL = vars.getSessionValue(tabId + "|requestURL");
    vars.removeSessionValue(tabId + "|requestURL");
    if(!refererURL.equals("")) {
      final Boolean failedAutosave = (Boolean) vars.getSessionObject(tabId + "|failedAutosave");
    vars.removeSessionValue(tabId + "|failedAutosave");
      if(failedAutosave != null && failedAutosave) {
        final String jsFunction = "continueUserAction('"+refererURL+"');";
        xmlDocument.setParameter("failedAutosave", jsFunction);
      }
    }

    if (strCommand.equalsIgnoreCase("NEW")) {
      vars.removeSessionValue(strMappingName + "|hash");
    }

    response.setContentType("text/html; charset=UTF-8");
    PrintWriter out = response.getWriter();
    out.println(xmlDocument.print());
    out.close();
  }
View Full Code Here


  private void printPage(HttpServletResponse response, VariablesSecureApp vars)
      throws ServletException, IOException {
    if (log4j.isDebugEnabled())
      log4j.debug("Output: dataSheet");
    XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
        "org/openbravo/erpCommon/ad_callouts/CallOut").createXmlDocument();

    StringBuffer resultado = new StringBuffer();
    ComboTableData comboTableData = null;
    boolean isRelatedProjectType = false;
    FieldProvider[] data = null;

    String strCProjectTypeID = vars.getStringParameter("inpcProjecttypeId");
    String strWindowId = vars.getStringParameter("inpwindowId");

    resultado.append("var calloutName='SL_Project_Type';\n\n");
    resultado.append("var respuesta = new Array(");

    if (!strCProjectTypeID.isEmpty()) {
      try {
        comboTableData = new ComboTableData(vars, this, "19", "C_ProjectType_ID", "", "", Utility
            .getReferenceableOrg(vars, vars.getStringParameter("inpadOrgId")), Utility.getContext(
            this, vars, "#User_Client", strWindowId), 0);
        comboTableData.fillParameters(null, strWindowId, "");
        data = comboTableData.select(false);
      } catch (Exception ex) {
        throw new ServletException(ex);
      }

      if (data != null && data.length != 0) {
        for (FieldProvider fp : data) {
          if (fp.getField("ID").trim().equalsIgnoreCase(strCProjectTypeID)) {
            isRelatedProjectType = true;
            break;
          }
        }
      }

      if (!isRelatedProjectType && "130".equalsIgnoreCase(strWindowId)) {
        resultado.append("new Array('MESSAGE', \""
            + Utility.messageBD(this, "ProjectTypeNull", vars.getLanguage()) + "\"));");
      } else {
        resultado.append(");");
      }
    } else {
      resultado.append(");");
    }

    xmlDocument.setParameter("array", resultado.toString());
    xmlDocument.setParameter("frameName", "appFrame");
    response.setContentType("text/html; charset=UTF-8");
    PrintWriter out = response.getWriter();
    out.println(xmlDocument.print());
    out.close();
  }
View Full Code Here

  void printPageButtonFS(HttpServletResponse response, VariablesSecureApp vars, String strProcessId, String path) throws IOException, ServletException {
    log4j.debug("Output: Frames action button");
    response.setContentType("text/html; charset=UTF-8");
    PrintWriter out = response.getWriter();
    XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
        "org/openbravo/erpCommon/ad_actionButton/ActionButtonDefaultFrames").createXmlDocument();
    xmlDocument.setParameter("processId", strProcessId);
    xmlDocument.setParameter("trlFormType", "PROCESS");
    xmlDocument.setParameter("language", "defaultLang = \"" + vars.getLanguage() + "\";\n");
    xmlDocument.setParameter("type", strDireccion + path);
    out.println(xmlDocument.print());
    out.close();
  }
View Full Code Here

    }

    String[] discard={"isNotFiltered","isNotTest"};
    if (hasSearchCondition) discard[0] = new String("isFiltered");
    if (vars.getSessionValue("#ShowTest", "N").equals("Y")) discard[1] = new String("isTest");
    XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/vehicle/management/system/Vehicle/Damage_Relation", discard).createXmlDocument();

    ToolBar toolbar = new ToolBar(this, vars.getLanguage(), "Damage", false, "document.frmMain.inpvmVehicleDamageId", "grid", "../vehicle/print.html", "N".equals("Y"), "Vehicle", strReplaceWith, false);
    toolbar.prepareRelationTemplate("N".equals("Y"), hasSearchCondition, !vars.getSessionValue("#ShowTest", "N").equals("Y"), false, Utility.getContext(this, vars, "ShowAudit", windowId).equals("Y"));
    xmlDocument.setParameter("toolbar", toolbar.toString());

    xmlDocument.setParameter("keyParent", strPVM_Vehicle_Info_ID);

    StringBuffer orderByArray = new StringBuffer();
      vars.setSessionValue(tabId + "|newOrder", "1");
      String positions = vars.getSessionValue(tabId + "|orderbyPositions");
      orderByArray.append("var orderByPositions = new Array(\n");
      if (!positions.equals("")) {
        StringTokenizer tokens=new StringTokenizer(positions, ",");
        boolean firstOrder = true;
        while(tokens.hasMoreTokens()){
          if (!firstOrder) orderByArray.append(",\n");
          orderByArray.append("\"").append(tokens.nextToken()).append("\"");
          firstOrder = false;
        }
      }
      orderByArray.append(");\n");
      String directions = vars.getSessionValue(tabId + "|orderbyDirections");
      orderByArray.append("var orderByDirections = new Array(\n");
      if (!positions.equals("")) {
        StringTokenizer tokens=new StringTokenizer(directions, ",");
        boolean firstOrder = true;
        while(tokens.hasMoreTokens()){
          if (!firstOrder) orderByArray.append(",\n");
          orderByArray.append("\"").append(tokens.nextToken()).append("\"");
          firstOrder = false;
        }
      }
      orderByArray.append(");\n");
//    }

    xmlDocument.setParameter("selectedColumn", "\nvar selectedRow = " + selectedRow + ";\n" + orderByArray.toString());
    xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
    xmlDocument.setParameter("windowId", windowId);
    xmlDocument.setParameter("KeyName", "vmVehicleDamageId");
    xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
    xmlDocument.setParameter("theme", vars.getTheme());
    //xmlDocument.setParameter("buttonReference", Utility.messageBD(this, "Reference", vars.getLanguage()));
    try {
      WindowTabs tabs = new WindowTabs(this, vars, tabId, windowId, false);
      xmlDocument.setParameter("parentTabContainer", tabs.parentTabs());
      xmlDocument.setParameter("mainTabContainer", tabs.mainTabs());
      xmlDocument.setParameter("childTabContainer", tabs.childTabs());
      NavigationBar nav = new NavigationBar(this, vars.getLanguage(), "Damage_Relation.html", "Vehicle", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "Damage_Relation.html", strReplaceWith);
      xmlDocument.setParameter("leftTabs", lBar.relationTemplate());
    } catch (Exception ex) {
      throw new ServletException(ex);
    }
    {
      OBError myMessage = vars.getMessage(tabId);
      vars.removeMessage(tabId);
      if (myMessage!=null) {
        xmlDocument.setParameter("messageType", myMessage.getType());
        xmlDocument.setParameter("messageTitle", myMessage.getTitle());
        xmlDocument.setParameter("messageMessage", myMessage.getMessage());
      }
    }
    if (vars.getLanguage().equals("en_US")) xmlDocument.setParameter("parent", DamageData.selectParent(this, strPVM_Vehicle_Info_ID));
    else xmlDocument.setParameter("parent", DamageData.selectParentTrl(this, strPVM_Vehicle_Info_ID));

    xmlDocument.setParameter("grid", Utility.getContext(this, vars, "#RecordRange", windowId));
xmlDocument.setParameter("grid_Offset", strOffset);
xmlDocument.setParameter("grid_SortCols", positions);
xmlDocument.setParameter("grid_SortDirs", directions);
xmlDocument.setParameter("grid_Default", selectedRow);


    response.setContentType("text/html; charset=UTF-8");
    PrintWriter out = response.getWriter();
    out.println(xmlDocument.print());
    out.close();
  }
View Full Code Here

  void printPageButtonFS(HttpServletResponse response, VariablesSecureApp vars, String strProcessId, String path) throws IOException, ServletException {
    log4j.debug("Output: Frames action button");
    response.setContentType("text/html; charset=UTF-8");
    PrintWriter out = response.getWriter();
    XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
        "org/openbravo/erpCommon/ad_actionButton/ActionButtonDefaultFrames").createXmlDocument();
    xmlDocument.setParameter("processId", strProcessId);
    xmlDocument.setParameter("trlFormType", "PROCESS");
    xmlDocument.setParameter("language", "defaultLang = \"" + vars.getLanguage() + "\";\n");
    xmlDocument.setParameter("type", strDireccion + path);
    out.println(xmlDocument.print());
    out.close();
  }
View Full Code Here

  private void printPage(HttpServletResponse response, VariablesSecureApp vars, String strBPartner,
      String strDocType, String strIsSOTrx, String strWindowId, String strLocation,
      String strContact, String strProjectId, String strTabId) throws IOException, ServletException {
    if (log4j.isDebugEnabled())
      log4j.debug("Output: dataSheet");
    XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
        "org/openbravo/erpCommon/ad_callouts/CallOut").createXmlDocument();

    if (strBPartner.equals(""))
      vars.removeSessionValue(strWindowId + "|C_BPartner_ID");

    BpartnerMiscData[] data = BpartnerMiscData.select(this, strBPartner);
    String strUserRep;
    String DocBaseType = SEInvoiceBPartnerData.docBaseType(this, strDocType);
    StringBuffer resultado = new StringBuffer();
    resultado.append("var calloutName='SE_Invoice_BPartner';\n\n");
    if (data == null || data.length == 0)
      resultado.append("var respuesta = new Array(new Array(\"inpcBpartnerLocationId\", null));");

    else {
      resultado.append("var respuesta = new Array(");
      strUserRep = SEOrderBPartnerData.userIdSalesRep(this, data[0].salesrepId);
      String strPriceList = (strIsSOTrx.equals("Y") ? data[0].mPricelistId : data[0].poPricelistId);
      resultado.append("new Array(\"inpmPricelistId\", \""
          + (strPriceList.equals("") ? Utility.getContext(this, vars, "#M_PriceList_ID",
              strWindowId) : strPriceList) + "\"),");
      String strPaymentRule = (strIsSOTrx.equals("Y") ? data[0].paymentrule : data[0].paymentrulepo);
      if (strPaymentRule.equals("") && DocBaseType.endsWith("C"))
        strPaymentRule = "P";
      else if (strPaymentRule.equals("S") || strPaymentRule.equals("U") && strIsSOTrx.equals("Y"))
        strPaymentRule = "P";
      resultado.append("new Array(\"inppaymentrule\", \"" + strPaymentRule + "\"),");
      String PaymentTerm = (strIsSOTrx.equals("Y") ? data[0].cPaymenttermId
          : data[0].poPaymenttermId);
      resultado.append("new Array(\"inpcPaymenttermId\", \"" + PaymentTerm + "\"),");
      FieldProvider[] tdv = null;
      try {
        ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR",
            "C_BPartner_Location_ID", "", "C_BPartner Location - Bill To", Utility.getContext(this,
                vars, "#AccessibleOrgTree", strWindowId), Utility.getContext(this, vars,
                "#User_Client", strWindowId), 0);
        Utility.fillSQLParameters(this, vars, null, comboTableData, strWindowId, "");
        tdv = comboTableData.select(false);
        comboTableData = null;
      } catch (Exception ex) {
        throw new ServletException(ex);
      }

      resultado.append("new Array(\"inpcBpartnerLocationId\", ");
      if (tdv != null && tdv.length > 0) {
        resultado.append("new Array(");
        for (int i = 0; i < tdv.length; i++) {
          resultado.append("new Array(\"" + tdv[i].getField("id") + "\", \""
              + FormatUtilities.replaceJS(tdv[i].getField("name")) + "\", \""
              + (tdv[i].getField("id").equalsIgnoreCase(strLocation) ? "true" : "false") + "\")");
          if (i < tdv.length - 1)
            resultado.append(",\n");
        }
        resultado.append("\n)");
      } else
        resultado.append("null");
      resultado.append("\n),");
      resultado.append("new Array(\"inpsalesrepId\", ");
      FieldProvider[] tld = null;
      try {
        ComboTableData comboTableData = new ComboTableData(vars, this, "TABLE", "",
            "AD_User SalesRep", "", Utility.getContext(this, vars, "#AccessibleOrgTree",
                "SEInvoiceBPartner"), Utility.getContext(this, vars, "#User_Client",
                "SEInvoiceBPartner"), 0);
        Utility.fillSQLParameters(this, vars, null, comboTableData, "SEInvoiceBPartner", "");
        tld = comboTableData.select(false);
        comboTableData = null;
      } catch (Exception ex) {
        throw new ServletException(ex);
      }

      if (tld != null && tld.length > 0) {
        resultado.append("new Array(");
        for (int i = 0; i < tld.length; i++) {
          resultado.append("new Array(\"" + tld[i].getField("id") + "\", \""
              + FormatUtilities.replaceJS(tld[i].getField("name")) + "\", \""
              + (tld[i].getField("id").equalsIgnoreCase(strUserRep) ? "true" : "false") + "\")");
          if (i < tld.length - 1)
            resultado.append(",\n");
        }
        resultado.append("\n)");
      } else
        resultado.append("null");
      resultado.append("\n),");
      resultado.append("new Array(\"inpcProjectId\", \"\"),");
      resultado.append("new Array(\"inpcProjectId_R\", \"\"),");
      try {
        ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_User_ID",
            "", "AD_User C_BPartner User/Contacts", Utility.getContext(this, vars,
                "#AccessibleOrgTree", strWindowId), Utility.getContext(this, vars, "#User_Client",
                strWindowId), 0);
        Utility.fillSQLParameters(this, vars, null, comboTableData, strWindowId, "");
        tdv = comboTableData.select(false);
        comboTableData = null;
      } catch (Exception ex) {
        throw new ServletException(ex);
      }

      resultado.append("new Array(\"inpcBpartnerContactId\", ");
      if (tdv != null && tdv.length > 0) {
        resultado.append("new Array(");
        for (int i = 0; i < tdv.length; i++) {
          resultado.append("new Array(\"" + tdv[i].getField("id") + "\", \""
              + FormatUtilities.replaceJS(tdv[i].getField("name")) + "\", \""
              + (tdv[i].getField("id").equalsIgnoreCase(strContact) ? "true" : "false") + "\")");
          if (i < tdv.length - 1)
            resultado.append(",\n");
        }
        resultado.append("\n)");
      } else
        resultado.append("null");
      resultado.append("\n),");

      try {
        ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_User_ID",
            "", "AD_User C_BPartner User/Contacts", Utility.getContext(this, vars,
                "#AccessibleOrgTree", strWindowId), Utility.getContext(this, vars, "#User_Client",
                strWindowId), 0);
        Utility.fillSQLParameters(this, vars, null, comboTableData, strWindowId, "");
        tdv = comboTableData.select(false);
        comboTableData = null;
      } catch (Exception ex) {
        throw new ServletException(ex);
      }

      resultado.append("new Array(\"inpadUserId\", ");
      if (tdv != null && tdv.length > 0) {
        resultado.append("new Array(");
        for (int i = 0; i < tdv.length; i++) {
          resultado.append("new Array(\"" + tdv[i].getField("id") + "\", \""
              + FormatUtilities.replaceJS(tdv[i].getField("name")) + "\", \""
              + (tdv[i].getField("id").equalsIgnoreCase(strContact) ? "true" : "false") + "\")");
          if (i < tdv.length - 1)
            resultado.append(",\n");
        }
        resultado.append("\n)");
      } else
        resultado.append("null");
      resultado.append("\n),");
      String strWithHolding = SEInvoiceBPartnerData.WithHolding(this, strBPartner);
      resultado.append("new Array(\"inpcWithholdingId\", \"" + strWithHolding + "\"),");
      resultado
          .append("new Array(\"inpisdiscountprinted\", \"" + data[0].isdiscountprinted + "\")");
      if (data != null && data.length > 0
          && new BigDecimal(data[0].creditavailable).compareTo(BigDecimal.ZERO) < 0 && strIsSOTrx.equals("Y")) {
        String creditLimitExceed = "" + Double.parseDouble(data[0].creditavailable) * -1;
        resultado.append(", new Array('MESSAGE', \""
            + Utility.messageBD(this, "CreditLimitOver", vars.getLanguage()) + creditLimitExceed
            + "\")");
      }
      resultado.append(");");
    }
    xmlDocument.setParameter("array", resultado.toString());
    xmlDocument.setParameter("frameName", "appFrame");
    response.setContentType("text/html; charset=UTF-8");
    PrintWriter out = response.getWriter();
    out.println(xmlDocument.print());
    out.close();
  }
View Full Code Here

  void printPageButtonFS(HttpServletResponse response, VariablesSecureApp vars, String strProcessId, String path) throws IOException, ServletException {
    log4j.debug("Output: Frames action button");
    response.setContentType("text/html; charset=UTF-8");
    PrintWriter out = response.getWriter();
    XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
        "org/openbravo/erpCommon/ad_actionButton/ActionButtonDefaultFrames").createXmlDocument();
    xmlDocument.setParameter("processId", strProcessId);
    xmlDocument.setParameter("trlFormType", "PROCESS");
    xmlDocument.setParameter("language", "defaultLang = \"" + vars.getLanguage() + "\";\n");
    xmlDocument.setParameter("type", strDireccion + path);
    out.println(xmlDocument.print());
    out.close();
  }
View Full Code Here

  void printPageButtonFS(HttpServletResponse response, VariablesSecureApp vars, String strProcessId, String path) throws IOException, ServletException {
    log4j.debug("Output: Frames action button");
    response.setContentType("text/html; charset=UTF-8");
    PrintWriter out = response.getWriter();
    XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
        "org/openbravo/erpCommon/ad_actionButton/ActionButtonDefaultFrames").createXmlDocument();
    xmlDocument.setParameter("processId", strProcessId);
    xmlDocument.setParameter("trlFormType", "PROCESS");
    xmlDocument.setParameter("language", "defaultLang = \"" + vars.getLanguage() + "\";\n");
    xmlDocument.setParameter("type", strDireccion + path);
    out.println(xmlDocument.print());
    out.close();
  }
View Full Code Here

    }*/
   
   
    String strCommand = null;
    DamageData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
    String strParamDocumentNo = vars.getSessionValue(tabId + "|paramDocumentNo");
String strParamRepair_Date = vars.getSessionValue(tabId + "|paramRepair_Date");
String strParamVM_Vehicle_Info_ID = vars.getSessionValue(tabId + "|paramVM_Vehicle_Info_ID");
String strParamRepair_Date_f = vars.getSessionValue(tabId + "|paramRepair_Date_f");

    boolean hasSearchCondition=false;
    if (!(strParamDocumentNo.equals("") && strParamRepair_Date.equals("") && strParamVM_Vehicle_Info_ID.equals("") && strParamRepair_Date_f.equals(""))) hasSearchCondition=true;

       String strParamSessionDate = vars.getGlobalVariable("inpParamSessionDate", Utility.getTransactionalDate(this, vars, windowId), "");
      String buscador = "";
      String[] discard = {"", "isNotTest"};
     
      if (vars.getSessionValue("#ShowTest", "N").equals("Y")) discard[1] = new String("isTest");
    if (dataField==null) {
      if (!boolNew) {
        discard[0] = new String("newDiscard");
        data = DamageData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strPVM_Vehicle_Info_ID, strVM_Vehicle_Damage_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strVM_Vehicle_Damage_ID.equals("") && (data == null || data.length==0)) {
          response.sendRedirect(strDireccion + request.getServletPath() + "?Command=RELATION");
          return;
        }
        refreshSessionEdit(vars, data);
        strCommand = "EDIT";
      }

      if (boolNew || data==null || data.length==0) {
        discard[0] = new String ("editDiscard");
        strCommand = "NEW";
        data = new DamageData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("vmVehicleDamageId") == null || dataField.getField("vmVehicleDamageId").equals("")) {
        discard[0] = new String ("editDiscard");
        strCommand = "NEW";
        boolNew = true;
      } else {
        discard[0] = new String ("newDiscard");
        strCommand = "EDIT";
      }
    }
   
   
   
    if (dataField==null) {
      if (boolNew || data==null || data.length==0) {
        refreshSessionNew(vars, strPVM_Vehicle_Info_ID);
        data = DamageData.set(strPVM_Vehicle_Info_ID, Utility.getDefault(this, vars, "Name", "", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "Description", "", "60A281DE71234897A1641706076B3A01", "", dataField), "", Utility.getDefault(this, vars, "Updatedby", "", "60A281DE71234897A1641706076B3A01", "", dataField), DamageData.selectDef19568E09702E438A88C423F1B6564223_0(this, Utility.getDefault(this, vars, "Updatedby", "", "60A281DE71234897A1641706076B3A01", "", dataField)), Utility.getDefault(this, vars, "Warranty", "", "60A281DE71234897A1641706076B3A01", "N", dataField), Utility.getDefault(this, vars, "C_Doctypetarget_ID", "", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "Outoforder", "", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "Processing", "N", "60A281DE71234897A1641706076B3A01", "N", dataField), Utility.getDefault(this, vars, "Km", "", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "Serialno", "", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "Posted", "N", "60A281DE71234897A1641706076B3A01", "N", dataField), (vars.getLanguage().equals("en_US")?ListData.selectName(this, "234", Utility.getDefault(this, vars, "Posted", "N", "60A281DE71234897A1641706076B3A01", "N", dataField)):ListData.selectNameTrl(this, vars.getLanguage(), "234", Utility.getDefault(this, vars, "Posted", "N", "60A281DE71234897A1641706076B3A01", "N", dataField))), Utility.getDefault(this, vars, "Createdby", "", "60A281DE71234897A1641706076B3A01", "", dataField), DamageData.selectDef732FA22F0D7E4DA281E9B7DD382DDB1A_1(this, Utility.getDefault(this, vars, "Createdby", "", "60A281DE71234897A1641706076B3A01", "", dataField)), "Y", Utility.getDefault(this, vars, "Time", "", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "TO_Date", "", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "Processed", "N", "60A281DE71234897A1641706076B3A01", "N", dataField), (vars.getLanguage().equals("en_US")?ListData.selectName(this, "3C738BCC218F4A0F9211AD935E085C85", Utility.getDefault(this, vars, "Processed", "N", "60A281DE71234897A1641706076B3A01", "N", dataField)):ListData.selectNameTrl(this, vars.getLanguage(), "3C738BCC218F4A0F9211AD935E085C85", Utility.getDefault(this, vars, "Processed", "N", "60A281DE71234897A1641706076B3A01", "N", dataField))), Utility.getDefault(this, vars, "DocumentNo", "", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_ORG_ID@", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "Return_Date", "", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "Repair_Date", "", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "Accept_Date", "", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "From_Date", "", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "Damagecost", "0", "60A281DE71234897A1641706076B3A01", "0", dataField));
             data[0].documentno = "<" + Utility.getDocumentNo( this, vars, windowId, "vm_vehicle_damage", data[0].cDoctypetargetId, "", false, false) + ">";
      }
     }
     
    String currentPOrg=VehicleInformationData.selectOrg(this, strPVM_Vehicle_Info_ID);
    String currentOrg = (boolNew?"":(dataField!=null?dataField.getField("adOrgId"):data[0].getField("adOrgId")));
    if (!currentOrg.equals("") && !currentOrg.startsWith("'")) currentOrg = "'"+currentOrg+"'";
    String currentClient = (boolNew?"":(dataField!=null?dataField.getField("adClientId"):data[0].getField("adClientId")));
    if (!currentClient.equals("") && !currentClient.startsWith("'")) currentClient = "'"+currentClient+"'";
   
    boolean editableTab = (!org.openbravo.erpCommon.utility.WindowAccessData.hasReadOnlyAccess(this, vars.getRole(), tabId) && (currentOrg.equals("") || Utility.isElementInList(Utility.getContext(this, vars, "#User_Org", windowId, accesslevel),currentOrg)) && (currentClient.equals("") || Utility.isElementInList(Utility.getContext(this, vars, "#User_Client", windowId, accesslevel), currentClient)));
    if (editableTab)
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/vehicle/management/system/Vehicle/Damage_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/vehicle/management/system/Vehicle/Damage_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "Damage", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inpvmVehicleDamageId", "", "../vehicle/print.html", "N".equals("Y"), "Vehicle", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strVM_Vehicle_Damage_ID));
    toolbar.prepareEditionTemplate("N".equals("Y"), hasSearchCondition, vars.getSessionValue("#ShowTest", "N").equals("Y"), "STD", Utility.getContext(this, vars, "ShowAudit", windowId).equals("Y"));
    xmlDocument.setParameter("toolbar", toolbar.toString());

    try {
      WindowTabs tabs = new WindowTabs(this, vars, tabId, windowId, true, (strCommand.equalsIgnoreCase("NEW")));
      xmlDocument.setParameter("parentTabContainer", tabs.parentTabs());
      xmlDocument.setParameter("mainTabContainer", tabs.mainTabs());
      // if (!strVM_Vehicle_Damage_ID.equals("")) xmlDocument.setParameter("childTabContainer", tabs.childTabs(false));
    // else xmlDocument.setParameter("childTabContainer", tabs.childTabs(true));
    xmlDocument.setParameter("childTabContainer", tabs.childTabs(false));
      NavigationBar nav = new NavigationBar(this, vars.getLanguage(), "Damage_Relation.html", "Vehicle", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "Damage_Relation.html", strReplaceWith);
      xmlDocument.setParameter("leftTabs", lBar.editionTemplate(strCommand.equals("NEW")));
    } catch (Exception ex) {
      throw new ServletException(ex);
    }
   
   
    xmlDocument.setParameter("parentOrg", currentPOrg);
    xmlDocument.setParameter("commandType", strCommand);
    xmlDocument.setParameter("buscador",buscador);
    xmlDocument.setParameter("windowId", windowId);
    xmlDocument.setParameter("changed", "");
    xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
    xmlDocument.setParameter("theme", vars.getTheme());
    final String strMappingName = UtilityData.selectObjectMapping(this, tabId);
    xmlDocument.setParameter("mappingName", strMappingName);
    xmlDocument.setParameter("confirmOnChanges", Utility.getJSConfirmOnChanges(vars, windowId));
    //xmlDocument.setParameter("buttonReference", Utility.messageBD(this, "Reference", vars.getLanguage()));

    xmlDocument.setParameter("paramSessionDate", strParamSessionDate);

    xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
    OBError myMessage = vars.getMessage(tabId);
    vars.removeMessage(tabId);
    if (myMessage!=null) {
      xmlDocument.setParameter("messageType", myMessage.getType());
      xmlDocument.setParameter("messageTitle", myMessage.getTitle());
      xmlDocument.setParameter("messageMessage", myMessage.getMessage());
    }
    xmlDocument.setParameter("displayLogic", getDisplayLogicContext(vars, boolNew));
   
   
     if (dataField==null) {
      xmlDocument.setData("structure1",data);
     
    } else {
     
        FieldProvider[] dataAux = new FieldProvider[1];
        dataAux[0] = dataField;
       
        xmlDocument.setData("structure1",dataAux);
     
    }
   
     
  
    try {
      ComboTableData comboTableData = null;
comboTableData = new ComboTableData(vars, this, "18", "C_Doctypetarget_ID", "170", "BE076CC966A541F5908B1E4585A551C0", Utility.getReferenceableOrg(vars, (dataField!=null?dataField.getField("adOrgId"):data[0].getField("adOrgId").equals("")?vars.getOrg():data[0].getField("adOrgId"))), Utility.getContext(this, vars, "#User_Client", windowId), 0);
Utility.fillSQLParameters(this, vars, (dataField==null?data[0]:dataField), comboTableData, windowId, (dataField==null?data[0].getField("cDoctypetargetId"):dataField.getField("cDoctypetargetId")));
xmlDocument.setData("reportC_Doctypetarget_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "19", "VM_Vehicle_Info_ID", "", "", Utility.getReferenceableOrg(vars, (dataField!=null?dataField.getField("adOrgId"):data[0].getField("adOrgId").equals("")?vars.getOrg():data[0].getField("adOrgId"))), Utility.getContext(this, vars, "#User_Client", windowId), 0);
Utility.fillSQLParameters(this, vars, (dataField==null?data[0]:dataField), comboTableData, windowId, (dataField==null?data[0].getField("vmVehicleInfoId"):dataField.getField("vmVehicleInfoId")));
xmlDocument.setData("reportVM_Vehicle_Info_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("Repair_Date_Format", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("buttonDamagecost", Utility.messageBD(this, "Calc", vars.getLanguage()));
xmlDocument.setParameter("From_Date_Format", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("TO_Date_Format", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("Accept_Date_Format", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("Return_Date_Format", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("Processed_BTNname", Utility.getButtonName(this, vars, "3C738BCC218F4A0F9211AD935E085C85", (dataField==null?data[0].getField("processed"):dataField.getField("processed")), "Processed_linkBTN", usedButtonShortCuts, reservedButtonShortCuts));
xmlDocument.setParameter("Posted_BTNname", Utility.getButtonName(this, vars, "234", (dataField==null?data[0].getField("posted"):dataField.getField("posted")), "Posted_linkBTN", usedButtonShortCuts, reservedButtonShortCuts));
xmlDocument.setParameter("Created_Format", vars.getSessionValue("#AD_SqlDateTimeFormat"));xmlDocument.setParameter("Created_Maxlength", Integer.toString(vars.getSessionValue("#AD_SqlDateTimeFormat").length()));
xmlDocument.setParameter("Updated_Format", vars.getSessionValue("#AD_SqlDateTimeFormat"));xmlDocument.setParameter("Updated_Maxlength", Integer.toString(vars.getSessionValue("#AD_SqlDateTimeFormat").length()));
    } catch (Exception ex) {
      ex.printStackTrace();
      throw new ServletException(ex);
    }

    xmlDocument.setParameter("scriptOnLoad", getShortcutScript(usedButtonShortCuts, reservedButtonShortCuts));
   
    final String refererURL = vars.getSessionValue(tabId + "|requestURL");
    vars.removeSessionValue(tabId + "|requestURL");
    if(!refererURL.equals("")) {
      final Boolean failedAutosave = (Boolean) vars.getSessionObject(tabId + "|failedAutosave");
    vars.removeSessionValue(tabId + "|failedAutosave");
      if(failedAutosave != null && failedAutosave) {
        final String jsFunction = "continueUserAction('"+refererURL+"');";
        xmlDocument.setParameter("failedAutosave", jsFunction);
      }
    }

    if (strCommand.equalsIgnoreCase("NEW")) {
      vars.removeSessionValue(strMappingName + "|hash");
    }

    response.setContentType("text/html; charset=UTF-8");
    PrintWriter out = response.getWriter();
    out.println(xmlDocument.print());
    out.close();
  }
View Full Code Here

    throws IOException, ServletException {
      log4j.debug("Output: Button process 144");
      String[] discard = {"newDiscard"};
      response.setContentType("text/html; charset=UTF-8");
      PrintWriter out = response.getWriter();
      XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_actionButton/Processed144", discard).createXmlDocument();
      xmlDocument.setParameter("key", strC_Cash_ID);
      xmlDocument.setParameter("processing", strProcessing);
      xmlDocument.setParameter("form", "Header_Edition.html");
      xmlDocument.setParameter("window", windowId);
      xmlDocument.setParameter("css", vars.getTheme());
      xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
      xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
      xmlDocument.setParameter("processId", "144");
      xmlDocument.setParameter("cancel", Utility.messageBD(this, "Cancel", vars.getLanguage()));
      xmlDocument.setParameter("ok", Utility.messageBD(this, "OK", vars.getLanguage()));
     
      {
        OBError myMessage = vars.getMessage("144");
        vars.removeMessage("144");
        if (myMessage!=null) {
          xmlDocument.setParameter("messageType", myMessage.getType());
          xmlDocument.setParameter("messageTitle", myMessage.getTitle());
          xmlDocument.setParameter("messageMessage", myMessage.getMessage());
        }
      }

          try {
    } catch (Exception ex) {
      throw new ServletException(ex);
    }

     
      out.println(xmlDocument.print());
      out.close();
    }
View Full Code Here

TOP

Related Classes of org.openbravo.xmlEngine.XmlDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.