Package org.openbravo.erpCommon.utility

Examples of org.openbravo.erpCommon.utility.OBError


      String strPaymentRuleFrom = vars.getStringParameter("inppaymentruleFrom");
      String strPaymentRuleTo = vars.getStringParameter("inppaymentruleTo");
      String strAmount = vars.getStringParameter("inpAmount");
      String strMovementDate = vars.getStringParameter("inpmovementdate");
      String strDescription = vars.getStringParameter("inpdescription");
      OBError myMessage = process(vars, strCashFrom, strCashTo, strBankFrom, strBankTo,
          strPaymentRuleFrom, strPaymentRuleTo, strAmount, strMovementDate, strDescription,
          strOrgTrx);
      vars.setMessage("CashBankOperations", myMessage);
      printPage(response, vars);
    } else
View Full Code Here


      String strBankFrom, String strBankTo, String strPaymentRuleFrom, String strPaymentRuleTo,
      String strAmount, String strMovementDate, String strDescription, String strOrgTrx) {
    if (log4j.isDebugEnabled())
      log4j.debug("Save: CashBankOperations");
    Connection con = null;
    OBError myMessage = null;
    String strSettlementDocumentNo = "";
    try {
      con = getTransactionConnection();
      String strBPartner = CashBankOperationsData.select(this, strOrgTrx);
      String strCashCurrency = CashBankOperationsData.selectCashCurrency(this, strCashFrom
          .equals("") ? strCashTo : strCashFrom);
      String strBankCurrency = CashBankOperationsData.selectBankCurrency(this, strBankFrom
          .equals("") ? strBankTo : strBankFrom);
      String strSettlement = SequenceIdData.getUUID();
      String strDoctypeId = CashBankOperationsData.selectSettlementDoctypeId(this);
      strSettlementDocumentNo = Utility.getDocumentNo(this, vars, "CashBankOperations",
          "C_Settlement", "", strDoctypeId, false, true);
      if (strCashFrom.equals("") && strBankTo.equals("")) { // bank ->
        // cash
        CashBankOperationsData.insertSettlement(con, this, strSettlement, vars.getClient(),
            strOrgTrx, vars.getUser(), strSettlementDocumentNo, strMovementDate, strDoctypeId,
            strCashCurrency);
        String strDebtPaymentId = SequenceIdData.getUUID();

        CashBankOperationsData.insertDebtpayment(con, this, strDebtPaymentId, vars.getClient(),
            strOrgTrx, vars.getUser(), "Y", strSettlement, strDescription + " - "
                + Utility.messageBD(this, "DebtPaymentFor", vars.getLanguage())
                + Utility.messageBD(this, "Cash", vars.getLanguage())
                + CashBankOperationsData.selectCashBook(this, strCashTo), strBPartner,
            strCashCurrency, "", "", strCashTo, strPaymentRuleTo, strAmount, strMovementDate, "");
        insertCash(vars, strCashTo, strAmount, strMovementDate, strCashCurrency, strDescription,
            strDebtPaymentId, strOrgTrx, con);

        strDebtPaymentId = SequenceIdData.getUUID();
        CashBankOperationsData.insertDebtpayment(con, this, strDebtPaymentId, vars.getClient(),
            strOrgTrx, vars.getUser(), "N", strSettlement, strDescription + " - "
                + Utility.messageBD(this, "DebtPaymentFor", vars.getLanguage())
                + CashBankOperationsData.selectBankAccount(this, strBankFrom, vars.getLanguage()),
            strBPartner, strBankCurrency, "", strBankFrom, "", strPaymentRuleTo, strAmount,
            strMovementDate, "");
        CashBankOperationsData.updateSettlement(con, this, strSettlement);
      } else if (strCashTo.equals("") && strBankFrom.equals("")) { // cash
        // ->
        // bank
        CashBankOperationsData.insertSettlement(con, this, strSettlement, vars.getClient(),
            strOrgTrx, vars.getUser(), strSettlementDocumentNo, strMovementDate, strDoctypeId,
            strBankCurrency);
        String strDebtPaymentId = SequenceIdData.getUUID();

        CashBankOperationsData.insertDebtpayment(con, this, strDebtPaymentId, vars.getClient(),
            strOrgTrx, vars.getUser(), "N", strSettlement, strDescription + " - "
                + Utility.messageBD(this, "DebtPaymentFor", vars.getLanguage())
                + Utility.messageBD(this, "Cash", vars.getLanguage())
                + CashBankOperationsData.selectCashBook(this, strCashFrom), strBPartner,
            strCashCurrency, "", "", strCashFrom, strPaymentRuleFrom, strAmount, strMovementDate,
            "");

        insertCash(vars, strCashFrom, negate(strAmount), strMovementDate, strCashCurrency,
            strDescription, strDebtPaymentId, strOrgTrx, con);
        strDebtPaymentId = SequenceIdData.getUUID();
        CashBankOperationsData.insertDebtpayment(con, this, strDebtPaymentId, vars.getClient(),
            strOrgTrx, vars.getUser(), "Y", strSettlement, strDescription + " - "
                + Utility.messageBD(this, "DebtPaymentFor", vars.getLanguage())
                + CashBankOperationsData.selectBankAccount(this, strBankTo, vars.getLanguage()),
            strBPartner, strBankCurrency, "", strBankTo, "", strPaymentRuleTo, strAmount,
            strMovementDate, "");
        CashBankOperationsData.updateSettlement(con, this, strSettlement);
      } else if (strBankTo.equals("") && strBankFrom.equals("")) { // cash
        // ->
        // cash
        CashBankOperationsData.insertSettlement(con, this, strSettlement, vars.getClient(),
            strOrgTrx, vars.getUser(), strSettlementDocumentNo, strMovementDate, strDoctypeId,
            strCashCurrency);
        String strDebtPaymentId = SequenceIdData.getUUID();

        CashBankOperationsData.insertDebtpayment(con, this, strDebtPaymentId, vars.getClient(),
            strOrgTrx, vars.getUser(), "N", strSettlement, strDescription + " - "
                + Utility.messageBD(this, "DebtPaymentFor", vars.getLanguage())
                + Utility.messageBD(this, "Cash", vars.getLanguage())
                + CashBankOperationsData.selectCashBook(this, strCashFrom), strBPartner,
            strCashCurrency, "", "", strCashFrom, strPaymentRuleFrom, strAmount, strMovementDate,
            "");
        insertCash(vars, strCashFrom, negate(strAmount), strMovementDate, strCashCurrency,
            strDescription, strDebtPaymentId, strOrgTrx, con);

        strDebtPaymentId = SequenceIdData.getUUID();

        CashBankOperationsData.insertDebtpayment(con, this, strDebtPaymentId, vars.getClient(),
            strOrgTrx, vars.getUser(), "Y", strSettlement, strDescription + " - "
                + Utility.messageBD(this, "DebtPaymentFor", vars.getLanguage())
                + Utility.messageBD(this, "Cash", vars.getLanguage())
                + CashBankOperationsData.selectCashBook(this, strCashTo), strBPartner,
            strCashCurrency, "", "", strCashTo, strPaymentRuleTo, strAmount, strMovementDate, "");
        insertCash(vars, strCashTo, strAmount, strMovementDate, strCashCurrency, strDescription,
            strDebtPaymentId, strOrgTrx, con);
        CashBankOperationsData.updateSettlement(con, this, strSettlement);
      } else if (strCashTo.equals("") && strCashFrom.equals("")) { // bank
        // ->
        // bank
        CashBankOperationsData.insertSettlement(con, this, strSettlement, vars.getClient(),
            strOrgTrx, vars.getUser(), strSettlementDocumentNo, strMovementDate, strDoctypeId,
            strBankCurrency);
        String strDebtPaymentId = SequenceIdData.getUUID();
        CashBankOperationsData.insertDebtpayment(con, this, strDebtPaymentId, vars.getClient(),
            strOrgTrx, vars.getUser(), "N", strSettlement, strDescription + " - "
                + Utility.messageBD(this, "DebtPaymentFor", vars.getLanguage())
                + CashBankOperationsData.selectBankAccount(this, strBankFrom, vars.getLanguage()),
            strBPartner, strBankCurrency, "", strBankFrom, "", strPaymentRuleFrom, strAmount,
            strMovementDate, "");
        strDebtPaymentId = SequenceIdData.getUUID();
        CashBankOperationsData.insertDebtpayment(con, this, strDebtPaymentId, vars.getClient(),
            strOrgTrx, vars.getUser(), "Y", strSettlement, strDescription + " - "
                + Utility.messageBD(this, "DebtPaymentFor", vars.getLanguage())
                + CashBankOperationsData.selectBankAccount(this, strBankTo, vars.getLanguage()),
            strBPartner, strBankCurrency, "", strBankTo, "", strPaymentRuleTo, strAmount,
            strMovementDate, "");
        CashBankOperationsData.updateSettlement(con, this, strSettlement);
      }
      releaseCommitConnection(con);
      myMessage = new OBError();
      myMessage.setType("Success");
      myMessage.setTitle("");
      myMessage.setMessage(Utility.messageBD(this, "PaymentsSettlementDocNo", vars.getLanguage())
          + "*FT*" + strSettlementDocumentNo);
    } catch (Exception e) {
      myMessage = Utility.translateError(this, vars, vars.getLanguage(), e.getMessage());
      try {
        releaseRollbackConnection(con);
View Full Code Here

      xmlDocument.setParameter("leftTabs", lBar.manualTemplate());
    } catch (Exception ex) {
      throw new ServletException(ex);
    }
    {
      OBError myMessage = vars.getMessage("CashBankOperations");
      vars.removeMessage("CashBankOperations");
      if (myMessage != null) {
        xmlDocument.setParameter("messageType", myMessage.getType());
        xmlDocument.setParameter("messageTitle", myMessage.getTitle());
        xmlDocument.setParameter("messageMessage", myMessage.getMessage());
      }
    }

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

      String strWindowPath = Utility.getTabURL(this, strTab, "R");
      if (strWindowPath.equals(""))
        strWindowPath = strDefaultServlet;

      final OBError myMessage = getPrintPage(response, vars, strKey, strModule, strType);
      vars.setMessage(strTab, myMessage);
      // vars.setSessionValue(strWindow + "|" + strTabName + ".message",
      // messageResult);
      printPageClosePopUp(response, vars, strWindowPath);
    } else
View Full Code Here

    // xmlDocument.setParameter("message",strMessage.equals("")?"":"alert('"
    // + strMessage + "');");

    {
      final OBError myMessage = vars.getMessage("InsertAcces");
      vars.removeMessage("InsertAcces");
      if (myMessage != null) {
        xmlDocument.setParameter("messageType", myMessage.getType());
        xmlDocument.setParameter("messageTitle", myMessage.getTitle());
        xmlDocument.setParameter("messageMessage", myMessage.getMessage());
      }
    }
    response.setContentType("text/html; charset=UTF-8");
    final PrintWriter out = response.getWriter();
    out.println(xmlDocument.print());
View Full Code Here

    out.close();
  }

  private OBError getPrintPage(HttpServletResponse response, VariablesSecureApp vars,
      String strKey, String strModule, String strType) throws IOException, ServletException {
    OBError myMessage = null;
    myMessage = new OBError();
    myMessage.setTitle("");
    try {
      final InsertAccesData[] accesData = InsertAccesData.select(this);
      generateAcces(vars, accesData, strKey, strModule, strType);
      myMessage.setType("Success");
      myMessage.setMessage(Utility.messageBD(this, "ProcessOK", vars.getLanguage()));
      return myMessage;
      // return Utility.messageBD(this, "ProcessOK", vars.getLanguage());
    } catch (final Exception e) {
      log4j.warn(e);
      myMessage.setType("Error");
      myMessage.setMessage(Utility.messageBD(this, "ProcessRunError", vars.getLanguage()));
      return myMessage;
      // return Utility.messageBD(this, "ProcessRunError",
      // vars.getLanguage());
    }
  }
