Search in sources :

Example 1 with A21SubAccountChange

use of edu.cornell.kfs.coa.businessobject.A21SubAccountChange 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 A21SubAccountChange

use of edu.cornell.kfs.coa.businessobject.A21SubAccountChange 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 3 with A21SubAccountChange

use of edu.cornell.kfs.coa.businessobject.A21SubAccountChange 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)

Example 4 with A21SubAccountChange

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

the class SubAccountGlobalRule method checkCgCostSharingIsEmpty.

/**
 * This method tests if all fields in the Cost Sharing section are empty.
 *
 * @return true if the cost sharing values passed in are empty, otherwise false.
 */
protected boolean checkCgCostSharingIsEmpty(SubAccountGlobalDetail subAccountGlobalDetail) {
    boolean success = true;
    SubAccountGlobal newSubAccountGlobal = (SubAccountGlobal) super.getNewBo();
    A21SubAccountChange newA21SubAccount = newSubAccountGlobal.getA21SubAccount();
    boolean cgCostSharingEmptyOnGlobal = true;
    if (ObjectUtils.isNotNull(newA21SubAccount)) {
        cgCostSharingEmptyOnGlobal &= StringUtils.isEmpty(newA21SubAccount.getCostShareChartOfAccountCode());
        cgCostSharingEmptyOnGlobal &= StringUtils.isEmpty(newA21SubAccount.getCostShareSourceAccountNumber());
        cgCostSharingEmptyOnGlobal &= StringUtils.isEmpty(newA21SubAccount.getCostShareSourceSubAccountNumber());
    }
    success &= cgCostSharingEmptyOnGlobal;
    return success;
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) A21SubAccountChange(edu.cornell.kfs.coa.businessobject.A21SubAccountChange)

Example 5 with A21SubAccountChange

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

the class SubAccountGlobalRule method checkCgIcrRules.

/**
 * This checks that if the ICR information is entered that it is valid for this fiscal year and that all of its fields are valid
 * as well (such as account)
 *
 * @return true if the ICR information is filled in and it is valid
 */
protected boolean checkCgIcrRules(String subAccountTypeCode, SubAccountGlobalDetail subAccountGlobalDetail) {
    SubAccountGlobal newSubAccountGlobal = (SubAccountGlobal) super.getNewBo();
    A21SubAccountChange a21 = newSubAccountGlobal.getA21SubAccount();
    if (ObjectUtils.isNull(a21)) {
        return true;
    }
    boolean success = true;
    // existence check for Financial Series ID
    if (StringUtils.isNotEmpty(a21.getFinancialIcrSeriesIdentifier())) {
        String fiscalYear = StringUtils.EMPTY + SpringContext.getBean(UniversityDateService.class).getCurrentFiscalYear();
        String icrSeriesId = a21.getFinancialIcrSeriesIdentifier();
        Map<String, String> pkMap = new HashMap<String, String>();
        pkMap.put(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR, fiscalYear);
        pkMap.put(KFSPropertyConstants.FINANCIAL_ICR_SERIES_IDENTIFIER, icrSeriesId);
        Collection<IndirectCostRecoveryRateDetail> icrRateDetails = getBoService().findMatching(IndirectCostRecoveryRateDetail.class, pkMap);
        if (ObjectUtils.isNull(icrRateDetails) || icrRateDetails.isEmpty()) {
            String label = SpringContext.getBean(DataDictionaryService.class).getAttributeLabel(A21SubAccount.class, KFSPropertyConstants.FINANCIAL_ICR_SERIES_IDENTIFIER);
            putFieldError(KFSPropertyConstants.A21_SUB_ACCOUNT + "." + KFSPropertyConstants.FINANCIAL_ICR_SERIES_IDENTIFIER, KFSKeyConstants.ERROR_EXISTENCE, label + " (" + icrSeriesId + ")");
            success = false;
        } else {
            for (IndirectCostRecoveryRateDetail icrRateDetail : icrRateDetails) {
                if (ObjectUtils.isNull(icrRateDetail.getIndirectCostRecoveryRate())) {
                    putFieldError(KFSPropertyConstants.A21_SUB_ACCOUNT + "." + KFSPropertyConstants.FINANCIAL_ICR_SERIES_IDENTIFIER, KFSKeyConstants.IndirectCostRecovery.ERROR_DOCUMENT_ICR_RATE_NOT_FOUND, new String[] { fiscalYear, icrSeriesId });
                    success = false;
                    break;
                }
            }
        }
    }
    // existence check for ICR Account
    for (IndirectCostRecoveryAccountChange account : newSubAccountGlobal.getActiveIndirectCostRecoveryAccounts()) {
        if (StringUtils.isNotBlank(account.getIndirectCostRecoveryAccountNumber()) && StringUtils.isNotBlank(account.getIndirectCostRecoveryFinCoaCode())) {
            if (ObjectUtils.isNull(account.getIndirectCostRecoveryAccount())) {
                putFieldError(KFSPropertyConstants.INDIRECT_COST_RECOVERY_ACCOUNTS, KFSKeyConstants.ERROR_EXISTENCE, "ICR Account: " + account.getIndirectCostRecoveryFinCoaCode() + "-" + account.getIndirectCostRecoveryAccountNumber());
                success = false;
                break;
            }
        }
    }
    // The cost sharing fields must be empty if the sub-account type code is for ICR
    if (checkCgCostSharingIsEmpty(subAccountGlobalDetail) == false) {
        putFieldError(KFSPropertyConstants.A21_SUB_ACCOUNT + "." + KFSPropertyConstants.COST_SHARE_SOURCE_CHART_OF_ACCOUNTS_CODE, KFSKeyConstants.ERROR_DOCUMENT_SUBACCTMAINT_COST_SHARE_SECTION_INVALID, subAccountTypeCode);
        success &= false;
    }
    return success;
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) HashMap(java.util.HashMap) IndirectCostRecoveryAccountChange(edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange) IndirectCostRecoveryRateDetail(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryRateDetail) A21SubAccountChange(edu.cornell.kfs.coa.businessobject.A21SubAccountChange) DataDictionaryService(org.kuali.kfs.kns.service.DataDictionaryService)

Aggregations

A21SubAccountChange (edu.cornell.kfs.coa.businessobject.A21SubAccountChange)5 SubAccountGlobal (edu.cornell.kfs.coa.businessobject.SubAccountGlobal)5 IndirectCostRecoveryAccountChange (edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange)1 HashMap (java.util.HashMap)1 IndirectCostRecoveryRateDetail (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryRateDetail)1 DataDictionaryService (org.kuali.kfs.kns.service.DataDictionaryService)1