Пример #1
0
  private void processButton(VariablesSecureApp vars, String strClient) throws ServletException {
    String pinstance = SequenceIdData.getUUID();
    OBError myMessage = null;
    try {
      if (strClient.equals("")) {
        myMessage = new OBError();
        myMessage.setType("Error");
        myMessage.setTitle(
            Utility.parseTranslation(
                this, vars, vars.getLanguage(), "@DeleteClient_NoClientSelected@"));
        myMessage.setMessage(
            Utility.parseTranslation(
                this, vars, vars.getLanguage(), "@DeleteClient_SelectClient@"));
      } else {
        Client client = OBDal.getInstance().get(Client.class, strClient);
        SystemService.getInstance().deleteClient(client);
      }
    } catch (Exception e) {
      myMessage = Utility.translateError(this, vars, vars.getLanguage(), e.getMessage());
      e.printStackTrace();
      log4j.warn("Error");
    }
    if (myMessage == null) {
      myMessage = new OBError();
      myMessage.setType("Success");
      myMessage.setTitle("");
      myMessage.setMessage(Utility.messageBD(this, "Success", vars.getLanguage()));
    }

    vars.setMessage("DeleteClient", myMessage);
  }
Пример #2
0
  /**
   * Execute this process.
   *
   * @param conn the database connection
   * @throws ServletException
   */
  public String execute(ConnectionProvider conn) throws ServletException {

    Process process = null;
    try {
      process = bundle.getProcessClass().newInstance();

    } catch (final Exception e) {
      log.error(e.getMessage(), e);
      throw new ServletException(e.getMessage(), e);
    }
    final String requestId = SequenceIdData.getUUID();
    String status = SCHEDULED;

    final ProcessContext ctx = bundle.getContext();
    ProcessRequestData.insert(
        conn,
        ctx.getOrganization(),
        ctx.getClient(),
        ctx.getUser(),
        ctx.getUser(),
        requestId,
        bundle.getProcessId(),
        ctx.getUser(),
        status,
        "Direct",
        ctx.toString(),
        "",
        null,
        null,
        null,
        null);

    final String executionId = SequenceIdData.getUUID();
    final long startTime = System.currentTimeMillis();
    long endTime = startTime;

    status = PROCESSING;
    ProcessRunData.insert(
        conn,
        ctx.getOrganization(),
        ctx.getClient(),
        ctx.getUser(),
        ctx.getUser(),
        executionId,
        status,
        null,
        bundle.getLog(),
        requestId);

    try {
      log.debug("Calling execute on process " + requestId);
      process.execute(bundle);
      endTime = System.currentTimeMillis();
      status = SUCCESS;

    } catch (final Exception e) {
      endTime = System.currentTimeMillis();
      status = ERROR;
      log.error("Process " + requestId + " threw an Exception: " + e.getMessage(), e);
      throw new ServletException(e);
    } finally {
      final String duration = ProcessMonitor.getDuration(endTime - startTime);
      ProcessRequestData.update(conn, COMPLETE, requestId);
      ProcessRunData.update(conn, ctx.getUser(), status, duration, bundle.getLog(), executionId);
    }

    return executionId;
  }
  private OBError processButton(
      VariablesSecureApp vars,
      String strKey,
      String strProjectType,
      String strDateFrom,
      String windowId) {
    Connection conn = null;
    OBError myMessage = new OBError();
    if (strProjectType == null || strProjectType.equals("")) {
      try {
        releaseRollbackConnection(conn);
      } catch (Exception ignored) {
      }
      log4j.warn("Rollback in transaction");
      myMessage.setType("Error");
      myMessage.setTitle(Utility.messageBD(this, "Error", vars.getLanguage()));
      myMessage.setMessage(Utility.messageBD(this, "NoProjectTypeSelected", vars.getLanguage()));
    } else {
      try {
        conn = this.getTransactionConnection();
        ProjectSetTypeData[] data = ProjectSetTypeData.select(this, strProjectType);
        ProjectSetTypeData[] dataProject = ProjectSetTypeData.selectProject(this, strKey);
        String strProjectPhase = "";
        String strProjectTask = "";
        // Variables used for Project Scheduling purposes
        DateFormat DateFormatter = Utility.getDateFormatter(vars);
        int firstProjectPhase = 0;
        String strPhaseStartDate = "";
        String strPhaseContractDate = "";
        String strTaskStartDate = "";
        String strTaskContractDate = "";
        String strLastContractDate = "";

        for (int i = 0; data != null && i < data.length; i++) {
          strProjectPhase = SequenceIdData.getUUID();

          // Calculates the Starting Date of the Phase
          if (firstProjectPhase == 0) {
            strPhaseStartDate = strDateFrom;
          } else {
            strPhaseStartDate = calculateStartDate(strLastContractDate, DateFormatter);
          }
          // Calculates the Contract Date of the Phase
          strPhaseContractDate =
              calculateContractDate(strPhaseStartDate, data[i].stdduration, DateFormatter);

          try {
            if (ProjectSetTypeData.insertProjectPhase(
                    conn,
                    this,
                    strKey,
                    dataProject[0].adClientId,
                    dataProject[0].adOrgId,
                    vars.getUser(),
                    data[i].description,
                    data[i].mProductId,
                    data[i].cPhaseId,
                    strProjectPhase,
                    data[i].help,
                    data[i].name,
                    data[i].standardqty,
                    strPhaseStartDate,
                    strPhaseContractDate,
                    data[i].seqno)
                == 1) {
              strLastContractDate = strPhaseContractDate;
              ProjectSetTypeData[] data1 = ProjectSetTypeData.selectTask(this, data[i].cPhaseId);
              int firstProjectTask = 0;
              for (int j = 0; data1 != null && j < data1.length; j++) {
                strProjectTask = SequenceIdData.getUUID();

                // Calculates the Starting Date of the Task
                if (firstProjectTask == 0) {
                  strTaskStartDate = strPhaseStartDate;
                } else {
                  strTaskStartDate = calculateStartDate(strLastContractDate, DateFormatter);
                }
                // Calculates the Contract Date of the Task
                strTaskContractDate =
                    calculateContractDate(strTaskStartDate, data1[j].stdduration, DateFormatter);

                try {
                  ProjectSetTypeData.insertProjectTask(
                      conn,
                      this,
                      strProjectTask,
                      data1[j].cTaskId,
                      dataProject[0].adClientId,
                      dataProject[0].adOrgId,
                      vars.getUser(),
                      data1[j].seqno,
                      data1[j].name,
                      data1[j].description,
                      data1[j].help,
                      data1[j].mProductId,
                      strProjectPhase,
                      data1[j].standardqty,
                      strTaskStartDate,
                      strTaskContractDate);
                } catch (ServletException ex) {
                  myMessage =
                      Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
                  releaseRollbackConnection(conn);
                  return myMessage;
                }

                strLastContractDate = strTaskContractDate;
                firstProjectTask++;
              }
              firstProjectPhase++;
            }
          } catch (ServletException ex) {
            myMessage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
            releaseRollbackConnection(conn);
            return myMessage;
          }
        }

        // Updates project's Type and category
        String strProjectCategory = ProjectSetTypeData.selectProjectCategory(this, strProjectType);
        try {
          ProjectSetTypeData.update(
              conn, this, vars.getUser(), strProjectType, strProjectCategory, strKey);
        } catch (ServletException ex) {
          myMessage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
          releaseRollbackConnection(conn);
          return myMessage;
        }

        // Updates project's Starting and Contract Dates
        ProjectSetTypeData[] dataDates = ProjectSetTypeData.selectDates(this, strKey);
        String strStartDate = strDateFrom.equals("") ? dataDates[0].startdate : strDateFrom;
        String strContractDate =
            strLastContractDate.equals("") ? dataDates[0].datecontract : strLastContractDate;
        try {
          ProjectSetTypeData.updateDates(
              conn, this, vars.getUser(), strStartDate, strContractDate, strKey);
        } catch (ServletException ex) {
          myMessage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
          releaseRollbackConnection(conn);
          return myMessage;
        }

        releaseCommitConnection(conn);
        myMessage.setType("Success");
        myMessage.setTitle(Utility.messageBD(this, "Success", vars.getLanguage()));
      } catch (Exception e) {
        try {
          releaseRollbackConnection(conn);
        } catch (Exception ignored) {
        }
        e.printStackTrace();
        log4j.warn("Rollback in transaction");
        myMessage = Utility.translateError(this, vars, vars.getLanguage(), e.getMessage());
      }
    }
    return myMessage;
  }
  /**
   * Create Facts (the accounting logic) for MMS, MMR.
   *
   * <pre>
   *  Shipment
   *      CoGS            DR
   *      Inventory               CR
   *  Shipment of Project Issue
   *      CoGS            DR
   *      Project                 CR
   *  Receipt
   *      Inventory       DR
   *      NotInvoicedReceipt      CR
   * </pre>
   *
   * @param as accounting schema
   * @return Fact
   */
  public Fact createFact(
      AcctSchema as, ConnectionProvider conn, Connection con, VariablesSecureApp vars)
      throws ServletException {
    // Select specific definition
    String strClassname =
        AcctServerData.selectTemplateDoc(conn, as.m_C_AcctSchema_ID, DocumentType);
    if (StringUtils.isEmpty(strClassname)) {
      strClassname = AcctServerData.selectTemplate(conn, as.m_C_AcctSchema_ID, AD_Table_ID);
    } else {
      try {
        DocCostAdjustmentTemplate newTemplate =
            (DocCostAdjustmentTemplate) Class.forName(strClassname).newInstance();
        return newTemplate.createFact(this, as, conn, con, vars);
      } catch (Exception e) {
        log4j.error("Error while creating new instance for DocCostAdjustmentTemplate - ", e);
      }
    }
    C_Currency_ID = as.getC_Currency_ID();
    // create Fact Header
    Fact fact = new Fact(this, as, Fact.POST_Actual);
    String Fact_Acct_Group_ID = SequenceIdData.getUUID();
    String amtDebit = "0";
    String amtCredit = "0";

    // Lines
    for (int i = 0; p_lines != null && i < p_lines.length; i++) {
      DocLine_CostAdjustment line = (DocLine_CostAdjustment) p_lines[i];
      String transactionType = line.getTransactionType();

      BigDecimal amount = new BigDecimal(line.getAmount());
      ProductInfo p = new ProductInfo(line.m_M_Product_ID, conn);

      log4jDocCostAdjustment.debug(
          "antes del creteline, line.getAmount(): "
              + line.getAmount()
              + " - TransactionType: "
              + transactionType);
      if (transactionType.equals(DocLine_CostAdjustment.TRXTYPE_SHIPMENT)) {
        // Cogs DR
        // Inventory Asset CR
        log4jDocCostAdjustment.debug(
            "********** DocCostAdjustment - factAcct - account - "
                + p.getAccount(ProductInfo.ACCTTYPE_P_Cogs, as, conn).C_ValidCombination_ID);

        if (line.isTransactionNegative()) {
          amtDebit = "";
          amtCredit = amount.toPlainString();
        } else {
          amtDebit = amount.toPlainString();
          amtCredit = "";
        }
        fact.createLine(
            line,
            p.getAccount(ProductInfo.ACCTTYPE_P_Cogs, as, conn),
            line.m_C_Currency_ID,
            amtDebit,
            amtCredit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);
        fact.createLine(
            line,
            p.getAccount(ProductInfo.ACCTTYPE_P_Asset, as, conn),
            line.m_C_Currency_ID,
            amtCredit,
            amtDebit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);
      } else if (transactionType.equals(DocLine_CostAdjustment.TRXTYPE_RECEIPT)) {
        Account acct = null;
        // Inventory Asset DR
        if (line.getIsSource() && ("PDC").equals(line.getSourceProcess())) { // Price Diff
          // Correction
          // Invoice Price Variance CR
          acct = p.getAccount(ProductInfo.ACCTTYPE_P_IPV, as, conn);
        } else if (line.getIsSource() && ("LC").equals(line.getSourceProcess())) {
          throw new IllegalStateException(OBMessageUtils.messageBD("LCNotAccounting"));
        } else {
          // Product Exp CR
          acct =
              getAccountByWarehouse(
                  AcctServer.ACCTTYPE_InvDifferences, as, line.getWarehouseId(), conn);
        }
        log4jDocCostAdjustment.debug(
            "********** DocCostAdjustment - factAcct - account - "
                + p.getAccount(ProductInfo.ACCTTYPE_P_Expense, as, conn).C_ValidCombination_ID);
        if (line.isTransactionNegative()) {
          amtDebit = amount.toPlainString();
          amtCredit = "";
        } else {
          amtDebit = "";
          amtCredit = amount.toPlainString();
        }
        fact.createLine(
            line,
            acct,
            line.m_C_Currency_ID,
            amtDebit,
            amtCredit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);
        fact.createLine(
            line,
            p.getAccount(ProductInfo.ACCTTYPE_P_Asset, as, conn),
            line.m_C_Currency_ID,
            amtCredit,
            amtDebit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);
      } else if (transactionType.equals(DocLine_CostAdjustment.TRXTYPE_INVENTORY)) {
        // Inventory Asset DR
        // Inventory Adjustment CR
        log4jDocCostAdjustment.debug(
            "********** DocCostAdjustment - factAcct - account - "
                + getAccountByWarehouse(
                        AcctServer.ACCTTYPE_InvDifferences, as, line.getWarehouseId(), conn)
                    .C_ValidCombination_ID);
        if (line.isTransactionNegative()) {
          amtDebit = amount.toPlainString();
          amtCredit = "";
        } else {
          amtDebit = "";
          amtCredit = amount.toPlainString();
        }
        fact.createLine(
            line,
            getAccountByWarehouse(
                AcctServer.ACCTTYPE_InvDifferences, as, line.getWarehouseId(), conn),
            line.m_C_Currency_ID,
            amtDebit,
            amtCredit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);
        fact.createLine(
            line,
            p.getAccount(ProductInfo.ACCTTYPE_P_Asset, as, conn),
            line.m_C_Currency_ID,
            amtCredit,
            amtDebit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);
      } else if (transactionType.equals(DocLine_CostAdjustment.TRXTYPE_INTERNALMOVEMENTFROM)) {
        // Inventory Asset DR
        // Inventory Adjustment CR
        M_Warehouse_ID = line.getWarehouseId();
        log4jDocCostAdjustment.debug(
            "********** DocCostAdjustment - factAcct - account - "
                + getAccountByWarehouse(
                        AcctServer.ACCTTYPE_InvDifferences, as, line.getWarehouseId(), conn)
                    .C_ValidCombination_ID);
        if (line.isTransactionNegative()) {
          amtDebit = amount.negate().toPlainString();
          amtCredit = "";
        } else {
          amtDebit = "";
          amtCredit = amount.negate().toPlainString();
        }
        fact.createLine(
            line,
            p.getAccount(ProductInfo.ACCTTYPE_P_Asset, as, conn),
            line.m_C_Currency_ID,
            amtDebit,
            amtCredit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);

        fact.createLine(
            line,
            getAccountByWarehouse(
                AcctServer.ACCTTYPE_InvDifferences, as, line.getWarehouseId(), conn),
            line.m_C_Currency_ID,
            amtCredit,
            amtDebit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);
      } else if (transactionType.equals(DocLine_CostAdjustment.TRXTYPE_INTERNALMOVEMENTTO)) {
        // Inventory Asset DR
        // Inventory Adjustment CR
        M_Warehouse_ID = line.getWarehouseId();
        log4jDocCostAdjustment.debug(
            "********** DocCostAdjustment - factAcct - account - "
                + getAccountByWarehouse(
                        AcctServer.ACCTTYPE_InvDifferences, as, line.getWarehouseId(), conn)
                    .C_ValidCombination_ID);
        if (line.isTransactionNegative()) {
          amtDebit = amount.toPlainString();
          amtCredit = "";
        } else {
          amtDebit = "";
          amtCredit = amount.toPlainString();
        }
        fact.createLine(
            line,
            getAccountByWarehouse(
                AcctServer.ACCTTYPE_InvDifferences, as, line.getWarehouseId(), conn),
            line.m_C_Currency_ID,
            amtDebit,
            amtCredit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);
        fact.createLine(
            line,
            p.getAccount(ProductInfo.ACCTTYPE_P_Asset, as, conn),
            line.m_C_Currency_ID,
            amtCredit,
            amtDebit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);
      } else if (transactionType.equals(DocLine_CostAdjustment.TRXTYPE_INTERNALCONSUMPTION)) {
        // Inventory Asset DR
        // Inventory Adjustment CR
        M_Warehouse_ID = line.getWarehouseId();
        log4jDocCostAdjustment.debug(
            "********** DocCostAdjustment - factAcct - account - "
                + getAccountByWarehouse(
                        AcctServer.ACCTTYPE_InvDifferences, as, line.getWarehouseId(), conn)
                    .C_ValidCombination_ID);
        if (line.isTransactionNegative()) {
          amtDebit = amount.toPlainString();
          amtCredit = "";
        } else {
          amtDebit = "";
          amtCredit = amount.toPlainString();
        }
        fact.createLine(
            line,
            p.getAccount(ProductInfo.ACCTTYPE_P_Asset, as, conn),
            line.m_C_Currency_ID,
            amtDebit,
            amtCredit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);

        fact.createLine(
            line,
            getAccountByWarehouse(
                AcctServer.ACCTTYPE_InvDifferences, as, line.getWarehouseId(), conn),
            line.m_C_Currency_ID,
            amtCredit,
            amtDebit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);
      } else if (transactionType.equals(DocLine_CostAdjustment.TRXTYPE_BOM)) {
        // Inventory Asset DR
        // Inventory Adjustment CR
        M_Warehouse_ID = line.getWarehouseId();
        log4jDocCostAdjustment.debug(
            "********** DocCostAdjustment - factAcct - account - "
                + getAccountByWarehouse(
                        AcctServer.ACCTTYPE_InvDifferences, as, line.getWarehouseId(), conn)
                    .C_ValidCombination_ID);
        if (line.isTransactionNegative()) {
          amtDebit = amount.toPlainString();
          amtCredit = "";
        } else {
          amtDebit = "";
          amtCredit = amount.toPlainString();
        }
        fact.createLine(
            line,
            getAccountByWarehouse(
                AcctServer.ACCTTYPE_InvDifferences, as, line.getWarehouseId(), conn),
            line.m_C_Currency_ID,
            amtDebit,
            amtCredit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);

        fact.createLine(
            line,
            p.getAccount(ProductInfo.ACCTTYPE_P_Asset, as, conn),
            line.m_C_Currency_ID,
            amtCredit,
            amtDebit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);
      } else if (transactionType.equals(DocLine_CostAdjustment.TRXTYPE_MANUFACTURING)) {
        // Inventory Asset DR
        // Inventory Adjustment CR
        M_Warehouse_ID = line.getWarehouseId();
        log4jDocCostAdjustment.debug(
            "********** DocCostAdjustment - factAcct - account - "
                + getAccountByWarehouse(
                        AcctServer.ACCTTYPE_InvDifferences, as, line.getWarehouseId(), conn)
                    .C_ValidCombination_ID);
        if (line.isTransactionNegative()) {
          amtDebit = amount.toPlainString();
          amtCredit = "";
        } else {
          amtDebit = "";
          amtCredit = amount.toPlainString();
        }
        fact.createLine(
            line,
            getAccountByWarehouse(
                AcctServer.ACCTTYPE_InvDifferences, as, line.getWarehouseId(), conn),
            line.m_C_Currency_ID,
            amtDebit,
            amtCredit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);

        fact.createLine(
            line,
            p.getAccount(ProductInfo.ACCTTYPE_P_Asset, as, conn),
            line.m_C_Currency_ID,
            amtCredit,
            amtDebit,
            Fact_Acct_Group_ID,
            nextSeqNo(SeqNo),
            DocumentType,
            line.m_DateAcct,
            null,
            conn);
      }
    } // lines

    SeqNo = "0";
    return fact;
  } // createFact
  private int saveRecord(VariablesSecureApp vars, OBError myError, char type)
      throws IOException, ServletException {
    BusinessPartnerCategoryData data = null;
    int total = 0;
    if (org.openbravo.erpCommon.utility.WindowAccessData.hasReadOnlyAccess(
        this, vars.getRole(), tabId)) {
      OBError newError =
          Utility.translateError(
              this,
              vars,
              vars.getLanguage(),
              Utility.messageBD(this, "NoWriteAccess", vars.getLanguage()));
      myError.setError(newError);
      vars.setMessage(tabId, myError);
    } else {
      Connection con = null;
      try {
        con = this.getTransactionConnection();
        data = getEditVariables(con, vars);
        data.dateTimeFormat = vars.getSessionValue("#AD_SqlDateTimeFormat");
        String strSequence = "";
        if (type == 'I') {
          strSequence = SequenceIdData.getUUID();
          if (log4j.isDebugEnabled()) log4j.debug("Sequence: " + strSequence);
          data.cBpGroupId = strSequence;
        }
        if (Utility.isElementInList(
                Utility.getContext(this, vars, "#User_Client", windowId, accesslevel),
                data.adClientId)
            && Utility.isElementInList(
                Utility.getContext(this, vars, "#User_Org", windowId, accesslevel), data.adOrgId)) {
          if (type == 'I') {
            total = data.insert(con, this);
          } else {
            // Check the version of the record we are saving is the one in DB
            if (BusinessPartnerCategoryData.getCurrentDBTimestamp(this, data.cBpGroupId)
                .equals(vars.getStringParameter("updatedTimestamp"))) {
              total = data.update(con, this);
            } else {
              myError.setMessage(
                  Replace.replace(
                      Replace.replace(
                          Utility.messageBD(this, "SavingModifiedRecord", vars.getLanguage()),
                          "\\n",
                          "<br/>"),
                      "&quot;",
                      "\""));
              myError.setType("Error");
              vars.setSessionValue(tabId + "|concurrentSave", "true");
            }
          }

        } else {
          OBError newError =
              Utility.translateError(
                  this,
                  vars,
                  vars.getLanguage(),
                  Utility.messageBD(this, "NoWriteAccess", vars.getLanguage()));
          myError.setError(newError);
        }
        releaseCommitConnection(con);
      } catch (Exception ex) {
        OBError newError = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
        myError.setError(newError);
        try {
          releaseRollbackConnection(con);
        } catch (final Exception e) { // do nothing
        }
      }

      if (myError.isEmpty() && total == 0) {
        OBError newError =
            Utility.translateError(this, vars, vars.getLanguage(), "@CODE=DBExecuteError");
        myError.setError(newError);
      }
      vars.setMessage(tabId, myError);

      if (!myError.isEmpty()) {
        if (data != null) {
          if (type == 'I') {
            data.cBpGroupId = "";
          } else {

          }
          vars.setEditionData(tabId, data);
        }
      } else {
        vars.setSessionValue(windowId + "|C_BP_Group_ID", data.cBpGroupId);
      }
    }
    return total;
  }