use of org.kuali.kfs.krad.service.BusinessObjectService in project cu-kfs by CU-CommunityApps.
the class KualiAccountingDocumentActionBase method isValidSalesTaxEntered.
/**
* This method checks to see if the sales tax information was put into the accounting line
*
* @param accountingLine
* @return true if entered correctly, false otherwise
*/
protected boolean isValidSalesTaxEntered(AccountingLine accountingLine, boolean source, boolean newLine, int index) {
boolean valid = true;
DictionaryValidationService dictionaryValidationService = SpringContext.getBean(DictionaryValidationService.class);
BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
String objCd = accountingLine.getFinancialObjectCode();
String account = accountingLine.getAccountNumber();
SalesTax salesTax = accountingLine.getSalesTax();
String pathPrefix = "";
if (source && !newLine) {
pathPrefix = "document." + KFSConstants.EXISTING_SOURCE_ACCT_LINE_PROPERTY_NAME + "[" + index + "]";
} else if (!source && !newLine) {
pathPrefix = "document." + KFSConstants.EXISTING_TARGET_ACCT_LINE_PROPERTY_NAME + "[" + index + "]";
} else if (source && newLine) {
pathPrefix = KFSConstants.NEW_SOURCE_ACCT_LINE_PROPERTY_NAME;
} else if (!source && newLine) {
pathPrefix = KFSConstants.NEW_TARGET_ACCT_LINE_PROPERTY_NAME;
}
GlobalVariables.getMessageMap().addToErrorPath(pathPrefix);
if (ObjectUtils.isNull(salesTax)) {
valid &= false;
GlobalVariables.getMessageMap().putError("salesTax.chartOfAccountsCode", ERROR_DOCUMENT_ACCOUNTING_LINE_SALES_TAX_REQUIRED, account, objCd);
} else {
if (StringUtils.isBlank(salesTax.getChartOfAccountsCode())) {
valid &= false;
GlobalVariables.getMessageMap().putError("salesTax.chartOfAccountsCode", ERROR_REQUIRED, "Chart of Accounts");
}
if (StringUtils.isBlank(salesTax.getAccountNumber())) {
valid &= false;
GlobalVariables.getMessageMap().putError("salesTax.accountNumber", ERROR_REQUIRED, "Account Number");
}
if (salesTax.getFinancialDocumentGrossSalesAmount() == null) {
valid &= false;
GlobalVariables.getMessageMap().putError("salesTax.financialDocumentGrossSalesAmount", ERROR_REQUIRED, "Gross Sales Amount");
}
if (salesTax.getFinancialDocumentTaxableSalesAmount() == null) {
valid &= false;
GlobalVariables.getMessageMap().putError("salesTax.financialDocumentTaxableSalesAmount", ERROR_REQUIRED, "Taxable Sales Amount");
}
if (salesTax.getFinancialDocumentSaleDate() == null) {
valid &= false;
GlobalVariables.getMessageMap().putError("salesTax.financialDocumentSaleDate", ERROR_REQUIRED, "Sale Date");
}
if (StringUtils.isNotBlank(salesTax.getChartOfAccountsCode()) && StringUtils.isNotBlank(salesTax.getAccountNumber())) {
if (boService.getReferenceIfExists(salesTax, "account") == null) {
valid &= false;
GlobalVariables.getMessageMap().putError("salesTax.accountNumber", ERROR_DOCUMENT_ACCOUNTING_LINE_SALES_TAX_INVALID_ACCOUNT, salesTax.getChartOfAccountsCode(), salesTax.getAccountNumber());
}
}
if (!valid) {
GlobalVariables.getMessageMap().putError("salesTax.chartOfAccountsCode", ERROR_DOCUMENT_ACCOUNTING_LINE_SALES_TAX_REQUIRED, account, objCd);
}
}
GlobalVariables.getMessageMap().removeFromErrorPath(pathPrefix);
return valid;
}
use of org.kuali.kfs.krad.service.BusinessObjectService in project cu-kfs by CU-CommunityApps.
the class AccountReversionImportServiceImplTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
accountReversionImportService = SpringContext.getBean(AccountReversionImportService.class);
businessObjectService = SpringContext.getBean(BusinessObjectService.class);
accountReversion = AccountReversionFixture.ACCOUNT_REVERSION_UPLOAD.createAccountReversion();
dataFileSrc = new File(DATA_FILE_PATH);
}
use of org.kuali.kfs.krad.service.BusinessObjectService in project cu-kfs by CU-CommunityApps.
the class CheckReconciliationRule method processCustomRouteDocumentBusinessRules.
/**
* @see org.kuali.core.maintenance.rules.MaintenanceDocumentRuleBase#processCustomRouteDocumentBusinessRules(org.kuali.core.document.MaintenanceDocument)
*/
protected boolean processCustomRouteDocumentBusinessRules(MaintenanceDocument document) {
LOG.info("processCustomRouteDocumentBusinessRules called");
setupConvenienceObjects();
boolean valid = true;
if (newCheckReconciliation.getAmount() == null) {
putFieldError("amount", CRKeyConstants.ERROR_CR_INVALID_AMOUNT);
valid = false;
} else if (newCheckReconciliation.getAmount().isZero()) {
if (oldCheckReconciliation != null && CRConstants.EXCP.equalsIgnoreCase(oldCheckReconciliation.getStatus()) && CRConstants.VOIDED.equalsIgnoreCase(newCheckReconciliation.getStatus())) {
valid = true;
} else {
putFieldError("amount", CRKeyConstants.ERROR_CR_INVALID_AMOUNT);
valid = false;
}
} else if (newCheckReconciliation.getAmount().isNegative()) {
putFieldError("amount", CRKeyConstants.ERROR_CR_INVALID_AMOUNT);
valid = false;
}
BusinessObjectService businessObjectService = SpringContext.getBean(BusinessObjectService.class);
Map<String, Object> fieldValues = new HashMap<String, Object>();
fieldValues.put("checkNumber", newCheckReconciliation.getCheckNumber());
fieldValues.put("bankAccountNumber", newCheckReconciliation.getBankAccountNumber());
Collection<CheckReconciliation> checks = businessObjectService.findMatching(CheckReconciliation.class, fieldValues);
boolean isEdit = document.isEdit();
if (checks.size() > 0 && !isEdit) {
valid = false;
putFieldError("checkNumber", "error.checkexists");
}
return valid;
}
use of org.kuali.kfs.krad.service.BusinessObjectService in project cu-kfs by CU-CommunityApps.
the class AccountExtendedAttribute method setInvoiceFrequencyCode.
/**
* @param invoiceFrequencyCode the invoiceFrequencyCode to set
*/
public void setInvoiceFrequencyCode(String invoiceFrequencyCode) {
this.invoiceFrequencyCode = invoiceFrequencyCode;
BusinessObjectService bos = SpringContext.getBean(BusinessObjectService.class);
HashMap<String, String> keys = new HashMap<String, String>();
keys.put("invoiceFrequencyCode", invoiceFrequencyCode);
invoiceFrequency = (InvoiceFrequency) bos.findByPrimaryKey(InvoiceFrequency.class, keys);
// invoiceFrequency.setInvoiceFrequencyCode(invoiceFrequencyCode);
}
use of org.kuali.kfs.krad.service.BusinessObjectService in project cu-kfs by CU-CommunityApps.
the class AccountExtendedAttribute method setProgramCode.
/**
* @param programCode the programCode to set
*/
public void setProgramCode(String programCode) {
this.programCode = programCode;
BusinessObjectService bos = SpringContext.getBean(BusinessObjectService.class);
HashMap<String, String> keys = new HashMap<String, String>();
keys.put("programCode", programCode);
keys.put("subFundGroupCode", subFundGroupCode);
subFundProgram = (SubFundProgram) bos.findByPrimaryKey(SubFundProgram.class, keys);
// subFundProgram.setProgramCode(programCode);
}
Aggregations