Search in sources :

Example 6 with BusinessObjectService

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;
}
Also used : DictionaryValidationService(org.kuali.kfs.kns.service.DictionaryValidationService) SalesTax(org.kuali.kfs.fp.businessobject.SalesTax) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 7 with BusinessObjectService

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);
}
Also used : AccountReversionImportService(edu.cornell.kfs.coa.service.AccountReversionImportService) File(java.io.File) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 8 with BusinessObjectService

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;
}
Also used : HashMap(java.util.HashMap) CheckReconciliation(com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 9 with BusinessObjectService

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);
}
Also used : HashMap(java.util.HashMap) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 10 with BusinessObjectService

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);
}
Also used : HashMap(java.util.HashMap) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Aggregations

BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)34 HashMap (java.util.HashMap)26 Map (java.util.Map)7 Account (org.kuali.kfs.coa.businessobject.Account)7 AppropriationAccount (edu.cornell.kfs.coa.businessobject.AppropriationAccount)6 ArrayList (java.util.ArrayList)6 List (java.util.List)5 AccountExtendedAttribute (edu.cornell.kfs.coa.businessobject.AccountExtendedAttribute)4 LinkedHashMap (java.util.LinkedHashMap)4 SubFundProgram (edu.cornell.kfs.coa.businessobject.SubFundProgram)3 ContractGrantReportingCode (edu.cornell.kfs.coa.businessobject.ContractGrantReportingCode)2 IndirectCostRecoveryAccount (org.kuali.kfs.coa.businessobject.IndirectCostRecoveryAccount)2 CheckReconciliation (com.rsmart.kuali.kfs.cr.businessobject.CheckReconciliation)1 CUObjectCodeGlobal (edu.cornell.kfs.coa.businessobject.CUObjectCodeGlobal)1 CuAccountGlobal (edu.cornell.kfs.coa.businessobject.CuAccountGlobal)1 MajorReportingCategory (edu.cornell.kfs.coa.businessobject.MajorReportingCategory)1 ObjectCodeExtendedAttribute (edu.cornell.kfs.coa.businessobject.ObjectCodeExtendedAttribute)1 AccountReversionImportService (edu.cornell.kfs.coa.service.AccountReversionImportService)1 AccountReversionTrickleDownInactivationService (edu.cornell.kfs.coa.service.AccountReversionTrickleDownInactivationService)1 EzraProposalAward (edu.cornell.kfs.module.ezra.businessobject.EzraProposalAward)1