use of org.kuali.kfs.coa.businessobject.Account in project cu-kfs by CU-CommunityApps.
the class AwsAccountingXmlDocumentAccountingLineServiceImplTest method createMockAccount.
private static Account createMockAccount(AwsAccountFixture accountFixture) {
Account account = mock(Account.class);
when(account.isClosed()).thenReturn(!accountFixture.active);
when(account.isExpired()).thenReturn(accountFixture.expired);
return account;
}
use of org.kuali.kfs.coa.businessobject.Account in project cu-kfs by CU-CommunityApps.
the class CuRequisitionDocument method getAccountsForAwardRouting.
public List<Account> getAccountsForAwardRouting() {
List<Account> accounts = new ArrayList<Account>();
ParameterService parameterService = SpringContext.getBean(ParameterService.class);
for (PurApItem item : (List<PurApItem>) this.getItems()) {
for (PurApAccountingLine accountingLine : item.getSourceAccountingLines()) {
if (isObjectCodeAllowedForAwardRouting(accountingLine, parameterService)) {
if (ObjectUtils.isNull(accountingLine.getAccount())) {
accountingLine.refreshReferenceObject("account");
}
if (accountingLine.getAccount() != null && !accounts.contains(accountingLine.getAccount())) {
accounts.add(accountingLine.getAccount());
}
}
}
}
return accounts;
}
use of org.kuali.kfs.coa.businessobject.Account in project cu-kfs by CU-CommunityApps.
the class CuScrubberProcessImpl method setupEntryWithPotentialContinuation.
/**
* Helper method for configuring the chart, account and sub-account on the cost-share-source-account entry,
* using the cost share account's continuation account or descendant (up to a depth of 10) in the
* event of a closed cost share account.
*
* @param costShareSourceAccountEntry The origin entry to configure.
* @param scrubbedEntryA21SubAccount The A21 sub-account from the original scrubbed origin entry.
* @return A ScrubberProcessTransactionError if a valid cost share or continuation account could not be found, null otherwise.
*/
protected ScrubberProcessTransactionError setupEntryWithPotentialContinuation(OriginEntryFull costShareSourceAccountEntry, A21SubAccount scrubbedEntryA21SubAccount) {
Account costShareAccount = accountingCycleCachingService.getAccount(scrubbedEntryA21SubAccount.getCostShareChartOfAccountCode(), scrubbedEntryA21SubAccount.getCostShareSourceAccountNumber());
if (ObjectUtils.isNotNull(costShareAccount) && costShareAccount.isClosed()) {
// Cost share source account is closed; check for a valid continuation account.
Account continuationAccount = costShareAccount;
for (int i = 0; i < CONTINUATION_ACCOUNT_DEPTH_LIMIT && ObjectUtils.isNotNull(continuationAccount) && continuationAccount.isClosed(); i++) {
continuationAccount = accountingCycleCachingService.getAccount(continuationAccount.getContinuationFinChrtOfAcctCd(), continuationAccount.getContinuationAccountNumber());
}
if (ObjectUtils.isNull(continuationAccount) || costShareAccount == continuationAccount || continuationAccount.isClosed()) {
// Could not find a valid Cost Share continuation account; return an error.
return new ScrubberProcessTransactionError(costShareSourceAccountEntry, new Message(MessageFormat.format(configurationService.getPropertyValueAsString(CUKFSKeyConstants.ERROR_CSACCOUNT_CONTINUATION_ACCOUNT_CLOSED), scrubbedEntryA21SubAccount.getCostShareChartOfAccountCode(), scrubbedEntryA21SubAccount.getCostShareSourceAccountNumber()), Message.TYPE_FATAL));
} else {
// Found a valid Cost Share continuation account, so use it.
LOG.warn(MessageFormat.format(configurationService.getPropertyValueAsString(CUKFSKeyConstants.WARNING_CSACCOUNT_CONTINUATION_ACCOUNT_USED), scrubbedEntryA21SubAccount.getCostShareChartOfAccountCode(), scrubbedEntryA21SubAccount.getCostShareSourceAccountNumber(), continuationAccount.getChartOfAccountsCode(), continuationAccount.getAccountNumber()));
costShareSourceAccountEntry.setChartOfAccountsCode(continuationAccount.getChartOfAccountsCode());
costShareSourceAccountEntry.setAccountNumber(continuationAccount.getAccountNumber());
costShareSourceAccountEntry.setSubAccountNumber(KFSConstants.getDashSubAccountNumber());
}
} else {
// Cost Share source account is still open, so use it.
costShareSourceAccountEntry.setChartOfAccountsCode(scrubbedEntryA21SubAccount.getCostShareChartOfAccountCode());
costShareSourceAccountEntry.setAccountNumber(scrubbedEntryA21SubAccount.getCostShareSourceAccountNumber());
costShareSourceAccountEntry.setSubAccountNumber(scrubbedEntryA21SubAccount.getCostShareSourceSubAccountNumber());
}
return null;
}
Aggregations