Search in sources :

Example 1 with SubAccountGlobal

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());
        }
    }
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) A21SubAccountChange(edu.cornell.kfs.coa.businessobject.A21SubAccountChange)

Example 2 with SubAccountGlobal

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);
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) IndirectCostRecoveryAccountChange(edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 3 with SubAccountGlobal

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);
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) IndirectCostRecoveryAccountChange(edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 4 with SubAccountGlobal

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;
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) A21SubAccountChange(edu.cornell.kfs.coa.businessobject.A21SubAccountChange)

Example 5 with SubAccountGlobal

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;
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) A21SubAccountChange(edu.cornell.kfs.coa.businessobject.A21SubAccountChange)

Aggregations

SubAccountGlobal (edu.cornell.kfs.coa.businessobject.SubAccountGlobal)14 SubAccountGlobalDetail (edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail)7 A21SubAccountChange (edu.cornell.kfs.coa.businessobject.A21SubAccountChange)5 IndirectCostRecoveryAccountChange (edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange)4 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)3 IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount)3 HashMap (java.util.HashMap)1 IndirectCostRecoveryRateDetail (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryRateDetail)1 SubAccount (org.kuali.kfs.coa.businessobject.SubAccount)1 DataDictionaryService (org.kuali.kfs.kns.service.DataDictionaryService)1 MaintenanceLock (org.kuali.kfs.krad.maintenance.MaintenanceLock)1 ConfigurationService (org.kuali.rice.core.api.config.property.ConfigurationService)1