use of org.kuali.kfs.coa.businessobject.SubAccount in project cu-kfs by CU-CommunityApps.
the class SubAccountGlobalDetail method getContractsAndGrantsAccountResponsibilityIdForRouting.
/**
* Determines the contractsAndGrantsAccountResponsibilityId For Routing. If SubAccountTypeCode is CS then the ContractsAndGrantsAccountResponsibilityId on the sub account account is returned.
* Otherwise null is returned. This ensures that document is only routed to CG if sub account type is CS.
*
* @return ContractsAndGrantsAccountResponsibilityId on account if sub account type is CS, null otherwise
*/
public Integer getContractsAndGrantsAccountResponsibilityIdForRouting() {
this.refreshReferenceObject("subAccount");
SubAccount subAccount = this.getSubAccount();
if (subAccount.getA21SubAccount().getSubAccountTypeCode().equals(KFSConstants.SubAccountType.COST_SHARE)) {
subAccount.refreshReferenceObject("account");
contractsAndGrantsAccountResponsibilityIdForRouting = subAccount.getAccount().getContractsAndGrantsAccountResponsibilityId();
}
return contractsAndGrantsAccountResponsibilityIdForRouting;
}
use of org.kuali.kfs.coa.businessobject.SubAccount in project cu-kfs by CU-CommunityApps.
the class AmazonWebServicesBillingServiceImpl method updateTransactionDTOSubAccount.
private void updateTransactionDTOSubAccount(AmazonBillingDistributionOfIncomeTransactionDTO transactionDTO, AmazonBillingCostCenterDTO costCenterDTO, Account account) {
if (StringUtils.isNotBlank(costCenterDTO.getSubAccountNumber())) {
SubAccount subAccount = findSubAccountFromSubAccountNumber(account, costCenterDTO.getSubAccountNumber());
if (ObjectUtils.isNotNull(subAccount)) {
transactionDTO.setSubAccountNumber(subAccount.getSubAccountNumber());
} else {
LOG.info("updateTransactionDTOSubAccount() Invalid Sub Account.");
transactionDTO.setTransactionInputError(true);
}
}
}
use of org.kuali.kfs.coa.businessobject.SubAccount in project cu-kfs by CU-CommunityApps.
the class AmazonWebServicesBillingServiceImpl method findSubAccountFromSubAccountNumber.
private SubAccount findSubAccountFromSubAccountNumber(Account account, String subAccountNumber) {
SubAccount subAccount = null;
if (ObjectUtils.isNotNull(account)) {
subAccount = getSubAccountService().getByPrimaryId(account.getChartOfAccountsCode(), account.getAccountNumber(), subAccountNumber);
if (ObjectUtils.isNull(subAccount) || !subAccount.isActive()) {
LOG.info("findSubAccountFromSubAccountNumber() An invalid sub account number was provided: " + subAccountNumber);
subAccount = null;
}
}
return subAccount;
}
use of org.kuali.kfs.coa.businessobject.SubAccount in project cu-kfs by CU-CommunityApps.
the class MockSubAccountService method createSubAccount.
private SubAccount createSubAccount(String chartOfAccountsCode, String accountNumber, String subAccountNumber) {
SubAccount subAccount = new SubAccount();
subAccount.setChartOfAccountsCode(chartOfAccountsCode);
subAccount.setAccountNumber(accountNumber);
subAccount.setSubAccountNumber(subAccountNumber);
return subAccount;
}
use of org.kuali.kfs.coa.businessobject.SubAccount 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;
}
Aggregations