Examples of FieldProvider


Examples of org.openbravo.data.FieldProvider

   
   
    String strCommand = null;
    DateandShiftData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
    String strParamMeasuredate = vars.getSessionValue(tabId + "|paramMeasuredate");
String strParamMeasuredate_f = vars.getSessionValue(tabId + "|paramMeasuredate_f");

    boolean hasSearchCondition=false;
    if (!(strParamMeasuredate.equals("") && strParamMeasuredate_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 = DateandShiftData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strMA_Measure_Shift_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strMA_Measure_Shift_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 DateandShiftData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("maMeasureShiftId") == null || dataField.getField("maMeasureShiftId").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 = DateandShiftData.set("", 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), DateandShiftData.selectDef802305_0(this, Utility.getDefault(this, vars, "Createdby", "", "800064", "", dataField)), Utility.getDefault(this, vars, "Updatedby", "", "800064", "", dataField), DateandShiftData.selectDef802307_1(this, Utility.getDefault(this, vars, "Updatedby", "", "800064", "", dataField)), Utility.getDefault(this, vars, "Shift", "", "800064", "", dataField), Utility.getDefault(this, vars, "Measuredate", "", "800064", "", dataField), Utility.getDefault(this, vars, "Observation", "", "800064", "", dataField), Utility.getDefault(this, vars, "AD_User_ID", "", "800064", "", dataField), Utility.getDefault(this, vars, "Processed", "N", "800064", "N", dataField), Utility.getDefault(this, vars, "Edit", "", "800064", "N", 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/QualityControlReport/DateandShift_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/QualityControlReport/DateandShift_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "DateandShift", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inpmaMeasureShiftId", "", "../RptMA_CCP_Measures.pdf", "N".equals("Y"), "QualityControlReport", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strMA_Measure_Shift_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_Shift_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(), "DateandShift_Relation.html", "QualityControlReport", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "DateandShift_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", "", "", 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;
xmlDocument.setParameter("Measuredate_Format", vars.getSessionValue("#AD_SqlDateFormat"));
comboTableData = new ComboTableData(vars, this, "17", "Shift", "800038", "", 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("shift"):dataField.getField("shift")));
xmlDocument.setData("reportShift","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "19", "AD_User_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("adUserId"):dataField.getField("adUserId")));
xmlDocument.setData("reportAD_User_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("Processed_BTNname", Utility.getButtonName(this, vars, "802724", "Processed_linkBTN", usedButtonShortCuts, reservedButtonShortCuts));
xmlDocument.setParameter("Edit_BTNname", Utility.getButtonName(this, vars, "802725", "Edit_linkBTN", usedButtonShortCuts, reservedButtonShortCuts));
xmlDocument.setParameter("Created_Format", vars.getSessionValue("#AD_SqlDateTimeFormat"));xmlDocument.setParameter("Created_Maxlength", Integer.toString(vars.getSessionValue("#AD_SqlDateTimeFormat").length()));
View Full Code Here

Examples of org.openbravo.data.FieldProvider

   
   
    String strCommand = null;
    ProductTransactionsData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
    String strParamMovementDate = vars.getSessionValue(tabId + "|paramMovementDate");
String strParamMovementType = vars.getSessionValue(tabId + "|paramMovementType");
String strParamM_Product_ID = vars.getSessionValue(tabId + "|paramM_Product_ID");
String strParamMovementDate_f = vars.getSessionValue(tabId + "|paramMovementDate_f");

    boolean hasSearchCondition=false;
    if (!(strParamMovementDate.equals("") && strParamMovementType.equals("") && strParamM_Product_ID.equals("") && strParamMovementDate_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 = ProductTransactionsData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), Utility.getContext(this, vars, "M_Locator_ID", windowId), strPM_Locator_ID, strM_Transaction_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strM_Transaction_ID.equals("") && (data == null || data.length==0)) {
          response.sendRedirect(strDireccion + request.getServletPath() + "?Command=RELATION");
          return;
        }
        refreshSessionEdit(vars, data);
        strCommand = "EDIT";
      }

      if (data==null || data.length==0) {
        strM_Transaction_ID = firstElement(vars, tableSQL);
        if (strM_Transaction_ID.equals("")) {
          response.sendRedirect(strDireccion + request.getServletPath() + "?Command=RELATION");
          return;
        } else {
          data = ProductTransactionsData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), Utility.getContext(this, vars, "M_Locator_ID", windowId), strPM_Locator_ID, strM_Transaction_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
        }
      }

      if (boolNew || data==null || data.length==0) {
        discard[0] = new String ("editDiscard");
        strCommand = "NEW";
        data = new ProductTransactionsData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("mTransactionId") == null || dataField.getField("mTransactionId").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, strPM_Locator_ID);
        data = ProductTransactionsData.set(strPM_Locator_ID, "", Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "139", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_Org_ID@", "139", "", dataField), "Y", Utility.getDefault(this, vars, "CreatedBy", "", "139", "", dataField), ProductTransactionsData.selectDef3663_0(this, Utility.getDefault(this, vars, "CreatedBy", "", "139", "", dataField)), Utility.getDefault(this, vars, "UpdatedBy", "", "139", "", dataField), ProductTransactionsData.selectDef3665_1(this, Utility.getDefault(this, vars, "UpdatedBy", "", "139", "", dataField)), Utility.getDefault(this, vars, "MovementType", "", "139", "", dataField), ProductTransactionsData.selectDef3667_2(this, strPM_Locator_ID), Utility.getDefault(this, vars, "M_Product_ID", "", "139", "", dataField), ProductTransactionsData.selectDef3668_3(this, Utility.getDefault(this, vars, "M_Product_ID", "", "139", "", dataField)), Utility.getDefault(this, vars, "MovementDate", "", "139", "", dataField), Utility.getDefault(this, vars, "MovementQty", "", "139", "0", dataField), Utility.getDefault(this, vars, "M_InventoryLine_ID", "", "139", "", dataField), ProductTransactionsData.selectDef3671_4(this, Utility.getDefault(this, vars, "M_InventoryLine_ID", "", "139", "", dataField)), Utility.getDefault(this, vars, "M_MovementLine_ID", "", "139", "", dataField), ProductTransactionsData.selectDef3672_5(this, Utility.getDefault(this, vars, "M_MovementLine_ID", "", "139", "", dataField)), Utility.getDefault(this, vars, "M_InOutLine_ID", "", "139", "", dataField), ProductTransactionsData.selectDef3673_6(this, Utility.getDefault(this, vars, "M_InOutLine_ID", "", "139", "", dataField)), Utility.getDefault(this, vars, "M_ProductionLine_ID", "", "139", "", dataField), ProductTransactionsData.selectDef3674_7(this, Utility.getDefault(this, vars, "M_ProductionLine_ID", "", "139", "", dataField)), Utility.getDefault(this, vars, "C_ProjectIssue_ID", "", "139", "", dataField), ProductTransactionsData.selectDef9855_8(this, Utility.getDefault(this, vars, "C_ProjectIssue_ID", "", "139", "", dataField)), Utility.getDefault(this, vars, "M_AttributeSetInstance_ID", "", "139", "", dataField), ProductTransactionsData.selectDef9867_9(this, Utility.getDefault(this, vars, "M_AttributeSetInstance_ID", "", "139", "", dataField)));
       
      }
     }
     
    String currentPOrg=StorageBinData.selectOrg(this, strPM_Locator_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/WarehouseandStorageBins/ProductTransactions_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/WarehouseandStorageBins/ProductTransactions_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "ProductTransactions", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inpmTransactionId", "", "..", "".equals("Y"), "WarehouseandStorageBins", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strM_Transaction_ID));
    toolbar.prepareEditionTemplate("N".equals("Y"), hasSearchCondition, vars.getSessionValue("#ShowTest", "N").equals("Y"), "RO", 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_Transaction_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(), "ProductTransactions_Relation.html", "WarehouseandStorageBins", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "ProductTransactions_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;
xmlDocument.setParameter("buttonMovementQty", Utility.messageBD(this, "Calc", vars.getLanguage()));
xmlDocument.setParameter("MovementDate_Format", vars.getSessionValue("#AD_SqlDateFormat"));
comboTableData = new ComboTableData(vars, this, "17", "MovementType", "189", "", 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("movementtype"):dataField.getField("movementtype")));
xmlDocument.setData("reportMovementType","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

Examples of org.openbravo.data.FieldProvider

   
   
    String strCommand = null;
    TranslationData[] 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 = TranslationData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strPAD_Month_ID, strAD_Month_Trl_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strAD_Month_Trl_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 TranslationData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("adMonthTrlId") == null || dataField.getField("adMonthTrlId").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, strPAD_Month_ID);
        data = TranslationData.set(strPAD_Month_ID, "", Utility.getDefault(this, vars, "AD_Language", "", "800019", "", dataField), "0", "0", "Y", Utility.getDefault(this, vars, "Createdby", "", "800019", "", dataField), TranslationData.selectDef5C315336D8D8F72DE040007F01013754_0(this, Utility.getDefault(this, vars, "Createdby", "", "800019", "", dataField)), Utility.getDefault(this, vars, "Updatedby", "", "800019", "", dataField), TranslationData.selectDef5C315336D8DAF72DE040007F01013754_1(this, Utility.getDefault(this, vars, "Updatedby", "", "800019", "", dataField)), Utility.getDefault(this, vars, "Name", "", "800019", "", dataField), Utility.getDefault(this, vars, "Istranslated", "N", "800019", "N", dataField));
       
      }
     }
     
    String currentPOrg=MonthData.selectOrg(this, strPAD_Month_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/Month/Translation_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/Month/Translation_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "Translation", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inpadMonthTrlId", "", "..", "".equals("Y"), "Month", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strAD_Month_Trl_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 (!strAD_Month_Trl_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(), "Translation_Relation.html", "Month", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "Translation_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", "", "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.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", "AD_Month_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("adMonthId"):dataField.getField("adMonthId")));
