Search in sources :

Example 1 with LaborObject

use of org.kuali.kfs.module.ld.businessobject.LaborObject in project cu-kfs by CU-CommunityApps.

the class CuScrubberValidatorImpl method checkAccountFringeIndicator.

/**
 * Overridden to clear out the sub-account number on fringe transactions
 * if the transaction had its account number modified.
 *
 * @see org.kuali.kfs.module.ld.batch.service.impl.ScrubberValidatorImpl#checkAccountFringeIndicator(
 * org.kuali.kfs.module.ld.businessobject.LaborOriginEntry, org.kuali.kfs.module.ld.businessobject.LaborOriginEntry,
 * org.kuali.kfs.coa.businessobject.Account, org.kuali.kfs.sys.businessobject.UniversityDate,
 * org.kuali.kfs.module.ld.batch.service.LaborAccountingCycleCachingService)
 */
@Override
protected Message checkAccountFringeIndicator(LaborOriginEntry laborOriginEntry, LaborOriginEntry laborWorkingEntry, Account account, UniversityDate universityRunDate, LaborAccountingCycleCachingService laborAccountingCycleCachingService) {
    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());
    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() });
            }
            clearSubAccountOnModifiedFringeTransaction(laborOriginEntry, laborWorkingEntry, laborAccountingCycleCachingService, err);
            return err;
        }
        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);
}
Also used : Account(org.kuali.kfs.coa.businessobject.Account) Message(org.kuali.kfs.sys.Message) LaborObject(org.kuali.kfs.module.ld.businessobject.LaborObject) LaborObject(org.kuali.kfs.module.ld.businessobject.LaborObject)

Example 2 with LaborObject

use of org.kuali.kfs.module.ld.businessobject.LaborObject in project cu-kfs by CU-CommunityApps.

the class CULaborObjectDaoOjb method getByPrimaryId.

public LaborObject getByPrimaryId(int fiscalYear, String chartCode, String objectCode) {
    Criteria criteria = new Criteria();
    criteria.addEqualTo("universityFiscalYear", fiscalYear);
    criteria.addEqualTo("chartOfAccountsCode", chartCode == null ? chartCode : chartCode.toUpperCase());
    criteria.addEqualTo("financialObjectCode", objectCode == null ? objectCode : objectCode.toUpperCase());
    return (LaborObject) getPersistenceBrokerTemplate().getObjectByQuery(QueryFactory.newQuery(LaborObject.class, criteria));
}
Also used : LaborObject(org.kuali.kfs.module.ld.businessobject.LaborObject) Criteria(org.apache.ojb.broker.query.Criteria)

Example 3 with LaborObject

use of org.kuali.kfs.module.ld.businessobject.LaborObject in project cu-kfs by CU-CommunityApps.

the class CULaborObjectServiceImplTest method testGetByPrimaryKey.

public void testGetByPrimaryKey() throws IOException {
    LaborObject laborObject = cuLaborObjectService.getByPrimaryKey(2013, "IT", "5150");
    assertEquals("S", laborObject.getFinancialObjectFringeOrSalaryCode());
}
Also used : LaborObject(org.kuali.kfs.module.ld.businessobject.LaborObject)

Example 4 with LaborObject

use of org.kuali.kfs.module.ld.businessobject.LaborObject in project cu-kfs by CU-CommunityApps.

the class CULaborObjectServiceImplTest method testGetByPrimaryKeyBad.

public void testGetByPrimaryKeyBad() throws IOException {
    LaborObject laborObject = cuLaborObjectService.getByPrimaryKey(2013, "IT", "1289");
    assertNull(laborObject);
}
Also used : LaborObject(org.kuali.kfs.module.ld.businessobject.LaborObject)

Aggregations

LaborObject (org.kuali.kfs.module.ld.businessobject.LaborObject)4 Criteria (org.apache.ojb.broker.query.Criteria)1 Account (org.kuali.kfs.coa.businessobject.Account)1 Message (org.kuali.kfs.sys.Message)1