use of edu.cornell.kfs.coa.businessobject.SubAccountGlobal in project cu-kfs by CU-CommunityApps.
the class SubAccountGlobalMaintainableImpl method prepareGlobalsForSave.
/**
* Overriden to set the document number on the a21SubAccount.
*
* @see org.kuali.kfs.kns.maintenance.KualiGlobalMaintainableImpl#prepareGlobalsForSave()
*/
@Override
protected void prepareGlobalsForSave() {
SubAccountGlobal subAccountGlobal = (SubAccountGlobal) businessObject;
super.prepareGlobalsForSave();
if (businessObject != null) {
A21SubAccountChange a21SubAccount = subAccountGlobal.getA21SubAccount();
if (a21SubAccount != null) {
a21SubAccount.setDocumentNumber(getDocumentNumber());
}
}
}
use of edu.cornell.kfs.coa.businessobject.SubAccountGlobal in project cu-kfs by CU-CommunityApps.
the class GlobalIndirectCostRecoveryAccountsRuleTest method testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdateTwoSameAccounts_Pass.
@Test
public void testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdateTwoSameAccounts_Pass() {
LOG.debug("enter testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdateTwoSameAccounts_Pass");
SubAccountGlobal subAccountGlobal = (SubAccountGlobal) SubAccountGlobalFixture.SUB_ACCT_GLOBAL_1111111_2222222_3333333_98_2_ACTIVE_100_INACTIVE.getSubAccountGlobal();
SubAccountGlobalDetail subAccountGlobalDetail = SubAccountGlobalDetailFixture.SUB_ACCOUNT_GLOBAL_DETAIL_1111111_98_INACTIVE_98_INACTIVE_3333333_100_PERCENT_ACTIVE.getSubAccountGlobalDetail();
List<IndirectCostRecoveryAccount> existingIcrAccountsOnDetail = new ArrayList<IndirectCostRecoveryAccount>();
existingIcrAccountsOnDetail.addAll(subAccountGlobalDetail.getSubAccount().getA21SubAccount().getA21IndirectCostRecoveryAccounts());
LOG.debug("updates");
List<IndirectCostRecoveryAccountChange> updates = subAccountGlobal.getIndirectCostRecoveryAccounts();
logDetailsForIcrAccountChanges(updates);
LOG.debug("existing");
logDetailsForIcrAccounts(existingIcrAccountsOnDetail);
boolean result = globalIndirectCostRecoveryAccountsRule.checkICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate(updates, existingIcrAccountsOnDetail, subAccountGlobalDetail, subAccountGlobal);
assertTrue("Updated Sub Account Global ICR account distribution should have been 100%", result);
}
use of edu.cornell.kfs.coa.businessobject.SubAccountGlobal in project cu-kfs by CU-CommunityApps.
the class GlobalIndirectCostRecoveryAccountsRuleTest method testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Pass.
@Test
public void testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Pass() {
LOG.debug("enter testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Pass");
SubAccountGlobal subAccountGlobal = (SubAccountGlobal) SubAccountGlobalFixture.SUB_ACCT_GLOBAL_3333333_100_ACTIVE_1111111_2222222_98_2_INACTIVE.getSubAccountGlobal();
SubAccountGlobalDetail subAccountGlobalDetail = SubAccountGlobalDetailFixture.SUB_ACCOUNT_GLOBAL_DETAIL_1111111_2222222_98_2.getSubAccountGlobalDetail();
List<IndirectCostRecoveryAccount> existingIcrAccountsOnDetail = new ArrayList<IndirectCostRecoveryAccount>();
existingIcrAccountsOnDetail.addAll(subAccountGlobalDetail.getSubAccount().getA21SubAccount().getA21IndirectCostRecoveryAccounts());
LOG.debug("updates");
List<IndirectCostRecoveryAccountChange> updates = subAccountGlobal.getIndirectCostRecoveryAccounts();
logDetailsForIcrAccountChanges(updates);
LOG.debug("existing");
logDetailsForIcrAccounts(existingIcrAccountsOnDetail);
boolean result = globalIndirectCostRecoveryAccountsRule.checkICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate(updates, existingIcrAccountsOnDetail, subAccountGlobalDetail, subAccountGlobal);
assertTrue("Updated Sub Account Global ICR account distribution should have been 100%", result);
}
use of edu.cornell.kfs.coa.businessobject.SubAccountGlobal in project cu-kfs by CU-CommunityApps.
the class SubAccountGlobalRule method checkCgIcrIsEmpty.
/**
* This method tests if all fields in the ICR section are empty.
*
* @return true if the ICR values passed in are empty, otherwise false.
*/
protected boolean checkCgIcrIsEmpty() {
boolean success = true;
SubAccountGlobal newSubAccountGlobal = (SubAccountGlobal) super.getNewBo();
A21SubAccountChange newA21SubAccount = newSubAccountGlobal.getA21SubAccount();
if (ObjectUtils.isNotNull(newA21SubAccount)) {
success &= StringUtils.isEmpty(newA21SubAccount.getFinancialIcrSeriesIdentifier());
success &= StringUtils.isEmpty(newA21SubAccount.getIndirectCostRecoveryTypeCode());
}
return success;
}
use of edu.cornell.kfs.coa.businessobject.SubAccountGlobal in project cu-kfs by CU-CommunityApps.
the class SubAccountGlobalRule method checkCgCostSharingRules.
/**
* This checks that if the cost share information is filled out that it is valid and exists, or if fields are missing (such as
* the chart of accounts code and account number) an error is recorded
*
* @return true if all cost share fields filled out correctly, false if the chart of accounts code and account number for cost
* share are missing
*/
protected boolean checkCgCostSharingRules(String subAccountTypeCode) {
boolean success = true;
boolean allFieldsSet = false;
SubAccountGlobal newSubAccountGlobal = (SubAccountGlobal) super.getNewBo();
A21SubAccountChange a21 = newSubAccountGlobal.getA21SubAccount();
// check to see if all required fields are set
if (StringUtils.isNotEmpty(a21.getCostShareChartOfAccountCode()) && StringUtils.isNotEmpty(a21.getCostShareSourceAccountNumber())) {
allFieldsSet = true;
}
// Cost Sharing COA Code and Cost Sharing Account Number are required
if (!allFieldsSet && StringUtils.isNotBlank(a21.getCostShareChartOfAccountCode())) {
success &= checkEmptyBOField(KFSPropertyConstants.A21_SUB_ACCOUNT + "." + KFSPropertyConstants.COST_SHARE_SOURCE_ACCOUNT_NUMBER, a21.getCostShareSourceAccountNumber(), getDisplayName(KFSPropertyConstants.A21_SUB_ACCOUNT + "." + KFSPropertyConstants.COST_SHARE_SOURCE_ACCOUNT_NUMBER));
}
if (!allFieldsSet && StringUtils.isNotBlank(a21.getCostShareSourceAccountNumber())) {
success &= checkEmptyBOField(KFSPropertyConstants.A21_SUB_ACCOUNT + "." + KFSPropertyConstants.COST_SHARE_SOURCE_CHART_OF_ACCOUNTS_CODE, a21.getCostShareChartOfAccountCode(), getDisplayName(KFSPropertyConstants.A21_SUB_ACCOUNT + "." + KFSPropertyConstants.COST_SHARE_SOURCE_CHART_OF_ACCOUNTS_CODE));
}
a21.refreshReferenceObject(KFSPropertyConstants.COST_SHARE_SOURCE_ACCOUNT);
// existence test on Cost Share Account
if (allFieldsSet) {
if (ObjectUtils.isNull(a21.getCostShareAccount())) {
putFieldError(KFSPropertyConstants.A21_SUB_ACCOUNT + "." + KFSPropertyConstants.COST_SHARE_SOURCE_ACCOUNT_NUMBER, KFSKeyConstants.ERROR_EXISTENCE, getDisplayName(KFSPropertyConstants.A21_SUB_ACCOUNT + "." + KFSPropertyConstants.COST_SHARE_SOURCE_ACCOUNT_NUMBER));
success &= false;
}
}
a21.refreshReferenceObject(KFSPropertyConstants.COST_SHARE_SOURCE_SUB_ACCOUNT);
// existence test on Cost Share SubAccount
if (allFieldsSet && StringUtils.isNotBlank(a21.getCostShareSourceSubAccountNumber())) {
if (ObjectUtils.isNull(a21.getCostShareSourceSubAccount())) {
putFieldError(KFSPropertyConstants.A21_SUB_ACCOUNT + "." + KFSPropertyConstants.COST_SHARE_SOURCE_SUB_ACCOUNT_NUMBER, KFSKeyConstants.ERROR_EXISTENCE, getDisplayName(KFSPropertyConstants.A21_SUB_ACCOUNT + "." + KFSPropertyConstants.COST_SHARE_SOURCE_SUB_ACCOUNT_NUMBER));
success &= false;
}
}
return success;
}
Aggregations