xmlDocument.setData("reportAD_Month_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "18", "AD_Language", "106", "", 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("adLanguage"):dataField.getField("adLanguage")));
xmlDocument.setData("reportAD_Language","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

Examples of org.openbravo.data.FieldProvider

   
   
    String strCommand = null;
    AssetsData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
    String strParamValue = vars.getSessionValue(tabId + "|paramValue");
String strParamA_Asset_Group_ID = vars.getSessionValue(tabId + "|paramA_Asset_Group_ID");

    boolean hasSearchCondition=false;
    if (!(strParamValue.equals("") && strParamA_Asset_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 = AssetsData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strA_Asset_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strA_Asset_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 AssetsData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("aAssetId") == null || dataField.getField("aAssetId").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 = AssetsData.set(Utility.getDefault(this, vars, "Datepurchased", "", "800027", "", dataField), Utility.getDefault(this, vars, "Datecancelled", "", "800027", "", dataField), Utility.getDefault(this, vars, "Amortizationstartdate", "", "800027", "", dataField), Utility.getDefault(this, vars, "Amortizationenddate", "", "800027", "", dataField), Utility.getDefault(this, vars, "Annualamortizationpercentage", "", "800027", "", dataField), Utility.getDefault(this, vars, "C_Currency_ID", "@C_Currency_ID@", "800027", "", dataField), Utility.getDefault(this, vars, "AssetValueAmt", "", "800027", "", dataField), Utility.getDefault(this, vars, "Residualassetvalueamt", "", "800027", "", dataField), Utility.getDefault(this, vars, "M_AttributeSetInstance_ID", "", "800027", "", dataField), AssetsData.selectDef801068_0(this, Utility.getDefault(this, vars, "M_AttributeSetInstance_ID", "", "800027", "", dataField)), Utility.getDefault(this, vars, "Acctvalueamt", "", "800027", "", dataField), Utility.getDefault(this, vars, "Amortizationtype", "", "800027", "", dataField), Utility.getDefault(this, vars, "Amortizationvalueamt", "", "800027", "", dataField), Utility.getDefault(this, vars, "Assetschedule", "", "800027", "", dataField), Utility.getDefault(this, vars, "DocumentNo", "", "800027", "", dataField), Utility.getDefault(this, vars, "Processed", "N", "800027", "N", dataField), (vars.getLanguage().equals("en_US")?ListData.selectName(this, "800042", Utility.getDefault(this, vars, "Processed", "N", "800027", "N", dataField)):ListData.selectNameTrl(this, vars.getLanguage(), "800042", Utility.getDefault(this, vars, "Processed", "N", "800027", "N", dataField))), Utility.getDefault(this, vars, "Profit", "", "800027", "", dataField), Utility.getDefault(this, vars, "Qty", "", "800027", "", dataField), Utility.getDefault(this, vars, "Depreciatedvalue", "0", "800027", "", dataField), Utility.getDefault(this, vars, "Depreciatedplan", "0", "800027", "", dataField), Utility.getDefault(this, vars, "Amortizationcalctype", "", "800027", "", dataField), Utility.getDefault(this, vars, "Depreciatedpreviousamt", "0", "800027", "", dataField), Utility.getDefault(this, vars, "Lot", "", "800027", "", dataField), Utility.getDefault(this, vars, "AD_User_ID", "", "800027", "", dataField), Utility.getDefault(this, vars, "IsDisposed", "", "800027", "N", dataField), Utility.getDefault(this, vars, "M_Locator_ID", "", "800027", "", dataField), Utility.getDefault(this, vars, "IsInPosession", "", "800027", "N", dataField), "Y", Utility.getDefault(this, vars, "AssetDepreciationDate", "", "800027", "", dataField), Utility.getDefault(this, vars, "CreatedBy", "", "800027", "", dataField), AssetsData.selectDef8045_1(this, Utility.getDefault(this, vars, "CreatedBy", "", "800027", "", dataField)), Utility.getDefault(this, vars, "UseLifeYears", "", "800027", "", dataField), Utility.getDefault(this, vars, "M_Product_ID", "", "800027", "", dataField), AssetsData.selectDef8047_2(this, Utility.getDefault(this, vars, "M_Product_ID", "", "800027", "", dataField)), Utility.getDefault(this, vars, "AssetDisposalDate", "", "800027", "", dataField), Utility.getDefault(this, vars, "C_Location_ID", "", "800027", "", dataField), Utility.getDefault(this, vars, "A_Asset_Group_ID", "", "800027", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_Org_ID@", "800027", "", dataField), Utility.getDefault(this, vars, "VersionNo", "", "800027", "", dataField), Utility.getDefault(this, vars, "Value", "", "800027", "", dataField), Utility.getDefault(this, vars, "IsOwned", "", "800027", "N", dataField), Utility.getDefault(this, vars, "Name", "", "800027", "", dataField), Utility.getDefault(this, vars, "Description", "", "800027", "", dataField), Utility.getDefault(this, vars, "LocationComment", "", "800027", "", dataField), Utility.getDefault(this, vars, "IsDepreciated", "", "800027", "N", dataField), Utility.getDefault(this, vars, "LifeUseUnits", "", "800027", "", dataField), Utility.getDefault(this, vars, "Help", "", "800027", "", dataField), Utility.getDefault(this, vars, "UpdatedBy", "", "800027", "", dataField), AssetsData.selectDef8063_3(this, Utility.getDefault(this, vars, "UpdatedBy", "", "800027", "", dataField)), Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "800027", "", dataField), Utility.getDefault(this, vars, "C_BPartner_ID", "", "800027", "", dataField), Utility.getDefault(this, vars, "GuaranteeDate", "", "800027", "", dataField), Utility.getDefault(this, vars, "UseLifeMonths", "", "800027", "", dataField), Utility.getDefault(this, vars, "AssetServiceDate", "", "800027", "", dataField), Utility.getDefault(this, vars, "UseUnits", "", "800027", "", dataField), "", Utility.getDefault(this, vars, "SerNo", "", "800027", "", dataField), Utility.getDefault(this, vars, "C_BPartner_Location_ID", "", "800027", "", dataField), Utility.getDefault(this, vars, "IsFullyDepreciated", "N", "800027", "N", dataField));
             data[0].documentno = "<" + Utility.getDocumentNo( this, vars, windowId, "A_Asset", "", "", 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/Assets/Assets_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/Assets/Assets_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "Assets", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inpaAssetId", "", "..", "".equals("Y"), "Assets", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strA_Asset_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 (!strA_Asset_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(), "Assets_Relation.html", "Assets", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "Assets_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", "", "", 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;
xmlDocument.setParameter("buttonQty", Utility.messageBD(this, "Calc", vars.getLanguage()));
comboTableData = new ComboTableData(vars, this, "19", "A_Asset_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("aAssetGroupId"):dataField.getField("aAssetGroupId")));
xmlDocument.setData("reportA_Asset_Group_ID","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "17", "Amortizationtype", "800040", "", 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("amortizationtype"):dataField.getField("amortizationtype")));
xmlDocument.setData("reportAmortizationtype","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "17", "Amortizationcalctype", "800068", "", 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("amortizationcalctype"):dataField.getField("amortizationcalctype")));
xmlDocument.setData("reportAmortizationcalctype","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
comboTableData = new ComboTableData(vars, this, "17", "Assetschedule", "800041", "", 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("assetschedule"):dataField.getField("assetschedule")));
xmlDocument.setData("reportAssetschedule","liststructure", comboTableData.select(!strCommand.equals("NEW")));
comboTableData = null;
xmlDocument.setParameter("buttonAnnualamortizationpercentage", Utility.messageBD(this, "Calc", vars.getLanguage()));
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("Datepurchased_Format", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("Datecancelled_Format", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("Amortizationstartdate_Format", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("Amortizationenddate_Format", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("buttonAssetValueAmt", Utility.messageBD(this, "Calc", vars.getLanguage()));
xmlDocument.setParameter("buttonResidualassetvalueamt", Utility.messageBD(this, "Calc", vars.getLanguage()));
xmlDocument.setParameter("buttonAmortizationvalueamt", Utility.messageBD(this, "Calc", vars.getLanguage()));
xmlDocument.setParameter("buttonDepreciatedpreviousamt", Utility.messageBD(this, "Calc", vars.getLanguage()));
xmlDocument.setParameter("buttonDepreciatedvalue", Utility.messageBD(this, "Calc", vars.getLanguage()));
xmlDocument.setParameter("buttonDepreciatedplan", Utility.messageBD(this, "Calc", vars.getLanguage()));
xmlDocument.setParameter("Processed_BTNname", Utility.getButtonName(this, vars, "800042", (dataField==null?data[0].getField("processed"):dataField.getField("processed")), "Processed_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()));
xmlDocument.setParameter("buttonAcctvalueamt", Utility.messageBD(this, "Calc", vars.getLanguage()));
xmlDocument.setParameter("GuaranteeDate_Format", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("AssetDisposalDate_Format", vars.getSessionValue("#AD_SqlDateFormat"));
View Full Code Here

Examples of org.openbravo.data.FieldProvider

   
   
    String strCommand = null;
    PaymentData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
   
    boolean hasSearchCondition=false;
   


      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 = PaymentData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strPVM_Vehicle_Loan_ID, strVM_Loan_Payment_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strVM_Loan_Payment_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 PaymentData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("vmLoanPaymentId") == null || dataField.getField("vmLoanPaymentId").equals("")) {
        discard[0] = new String ("editDiscard");
        strCommand = "NEW";
        boolNew = true;
      } else {
        discard[0] = new String ("newDiscard");
        strCommand = "EDIT";
      }
    }
   
   
   
    if (dataField==null) {
      if (boolNew || data==null || data.length==0) {
        refreshSessionNew(vars, strPVM_Vehicle_Loan_ID);
        data = PaymentData.set(strPVM_Vehicle_Loan_ID, Utility.getDefault(this, vars, "Posted", "N", "60A281DE71234897A1641706076B3A01", "N", dataField), (vars.getLanguage().equals("en_US")?ListData.selectName(this, "234", Utility.getDefault(this, vars, "Posted", "N", "60A281DE71234897A1641706076B3A01", "N", dataField)):ListData.selectNameTrl(this, vars.getLanguage(), "234", Utility.getDefault(this, vars, "Posted", "N", "60A281DE71234897A1641706076B3A01", "N", dataField))), Utility.getDefault(this, vars, "DocumentNo", "", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "Processing", "N", "60A281DE71234897A1641706076B3A01", "N", dataField), Utility.getDefault(this, vars, "Processed", "N", "60A281DE71234897A1641706076B3A01", "N", dataField), (vars.getLanguage().equals("en_US")?ListData.selectName(this, "3C738BCC218F4A0F9211AD935E085C85", Utility.getDefault(this, vars, "Processed", "N", "60A281DE71234897A1641706076B3A01", "N", dataField)):ListData.selectNameTrl(this, vars.getLanguage(), "3C738BCC218F4A0F9211AD935E085C85", Utility.getDefault(this, vars, "Processed", "N", "60A281DE71234897A1641706076B3A01", "N", dataField))), Utility.getDefault(this, vars, "Amout", "", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "Date", "", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_ORG_ID@", "60A281DE71234897A1641706076B3A01", "", dataField), "Y", Utility.getDefault(this, vars, "Updatedby", "", "60A281DE71234897A1641706076B3A01", "", dataField), PaymentData.selectDef9A6A8ABD1B1B4C2A88E1C030C34317A7_0(this, Utility.getDefault(this, vars, "Updatedby", "", "60A281DE71234897A1641706076B3A01", "", dataField)), Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "60A281DE71234897A1641706076B3A01", "", dataField), Utility.getDefault(this, vars, "Createdby", "", "60A281DE71234897A1641706076B3A01", "", dataField), PaymentData.selectDefA787B7A7A18F4F60BC622B88F561DECD_1(this, Utility.getDefault(this, vars, "Createdby", "", "60A281DE71234897A1641706076B3A01", "", dataField)), "", Utility.getDefault(this, vars, "VM_Vehicle_Info_ID", "", "60A281DE71234897A1641706076B3A01", "", dataField), PaymentData.selectDefCB10003ECC96478E9736CE1EE19D8B61_2(this, Utility.getDefault(this, vars, "VM_Vehicle_Info_ID", "", "60A281DE71234897A1641706076B3A01", "", dataField)), PaymentData.selectDefFE70D27395034B38898C01B375B164ED_3(this, strPVM_Vehicle_Loan_ID));
             data[0].documentno = "<" + Utility.getDocumentNo( this, vars, windowId, "vm_loan_payment", "", "", false, false) + ">";
      }
     }
     
    String currentPOrg=LoanData.selectOrg(this, strPVM_Vehicle_Loan_ID);
    String currentOrg = (boolNew?"":(dataField!=null?dataField.getField("adOrgId"):data[0].getField("adOrgId")));
    if (!currentOrg.equals("") && !currentOrg.startsWith("'")) currentOrg = "'"+currentOrg+"'";
    String currentClient = (boolNew?"":(dataField!=null?dataField.getField("adClientId"):data[0].getField("adClientId")));
    if (!currentClient.equals("") && !currentClient.startsWith("'")) currentClient = "'"+currentClient+"'";
   
    boolean editableTab = (!org.openbravo.erpCommon.utility.WindowAccessData.hasReadOnlyAccess(this, vars.getRole(), tabId) && (currentOrg.equals("") || Utility.isElementInList(Utility.getContext(this, vars, "#User_Org", windowId, accesslevel),currentOrg)) && (currentClient.equals("") || Utility.isElementInList(Utility.getContext(this, vars, "#User_Client", windowId, accesslevel), currentClient)));
    if (editableTab)
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/vehicle/management/system/Vehicle/Payment_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/vehicle/management/system/Vehicle/Payment_NonEditable",discard).createXmlDocument();

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

    try {
      WindowTabs tabs = new WindowTabs(this, vars, tabId, windowId, true, (strCommand.equalsIgnoreCase("NEW")));
      xmlDocument.setParameter("parentTabContainer", tabs.parentTabs());
      xmlDocument.setParameter("mainTabContainer", tabs.mainTabs());
      // if (!strVM_Loan_Payment_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(), "Payment_Relation.html", "Vehicle", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "Payment_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("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;
xmlDocument.setParameter("Date_Format", vars.getSessionValue("#AD_SqlDateFormat"));
xmlDocument.setParameter("buttonAmout", Utility.messageBD(this, "Calc", vars.getLanguage()));
xmlDocument.setParameter("Processed_BTNname", Utility.getButtonName(this, vars, "3C738BCC218F4A0F9211AD935E085C85", (dataField==null?data[0].getField("processed"):dataField.getField("processed")), "Processed_linkBTN", usedButtonShortCuts, reservedButtonShortCuts));
xmlDocument.setParameter("Posted_BTNname", Utility.getButtonName(this, vars, "234", (dataField==null?data[0].getField("posted"):dataField.getField("posted")), "Posted_linkBTN", usedButtonShortCuts, reservedButtonShortCuts));
xmlDocument.setParameter("Created_Format", vars.getSessionValue("#AD_SqlDateTimeFormat"));xmlDocument.setParameter("Created_Maxlength", Integer.toString(vars.getSessionValue("#AD_SqlDateTimeFormat").length()));
xmlDocument.setParameter("Updated_Format", vars.getSessionValue("#AD_SqlDateTimeFormat"));xmlDocument.setParameter("Updated_Maxlength", Integer.toString(vars.getSessionValue("#AD_SqlDateTimeFormat").length()));
    } catch (Exception ex) {
      ex.printStackTrace();
      throw new ServletException(ex);
View Full Code Here

Examples of org.openbravo.data.FieldProvider

   
   
    String strCommand = null;
    WorkShiftsData[] 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 = WorkShiftsData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strHRM_Tm_Workshift_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strHRM_Tm_Workshift_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 WorkShiftsData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("hrmTmWorkshiftId") == null || dataField.getField("hrmTmWorkshiftId").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 = WorkShiftsData.set("", Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "777B3647C2EE4B0BA2D3EEBB17C95F7C", "", dataField), "0", "Y", Utility.getDefault(this, vars, "Createdby", "", "777B3647C2EE4B0BA2D3EEBB17C95F7C", "", dataField), WorkShiftsData.selectDef23DB2DFA5F2611DE901D8F51E2FF1347_0(this, Utility.getDefault(this, vars, "Createdby", "", "777B3647C2EE4B0BA2D3EEBB17C95F7C", "", dataField)), Utility.getDefault(this, vars, "Updatedby", "", "777B3647C2EE4B0BA2D3EEBB17C95F7C", "", dataField), WorkShiftsData.selectDef23EBDE705F2611DEA32B9B5C38194722_1(this, Utility.getDefault(this, vars, "Updatedby", "", "777B3647C2EE4B0BA2D3EEBB17C95F7C", "", dataField)), Utility.getDefault(this, vars, "Name", "", "777B3647C2EE4B0BA2D3EEBB17C95F7C", "", dataField), Utility.getDefault(this, vars, "Hoursperday", "", "777B3647C2EE4B0BA2D3EEBB17C95F7C", "0", 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/WorkShifts/WorkShifts_Edition",discard).createXmlDocument();
View Full Code Here

Examples of org.openbravo.data.FieldProvider

   
   
    String strCommand = null;
    SpecificHolidaysData[] 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 = SpecificHolidaysData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strHRM_Hr_Spe_Hol_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strHRM_Hr_Spe_Hol_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 SpecificHolidaysData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("hrmHrSpeHolId") == null || dataField.getField("hrmHrSpeHolId").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 = SpecificHolidaysData.set("", Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "7532AAD93CC648ECA5C1BAA5A33D6DBF", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_ORG_ID@", "7532AAD93CC648ECA5C1BAA5A33D6DBF", "", dataField), "Y", Utility.getDefault(this, vars, "Createdby", "", "7532AAD93CC648ECA5C1BAA5A33D6DBF", "", dataField), SpecificHolidaysData.selectDefA694DEEC573A11DEB55A4B63DB02D7F3_0(this, Utility.getDefault(this, vars, "Createdby", "", "7532AAD93CC648ECA5C1BAA5A33D6DBF", "", dataField)), Utility.getDefault(this, vars, "Updatedby", "", "7532AAD93CC648ECA5C1BAA5A33D6DBF", "", dataField), SpecificHolidaysData.selectDefA6A32D08573A11DEA1E23711A4B5F06B_1(this, Utility.getDefault(this, vars, "Updatedby", "", "7532AAD93CC648ECA5C1BAA5A33D6DBF", "", dataField)), Utility.getDefault(this, vars, "Name", "", "7532AAD93CC648ECA5C1BAA5A33D6DBF", "", dataField), Utility.getDefault(this, vars, "Date_Of_Hol", "", "7532AAD93CC648ECA5C1BAA5A33D6DBF", "", dataField), Utility.getDefault(this, vars, "REP_Annualy", "Y", "7532AAD93CC648ECA5C1BAA5A33D6DBF", "N", dataField), Utility.getDefault(this, vars, "FU_Hal_Day", "", "7532AAD93CC648ECA5C1BAA5A33D6DBF", "", 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/DefineDaysOff/SpecificHolidays_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/Human/Resource/management/DefineDaysOff/SpecificHolidays_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "SpecificHolidays", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inphrmHrSpeHolId", "", "..", "".equals("Y"), "DefineDaysOff", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strHRM_Hr_Spe_Hol_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_Hr_Spe_Hol_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(), "SpecificHolidays_Relation.html", "DefineDaysOff", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "SpecificHolidays_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;
xmlDocument.setParameter("Date_Of_Hol_Format", vars.getSessionValue("#AD_SqlDateFormat"));
comboTableData = new ComboTableData(vars, this, "17", "FU_Hal_Day", "6161372EE9594F339670BF4263026FE4", "", 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("fuHalDay"):dataField.getField("fuHalDay")));
xmlDocument.setData("reportFU_Hal_Day","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

Examples of org.openbravo.data.FieldProvider

   
   
    String strCommand = null;
    PayrollData[] data=null;
    XmlDocument xmlDocument=null;
    FieldProvider dataField = vars.getEditionData(tabId);
    vars.removeEditionData(tabId);
   
    boolean hasSearchCondition=false;
   


      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 = PayrollData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strHRM_Hr_Empsalary_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strHRM_Hr_Empsalary_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 PayrollData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("hrmHrEmpsalaryId") == null || dataField.getField("hrmHrEmpsalaryId").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 = PayrollData.set(Utility.getDefault(this, vars, "Bonus", "0", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "HRM_Hr_Employee_ID", "", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "Servicebenefits", "0", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "Conveyance", "0", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "Hra", "0", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), "Y", Utility.getDefault(this, vars, "Lop", "0", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "Esi", "0", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), "", Utility.getDefault(this, vars, "Createdby", "", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), PayrollData.selectDef821840AD2E2A4985A01B5E782D0D62CB_0(this, Utility.getDefault(this, vars, "Createdby", "", "9C4248DF110446EEA192107D3EDC1C85", "", dataField)), Utility.getDefault(this, vars, "Specialallowance", "0", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "Netpay", "0", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "Pf", "0", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "Advancesalary", "0", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "BAS_Salary", "", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "Updatedby", "", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), PayrollData.selectDefC76D76C9DFB14B578A78583E3DC1A6D3_1(this, Utility.getDefault(this, vars, "Updatedby", "", "9C4248DF110446EEA192107D3EDC1C85", "", dataField)), Utility.getDefault(this, vars, "Grosspay", "0", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "Da", "0", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "Incentive", "0", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "Otherdeduction", "0", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "Totaldeduction", "0", "9C4248DF110446EEA192107D3EDC1C85", "", dataField), Utility.getDefault(this, vars, "AD_Org_ID", "@AD_ORG_ID@", "9C4248DF110446EEA192107D3EDC1C85", "", 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/Payroll/Payroll_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/Human/Resource/management/Payroll/Payroll_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "Payroll", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inphrmHrEmpsalaryId", "", "..", "".equals("Y"), "Payroll", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strHRM_Hr_Empsalary_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_Hr_Empsalary_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(), "Payroll_Relation.html", "Payroll", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "Payroll_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("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_Hr_Employee_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("hrmHrEmployeeId"):dataField.getField("hrmHrEmployeeId")));
xmlDocument.setData("reportHRM_Hr_Employee_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

Examples of org.openbravo.data.FieldProvider

   
   
    String strCommand = null;
    LicensesData[] 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 = LicensesData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strHRM_Licenses_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strHRM_Licenses_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 LicensesData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("hrmLicensesId") == null || dataField.getField("hrmLicensesId").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 = LicensesData.set("", Utility.getDefault(this, vars, "AD_Client_ID", "@AD_CLIENT_ID@", "980339267B8A486A96E130695494120C", "", dataField), "0", "Y", Utility.getDefault(this, vars, "Createdby", "", "980339267B8A486A96E130695494120C", "", dataField), LicensesData.selectDef8E29B08050F511DE8BE77F0D45782294_0(this, Utility.getDefault(this, vars, "Createdby", "", "980339267B8A486A96E130695494120C", "", dataField)), Utility.getDefault(this, vars, "Updatedby", "", "980339267B8A486A96E130695494120C", "", dataField), LicensesData.selectDef8E359C4250F511DEA9DA476BA0B353A1_1(this, Utility.getDefault(this, vars, "Updatedby", "", "980339267B8A486A96E130695494120C", "", dataField)), Utility.getDefault(this, vars, "Name", "", "980339267B8A486A96E130695494120C", "", dataField), Utility.getDefault(this, vars, "DocumentNo", "", "980339267B8A486A96E130695494120C", "", dataField));
             data[0].documentno = "<" + Utility.getDocumentNo( this, vars, windowId, "hrm_licenses", "", "", 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/Qualification/Licenses_Edition",discard).createXmlDocument();
View Full Code Here

Examples of org.openbravo.data.FieldProvider

   
   
    String strCommand = null;
    LanguageData[] 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 = LanguageData.selectEdit(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage(), strAD_Language_ID, Utility.getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel));
 
        if (!strAD_Language_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 LanguageData[0];
      } else {
        discard[0] = new String ("newDiscard");
      }
    } else {
      if (dataField.getField("adLanguageId") == null || dataField.getField("adLanguageId").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 = LanguageData.set(Utility.getDefault(this, vars, "AD_Language", "", "106", "", dataField), Utility.getDefault(this, vars, "Name", "", "106", "", dataField), Utility.getDefault(this, vars, "IsBaseLanguage", "N", "106", "N", dataField), "Y", Utility.getDefault(this, vars, "IsSystemLanguage", "", "106", "N", dataField), Utility.getDefault(this, vars, "LanguageISO", "", "106", "", dataField), "0", "0", Utility.getDefault(this, vars, "Isrtl", "N", "106", "N", dataField), Utility.getDefault(this, vars, "CreatedBy", "", "106", "", dataField), LanguageData.selectDef614_0(this, Utility.getDefault(this, vars, "CreatedBy", "", "106", "", dataField)), Utility.getDefault(this, vars, "UpdatedBy", "", "106", "", dataField), LanguageData.selectDef616_1(this, Utility.getDefault(this, vars, "UpdatedBy", "", "106", "", dataField)), Utility.getDefault(this, vars, "CountryCode", "", "106", "", dataField), Utility.getDefault(this, vars, "Processing", "", "106", "N", dataField), Utility.getDefault(this, vars, "Pixelsize", "", "106", "", dataField), Utility.getDefault(this, vars, "Translatedby", "", "106", "", dataField), LanguageData.selectDef9622(this));
       
      }
     }
     
   
    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/Language/Language_Edition",discard).createXmlDocument();
    else
      xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpWindows/Language/Language_NonEditable",discard).createXmlDocument();

    xmlDocument.setParameter("tabId", tabId);
    ToolBar toolbar = new ToolBar(this, editableTab, vars.getLanguage(), "Language", (strCommand.equals("NEW") || boolNew || (dataField==null && (data==null || data.length==0))), "document.frmMain.inpadLanguageId", "", "..", "".equals("Y"), "Language", strReplaceWith, true, false, false, Utility.hasTabAttachments(this, vars, tabId, strAD_Language_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 (!strAD_Language_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(), "Language_Relation.html", "Language", "W", strReplaceWith, tabs.breadcrumb());
      xmlDocument.setParameter("navigationBar", nav.toString());
      LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "Language_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;
xmlDocument.setParameter("Processing_BTNname", Utility.getButtonName(this, vars, "5226", "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
TOP
Copyright © 2018 www.massapi.com. 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.