Search in sources :

Example 21 with Account

use of org.kuali.kfs.coa.businessobject.Account in project cu-kfs by CU-CommunityApps.

the class MockAccountService method getByPrimaryId.

@Override
public Account getByPrimaryId(String chartOfAccountsCode, String accountNumber) {
    Account account = null;
    if (ConcurAccountValidationTestConstants.VALID_CHART.equalsIgnoreCase(chartOfAccountsCode) && ConcurAccountValidationTestConstants.VALID_ACCT_NBR.equalsIgnoreCase(accountNumber)) {
        account = createAccount(chartOfAccountsCode, accountNumber);
        account.setActive(true);
    }
    if (ConcurAccountValidationTestConstants.VALID_CHART.equalsIgnoreCase(chartOfAccountsCode) && ConcurAccountValidationTestConstants.INACTIVE_ACCT_NBR.equalsIgnoreCase(accountNumber)) {
        account = createAccount(chartOfAccountsCode, accountNumber);
        account.setActive(false);
    }
    if (ConcurAccountValidationTestConstants.VALID_CHART.equalsIgnoreCase(chartOfAccountsCode) && ConcurAccountValidationTestConstants.CLOSED_ACCT_NBR.equalsIgnoreCase(accountNumber)) {
        account = createAccount(chartOfAccountsCode, accountNumber);
        account.setClosed(true);
    }
    return account;
}
Also used : Account(org.kuali.kfs.coa.businessobject.Account)

Example 22 with Account

use of org.kuali.kfs.coa.businessobject.Account in project cu-kfs by CU-CommunityApps.

the class MockAccountService method createAccount.

private Account createAccount(String chartOfAccountsCode, String accountNumber) {
    Account account = new Account();
    account.setChartOfAccountsCode(chartOfAccountsCode);
    account.setAccountNumber(accountNumber);
    return account;
}
Also used : Account(org.kuali.kfs.coa.businessobject.Account)

Example 23 with Account

use of org.kuali.kfs.coa.businessobject.Account in project cu-kfs by CU-CommunityApps.

the class CuSubAccountMaintainableImpl method hasCgIcrDataChanged.

// KFSPTS-1740 added
/**
 * Answers true for the following conditions:
 * a) New or Copy of SubAccount with data existing in any field on the Edit CG ICR tab of the Sub-Account
 *      maintenance document will enforce the route the Award split-node.
 * b) Edit of the SubAccount where any data change is detected on the Edit CG ICR tab of the Sub-Account
 *      maintenance document will enforce the route the Award split-node.
 *
 * @return true when conditions are met; otherwise return false
 */
private boolean hasCgIcrDataChanged() {
    String maintAction = super.getMaintenanceAction();
    boolean retval = false;
    if ((maintAction.equalsIgnoreCase(KRADConstants.MAINTENANCE_NEW_ACTION)) || (maintAction.equalsIgnoreCase(KRADConstants.MAINTENANCE_COPY_ACTION))) {
        // need "new" bo for data comparisons
        SubAccount subAccount = (SubAccount) super.getBusinessObject();
        if (subAccount.getA21SubAccount().getSubAccountTypeCode().equals(KFSConstants.SubAccountType.EXPENSE)) {
            // We need to route only when the ICR data the user is submitting does NOT match the ICR data on the account
            // "new" subAccount for data comparisons
            A21SubAccount newSubAccount = subAccount.getA21SubAccount();
            // "existing" data that would have pre-populated
            Account account = this.getAccountService().getByPrimaryIdWithCaching(subAccount.getChartOfAccountsCode(), subAccount.getAccountNumber());
            if (ObjectUtils.isNotNull(account) && ObjectUtils.isNotNull(newSubAccount)) {
                // compare each field in question
                boolean hasIcrIdChanged = !areFieldValuesTheSame(account.getFinancialIcrSeriesIdentifier(), newSubAccount.getFinancialIcrSeriesIdentifier());
                boolean hasIcrTypeCodeChanged = !areFieldValuesTheSame(account.getAcctIndirectCostRcvyTypeCd(), newSubAccount.getIndirectCostRecoveryTypeCode());
                boolean hasOffCampusIndChanged = newSubAccount.getOffCampusCode() != account.isAccountOffCampusIndicator();
                if (hasIcrIdChanged || hasIcrTypeCodeChanged || hasOffCampusIndChanged) {
                    // retrieve data we need for split-node route to work, contractsAndGrantsAccountResponsibilityId
                    // is not a sub-account attribute and we must populate the account attribute on sub-account
                    subAccount.setAccount(getAccountService().getByPrimaryIdWithCaching(subAccount.getChartOfAccountsCode(), subAccount.getAccountNumber()));
                    retval = true;
                }
            }
        }
    } else if (maintAction.equalsIgnoreCase(KRADConstants.MAINTENANCE_EDIT_ACTION)) {
        // need "new" bo for data comparisons
        SubAccount subAccount = (SubAccount) super.getBusinessObject();
        // "new" subAccount for data comparisons
        A21SubAccount newSubAccount = subAccount.getA21SubAccount();
        // "old" subAccount for data comparisons
        A21SubAccount oldSubAccount = this.getA21SubAccountService().getByPrimaryKey(subAccount.getChartOfAccountsCode(), subAccount.getAccountNumber(), subAccount.getSubAccountNumber());
        // compare each field in question
        boolean hasIcrIdChanged = isFieldValueChanged(newSubAccount.getFinancialIcrSeriesIdentifier(), oldSubAccount.getFinancialIcrSeriesIdentifier());
        boolean hasIcrTypeCodeChanged = isFieldValueChanged(newSubAccount.getIndirectCostRecoveryTypeCode(), oldSubAccount.getIndirectCostRecoveryTypeCode());
        boolean hasOffCampusIndChanged = newSubAccount.getOffCampusCode() != oldSubAccount.getOffCampusCode();
        if (hasIcrIdChanged || hasIcrTypeCodeChanged || hasOffCampusIndChanged) {
            // retrieve data we need for split-node route to work, contractsAndGrantsAccountResponsibilityId is
            // not a sub-account attribute and we must populate the account attribute on sub-account
            subAccount.setAccount(getAccountService().getByPrimaryIdWithCaching(subAccount.getChartOfAccountsCode(), subAccount.getAccountNumber()));
            retval = true;
        }
    }
    return retval;
}
Also used : A21IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.A21IndirectCostRecoveryAccount) SubAccount(org.kuali.kfs.coa.businessobject.SubAccount) A21SubAccount(org.kuali.kfs.coa.businessobject.A21SubAccount) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) Account(org.kuali.kfs.coa.businessobject.Account) SubAccount(org.kuali.kfs.coa.businessobject.SubAccount) A21SubAccount(org.kuali.kfs.coa.businessobject.A21SubAccount) A21SubAccount(org.kuali.kfs.coa.businessobject.A21SubAccount)

