/** This method changes account to suspenseAccount */ protected Message useSuspenseAccount(LaborOriginEntry workingEntry) { String suspenseAccountNumber = parameterService.getParameterValueAsString( LaborScrubberStep.class, LaborConstants.Scrubber.SUSPENSE_ACCOUNT); String suspenseCOAcode = parameterService.getParameterValueAsString( LaborScrubberStep.class, LaborConstants.Scrubber.SUSPENSE_CHART); String suspenseSubAccountNumber = parameterService.getParameterValueAsString( LaborScrubberStep.class, LaborConstants.Scrubber.SUSPENSE_SUB_ACCOUNT); Account account = accountService.getByPrimaryId(suspenseCOAcode, suspenseAccountNumber); if (ObjectUtils.isNull(account)) { return MessageBuilder.buildMessage( LaborKeyConstants.ERROR_INVALID_SUSPENSE_ACCOUNT, Message.TYPE_FATAL); } workingEntry.setAccount(account); workingEntry.setAccountNumber(suspenseAccountNumber); workingEntry.setChartOfAccountsCode(suspenseCOAcode); workingEntry.setSubAccountNumber(suspenseSubAccountNumber); return MessageBuilder.buildMessageWithPlaceHolder( LaborKeyConstants.MESSAGE_SUSPENSE_ACCOUNT_APPLIED, Message.TYPE_WARNING, new Object[] {suspenseCOAcode, suspenseAccountNumber, suspenseSubAccountNumber}); }
/** * 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); }