Search in sources :

Example 6 with SubObjectCode

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

the class MockSubObjectCodeService method createSubObjectCode.

private SubObjectCode createSubObjectCode(String chartOfAccountsCode, String accountNumber, String financialObjectCode, String financialSubObjectCode) {
    SubObjectCode subObjectCode = new SubObjectCode();
    subObjectCode.setChartOfAccountsCode(chartOfAccountsCode);
    subObjectCode.setAccountNumber(accountNumber);
    subObjectCode.setFinancialObjectCode(financialObjectCode);
    subObjectCode.setFinancialSubObjectCode(financialSubObjectCode);
    return subObjectCode;
}
Also used : SubObjectCode(org.kuali.kfs.coa.businessobject.SubObjectCode)

Example 7 with SubObjectCode

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

the class AmazonWebServicesBillingServiceImpl method updateTransactionDTOObjectCodes.

private void updateTransactionDTOObjectCodes(AmazonBillingDistributionOfIncomeTransactionDTO transactionDTO, AmazonBillingCostCenterDTO costCenterDTO) {
    if (StringUtils.isNotBlank(costCenterDTO.getObjectCode())) {
        ObjectCode objectCode = getObjectCodeService().getByPrimaryIdForCurrentYear(transactionDTO.getChartCode(), costCenterDTO.getObjectCode());
        if (ObjectUtils.isNotNull(objectCode)) {
            transactionDTO.setObjectCodeNumber(objectCode.getFinancialObjectCode());
            if (StringUtils.isNotBlank(costCenterDTO.getSubObjectCode())) {
                SubObjectCode subObjectCode = getSubObjectCodeService().getByPrimaryIdForCurrentYear(transactionDTO.getChartCode(), transactionDTO.getAccountNumber(), objectCode.getFinancialObjectCode(), costCenterDTO.getSubObjectCode());
                if (ObjectUtils.isNotNull(subObjectCode)) {
                    transactionDTO.setSubObjectCodeNumber(subObjectCode.getFinancialSubObjectCode());
                } else {
                    LOG.info("updateTransactionDTOObjectCodes() Invalid Sub Object Code.");
                    transactionDTO.setTransactionInputError(true);
                }
            }
        } else {
            LOG.info("updateTransactionDTOObjectCodes() Invalid Object Code.");
            transactionDTO.setTransactionInputError(true);
        }
    } else {
        transactionDTO.setObjectCodeNumber(getTransactionObjectCode());
    }
}
Also used : SubObjectCode(org.kuali.kfs.coa.businessobject.SubObjectCode) ObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode) SubObjectCode(org.kuali.kfs.coa.businessobject.SubObjectCode)

Example 8 with SubObjectCode

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

the class ScrubberValidatorImpl method validateSubObjectCode.

/**
 * Validates the sub object code of the origin entry
 *
 * @param originEntry  the origin entry being scrubbed
 * @param workingEntry the scrubbed version of the origin entry
 * @return a Message if an error was encountered, otherwise null
 */
protected Message validateSubObjectCode(OriginEntryInformation originEntry, OriginEntryInformation workingEntry, AccountingCycleCachingService accountingCycleCachingService) {
    LOG.debug("validateFinancialSubObjectCode() started");
    if (!StringUtils.hasText(originEntry.getFinancialSubObjectCode())) {
        workingEntry.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
        return null;
    }
    if (!KFSConstants.getDashFinancialSubObjectCode().equals(originEntry.getFinancialSubObjectCode())) {
        SubObjectCode originEntrySubObject = accountingCycleCachingService.getSubObjectCode(originEntry.getUniversityFiscalYear(), originEntry.getChartOfAccountsCode(), originEntry.getAccountNumber(), originEntry.getFinancialObjectCode(), originEntry.getFinancialSubObjectCode());
        if (originEntrySubObject != null) {
            // Exists
            if (!originEntrySubObject.isActive()) {
                // if NOT active, set it to dashes
                workingEntry.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
                return null;
            }
        } else {
            // Doesn't exist
            workingEntry.setFinancialSubObjectCode(KFSConstants.getDashFinancialSubObjectCode());
            return null;
        }
    }
    workingEntry.setFinancialSubObjectCode(originEntry.getFinancialSubObjectCode());
    return null;
}
Also used : SubObjectCode(org.kuali.kfs.coa.businessobject.SubObjectCode)

