/**
   * Using the selected accounting period to determine university fiscal year and look up all the
   * encumbrance balance type - check if the selected balance type is for encumbrance
   *
   * @return true/false - true if it is an encumbrance balance type
   */
  public boolean getIsEncumbranceBalanceType() {
    // get encumbrance balance type list
    BalanceTypeService balanceTypeSerivce = SpringContext.getBean(BalanceTypeService.class);
    List<String> encumbranceBalanceTypes =
        balanceTypeSerivce.getEncumbranceBalanceTypes(getSelectedPostingYear());

    return encumbranceBalanceTypes.contains(selectedBalanceType.getCode());
  }
  /**
   * This method will fully populate a balance type given the passed in code, by calling the
   * business object service that retrieves the rest of the instances' information.
   *
   * @param balanceTypeCode
   * @return BalanceTyp
   */
  protected BalanceType getPopulatedBalanceTypeInstance(String balanceTypeCode) {
    // now we have to get the code and the name of the original and new balance types
    BalanceTypeService bts = SpringContext.getBean(BalanceTypeService.class);

    BalanceType balanceType = bts.getBalanceTypeByCode(balanceTypeCode);
    balanceType.setCode(balanceTypeCode);
    return balanceType;
  }
Example #3
0
  /**
   * Checks the continuation account system indicator. If on checks whether the account is expired
   * or closed, and if so calls the contination logic.
   */
  protected Message handleExpiredClosedAccount(
      Account account,
      LaborOriginEntry laborOriginEntry,
      LaborOriginEntry laborWorkingEntry,
      UniversityDate universityRunDate) {
    List<String> continuationAccountBypassBalanceTypeCodes =
        balanceTypService.getContinuationAccountBypassBalanceTypeCodes(
            universityRunDate.getUniversityFiscalYear());
    List<String> continuationAccountBypassOriginationCodes =
        new ArrayList<String>(
            parameterService.getParameterValuesAsString(
                LaborScrubberStep.class,
                LaborConstants.Scrubber.CONTINUATION_ACCOUNT_BYPASS_ORIGINATION_CODES));
    List<String> continuationAccountBypassDocumentTypeCodes =
        new ArrayList<String>(
            parameterService.getParameterValuesAsString(
                LaborScrubberStep.class,
                LaborConstants.Scrubber.CONTINUATION_ACCOUNT_BYPASS_DOCUMENT_TYPE_CODES));

    Calendar today = Calendar.getInstance();
    today.setTime(universityRunDate.getUniversityDate());

    long offsetAccountExpirationTime = getAdjustedAccountExpirationDate(account);
    boolean isAccountExpiredOrClosed =
        (account.getAccountExpirationDate() != null && isAccountExpired(account, universityRunDate))
            || !account.isActive();
    boolean continuationAccountLogicInd =
        parameterService.getParameterValueAsBoolean(
            LaborScrubberStep.class, LaborConstants.Scrubber.CONTINUATION_ACCOUNT_LOGIC_PARAMETER);

    if (continuationAccountLogicInd && isAccountExpiredOrClosed) {
      // special checks for origination codes that have override ability
      boolean isOverrideOriginCode =
          continuationAccountBypassOriginationCodes.contains(
              laborOriginEntry.getFinancialSystemOriginationCode());
      if (isOverrideOriginCode && !account.isActive()) {
        return MessageBuilder.buildMessage(
            KFSKeyConstants.ERROR_ORIGIN_CODE_CANNOT_HAVE_CLOSED_ACCOUNT,
            laborOriginEntry.getChartOfAccountsCode() + "-" + laborOriginEntry.getAccountNumber(),
            Message.TYPE_FATAL);
      }

      boolean canBypass =
          isOverrideOriginCode
              || continuationAccountBypassBalanceTypeCodes.contains(
                  laborOriginEntry.getFinancialBalanceTypeCode())
              || continuationAccountBypassDocumentTypeCodes.contains(
                  laborOriginEntry.getFinancialDocumentTypeCode().trim());
      if (account.isActive() && canBypass) {
        return null;
      }

      return continuationAccountLogic(
          account, laborOriginEntry, laborWorkingEntry, universityRunDate);
    }

    return null;
  }