Package org.openbravo.data

Examples of org.openbravo.data.FieldProvider


   
   
    String strCommand = null;
    CurrencyAssignData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
    String strParamC_Currency_ID = vars.getSessionValue(tabId + "|paramC_Currency_ID");

    boolean hasSearchCondition=false;
    if (!(strParamC_Currency_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 = CurrencyAssignData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strPHRM_Job_Paygrade_ID, strHRM_Job_Currency_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strHRM_Job_Currency_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 CurrencyAssignData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("hrmJobCurrencyId") == null || dataField.getField("hrmJobCurrencyId").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, strPHRM_Job_Paygrade_ID);
        data = CurrencyAssignData.set(strPHRM_Job_Paygrade_ID, "", Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "BB6BEC36C8CF438FAF636844F4A6103E", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_ORG_ID@", "BB6BEC36C8CF438FAF636844F4A6103E", "", dataField), "Y", Utility.getDefault(this, vars, "Createdby", "", "BB6BEC36C8CF438FAF636844F4A6103E", "", dataField), CurrencyAssignData.selectDef0A7C5D3E571F11DEA9155F326C26C60F_0(this, Utility.getDefault(this, vars, "Createdby", "", "BB6BEC36C8CF438FAF636844F4A6103E", "", dataField)), Utility.getDefault(this, vars, "Updatedby", "", "BB6BEC36C8CF438FAF636844F4A6103E", "", dataField), CurrencyAssignData.selectDef0A8AAB5A571F11DEA464B7FEDEFC8DCB_1(this, Utility.getDefault(this, vars, "Updatedby", "", "BB6BEC36C8CF438FAF636844F4A6103E", "", dataField)), Utility.getDefault(this, vars, "Paygrade_Minsalary", "", "BB6BEC36C8CF438FAF636844F4A6103E", "", dataField), Utility.getDefault(this, vars, "Paygrade_Maxsalary", "", "BB6BEC36C8CF438FAF636844F4A6103E", "", dataField), Utility.getDefault(this, vars, "Paygrade_Stepincr", "", "BB6BEC36C8CF438FAF636844F4A6103E", "", dataField), Utility.getDefault(this, vars, "C_Currency_ID", "", "BB6BEC36C8CF438FAF636844F4A6103E", "", dataField));
       
      }
     }
     
    String currentPOrg=PayGradesData.selectOrg(this, strPHRM_Job_Paygrade_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/Human/Resource/management/Job/CurrencyAssign_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/Human/Resource/management/Job/CurrencyAssign_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "CurrencyAssign", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inphrmJobCurrencyId", "", "..", "".equals("Y"), "Job", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strHRM_Job_Currency_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 (!strHRM_Job_Currency_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(), "CurrencyAssign_Relation.html", "Job", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "CurrencyAssign_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, "19", "C_Currency_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("cCurrencyId"):dataField.getField("cCurrencyId")));
xmlDocument.setData("reportC_Currency_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("buttonPaygrade_Minsalary", Utility.messageBD(this, "Calc", vars.getLanguage()));
xmlDocument.setParameter("buttonPaygrade_Maxsalary", Utility.messageBD(this, "Calc", vars.getLanguage()));
xmlDocument.setParameter("buttonPaygrade_Stepincr", Utility.messageBD(this, "Calc", vars.getLanguage()));
View Full Code Here


   
   
    String strCommand = null;
    GeneralData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
    String strParamName = vars.getSessionValue(tabId + "|paramName");

    boolean hasSearchCondition=false;
    if (!(strParamName.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 = GeneralData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strHRM_Genralinfo_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strHRM_Genralinfo_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 GeneralData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("hrmGenralinfoId") == null || dataField.getField("hrmGenralinfoId").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);
        data = GeneralData.set("", Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_ORG_ID@", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), "Y", Utility.getDefault(this, vars, "Createdby", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), GeneralData.selectDefD3A3C4E2500B11DE9DFE5786156A6237_0(this, Utility.getDefault(this, vars, "Createdby", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField)), Utility.getDefault(this, vars, "Updatedby", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), GeneralData.selectDefD3AFB0A4500B11DEBF80CBC2FFF05CC0_1(this, Utility.getDefault(this, vars, "Updatedby", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField)), Utility.getDefault(this, vars, "Name", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), Utility.getDefault(this, vars, "Noofemp", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), Utility.getDefault(this, vars, "Taxnumber", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), Utility.getDefault(this, vars, "Naicsnumber", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), Utility.getDefault(this, vars, "Phone_No", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), Utility.getDefault(this, vars, "Faxnumber", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), Utility.getDefault(this, vars, "Street1", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), Utility.getDefault(this, vars, "Street2", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), Utility.getDefault(this, vars, "Cityname", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), Utility.getDefault(this, vars, "Statename", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), Utility.getDefault(this, vars, "Zipno", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), Utility.getDefault(this, vars, "Gencomments", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField), Utility.getDefault(this, vars, "C_Country_ID", "", "B8442C2FA0364E56A4CC79D9085A8116", "", dataField));
       
      }
     }
     
   
    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/Human/Resource/management/CompanyInfo/General_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/Human/Resource/management/CompanyInfo/General_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "General", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inphrmGenralinfoId", "", "..", "".equals("Y"), "CompanyInfo", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strHRM_Genralinfo_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 (!strHRM_Genralinfo_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(), "General_Relation.html", "CompanyInfo", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "General_Relation.html", strReplaceWith);
      xmlDocument.setParameter("leftTabs", lBar.editionTemplate(strCommand.equals("NEW")));
    } catch (Exception ex) {
      throw new ServletException(ex);
    }
   
   
   
    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, "19", "C_Country_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("cCountryId"):dataField.getField("cCountryId")));
xmlDocument.setData("reportC_Country_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) {
View Full Code Here

   
   
    String strCommand = null;
    ImportOrderData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
    String strParamAD_Client_ID = vars.getSessionValue(tabId + "|paramAD_Client_ID");

    boolean hasSearchCondition=false;
    if (!(strParamAD_Client_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 = ImportOrderData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strI_Order_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strI_Order_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 ImportOrderData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("iOrderId") == null || dataField.getField("iOrderId").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);
        data = ImportOrderData.set(Utility.getDefault(this, vars, "DateOrdered", "", "281", "", dataField), Utility.getDefault(this, vars, "Order_Referenceno", "", "281", "", dataField), Utility.getDefault(this, vars, "DatePromised", "", "281", "", dataField), Utility.getDefault(this, vars, "Bpartnerupc", "", "281", "", dataField), Utility.getDefault(this, vars, "C_Bpartner_Location_Upc", "", "281", "", dataField), Utility.getDefault(this, vars, "Billto_Upc", "", "281", "", dataField), Utility.getDefault(this, vars, "Vendor_Upc", "", "281", "", dataField), Utility.getDefault(this, vars, "C_Activity_ID", "", "281", "", dataField), Utility.getDefault(this, vars, "TaxIndicator", "", "281", "", dataField), Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "281", "", dataField), Utility.getDefault(this, vars, "UPC", "", "281", "", dataField), Utility.getDefault(this, vars, "BPartnerValue", "", "281", "", dataField), Utility.getDefault(this, vars, "SalesRep_ID", "", "281", "", dataField), Utility.getDefault(this, vars, "I_IsImported", "", "281", "N", dataField), Utility.getDefault(this, vars, "PriceActual", "", "281", "0", dataField), Utility.getDefault(this, vars, "C_UOM_ID", "", "281", "", dataField), Utility.getDefault(this, vars, "DocumentNo", "", "281", "", dataField), Utility.getDefault(this, vars, "C_Order_ID", "", "281", "", dataField), ImportOrderData.selectDef9000_0(this, Utility.getDefault(this, vars, "C_Order_ID", "", "281", "", dataField)), Utility.getDefault(this, vars, "C_OrderLine_ID", "", "281", "", dataField), ImportOrderData.selectDef9001_1(this, Utility.getDefault(this, vars, "C_OrderLine_ID", "", "281", "", dataField)), Utility.getDefault(this, vars, "PaymentTermValue", "", "281", "", dataField), Utility.getDefault(this, vars, "AD_User_ID", "-1", "281", "", dataField), Utility.getDefault(this, vars, "CreatedBy", "", "281", "", dataField), ImportOrderData.selectDef9004_2(this, Utility.getDefault(this, vars, "CreatedBy", "", "281", "", dataField)), Utility.getDefault(this, vars, "Processing", "", "281", "N", dataField), "", Utility.getDefault(this, vars, "M_Product_ID", "", "281", "", dataField), ImportOrderData.selectDef9008_3(this, Utility.getDefault(this, vars, "M_Product_ID", "", "281", "", dataField)), Utility.getDefault(this, vars, "C_Currency_ID", "", "281", "", dataField), Utility.getDefault(this, vars, "C_BPartner_ID", "", "281", "", dataField), ImportOrderData.selectDef9010_4(this, Utility.getDefault(this, vars, "C_BPartner_ID", "", "281", "", dataField)), Utility.getDefault(this, vars, "Address1", "", "281", "", dataField), Utility.getDefault(this, vars, "C_Project_ID", "", "281", "", dataField), ImportOrderData.selectDef9012_5(this, Utility.getDefault(this, vars, "C_Project_ID", "", "281", "", dataField)), Utility.getDefault(this, vars, "Processed", "", "281", "N", dataField), Utility.getDefault(this, vars, "Description", "", "281", "", dataField), Utility.getDefault(this, vars, "I_ErrorMsg", "", "281", "", dataField), Utility.getDefault(this, vars, "C_DocType_ID", "", "281", "", dataField), Utility.getDefault(this, vars, "M_PriceList_ID", "", "281", "", dataField), Utility.getDefault(this, vars, "UpdatedBy", "", "281", "", dataField), ImportOrderData.selectDef9019_6(this, Utility.getDefault(this, vars, "UpdatedBy", "", "281", "", dataField)), Utility.getDefault(this, vars, "C_BPartner_Location_ID", "", "281", "", dataField), Utility.getDefault(this, vars, "C_PaymentTerm_ID", "", "281", "", dataField), Utility.getDefault(this, vars, "TaxAmt", "", "281", "", dataField), Utility.getDefault(this, vars, "Email", "", "281", "", dataField), Utility.getDefault(this, vars, "C_Tax_ID", "", "281", "", dataField), Utility.getDefault(this, vars, "M_Shipper_ID", "", "281", "", dataField), Utility.getDefault(this, vars, "M_Warehouse_ID", "", "281", "", dataField), "Y", Utility.getDefault(this, vars, "QtyOrdered", "", "281", "0", dataField), Utility.getDefault(this, vars, "LineDescription", "", "281", "", dataField), Utility.getDefault(this, vars, "RegionName", "", "281", "", dataField), Utility.getDefault(this, vars, "SKU", "", "281", "", dataField), Utility.getDefault(this, vars, "AD_OrgTrx_ID", "", "281", "", dataField), Utility.getDefault(this, vars, "Address2", "", "281", "", dataField), Utility.getDefault(this, vars, "BillTo_ID", "", "281", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_Org_ID@", "281", "", dataField), Utility.getDefault(this, vars, "DocTypeName", "", "281", "", dataField), Utility.getDefault(this, vars, "ProductValue", "", "281", "", dataField), Utility.getDefault(this, vars, "Postal", "", "281", "", dataField), Utility.getDefault(this, vars, "IsSOTrx", "", "281", "N", dataField), Utility.getDefault(this, vars, "Name", "", "281", "", dataField), Utility.getDefault(this, vars, "City", "", "281", "", dataField), Utility.getDefault(this, vars, "CountryCode", "", "281", "", dataField), Utility.getDefault(this, vars, "C_Location_ID", "", "281", "", dataField), ImportOrderData.selectDef9408_7(this, Utility.getDefault(this, vars, "C_Location_ID", "", "281", "", dataField)), Utility.getDefault(this, vars, "C_Region_ID", "", "281", "", dataField), Utility.getDefault(this, vars, "C_Country_ID", "", "281", "", dataField), Utility.getDefault(this, vars, "ContactName", "", "281", "", dataField), Utility.getDefault(this, vars, "Phone", "", "281", "", dataField), Utility.getDefault(this, vars, "C_Campaign_ID", "", "281", "", dataField));
             data[0].documentno = "<" + Utility.getDocumentNo( this, vars, windowId, "I_Order", "", data[0].cDoctypeId, false, false) + ">";
      }
     }
     
   
    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/ImportOrders/ImportOrder_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/ImportOrders/ImportOrder_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "ImportOrder", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inpiOrderId", "", "..", "".equals("Y"), "ImportOrders", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strI_Order_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 (!strI_Order_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(), "ImportOrder_Relation.html", "ImportOrders", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "ImportOrder_Relation.html", strReplaceWith);
      xmlDocument.setParameter("leftTabs", lBar.editionTemplate(strCommand.equals("NEW")));
    } catch (Exception ex) {
      throw new ServletException(ex);
    }
   
   
   
    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", "", "103", 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.getContext(this, vars, "#User_Org", windowId, accesslevel); //editable record
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", "C_DocType_ID", "", "172", 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("cDoctypeId"):dataField.getField("cDoctypeId")));
xmlDocument.setData("reportC_DocType_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "18", "SalesRep_ID", "190", "", 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("salesrepId"):dataField.getField("salesrepId")));
xmlDocument.setData("reportSalesRep_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "19", "C_Currency_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("cCurrencyId"):dataField.getField("cCurrencyId")));
xmlDocument.setData("reportC_Currency_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "19", "M_PriceList_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("mPricelistId"):dataField.getField("mPricelistId")));
xmlDocument.setData("reportM_PriceList_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "19", "C_PaymentTerm_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("cPaymenttermId"):dataField.getField("cPaymenttermId")));
xmlDocument.setData("reportC_PaymentTerm_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "19", "M_Warehouse_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("mWarehouseId"):dataField.getField("mWarehouseId")));
xmlDocument.setData("reportM_Warehouse_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "19", "M_Shipper_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("mShipperId"):dataField.getField("mShipperId")));
xmlDocument.setData("reportM_Shipper_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("DateOrdered_Format", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("DatePromised_Format", vars.getSessionValue("#AD_SqlDateFormat"));
comboTableData = new ComboTableData(vars, this, "18", "BillTo_ID", "159", "", 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("billtoId"):dataField.getField("billtoId")));
xmlDocument.setData("reportBillTo_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "19", "C_BPartner_Location_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("cBpartnerLocationId"):dataField.getField("cBpartnerLocationId")));
xmlDocument.setData("reportC_BPartner_Location_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "19", "C_Region_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("cRegionId"):dataField.getField("cRegionId")));
xmlDocument.setData("reportC_Region_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "19", "C_Country_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("cCountryId"):dataField.getField("cCountryId")));
xmlDocument.setData("reportC_Country_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "19", "AD_User_ID", "", "123", 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("adUserId"):dataField.getField("adUserId")));
xmlDocument.setData("reportAD_User_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "19", "C_UOM_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("cUomId"):dataField.getField("cUomId")));
xmlDocument.setData("reportC_UOM_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("buttonQtyOrdered", Utility.messageBD(this, "Calc", vars.getLanguage()));
xmlDocument.setParameter("buttonPriceActual", Utility.messageBD(this, "Calc", vars.getLanguage()));
comboTableData = new ComboTableData(vars, this, "19", "C_Tax_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("cTaxId"):dataField.getField("cTaxId")));
xmlDocument.setData("reportC_Tax_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("buttonTaxAmt", Utility.messageBD(this, "Calc", vars.getLanguage()));
comboTableData = new ComboTableData(vars, this, "19", "C_Campaign_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("cCampaignId"):dataField.getField("cCampaignId")));
xmlDocument.setData("reportC_Campaign_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "19", "C_Activity_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("cActivityId"):dataField.getField("cActivityId")));
xmlDocument.setData("reportC_Activity_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "18", "AD_OrgTrx_ID", "130", "", 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("adOrgtrxId"):dataField.getField("adOrgtrxId")));
xmlDocument.setData("reportAD_OrgTrx_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("Processing_BTNname", Utility.getButtonName(this, vars, "7327", "Processing_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()));
View Full Code Here

   
   
    String strCommand = null;
    ApplyLeaveData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
    String strParamTotaldays = vars.getSessionValue(tabId + "|paramTotaldays");
String strParamTotaldays_f = vars.getSessionValue(tabId + "|paramTotaldays_f");

    boolean hasSearchCondition=false;
    if (!(strParamTotaldays.equals("") && strParamTotaldays_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 = ApplyLeaveData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strHRM_Leave_Apply_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strHRM_Leave_Apply_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 ApplyLeaveData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("hrmLeaveApplyId") == null || dataField.getField("hrmLeaveApplyId").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);
        data = ApplyLeaveData.set("", Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "2E3732592CC64BEFACFFBA562D0553D3", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_ORG_ID@", "2E3732592CC64BEFACFFBA562D0553D3", "", dataField), "Y", Utility.getDefault(this, vars, "Createdby", "", "2E3732592CC64BEFACFFBA562D0553D3", "", dataField), ApplyLeaveData.selectDef3212D146573F11DE85BDB75C8C277608_0(this, Utility.getDefault(this, vars, "Createdby", "", "2E3732592CC64BEFACFFBA562D0553D3", "", dataField)), Utility.getDefault(this, vars, "Updatedby", "", "2E3732592CC64BEFACFFBA562D0553D3", "", dataField), ApplyLeaveData.selectDef32211F62573F11DEA5BFC3DE49E82D42_1(this, Utility.getDefault(this, vars, "Updatedby", "", "2E3732592CC64BEFACFFBA562D0553D3", "", dataField)), Utility.getDefault(this, vars, "Fromdate", "", "2E3732592CC64BEFACFFBA562D0553D3", "", dataField), Utility.getDefault(this, vars, "Todate", "", "2E3732592CC64BEFACFFBA562D0553D3", "", dataField), Utility.getDefault(this, vars, "Fromtime", "", "2E3732592CC64BEFACFFBA562D0553D3", "", dataField), Utility.getDefault(this, vars, "Totime", "", "2E3732592CC64BEFACFFBA562D0553D3", "", dataField), Utility.getDefault(this, vars, "Leave_Status", "Pending Approval", "2E3732592CC64BEFACFFBA562D0553D3", "", dataField), Utility.getDefault(this, vars, "Totalhour", "", "2E3732592CC64BEFACFFBA562D0553D3", "", dataField), Utility.getDefault(this, vars, "HRM_Leavetype_ID", "", "2E3732592CC64BEFACFFBA562D0553D3", "", dataField), Utility.getDefault(this, vars, "Totaldays", "", "2E3732592CC64BEFACFFBA562D0553D3", "", dataField), Utility.getDefault(this, vars, "Comments", "", "2E3732592CC64BEFACFFBA562D0553D3", "", dataField));
       
      }
     }
     
   
    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/Human/Resource/management/ApplyLeave/ApplyLeave_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/Human/Resource/management/ApplyLeave/ApplyLeave_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "ApplyLeave", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inphrmLeaveApplyId", "", "..", "".equals("Y"), "ApplyLeave", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strHRM_Leave_Apply_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 (!strHRM_Leave_Apply_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(), "ApplyLeave_Relation.html", "ApplyLeave", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "ApplyLeave_Relation.html", strReplaceWith);
      xmlDocument.setParameter("leftTabs", lBar.editionTemplate(strCommand.equals("NEW")));
    } catch (Exception ex) {
      throw new ServletException(ex);
    }
   
   
   
    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, "19", "HRM_Leavetype_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("hrmLeavetypeId"):dataField.getField("hrmLeavetypeId")));
xmlDocument.setData("reportHRM_Leavetype_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("Fromdate_Format", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("Todate_Format", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("buttonTotaldays", Utility.messageBD(this, "Calc", vars.getLanguage()));
xmlDocument.setParameter("buttonTotalhour", Utility.messageBD(this, "Calc", vars.getLanguage()));
comboTableData = new ComboTableData(vars, this, "17", "Leave_Status", "B2B4C2A4FCC04E7DA548F782CF21B603", "", 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("leaveStatus"):dataField.getField("leaveStatus")));
xmlDocument.setData("reportLeave_Status","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) {
View Full Code Here

   
   
    String strCommand = null;
    LinesData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
    String strParamLine = vars.getSessionValue(tabId + "|paramLine");
String strParamMovementQty = vars.getSessionValue(tabId + "|paramMovementQty");
String strParamM_InOut_ID = vars.getSessionValue(tabId + "|paramM_InOut_ID");
String strParamM_Product_ID = vars.getSessionValue(tabId + "|paramM_Product_ID");
String strParamLine_f = vars.getSessionValue(tabId + "|paramLine_f");
String strParamMovementQty_f = vars.getSessionValue(tabId + "|paramMovementQty_f");

    boolean hasSearchCondition=false;
    if (!(strParamLine.equals("") && strParamMovementQty.equals("") && strParamM_InOut_ID.equals("") && strParamM_Product_ID.equals("") && strParamLine_f.equals("") && strParamMovementQty_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 = LinesData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strPM_InOut_ID, strM_InOutLine_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strM_InOutLine_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 LinesData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("mInoutlineId") == null || dataField.getField("mInoutlineId").equals("")) {
        discard[0] = new String ("editDiscard");
        strCommand = "NEW";
        boolNew = true;
      } else {
        discard[0] = new String ("newDiscard");
        strCommand = "EDIT";
      }
    }
   
        String strHASSECONDUOM = LinesData.selectAux800005(this, ((dataField!=null)?dataField.getField("mProductId"):((data==null || data.length==0)?"":data[0].mProductId)));
    vars.setSessionValue(windowId + "|HASSECONDUOM", strHASSECONDUOM);
        String strC_BPARTNER_ID = Utility.getContext(this, vars, "C_BPARTNER_ID", "184");
    vars.setSessionValue(windowId + "|C_BPARTNER_ID", strC_BPARTNER_ID);
   
   
    if (dataField==null) {
      if (boolNew || data==null || data.length==0) {
        refreshSessionNew(vars, strPM_InOut_ID);
        data = LinesData.set(strPM_InOut_ID, "", Utility.getDefault(this, vars, "AD_Client_ID", "@AD_Client_ID@", "184", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_Org_ID@", "184", "", dataField), "Y", Utility.getDefault(this, vars, "CreatedBy", "", "184", "", dataField), LinesData.selectDef3534_0(this, Utility.getDefault(this, vars, "CreatedBy", "", "184", "", dataField)), Utility.getDefault(this, vars, "UpdatedBy", "", "184", "", dataField), LinesData.selectDef3536_1(this, Utility.getDefault(this, vars, "UpdatedBy", "", "184", "", dataField)), Utility.getDefault(this, vars, "M_Locator_ID", "@M_Locator_ID@", "184", "", dataField), LinesData.selectDef3537_2(this, Utility.getDefault(this, vars, "M_Locator_ID", "@M_Locator_ID@", "184", "", dataField)), LinesData.selectDef3538_3(this, strPM_InOut_ID), Utility.getDefault(this, vars, "M_Product_ID", "", "184", "", dataField), LinesData.selectDef3539_4(this, Utility.getDefault(this, vars, "M_Product_ID", "", "184", "", dataField)), Utility.getDefault(this, vars, "MovementQty", "1", "184", "0", dataField), Utility.getDefault(this, vars, "Description", "", "184", "", dataField), LinesData.selectDef3810(this, strPM_InOut_ID), Utility.getDefault(this, vars, "C_OrderLine_ID", "", "184", "", dataField), LinesData.selectDef3811_5(this, Utility.getDefault(this, vars, "C_OrderLine_ID", "", "184", "", dataField)), Utility.getDefault(this, vars, "C_UOM_ID", "", "184", "", dataField), Utility.getDefault(this, vars, "IsInvoiced", "", "184", "N", dataField), Utility.getDefault(this, vars, "M_Product_Uom_Id", "", "184", "", dataField), Utility.getDefault(this, vars, "QuantityOrder", "", "184", "", dataField), Utility.getDefault(this, vars, "M_AttributeSetInstance_ID", "", "184", "", dataField), LinesData.selectDef8772_6(this, Utility.getDefault(this, vars, "M_AttributeSetInstance_ID", "", "184", "", dataField)), Utility.getDefault(this, vars, "IsDescription", "N", "184", "N", dataField));
       
      }
     }
     
    String currentPOrg=HeaderData.selectOrg(this, strPM_InOut_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/GoodsReceipt/Lines_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/GoodsReceipt/Lines_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "Lines", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inpmInoutlineId", "", "..", "".equals("Y"), "GoodsReceipt", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strM_InOutLine_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 (!strM_InOutLine_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(), "Lines_Relation.html", "GoodsReceipt", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "Lines_Relation.html", strReplaceWith);
      xmlDocument.setParameter("leftTabs", lBar.editionTemplate(strCommand.equals("NEW")));
    } catch (Exception ex) {
      throw new ServletException(ex);
    }
   
        xmlDocument.setParameter("HASSECONDUOM", strHASSECONDUOM);
        xmlDocument.setParameter("C_BPARTNER_ID", strC_BPARTNER_ID);
   
    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", "", "53AE60A473D2460D8663D7A1BC5BA732", 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;
xmlDocument.setParameter("buttonQuantityOrder", Utility.messageBD(this, "Calc", vars.getLanguage()));
comboTableData = new ComboTableData(vars, this, "18", "M_Product_Uom_Id", "800000", "", 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("mProductUomId"):dataField.getField("mProductUomId")));
xmlDocument.setData("reportM_Product_Uom_Id","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("buttonMovementQty", Utility.messageBD(this, "Calc", vars.getLanguage()));
comboTableData = new ComboTableData(vars, this, "19", "C_UOM_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("cUomId"):dataField.getField("cUomId")));
xmlDocument.setData("reportC_UOM_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) {
View Full Code Here

   
   
    String strCommand = null;
    LinesData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
    String strParamM_Internal_Consumption_ID = vars.getSessionValue(tabId + "|paramM_Internal_Consumption_ID");
String strParamM_Product_ID = vars.getSessionValue(tabId + "|paramM_Product_ID");
String strParamMovementQty = vars.getSessionValue(tabId + "|paramMovementQty");
String strParamMovementQty_f = vars.getSessionValue(tabId + "|paramMovementQty_f");

    boolean hasSearchCondition=false;
    if (!(strParamM_Internal_Consumption_ID.equals("") && strParamM_Product_ID.equals("") && strParamMovementQty.equals("") && strParamMovementQty_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 = LinesData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strPM_Internal_Consumption_ID, strM_Internal_Consumptionline_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strM_Internal_Consumptionline_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 LinesData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("mInternalConsumptionlineId") == null || dataField.getField("mInternalConsumptionlineId").equals("")) {
        discard[0] = new String ("editDiscard");
        strCommand = "NEW";
        boolNew = true;
      } else {
        discard[0] = new String ("newDiscard");
        strCommand = "EDIT";
      }
    }
   
        String strHASSECONDUOM = LinesData.selectAux800041(this, ((dataField!=null)?dataField.getField("mProductId"):((data==null || data.length==0)?"":data[0].mProductId)));
    vars.setSessionValue(windowId + "|HASSECONDUOM", strHASSECONDUOM);
   
   
    if (dataField==null) {
      if (boolNew || data==null || data.length==0) {
        refreshSessionNew(vars, strPM_Internal_Consumption_ID);
        data = LinesData.set(strPM_Internal_Consumption_ID, "", Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "800076", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_ORG_ID@", "800076", "", dataField), "Y", Utility.getDefault(this, vars, "Createdby", "", "800076", "", dataField), LinesData.selectDef802767_0(this, Utility.getDefault(this, vars, "Createdby", "", "800076", "", dataField)), Utility.getDefault(this, vars, "Updatedby", "", "800076", "", dataField), LinesData.selectDef802769_1(this, Utility.getDefault(this, vars, "Updatedby", "", "800076", "", dataField)), Utility.getDefault(this, vars, "M_Locator_ID", "", "800076", "", dataField), LinesData.selectDef802771_2(this, Utility.getDefault(this, vars, "M_Locator_ID", "", "800076", "", dataField)), Utility.getDefault(this, vars, "M_Product_ID", "", "800076", "", dataField), LinesData.selectDef802772_3(this, Utility.getDefault(this, vars, "M_Product_ID", "", "800076", "", dataField)), LinesData.selectDef802773(this, strPM_Internal_Consumption_ID), Utility.getDefault(this, vars, "MovementQty", "0", "800076", "0", dataField), Utility.getDefault(this, vars, "Description", "", "800076", "", dataField), Utility.getDefault(this, vars, "M_AttributeSetInstance_ID", "", "800076", "", dataField), LinesData.selectDef802776_4(this, Utility.getDefault(this, vars, "M_AttributeSetInstance_ID", "", "800076", "", dataField)), Utility.getDefault(this, vars, "M_Product_Uom_Id", "", "800076", "", dataField), Utility.getDefault(this, vars, "QuantityOrder", "", "800076", "", dataField), Utility.getDefault(this, vars, "C_UOM_ID", "", "800076", "", dataField));
       
      }
     }
     
    String currentPOrg=HeaderData.selectOrg(this, strPM_Internal_Consumption_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/InternalConsumption/Lines_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/InternalConsumption/Lines_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "Lines", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inpmInternalConsumptionlineId", "", "..", "".equals("Y"), "InternalConsumption", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strM_Internal_Consumptionline_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 (!strM_Internal_Consumptionline_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(), "Lines_Relation.html", "InternalConsumption", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "Lines_Relation.html", strReplaceWith);
      xmlDocument.setParameter("leftTabs", lBar.editionTemplate(strCommand.equals("NEW")));
    } catch (Exception ex) {
      throw new ServletException(ex);
    }
   
        xmlDocument.setParameter("HASSECONDUOM", strHASSECONDUOM);
   
    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", "M_Internal_Consumption_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("mInternalConsumptionId"):dataField.getField("mInternalConsumptionId")));
xmlDocument.setData("reportM_Internal_Consumption_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("buttonQuantityOrder", Utility.messageBD(this, "Calc", vars.getLanguage()));
comboTableData = new ComboTableData(vars, this, "19", "M_Product_Uom_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("mProductUomId"):dataField.getField("mProductUomId")));
xmlDocument.setData("reportM_Product_Uom_Id","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("buttonMovementQty", Utility.messageBD(this, "Calc", vars.getLanguage()));
comboTableData = new ComboTableData(vars, this, "19", "C_UOM_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("cUomId"):dataField.getField("cUomId")));
xmlDocument.setData("reportC_UOM_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) {
View Full Code Here

   
   
    String strCommand = null;
    VersionData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
    String strParamDocumentNo = vars.getSessionValue(tabId + "|paramDocumentNo");
String strParamMA_Costcenter_ID = vars.getSessionValue(tabId + "|paramMA_Costcenter_ID");
String strParamValidFrom = vars.getSessionValue(tabId + "|paramValidFrom");
String strParamValidFrom_f = vars.getSessionValue(tabId + "|paramValidFrom_f");

    boolean hasSearchCondition=false;
    if (!(strParamDocumentNo.equals("") && strParamMA_Costcenter_ID.equals("") && strParamValidFrom.equals("") && strParamValidFrom_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 = VersionData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strPMA_Costcenter_ID, strMA_Costcenter_Version_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strMA_Costcenter_Version_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 VersionData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("maCostcenterVersionId") == null || dataField.getField("maCostcenterVersionId").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_Costcenter_ID);
        data = VersionData.set(strPMA_Costcenter_ID, "", Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "800030", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_ORG_ID@", "800030", "", dataField), "Y", Utility.getDefault(this, vars, "Createdby", "", "800030", "", dataField), VersionData.selectDef803285_0(this, Utility.getDefault(this, vars, "Createdby", "", "800030", "", dataField)), Utility.getDefault(this, vars, "Updatedby", "", "800030", "", dataField), VersionData.selectDef803287_1(this, Utility.getDefault(this, vars, "Updatedby", "", "800030", "", dataField)), Utility.getDefault(this, vars, "DocumentNo", "", "800030", "", dataField), Utility.getDefault(this, vars, "Cost", "", "800030", "", dataField), Utility.getDefault(this, vars, "Costuom", "", "800030", "", dataField), Utility.getDefault(this, vars, "ValidFrom", "", "800030", "", dataField));
             data[0].documentno = "<" + Utility.getDocumentNo( this, vars, windowId, "MA_Costcenter_Version", "", "", false, false) + ">";
      }
     }
     
    String currentPOrg=CostCenterData.selectOrg(this, strPMA_Costcenter_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/CostCenter/Version_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/CostCenter/Version_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "Version", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inpmaCostcenterVersionId", "", "..", "".equals("Y"), "CostCenter", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strMA_Costcenter_Version_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_Costcenter_Version_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(), "Version_Relation.html", "CostCenter", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "Version_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_Costcenter_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("maCostcenterId"):dataField.getField("maCostcenterId")));
xmlDocument.setData("reportMA_Costcenter_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("buttonCost", Utility.messageBD(this, "Calc", vars.getLanguage()));
comboTableData = new ComboTableData(vars, this, "17", "Costuom", "800088", "", 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("costuom"):dataField.getField("costuom")));
xmlDocument.setData("reportCostuom","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("ValidFrom_Format", vars.getSessionValue("#AD_SqlDateFormat"));
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()));
View Full Code Here

   
   
    String strCommand = null;
    WebServiceData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
    String strParamName = vars.getSessionValue(tabId + "|paramName");

    boolean hasSearchCondition=false;
    if (!(strParamName.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 = WebServiceData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strHRM_Wsexample_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strHRM_Wsexample_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 WebServiceData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("hrmWsexampleId") == null || dataField.getField("hrmWsexampleId").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);
        data = WebServiceData.set("", Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "2C1AD92832164C7692C6CCDF2FAC2E59", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_ORG_ID@", "2C1AD92832164C7692C6CCDF2FAC2E59", "", dataField), Utility.getDefault(this, vars, "Createdby", "", "2C1AD92832164C7692C6CCDF2FAC2E59", "", dataField), WebServiceData.selectDef4B382B62707111DE842B2775EB98A663_0(this, Utility.getDefault(this, vars, "Createdby", "", "2C1AD92832164C7692C6CCDF2FAC2E59", "", dataField)), Utility.getDefault(this, vars, "Updatedby", "", "2C1AD92832164C7692C6CCDF2FAC2E59", "", dataField), WebServiceData.selectDef4B46797E707111DEACF28BDEACB76E5B_1(this, Utility.getDefault(this, vars, "Updatedby", "", "2C1AD92832164C7692C6CCDF2FAC2E59", "", dataField)), Utility.getDefault(this, vars, "Name", "", "2C1AD92832164C7692C6CCDF2FAC2E59", "", dataField), "Y");
       
      }
     }
     
   
    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/Human/Resource/management/WebService/WebService_Edition",discard).createXmlDocument();
View Full Code Here

   
   
    String strCommand = null;
    TimeData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
    String strParamMA_Measure_Group_ID = vars.getSessionValue(tabId + "|paramMA_Measure_Group_ID");

    boolean hasSearchCondition=false;
    if (!(strParamMA_Measure_Group_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 = TimeData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strPMA_Measure_Group_ID, strMA_Measure_Time_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strMA_Measure_Time_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 TimeData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("maMeasureTimeId") == null || dataField.getField("maMeasureTimeId").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_Group_ID);
        data = TimeData.set(strPMA_Measure_Group_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), TimeData.selectDef802248_0(this, Utility.getDefault(this, vars, "Createdby", "", "800064", "", dataField)), Utility.getDefault(this, vars, "Updatedby", "", "800064", "", dataField), TimeData.selectDef802250_1(this, Utility.getDefault(this, vars, "Updatedby", "", "800064", "", dataField)), Utility.getDefault(this, vars, "Measurehour", "", "800064", "", dataField), Utility.getDefault(this, vars, "Explode", "", "800064", "N", dataField), Utility.getDefault(this, vars, "Processed", "N", "800064", "N", dataField));
       
      }
     }
     
    String currentPOrg=CheckPointSetData.selectOrg(this, strPMA_Measure_Group_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/Time_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/QualityControlReport/Time_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "Time", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inpmaMeasureTimeId", "", "..", "".equals("Y"), "QualityControlReport", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strMA_Measure_Time_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_Time_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(), "Time_Relation.html", "QualityControlReport", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "Time_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_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("maMeasureGroupId"):dataField.getField("maMeasureGroupId")));
xmlDocument.setData("reportMA_Measure_Group_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("Explode_BTNname", Utility.getButtonName(this, vars, "802572", "Explode_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()));
View Full Code Here

   
   
    String strCommand = null;
    SkillsData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
    String strParamName = vars.getSessionValue(tabId + "|paramName");

    boolean hasSearchCondition=false;
    if (!(strParamName.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 = SkillsData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strHRM_M_Skill_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strHRM_M_Skill_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 SkillsData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("hrmMSkillId") == null || dataField.getField("hrmMSkillId").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);
        data = SkillsData.set("", Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "0E76E76B612C4E2C8F89BEF963A59518", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_ORG_ID@", "0E76E76B612C4E2C8F89BEF963A59518", "", dataField), "Y", Utility.getDefault(this, vars, "Createdby", "", "0E76E76B612C4E2C8F89BEF963A59518", "", dataField), SkillsData.selectDef2ADA01CE50C311DEB9008B6F3FC91102_0(this, Utility.getDefault(this, vars, "Createdby", "", "0E76E76B612C4E2C8F89BEF963A59518", "", dataField)), Utility.getDefault(this, vars, "Updatedby", "", "0E76E76B612C4E2C8F89BEF963A59518", "", dataField), SkillsData.selectDef2AE5ED9050C311DEA5634F14BAB01B2F_1(this, Utility.getDefault(this, vars, "Updatedby", "", "0E76E76B612C4E2C8F89BEF963A59518", "", dataField)), Utility.getDefault(this, vars, "Name", "", "0E76E76B612C4E2C8F89BEF963A59518", "", dataField), Utility.getDefault(this, vars, "Skill_Description", "", "0E76E76B612C4E2C8F89BEF963A59518", "", dataField), Utility.getDefault(this, vars, "DocumentNo", "", "0E76E76B612C4E2C8F89BEF963A59518", "", dataField));
             data[0].documentno = "<" + Utility.getDocumentNo( this, vars, windowId, "hrm_m_skill", "", "", false, false) + ">";
      }
     }
     
   
    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/Human/Resource/management/Skills/Skills_Edition",discard).createXmlDocument();
View Full Code Here

TOP

Related Classes of org.openbravo.data.FieldProvider

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.