Search in sources :

Example 6 with ObjectCode

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

the class CashReversionCategoryLogic method containsObjectCode.

/**
 * Determines if the given object code is an object code for cash balances
 *
 * @param oc the object code to qualify
 * @return true if it is a cash object code, false if otherwise
 * @see org.kuali.kfs.gl.batch.service.OrganizationReversionCategoryLogic#containsObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode)
 */
public boolean containsObjectCode(ObjectCode oc) {
    LOG.debug("containsObjectCode() started");
    boolean retVal;
    ObjectCode chartCashObject = oc.getChartOfAccounts().getFinancialCashObject();
    retVal = (chartCashObject.getChartOfAccountsCode().equals(oc.getChartOfAccountsCode()) && chartCashObject.getFinancialObjectCode().equals(oc.getFinancialObjectCode()));
    retVal |= (oc.getFinancialObjectTypeCode().equals("AS") || oc.getFinancialObjectTypeCode().equals("LI"));
    return retVal;
}
Also used : ObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode)

Example 7 with ObjectCode

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

the class MockObjectCodeService method createObjectCode.

private ObjectCode createObjectCode(String chartOfAccountsCode, String financialObjectCode) {
    ObjectCode objectCode = new ObjectCode();
    objectCode.setChartOfAccountsCode(chartOfAccountsCode);
    objectCode.setFinancialObjectCode(financialObjectCode);
    return objectCode;
}
Also used : ObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode)

Example 8 with ObjectCode

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

the class ObjectCodeExtensionRule method checkContractGrantReportingCode.

/*
     * Verify value has been entered for required attribute cgReportingCode
     */
protected boolean checkContractGrantReportingCode(ObjectCode objectCode) {
    boolean success = true;
    ObjectCodeExtendedAttribute extendedAttributes = (ObjectCodeExtendedAttribute) objectCode.getExtension();
    String cgReportingCode = extendedAttributes.getCgReportingCode();
    String chartOfAccountsCode = objectCode.getChartOfAccountsCode();
    if ((!StringUtils.isBlank(cgReportingCode)) && (!StringUtils.isBlank(cgReportingCode))) {
        // have values for both table primary keys
        Map fieldValues = new HashMap();
        fieldValues.put("chartOfAccountsCode", chartOfAccountsCode);
        // prompt table has attribute defined as "code" and we need to use it for the lookup
        fieldValues.put("code", cgReportingCode);
        BusinessObjectService bos = SpringContext.getBean(BusinessObjectService.class);
        Collection<ContractGrantReportingCode> retVals = bos.findMatching(ContractGrantReportingCode.class, fieldValues);
        if (retVals.isEmpty()) {
            putFieldError("extension.cgReportingCode", CUKFSKeyConstants.ERROR_DOCUMENT_OBJCDMAINT_CG_RPT_CAT_CODE_NOT_EXIST, new String[] { chartOfAccountsCode, cgReportingCode });
            success = false;
        } else {
            // verify the value to be assigned is active
            for (ContractGrantReportingCode sfp : retVals) {
                if (!sfp.isActive()) {
                    putFieldError("extension.cgReportingCode", KFSKeyConstants.ERROR_INACTIVE, getFieldLabel(ObjectCode.class, "extension.cgReportingCode"));
                    success = false;
                }
            }
        }
    }
    // implied else coa or cgReportingCode or both are blank, caught by maintenance doc having these fields defined as "required", else coding to report this causes double error messages
    return success;
}
Also used : ObjectCodeExtendedAttribute(edu.cornell.kfs.coa.businessobject.ObjectCodeExtendedAttribute) HashMap(java.util.HashMap) ObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode) HashMap(java.util.HashMap) Map(java.util.Map) ContractGrantReportingCode(edu.cornell.kfs.coa.businessobject.ContractGrantReportingCode) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 9 with ObjectCode

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

