示例#1
0
  /**
   * For fringe transaction types checks if the account accepts fringe benefits. If not, retrieves
   * the alternative account, then calls expiration checking on either the alternative account or
   * the account passed in.
   */
  protected Message checkAccountFringeIndicator(
      LaborOriginEntry laborOriginEntry,
      LaborOriginEntry laborWorkingEntry,
      Account account,
      UniversityDate universityRunDate,
      LaborAccountingCycleCachingService laborAccountingCycleCachingService) {
    // check for fringe tranaction type
    // LaborObject laborObject = (LaborObject)
    // businessObjectService.findByPrimaryKey(LaborObject.class, fieldValues);
    LaborObject laborObject =
        laborAccountingCycleCachingService.getLaborObject(
            laborOriginEntry.getUniversityFiscalYear(),
            laborOriginEntry.getChartOfAccountsCode(),
            laborOriginEntry.getFinancialObjectCode());
    boolean isFringeTransaction =
        laborObject != null
            && org.apache.commons.lang.StringUtils.equals(
                LaborConstants.BenefitExpenseTransfer.LABOR_LEDGER_BENEFIT_CODE,
                laborObject.getFinancialObjectFringeOrSalaryCode());

    // alternative account handling for non fringe accounts
    if (isFringeTransaction && !account.isAccountsFringesBnftIndicator()) {
      Account altAccount =
          accountService.getByPrimaryId(
              laborOriginEntry.getAccount().getReportsToChartOfAccountsCode(),
              laborOriginEntry.getAccount().getReportsToAccountNumber());
      if (ObjectUtils.isNotNull(altAccount)) {
        laborWorkingEntry.setAccount(altAccount);
        laborWorkingEntry.setAccountNumber(altAccount.getAccountNumber());
        laborWorkingEntry.setChartOfAccountsCode(altAccount.getChartOfAccountsCode());
        Message err =
            handleExpiredClosedAccount(
                altAccount, laborOriginEntry, laborWorkingEntry, universityRunDate);
        if (err == null) {
          err =
              MessageBuilder.buildMessageWithPlaceHolder(
                  LaborKeyConstants.MESSAGE_FRINGES_MOVED_TO,
                  Message.TYPE_WARNING,
                  new Object[] {altAccount.getAccountNumber()});
        }
        return err;
      }

      // no alt acct, use suspense acct if active
      boolean suspenseAccountLogicInd =
          parameterService.getParameterValueAsBoolean(
              LaborScrubberStep.class, LaborConstants.Scrubber.SUSPENSE_ACCOUNT_LOGIC_PARAMETER);
      if (suspenseAccountLogicInd) {
        return useSuspenseAccount(laborWorkingEntry);
      }

      return MessageBuilder.buildMessage(
          LaborKeyConstants.ERROR_NON_FRINGE_ACCOUNT_ALTERNATIVE_NOT_FOUND, Message.TYPE_FATAL);
    }

    return handleExpiredClosedAccount(
        account, laborOriginEntry, laborWorkingEntry, universityRunDate);
  }
示例#2
0
  /** Performs Account Validation. */
  protected Message validateAccount(
      LaborOriginEntry laborOriginEntry,
      LaborOriginEntry laborWorkingEntry,
      UniversityDate universityRunDate,
      LaborAccountingCycleCachingService laborAccountingCycleCachingService) {
    LOG.debug("validateAccount() started");

    Account account = laborOriginEntry.getAccount();
    boolean suspenseAccountLogicInd =
        parameterService.getParameterValueAsBoolean(
            LaborScrubberStep.class, LaborConstants.Scrubber.SUSPENSE_ACCOUNT_LOGIC_PARAMETER);
    if (ObjectUtils.isNull(account)) {
      if (suspenseAccountLogicInd) {
        return useSuspenseAccount(laborWorkingEntry);
      }
      return MessageBuilder.buildMessage(
          KFSKeyConstants.ERROR_ACCOUNT_NOT_FOUND,
          laborOriginEntry.getChartOfAccountsCode() + "-" + laborOriginEntry.getAccountNumber(),
          Message.TYPE_FATAL);
    }

    // default
    laborWorkingEntry.setAccount(account);
    laborWorkingEntry.setChartOfAccountsCode(account.getChartOfAccountsCode());
    laborWorkingEntry.setAccountNumber(account.getAccountNumber());

    // no further validation for gl annual doc type
    String glAnnualClosingType =
        parameterService.getParameterValueAsString(
            KfsParameterConstants.GENERAL_LEDGER_BATCH.class,
            KFSConstants.SystemGroupParameterNames.GL_ANNUAL_CLOSING_DOC_TYPE);
    if (glAnnualClosingType.equals(laborOriginEntry.getFinancialDocumentTypeCode())) {
      return null;
    }

    // Sub-Fund Wage Exclusion
    String orginationCode = laborOriginEntry.getFinancialSystemOriginationCode();
    List<String> nonWageSubfundBypassOriginationCodes =
        new ArrayList<String>(
            parameterService.getParameterValuesAsString(
                LaborScrubberStep.class,
                LaborConstants.Scrubber.NON_WAGE_SUB_FUND_BYPASS_ORIGINATIONS));
    boolean subfundWageExclusionInd =
        parameterService.getParameterValueAsBoolean(
            LaborScrubberStep.class, LaborConstants.Scrubber.SUBFUND_WAGE_EXCLUSION_PARAMETER);

    if (subfundWageExclusionInd
        && !account.getSubFundGroup().isSubFundGroupWagesIndicator()
        && !nonWageSubfundBypassOriginationCodes.contains(orginationCode)) {
      if (suspenseAccountLogicInd) {
        return useSuspenseAccount(laborWorkingEntry);
      }

      return MessageBuilder.buildMessage(
          LaborKeyConstants.ERROR_SUN_FUND_NOT_ACCEPT_WAGES, Message.TYPE_FATAL);
    }

    // Account Fringe Validation
    List<String> nonFringeAccountBypassOriginationCodes =
        new ArrayList<String>(
            parameterService.getParameterValuesAsString(
                LaborScrubberStep.class,
                LaborConstants.Scrubber.NON_FRINGE_ACCOUNT_BYPASS_ORIGINATIONS));
    boolean accountFringeExclusionInd =
        parameterService.getParameterValueAsBoolean(
            LaborScrubberStep.class, LaborConstants.Scrubber.ACCOUNT_FRINGE_EXCLUSION_PARAMETER);

    if (accountFringeExclusionInd
        && !nonFringeAccountBypassOriginationCodes.contains(orginationCode)) {
      return checkAccountFringeIndicator(
          laborOriginEntry,
          laborWorkingEntry,
          account,
          universityRunDate,
          laborAccountingCycleCachingService);
    }

    // Expired/Closed Validation
    return handleExpiredClosedAccount(
        laborOriginEntry.getAccount(), laborOriginEntry, laborWorkingEntry, universityRunDate);
  }