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;
}
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;
}
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;
}
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());
}
}
}
}
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());
}
}
}
}
}
Aggregations