Example 24 with Account

use of org.kuali.kfs.coa.businessobject.Account in project cu-kfs by CU-CommunityApps.

the class AccountGlobalPreRules method checkForContinuationAccounts.

protected void checkForContinuationAccounts() {
    LOG.debug("entering checkForContinuationAccounts()");
    if (StringUtils.isNotBlank(accountGlobal.getReportsToAccountNumber())) {
        Account account = checkForContinuationAccount("Fringe Benefit Account", accountGlobal.getReportsToChartOfAccountsCode(), accountGlobal.getReportsToAccountNumber(), "");
        if (ObjectUtils.isNotNull(account)) {
            // override old user inputs
            accountGlobal.setReportsToAccountNumber(account.getAccountNumber());
            accountGlobal.setReportsToChartOfAccountsCode(account.getChartOfAccountsCode());
        }
    }
    if (StringUtils.isNotBlank(accountGlobal.getEndowmentIncomeAccountNumber())) {
        Account account = checkForContinuationAccount("Endowment Account", accountGlobal.getEndowmentIncomeAcctFinCoaCd(), accountGlobal.getEndowmentIncomeAccountNumber(), "");
        if (ObjectUtils.isNotNull(account)) {
            // override old user inputs
            accountGlobal.setEndowmentIncomeAccountNumber(account.getAccountNumber());
            accountGlobal.setEndowmentIncomeAcctFinCoaCd(account.getChartOfAccountsCode());
        }
    }
    if (StringUtils.isNotBlank(accountGlobal.getIncomeStreamAccountNumber())) {
        Account account = checkForContinuationAccount("Income Stream Account", accountGlobal.getIncomeStreamFinancialCoaCode(), accountGlobal.getIncomeStreamAccountNumber(), "");
        if (ObjectUtils.isNotNull(account)) {
            // override old user inputs
            accountGlobal.setIncomeStreamAccountNumber(account.getAccountNumber());
            accountGlobal.setIncomeStreamFinancialCoaCode(account.getChartOfAccountsCode());
        }
    }
    if (StringUtils.isNotBlank(accountGlobal.getContractControlAccountNumber())) {
        Account account = checkForContinuationAccount("Contract Control Account", accountGlobal.getContractControlFinCoaCode(), accountGlobal.getContractControlAccountNumber(), "");
        if (ObjectUtils.isNotNull(account)) {
            // override old user inputs
            accountGlobal.setContractControlAccountNumber(account.getAccountNumber());
            accountGlobal.setContractControlFinCoaCode(account.getChartOfAccountsCode());
        }
    }
    for (IndirectCostRecoveryAccountChange icra : accountGlobal.getActiveIndirectCostRecoveryAccounts()) {
        if (StringUtils.isNotBlank(icra.getIndirectCostRecoveryAccountNumber())) {
            Account account = checkForContinuationAccount("Indirect Cost Recovery Account", icra.getIndirectCostRecoveryAccountNumber(), icra.getIndirectCostRecoveryFinCoaCode(), "");
            if (ObjectUtils.isNotNull(account)) {
                // override old user inputs
                icra.setIndirectCostRecoveryAccountNumber(account.getAccountNumber());
                icra.setIndirectCostRecoveryFinCoaCode(account.getChartOfAccountsCode());
            }
        }
    }
}
Also used : Account(org.kuali.kfs.coa.businessobject.Account) IndirectCostRecoveryAccountChange(edu.cornell.kfs.coa.businessobject.IndirectCostRecoveryAccountChange)