the class AdvanceDepositServiceImpl method getObjectCodeType.

protected String getObjectCodeType(String chart, String objectCode) {
    Map<String, String> keys = new HashMap<String, String>();
    keys.put(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, chart);
    keys.put(KFSPropertyConstants.FINANCIAL_OBJECT_CODE, objectCode);
    ObjectCode objectCodeInfo = businessObjectService.findByPrimaryKey(ObjectCode.class, keys);
    objectCodeInfo.refreshReferenceObject(KFSPropertyConstants.FINANCIAL_OBJECT_TYPE);
    ObjectType objectType = objectCodeInfo.getFinancialObjectType();
    String objectTypeCode = objectType.getBasicAccountingCategoryCode();
    return objectTypeCode;
}
Also used : ObjectType(org.kuali.kfs.coa.businessobject.ObjectType) HashMap(java.util.HashMap) ObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode)

Example 10 with ObjectCode

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

the class ProcurementCardCreateDocumentServiceImpl method validateTransaction.

@Override
protected String validateTransaction(ProcurementCardTransaction transaction) {
    String errorText = "";
    UniversityDateService uds = SpringContext.getBean(UniversityDateService.class);
    ObjectCodeService ocs = SpringContext.getBean(ObjectCodeService.class);
    ObjectCode objectCode = ocs.getByPrimaryIdWithCaching(uds.getCurrentFiscalYear(), transaction.getChartOfAccountsCode(), transaction.getFinancialObjectCode());
    if (ObjectUtils.isNull(objectCode)) {
        String tempErrorText = "Chart " + transaction.getChartOfAccountsCode() + " Object Code " + transaction.getFinancialObjectCode() + " is invalid; using default error Object Code.";
        if (LOG.isInfoEnabled()) {
            LOG.info(tempErrorText);
        }
        errorText += " " + tempErrorText;
        transaction.setFinancialObjectCode(getErrorObjectCode());
        transaction.refresh();
    }
    errorText += " " + super.validateTransaction(transaction);
    return errorText;
}
Also used : ObjectCodeService(org.kuali.kfs.coa.service.ObjectCodeService) ObjectCode(org.kuali.kfs.coa.businessobject.ObjectCode) UniversityDateService(org.kuali.kfs.sys.service.UniversityDateService)

Aggregations

ObjectCode (org.kuali.kfs.coa.businessobject.ObjectCode)20 SubObjectCode (org.kuali.kfs.coa.businessobject.SubObjectCode)7 OriginEntryFull (org.kuali.kfs.gl.businessobject.OriginEntryFull)4 ObjectCodeService (org.kuali.kfs.coa.service.ObjectCodeService)3 FatalErrorException (org.kuali.kfs.gl.batch.service.impl.exception.FatalErrorException)3 GeneralLedgerPendingEntry (org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry)3 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)3 PaymentMethodChart (edu.cornell.kfs.fp.businessobject.PaymentMethodChart)2 HashMap (java.util.HashMap)2 ObjectType (org.kuali.kfs.coa.businessobject.ObjectType)2 SubObjectCodeService (org.kuali.kfs.coa.service.SubObjectCodeService)2 ContractGrantReportingCode (edu.cornell.kfs.coa.businessobject.ContractGrantReportingCode)1 ObjectCodeExtendedAttribute (edu.cornell.kfs.coa.businessobject.ObjectCodeExtendedAttribute)1 ReversionCategory (edu.cornell.kfs.coa.businessobject.ReversionCategory)1 ReversionCategoryInfo (edu.cornell.kfs.coa.businessobject.ReversionCategoryInfo)1 ReversionUnitOfWorkCategoryAmount (edu.cornell.kfs.gl.businessobject.ReversionUnitOfWorkCategoryAmount)1 IOException (java.io.IOException)1 BigDecimal (java.math.BigDecimal)1 Date (java.sql.Date)1 Timestamp (java.sql.Timestamp)1