Example 9 with SubObjectCode

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

the class ConcurAccountValidationServiceImpl method checkSubObjectCode.

public ValidationResult checkSubObjectCode(String chartOfAccountsCode, String accountNumber, String objectCode, String subObjectCodeParm) {
    ValidationResult validationResult = new ValidationResult();
    if (StringUtils.isNotBlank(subObjectCodeParm)) {
        SubObjectCode subObjectCode = subObjectCodeService.getByPrimaryIdForCurrentYear(chartOfAccountsCode, accountNumber, objectCode, subObjectCodeParm);
        String subObjectCodeErrorMessageString = ConcurUtils.formatStringForErrorMessage(ConcurConstants.AccountingStringFieldNames.SUB_OBJECT_CODE, chartOfAccountsCode, accountNumber, objectCode, subObjectCodeParm);
        validationResult = checkMissingOrInactive(subObjectCode, MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_EXISTENCE), subObjectCodeErrorMessageString), MessageFormat.format(configurationService.getPropertyValueAsString(KFSKeyConstants.ERROR_INACTIVE), subObjectCodeErrorMessageString));
    }
    return validationResult;
}
Also used : SubObjectCode(org.kuali.kfs.coa.businessobject.SubObjectCode) ValidationResult(edu.cornell.kfs.concur.businessobjects.ValidationResult)

Example 10 with SubObjectCode

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

the class SubObjectCodeGlobalEdit method generateGlobalChangesToPersist.

/**
 * @see org.kuali.kfs.krad.bo.GlobalBusinessObject#generateGlobalChangesToPersist()
 */
@Override
public List<PersistableBusinessObject> generateGlobalChangesToPersist() {
    // the list of persist-ready BOs
    List<PersistableBusinessObject> persistables = new ArrayList<PersistableBusinessObject>();
    // walk over each change detail record
    for (SubObjectCodeGlobalEditDetail detail : subObjCdGlobalEditDetails) {
        // load the object by keys
        SubObjectCode subObjectCode = SpringContext.getBean(BusinessObjectService.class).findByPrimaryKey(SubObjectCode.class, detail.getPrimaryKeys());
        // if we got a valid subObjectCode, inactivate it
        if (subObjectCode != null) {
            subObjectCode.setActive(false);
            persistables.add(subObjectCode);
        }
    }
    return persistables;
}
Also used : PersistableBusinessObject(org.kuali.kfs.krad.bo.PersistableBusinessObject) SubObjectCode(org.kuali.kfs.coa.businessobject.SubObjectCode) ArrayList(java.util.ArrayList) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Aggregations

SubObjectCode (org.kuali.kfs.coa.businessobject.SubObjectCode)11 ArrayList (java.util.ArrayList)2 ObjectCode (org.kuali.kfs.coa.businessobject.ObjectCode)2 SubObjectCodeService (org.kuali.kfs.coa.service.SubObjectCodeService)2 ValidationResult (edu.cornell.kfs.concur.businessobjects.ValidationResult)1 Account (org.kuali.kfs.coa.businessobject.Account)1 Chart (org.kuali.kfs.coa.businessobject.Chart)1 ProjectCode (org.kuali.kfs.coa.businessobject.ProjectCode)1 SubAccount (org.kuali.kfs.coa.businessobject.SubAccount)1 DocumentType (org.kuali.kfs.kew.doctype.bo.DocumentType)1 PersistableBusinessObject (org.kuali.kfs.krad.bo.PersistableBusinessObject)1 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)1 AccountingLineOverride (org.kuali.kfs.sys.businessobject.AccountingLineOverride)1 OriginationCode (org.kuali.kfs.sys.businessobject.OriginationCode)1