コード例 #1
0
  /** This method is for validation of PayrollEndFiscalPeriodCode */
  protected Message validatePayrollEndFiscalPeriodCode(
      LaborOriginEntry laborOriginEntry,
      LaborOriginEntry laborWorkingEntry,
      UniversityDate universityRunDate,
      LaborAccountingCycleCachingService laborAccountingCycleCachingService) {
    LOG.debug("validateUniversityFiscalPeriodCode() started");

    AccountingPeriod accountingPeriod = null;
    Integer tempPayrollFiscalYear = 0;
    if (laborOriginEntry.getPayrollEndDateFiscalYear() == null) {
      tempPayrollFiscalYear = universityRunDate.getUniversityFiscalYear();
    } else {
      tempPayrollFiscalYear = laborOriginEntry.getPayrollEndDateFiscalYear();
    }

    if (!laborOriginEntry.getPayrollEndDateFiscalPeriodCode().equals("")) {
      accountingPeriod =
          laborAccountingCycleCachingService.getAccountingPeriod(
              tempPayrollFiscalYear, laborOriginEntry.getPayrollEndDateFiscalPeriodCode());
      if (accountingPeriod == null) {
        return MessageBuilder.buildMessage(
            KFSKeyConstants.ERROR_PAYROLL_END_DATE_FISCAL_PERIOD,
            laborOriginEntry.getPayrollEndDateFiscalPeriodCode(),
            Message.TYPE_FATAL);
      }
    }

    return null;
  }
コード例 #2
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);
  }
コード例 #3
0
  /** This method is for validation of payrollEndFiscalYear */
  protected Message validatePayrollEndFiscalYear(
      LaborOriginEntry laborOriginEntry,
      LaborOriginEntry laborWorkingEntry,
      UniversityDate universityRunDate,
      LaborAccountingCycleCachingService laborAccountingCycleCachingService) {
    LOG.debug("validatePayrollEndFiscalYear() started");
    SystemOptions scrubbedEntryOption = null;
    if (laborOriginEntry.getPayrollEndDateFiscalYear() != null) {
      scrubbedEntryOption =
          laborAccountingCycleCachingService.getSystemOptions(
              laborOriginEntry.getPayrollEndDateFiscalYear());

      if (scrubbedEntryOption == null) {
        return MessageBuilder.buildMessage(
            KFSKeyConstants.ERROR_PAYROLL_END_DATE_FISCAL_YEAR,
            "" + laborOriginEntry.getPayrollEndDateFiscalYear(),
            Message.TYPE_FATAL);
      }
    }

    return null;
  }
コード例 #4
0
  /**
   * Validates the sub account of the origin entry
   *
   * @param originEntry the origin entry being scrubbed
   * @param workingEntry the scrubbed version of the origin entry
   * @return a Message if an error was encountered, otherwise null
   */
  protected Message validateSubAccount(
      LaborOriginEntry originEntry,
      LaborOriginEntry workingEntry,
      LaborAccountingCycleCachingService laborAccountingCycleCachingService) {
    LOG.debug("validateSubAccount() started");

    // when continuationAccount used, the subAccountNumber should be changed to dashes and skip
    // validation subAccount process
    if (continuationAccountIndicator) {
      workingEntry.setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
      return null;
    }

    // If the sub account number is empty, set it to dashes.
    // Otherwise set the workingEntry sub account number to the
    // sub account number of the input origin entry.
    if (org.springframework.util.StringUtils.hasText(originEntry.getSubAccountNumber())) {
      // sub account IS specified
      if (!KFSConstants.getDashSubAccountNumber().equals(originEntry.getSubAccountNumber())) {
        SubAccount originEntrySubAccount =
            laborAccountingCycleCachingService.getSubAccount(
                originEntry.getChartOfAccountsCode(),
                originEntry.getAccountNumber(),
                originEntry.getSubAccountNumber());
        // SubAccount originEntrySubAccount = getSubAccount(originEntry);
        if (originEntrySubAccount == null) {
          // sub account is not valid
          return MessageBuilder.buildMessage(
              KFSKeyConstants.ERROR_SUB_ACCOUNT_NOT_FOUND,
              originEntry.getChartOfAccountsCode()
                  + "-"
                  + originEntry.getAccountNumber()
                  + "-"
                  + originEntry.getSubAccountNumber(),
              Message.TYPE_FATAL);
        } else {
          // sub account IS valid
          if (originEntrySubAccount.isActive()) {
            // sub account IS active
            workingEntry.setSubAccountNumber(originEntry.getSubAccountNumber());
          } else {
            // sub account IS NOT active
            if (parameterService
                .getParameterValueAsString(
                    KfsParameterConstants.GENERAL_LEDGER_BATCH.class,
                    KFSConstants.SystemGroupParameterNames.GL_ANNUAL_CLOSING_DOC_TYPE)
                .equals(originEntry.getFinancialDocumentTypeCode())) {
              // document IS annual closing
              workingEntry.setSubAccountNumber(originEntry.getSubAccountNumber());
            } else {
              // document is NOT annual closing
              return MessageBuilder.buildMessage(
                  KFSKeyConstants.ERROR_SUB_ACCOUNT_NOT_ACTIVE,
                  originEntry.getChartOfAccountsCode()
                      + "-"
                      + originEntry.getAccountNumber()
                      + "-"
                      + originEntry.getSubAccountNumber(),
                  Message.TYPE_FATAL);
            }
          }
        }
      } else {
        // the sub account is dashes
        workingEntry.setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
      }
    } else {
      // No sub account is specified.
      workingEntry.setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
    }

    return null;
  }