Search in sources :

Example 6 with SubAccountGlobalDetail

use of edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail in project cu-kfs by CU-CommunityApps.

the class SubAccountGlobalRule method processCustomAddCollectionLineBusinessRules.

/**
 * @see org.kuali.kfs.kns.maintenance.rules.MaintenanceDocumentRuleBase#processCustomAddCollectionLineBusinessRules(org.kuali.kfs.kns.document.MaintenanceDocument, java.lang.String, org.kuali.kfs.krad.bo.PersistableBusinessObject)
 */
@Override
public boolean processCustomAddCollectionLineBusinessRules(MaintenanceDocument document, String collectionName, PersistableBusinessObject line) {
    boolean success = true;
    success &= super.processCustomAddCollectionLineBusinessRules(document, collectionName, line);
    if (line instanceof SubAccountGlobalDetail) {
        SubAccountGlobalDetail detail = (SubAccountGlobalDetail) line;
        success &= checkSubAccountDetail(detail);
    }
    return success;
}
Also used : SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail)

Example 7 with SubAccountGlobalDetail

use of edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail in project cu-kfs by CU-CommunityApps.

the class SubAccountGlobalRule method checkSubAccountDetails.

/**
 * Checks that at least one sub account is entered.
 *
 * @return true if at least one sub account entered, false otherwise
 */
public boolean checkSubAccountDetails() {
    boolean success = true;
    SubAccountGlobal newSubAccountGlobal = (SubAccountGlobal) super.getNewBo();
    List<SubAccountGlobalDetail> details = newSubAccountGlobal.getSubAccountGlobalDetails();
    // check if there are any accounts
    if (details.size() == 0) {
        putFieldError(KFSConstants.MAINTENANCE_ADD_PREFIX + CUKFSPropertyConstants.SUB_ACCOUNT_GLBL_CHANGE_DETAILS + "." + KFSPropertyConstants.ACCOUNT_NUMBER, CUKFSKeyConstants.ERROR_DOCUMENT_GLOBAL_SUS_ACCOUNT_NO_SUB_ACCOUNTS);
        success = false;
    }
    return success;
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail)

Example 8 with SubAccountGlobalDetail

use of edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail in project cu-kfs by CU-CommunityApps.

the class SubAccountGlobalRule method checkCgRules.

/**
 * Checks CG rules.
 *
 * @param document
 * @return true if valid, false otherwise
 */
protected boolean checkCgRules(MaintenanceDocument document) {
    boolean success = true;
    SubAccountGlobal newSubAccountGlobal = (SubAccountGlobal) super.getNewBo();
    List<SubAccountGlobalDetail> subAccountGlobalDetails = newSubAccountGlobal.getSubAccountGlobalDetails();
    for (SubAccountGlobalDetail subAccountGlobalDetail : subAccountGlobalDetails) {
        success &= checkCgRules(newSubAccountGlobal, subAccountGlobalDetail);
    }
    return success;
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail)

Example 9 with SubAccountGlobalDetail

use of edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail in project cu-kfs by CU-CommunityApps.

the class GlobalIndirectCostRecoveryAccountsRuleTest method testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Fail.

@Test
public void testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Fail() {
    LOG.debug("enter testSubAccountGlobalCheckICRAccountTotalDistributionOnDetailWillBe100PercentAfterUpdate_Fail");
    SubAccountGlobal subAccountGlobal = (SubAccountGlobal) SubAccountGlobalFixture.SUB_ACCT_GLOBAL_1111111_2222222_98_2.getSubAccountGlobal();
    SubAccountGlobalDetail subAccountGlobalDetail = SubAccountGlobalDetailFixture.SUB_ACCOUNT_GLOBAL_DETAIL_3333333_100_INACTIVATE.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);
    assertFalse("Updated Sub Account Global ICR account distribution should NOT 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)

Aggregations

SubAccountGlobalDetail (edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail)9 SubAccountGlobal (edu.cornell.kfs.coa.businessobject.SubAccountGlobal)7 ArrayList (java.util.ArrayList)4 IndirectCostRecoveryAccountChange (edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange)3 Test (org.junit.Test)3 IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount)3 AccountGlobalDetail (org.kuali.kfs.coa.businessobject.AccountGlobalDetail)1 SubAccount (org.kuali.kfs.coa.businessobject.SubAccount)1 MaintenanceLock (org.kuali.kfs.krad.maintenance.MaintenanceLock)1