Search in sources :

Example 6 with SubAccountGlobal

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

the class SubAccountGlobalRule method checkForPartiallyEnteredReportingFields.

/**
 * Checks that the reporting fields are entered altogether or none at all
 *
 * @return false if only one reporting field filled out and not all of them, true otherwise
 */
protected boolean checkForPartiallyEnteredReportingFields() {
    boolean success = true;
    boolean allReportingFieldsEntered = false;
    boolean anyReportingFieldsEntered = false;
    SubAccountGlobal newSubAccountGlobal = (SubAccountGlobal) super.getNewBo();
    // set a flag if all three reporting fields are filled (this is separated just for readability)
    if (StringUtils.isNotEmpty(newSubAccountGlobal.getFinancialReportChartCode()) && StringUtils.isNotEmpty(newSubAccountGlobal.getFinReportOrganizationCode()) && StringUtils.isNotEmpty(newSubAccountGlobal.getFinancialReportingCode())) {
        allReportingFieldsEntered = true;
    }
    // set a flag if any of the three reporting fields are filled (this is separated just for readability)
    if (StringUtils.isNotEmpty(newSubAccountGlobal.getFinancialReportChartCode()) || StringUtils.isNotEmpty(newSubAccountGlobal.getFinReportOrganizationCode()) || StringUtils.isNotEmpty(newSubAccountGlobal.getFinancialReportingCode())) {
        anyReportingFieldsEntered = true;
    }
    // if any of the three reporting code fields are filled out, all three must be, or none
    if (anyReportingFieldsEntered && !allReportingFieldsEntered) {
        putGlobalError(KFSKeyConstants.ERROR_DOCUMENT_SUBACCTMAINT_RPTCODE_ALL_FIELDS_IF_ANY_FIELDS);
        success &= false;
    }
    return success;
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal)

Example 7 with SubAccountGlobal

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

the class SubAccountGlobalMaintainableImpl method generateMaintenanceLocks.

/**
 * This creates the particular locking representation for this global document.
 *
 * @see org.kuali.kfs.kns.maintenance.Maintainable#generateMaintenanceLocks()
 */
@Override
public List<MaintenanceLock> generateMaintenanceLocks() {
    SubAccountGlobal subAccountGlobal = (SubAccountGlobal) getBusinessObject();
    List<MaintenanceLock> maintenanceLocks = new ArrayList();
    for (SubAccountGlobalDetail detail : subAccountGlobal.getSubAccountGlobalDetails()) {
        MaintenanceLock maintenanceLock = new MaintenanceLock();
        StringBuffer lockrep = new StringBuffer();
        lockrep.append(Account.class.getName() + KFSConstants.Maintenance.AFTER_CLASS_DELIM);
        lockrep.append(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
        lockrep.append(detail.getChartOfAccountsCode() + KFSConstants.Maintenance.AFTER_VALUE_DELIM);
        lockrep.append(KFSPropertyConstants.ACCOUNT_NUMBER + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
        lockrep.append(detail.getAccountNumber());
        lockrep.append(KFSPropertyConstants.SUB_ACCOUNT_NUMBER + KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM);
        lockrep.append(detail.getSubAccountNumber());
        maintenanceLock.setDocumentNumber(subAccountGlobal.getDocumentNumber());
        maintenanceLock.setLockingRepresentation(lockrep.toString());
        maintenanceLocks.add(maintenanceLock);
    }
    return maintenanceLocks;
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail) ArrayList(java.util.ArrayList) MaintenanceLock(org.kuali.kfs.krad.maintenance.MaintenanceLock)

Example 8 with SubAccountGlobal

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

the class SubAccountGlobalMaintainableImpl method isSubAccountTypeCodeCostShare.

/**
 * @return true when code is CS; otherwise return false
 */
private boolean isSubAccountTypeCodeCostShare() {
    boolean retval = false;
    SubAccountGlobal subAccountGlobal = (SubAccountGlobal) getBusinessObject();
    for (SubAccountGlobalDetail detail : subAccountGlobal.getSubAccountGlobalDetails()) {
        detail.refreshReferenceObject(KFSPropertyConstants.SUB_ACCOUNT);
        SubAccount subAccount = detail.getSubAccount();
        if (subAccount.getA21SubAccount().getSubAccountTypeCode().equals(KFSConstants.SubAccountType.COST_SHARE)) {
            retval = true;
            subAccount.refreshReferenceObject(KFSPropertyConstants.ACCOUNT);
            break;
        }
    }
    return retval;
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) SubAccountGlobalDetail(edu.cornell.kfs.coa.businessobject.SubAccountGlobalDetail) SubAccount(org.kuali.kfs.coa.businessobject.SubAccount)

Example 9 with SubAccountGlobal

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

the class SubAccountGlobalPreRules method checkOffCampus.

/**
 * Checks if off campus is set and prompts user question.
 *
 * @param maintenanceDocument
 * @return true if continue, false otherwise
 */
protected boolean checkOffCampus(MaintenanceDocument maintenanceDocument) {
    boolean continueRules = true;
    SubAccountGlobal subAccountGlobal = (SubAccountGlobal) maintenanceDocument.getNewMaintainableObject().getBusinessObject();
    boolean saccOffCampus = subAccountGlobal.getA21SubAccount().isOffCampusCode();
    if (saccOffCampus) {
        String questionText = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(CUKFSKeyConstants.QUESTION_A21SUBACCOUNT_OFF_CAMPUS_INDICATOR);
        boolean leaveAsIs = super.askOrAnalyzeYesNoQuestion(CUKFSConstants.A21SubAccountDocumentConstants.OFF_CAMPUS_INDICATOR_QUESTION_ID, questionText);
        if (!leaveAsIs) {
            // return to document if the user doesn't want to clear the indicator
            super.event.setActionForwardName(KFSConstants.MAPPING_BASIC);
            continueRules = false;
        }
    }
    return continueRules;
}
Also used : SubAccountGlobal(edu.cornell.kfs.coa.businessobject.SubAccountGlobal) ConfigurationService(org.kuali.rice.core.api.config.property.ConfigurationService)

Example 10 with SubAccountGlobal

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

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