Example 25 with Account

use of org.kuali.kfs.coa.businessobject.Account in project cu-kfs by CU-CommunityApps.

the class CuSubAccountPreRules method copyICRFromAccount.

@SuppressWarnings("deprecation")
protected void copyICRFromAccount(MaintenanceDocument document) {
    Person user = GlobalVariables.getUserSession().getPerson();
    // get a new instance of MaintenanceDocumentAuthorizations for this context
    MaintenanceDocumentRestrictions auths = SpringContext.getBean(BusinessObjectAuthorizationService.class).getMaintenanceDocumentRestrictions(document, user);
    // don't need to copy if the user does not have the authority to edit the fields
    if (!auths.getFieldRestriction("a21SubAccount.financialIcrSeriesIdentifier").isReadOnly()) {
        // only need to do this of the account sub type is EX
        A21SubAccount a21SubAccount = newSubAccount.getA21SubAccount();
        Account account = newSubAccount.getAccount();
        if (KFSConstants.SubAccountType.EXPENSE.equals(a21SubAccount.getSubAccountTypeCode())) {
            if (ObjectUtils.isNull(account) || StringUtils.isBlank(account.getAccountNumber())) {
                account = getAccountService().getByPrimaryId(newSubAccount.getChartOfAccountsCode(), newSubAccount.getAccountNumber());
            }
            if (ObjectUtils.isNotNull(account)) {
                if (a21SubAccount.getA21ActiveIndirectCostRecoveryAccounts().isEmpty()) {
                    for (IndirectCostRecoveryAccount icrAccount : account.getActiveIndirectCostRecoveryAccounts()) {
                        A21IndirectCostRecoveryAccount copyAccount = A21IndirectCostRecoveryAccount.copyICRAccount(icrAccount);
                        copyAccount.setNewCollectionRecord(true);
                        a21SubAccount.getA21IndirectCostRecoveryAccounts().add(copyAccount);
                    }
                }
                if (StringUtils.isBlank(a21SubAccount.getFinancialIcrSeriesIdentifier())) {
                    a21SubAccount.setFinancialIcrSeriesIdentifier(account.getFinancialIcrSeriesIdentifier());
                }
                if (StringUtils.isBlank(a21SubAccount.getIndirectCostRecoveryTypeCode())) {
                    a21SubAccount.setIndirectCostRecoveryTypeCode(account.getAcctIndirectCostRcvyTypeCd());
                }
            }
        }
    }
}
Also used : A21IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.A21IndirectCostRecoveryAccount) MaintenanceDocumentRestrictions(org.kuali.kfs.kns.document.authorization.MaintenanceDocumentRestrictions) A21IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.A21IndirectCostRecoveryAccount) A21SubAccount(org.kuali.kfs.coa.businessobject.A21SubAccount) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) Account(org.kuali.kfs.coa.businessobject.Account) A21IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.A21IndirectCostRecoveryAccount) IndirectCostRecoveryAccount(org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount) BusinessObjectAuthorizationService(org.kuali.kfs.kns.service.BusinessObjectAuthorizationService) Person(org.kuali.rice.kim.api.identity.Person) A21SubAccount(org.kuali.kfs.coa.businessobject.A21SubAccount)

Aggregations

Account (org.kuali.kfs.coa.businessobject.Account)38 IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount)14 SubAccount (org.kuali.kfs.coa.businessobject.SubAccount)11 AppropriationAccount (edu.cornell.kfs.coa.businessobject.AppropriationAccount)9 HashMap (java.util.HashMap)6 A21SubAccount (org.kuali.kfs.coa.businessobject.A21SubAccount)6 ArrayList (java.util.ArrayList)5 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)5 List (java.util.List)4 A21IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.A21IndirectCostRecoveryAccount)4 Message (org.kuali.kfs.sys.Message)4 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)3 AccountExtendedAttribute (edu.cornell.kfs.coa.businessobject.AccountExtendedAttribute)2 SubFundProgram (edu.cornell.kfs.coa.businessobject.SubFundProgram)2 Date (java.sql.Date)2 AccountGlobalDetail (org.kuali.kfs.coa.businessobject.AccountGlobalDetail)2 AccountService (org.kuali.kfs.coa.service.AccountService)2 SubAccountService (org.kuali.kfs.coa.service.SubAccountService)2 MaintenanceDocument (org.kuali.kfs.kns.document.MaintenanceDocument)2 DocumentService (org.kuali.kfs.krad.service.DocumentService)2