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