View Full Code Here

              pgLimit);
        }
      } catch (ServletException e) {
        log4j.error("Error in print page data: " + e);
        e.printStackTrace();
        OBError myError = Utility.translateError(this, vars, vars.getLanguage(), e.getMessage());
        if (!myError.isConnectionAvailable()) {
          bdErrorAjax(response, "Error", "Connection Error", "No database connection");
          return;
        } else {
          type = myError.getType();
          title = myError.getTitle();
          if (!myError.getMessage().startsWith("<![CDATA["))
            description = "<![CDATA[" + myError.getMessage() + "]]>";
          else
            description = myError.getMessage();
        }
      } catch (Exception e) {
        if (log4j.isDebugEnabled())
          log4j.debug("Error obtaining rows data");
        type = "Error";
View Full Code Here

      xmlDocument.setParameter("leftTabs", lBar.manualTemplate());
    } catch (Exception ex) {
      throw new ServletException(ex);
    }
    {
      OBError myMessage = vars.getMessage("MInOutTraceReports");
      vars.removeMessage("MInOutTraceReports");
      if (myMessage != null) {
        xmlDocument.setParameter("messageType", myMessage.getType());
        xmlDocument.setParameter("messageTitle", myMessage.getTitle());
        xmlDocument.setParameter("messageMessage", myMessage.getMessage());
      }
    }

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

      log4j.debug("Creating parameters");
  }

  protected OBError doIt(VariablesSecureApp vars) throws ServletException {
    int no = 0;
    OBError myError = new OBError();

    ConnectionProvider conn = null;
    Connection con = null;
    String strcTaxcategoryId = null;
    try {
      conn = getConnection();
      con = conn.getTransactionConnection();
      if (m_deleteOldImported) {
        no = ImportProductData.deleteOld(con, conn, getAD_Client_ID());
        if (log4j.isDebugEnabled())
          log4j.debug("Delete Old Imported = " + no);
      }
      // Set Client, Org, IaActive, Created/Updated, ProductType
      no = ImportProductData.updateRecords(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Reset = " + no);

      // Set Optional BPartner
      no = ImportProductData.updateBPartner(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct BPartner = " + no);

      //
      no = ImportProductData.updateBPartnerError(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Invalid BPartner = " + no);

      // EAN/UPC
      no = ImportProductData.updateProductByUPC(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Product Existing UPC = " + no);

      // Value
      no = ImportProductData.updateProductByValue(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Product Existing Value = " + no);

      // BP ProdNo
      no = ImportProductData.updateProductByVendor(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Product Existing Vendor ProductNo = " + no);

      // Copy From Product if Import does not have value
      String[] strFields = new String[] { "Value", "Name", "Description", "DocumentNote", "Help",
          "UPC", "SKU", "Classification", "ProductType", "Discontinued", "DiscontinuedBy",
          "ImageURL", "DescriptionURL" };
      for (int i = 0; i < strFields.length; i++) {
        no = ImportProductData.updateProductField(con, conn, strFields[i], getAD_Client_ID());
        if (log4j.isDebugEnabled())
          log4j.debug("ImportProduct" + strFields[i] + " Default from existing Product=" + no);
      }
      String[] numFields = new String[] { "C_UOM_ID", "M_Product_Category_ID", "Volume", "Weight",
          "ShelfWidth", "ShelfHeight", "ShelfDepth", "UnitsPerPallet" };
      for (int i = 0; i < numFields.length; i++) {
        no = ImportProductData.updateProductNumField(con, conn, numFields[i], getAD_Client_ID());
        if (log4j.isDebugEnabled())
          log4j.debug("ImportProduct" + numFields[i] + " Default from existing Product=" + no);
      }

      // Copy From Product_PO if Import does not have value
      String[] strFieldsPO = new String[] { "UPC", "PriceEffective", "VendorProductNo",
          "VendorCategory", "Manufacturer", "Discontinued", "DiscontinuedBy" };
      for (int i = 0; i < strFieldsPO.length; i++) {
        no = ImportProductData.updateProductFieldPO(con, conn, strFieldsPO[i], getAD_Client_ID());
        if (no != 0)
          if (log4j.isDebugEnabled())
            log4j.debug("ImportProduct" + strFieldsPO[i] + " Default from existing Product=" + no);
      }
      String[] numFieldsPO = new String[] { "C_UOM_ID", "C_Currency_ID", "PriceList", "PricePO",
          "RoyaltyAmt", "Order_Min", "Order_Pack", "CostPerOrder", "DeliveryTime_Promised" };
      for (int i = 0; i < numFieldsPO.length; i++) {
        no = ImportProductData
            .updateProductNumFieldPO(con, conn, numFieldsPO[i], getAD_Client_ID());
        if (no != 0)
          if (log4j.isDebugEnabled())
            log4j.debug("ImportProduct" + numFieldsPO[i] + " Default from existing Product=" + no);
      }

      // Set UOM (System/own)
      no = ImportProductData.updateX12DE355(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Set UOM Default=" + no);
      //
      no = ImportProductData.updateProductUOM(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Set UOM =" + no);
      //
      no = ImportProductData.updateProductInvalidUOM(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Invalid UOM =" + no);

      // Set Product Logger (own)
      no = ImportProductData.updateProductCategoryDefault(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Set Product Category Default =" + no);
      //
      no = ImportProductData.updateProductCategory(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Set Product Category =" + no);
      //
      no = ImportProductData.updateInvalidCategory(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Invalid Product Category =" + no);

      // Set Currency
      no = ImportProductData.updateCurrencyDefault(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Set Currency Default =" + no);
      //
      no = ImportProductData.updateCurrency(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Set Currency =" + no);
      //
      no = ImportProductData.updateInvalidCurrency(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Invalid Currency =" + no);

      // Verify ProductType
      no = ImportProductData.updateInvalidProductType(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Invalid ProductType =" + no);

      // Unique UPC/Value
      no = ImportProductData.updateNotUniqueValue(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Not Unique Value =" + no);
      //
      no = ImportProductData.updateNotUniqueUPC(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Not Unique UPC =" + no);

      // Mandatory Value
      no = ImportProductData.updateNoMandatoryValue(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct No Mandatory Value =" + no);

      // Vendor Product No
      no = ImportProductData.updateVendorProductNoSetToValue(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct VendorProductNo Set to Value =" + no);
      //
      no = ImportProductData.updateNotUniqueVendorProductNo(con, conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct Not Unique VendorProductNo =" + no);

      // Get Default Tax Category
      strcTaxcategoryId = ImportProductData.selectTaxCategory(conn, getAD_Client_ID());
      if (log4j.isDebugEnabled())
        log4j.debug("ImportProduct C_TaxCategory_ID =" + strcTaxcategoryId);
      conn.releaseCommitConnection(con);
      if (strcTaxcategoryId == null || strcTaxcategoryId.equals("")) {
        // Default Tax category doesn't exist
        addLog(Utility.messageBD(conn, "MarkDefaultTaxCategory", vars.getLanguage()));
        myError.setType("Error");
        myError.setTitle(Utility.messageBD(conn, "Error", vars.getLanguage()));
        myError.setMessage(Utility.messageBD(conn, "MarkDefaultTaxCategory", vars.getLanguage()));
        return myError;
      }

    } catch (Exception se) {
      try {
        conn.releaseRollbackConnection(con);
      } catch (Exception ignored) {
      }
      se.printStackTrace();
      addLog(Utility.messageBD(conn, "ProcessRunError", vars.getLanguage()));
      myError.setType("Error");
      myError.setTitle(Utility.messageBD(conn, "Error", vars.getLanguage()));
      myError.setMessage(Utility.messageBD(conn, "ProcessRunError", vars.getLanguage()));
      return myError;
    }
    // till here, the edition of the I_ImportProduct table
    // now, the insertion from I_ImportProduct table in M_Product,
    // M_Product_PO...

    int noInsert = 0;
    int noUpdate = 0;
    int noInsertPO = 0;
    int noUpdatePO = 0;
    int noProductError = 0;

    try {
      // Go through Records
      ImportProductData[] data = ImportProductData.selectRecords(conn, getAD_Client_ID());
      for (int i = 0; i < data.length; i++) {
        String I_Product_ID = data[i].iProductId;
        String M_Product_ID = data[i].mProductId;
        String C_BPartner_ID = data[i].cBpartnerId;
        con = conn.getTransactionConnection();
        boolean newProduct = M_Product_ID.equals("");
        // Product
        if (newProduct) { // Insert new Product
          M_Product_ID = SequenceIdData.getUUID();
          try {
            if (log4j.isDebugEnabled())
              log4j.debug("before insert");
            no = ImportProductData.insertProductImport(con, conn, M_Product_ID, strcTaxcategoryId,
                I_Product_ID);
            if (log4j.isDebugEnabled())
              log4j.debug("Insert Product = " + no);
            noInsert++;
          } catch (ServletException ex) {
            if (log4j.isDebugEnabled())
              log4j.debug("Insert Product - " + ex.toString());
            conn.releaseRollbackConnection(con);
            ImportProductData.insertProductError(conn, ex.toString(), I_Product_ID);
            continue;
          }
        } else { // Update Product
          try {
            no = ImportProductData.updateProductImport(con, conn, I_Product_ID, M_Product_ID);
            if (log4j.isDebugEnabled())
              log4j.debug("Update Product = " + no);
            noUpdate++;
          } catch (ServletException ex) {
            if (log4j.isDebugEnabled())
              log4j.debug("Update Product - " + ex.toString());
            conn.releaseRollbackConnection(con);
            ImportProductData.updateProductError(conn, ex.toString(), I_Product_ID);
            continue;
          }
        }
        // Do we have PO Info
        if (!C_BPartner_ID.equals("")) {
          no = 0;
          // If Product existed, Try to Update first
          if (!newProduct) {
            try {
              no = ImportProductData.updateProductPOImport(con, conn, I_Product_ID, M_Product_ID,
                  C_BPartner_ID);
              if (log4j.isDebugEnabled())
                log4j.debug("Update Product_PO = " + no);
              noUpdatePO++;
            } catch (ServletException ex) {
              if (log4j.isDebugEnabled())
                log4j.debug("Update Product_PO - " + ex.toString());
              noUpdate--;
              conn.releaseRollbackConnection(con);
              ImportProductData.updateProductPOError(conn, ex.toString(), I_Product_ID);
              continue;
            }
          }
          try {
            if (no == 0) { // Insert PO
              no = ImportProductData.insertProductPOImport(con, conn, M_Product_ID, C_BPartner_ID,
                  I_Product_ID);
              if (log4j.isDebugEnabled())
                log4j.debug("Insert Product_PO = " + no);
              noInsertPO++;
            }
          } catch (ServletException ex) {
            if (log4j.isDebugEnabled())
              log4j.debug("Insert Product_PO - " + ex.toString());
            noInsert--; // assume that product also did not exist
            ImportProductData.insertProductPOError(conn, ex.toString(), I_Product_ID);
            conn.releaseRollbackConnection(con);
            continue;
          }
        } // C_BPartner_ID != 0
        conn.releaseCommitConnection(con);
        // Update I_Product
        if (log4j.isDebugEnabled())
          log4j.debug("before update: " + M_Product_ID + " -- " + I_Product_ID);
        no = ImportProductData.updateProductSetImportY(conn, M_Product_ID, I_Product_ID);
        if (log4j.isDebugEnabled())
          log4j.debug("after update: " + M_Product_ID + " -- " + I_Product_ID);
      } // for all I_Product
    } catch (Exception se) {
      se.printStackTrace();
      addLog(Utility.messageBD(conn, "ProcessRunError", vars.getLanguage()));
      myError.setType("Error");
      myError.setTitle(Utility.messageBD(conn, "Error", vars.getLanguage()));
      myError.setMessage(Utility.messageBD(conn, "ProcessRunError", vars.getLanguage()));
      return myError;
    }

    // Set Error to indicator to not imported
    noProductError = ImportProductData.updateNotImported(conn, getAD_Client_ID());
    if (log4j.isDebugEnabled())
      log4j.debug("Errors = " + noProductError);
    addLog(Utility.messageBD(conn, "Products not imported", vars.getLanguage()) + ": "
        + noProductError + "; ");
    addLog("Product inserted: " + noInsert + "; ");
    addLog("Product updated: " + noUpdate + "; ");
    addLog("ProductPO inserted: " + noInsertPO + "; ");
    addLog("ProductPO updated: " + noUpdatePO);

    if (noProductError == 0) {
      myError.setType("Success");
      myError.setTitle(Utility.messageBD(conn, "Success", vars.getLanguage()));
    } else if (noInsert > 0 || noUpdate > 0 || noInsertPO > 0 || noUpdatePO > 0) {
      myError.setType("Warning");
      myError.setTitle(Utility.messageBD(conn, "Some products could not be imported", vars
          .getLanguage()));
    } else {
      myError.setType("Error");
      myError.setTitle(Utility
          .messageBD(conn, " No products could be imported", vars.getLanguage()));
    }
    myError.setMessage(Utility.messageBD(conn, getLog(), vars.getLanguage()));
    return myError;
  }
View Full Code Here

      String strWindowPath = Utility.getTabURL(this, strTab, "R");
      if (strWindowPath.equals(""))
        strWindowPath = strDefaultServlet;

      OBError myError = processButton(vars, strKey, strInvoice, strWindow);
      vars.setMessage(strTab, myError);
      printPageClosePopUp(response, vars, strWindowPath);
    } else
      pageErrorPopUp(response);
  }
View Full Code Here

TOP

Related Classes of org.openbravo.erpCommon.utility.OBError

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