Search in sources :

Example 21 with DateTimeService

use of org.kuali.kfs.core.api.datetime.DateTimeService in project cu-kfs by CU-CommunityApps.

the class CuDisbursementVoucherDefaultDueDateServiceImplTest method buildMockDateTimeService.

protected DateTimeService buildMockDateTimeService(Calendar currentCalendar) {
    DateTimeService service = Mockito.mock(DateTimeService.class);
    Mockito.when(service.getCurrentCalendar()).thenReturn(currentCalendar);
    return service;
}
Also used : DateTimeService(org.kuali.kfs.core.api.datetime.DateTimeService)

Example 22 with DateTimeService

use of org.kuali.kfs.core.api.datetime.DateTimeService in project cu-kfs by CU-CommunityApps.

the class VendorRule method validateW9SignedDate.

protected boolean validateW9SignedDate(VendorDetail vDetail) {
    if (ObjectUtils.isNotNull(vDetail.getVendorHeader().getVendorW9ReceivedIndicator()) && vDetail.getVendorHeader().getVendorW9ReceivedIndicator()) {
        if (SpringContext.getBean(ParameterService.class).getParameterValueAsBoolean(VendorDetail.class, VendorParameterConstants.W9_SIGNED_DATE_REQUIRED) && ObjectUtils.isNotNull(vDetail.getVendorHeader().getVendorW9ReceivedIndicator())) {
            DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
            Date today = dateTimeService.getCurrentDate();
            if (ObjectUtils.isNotNull(vDetail.getVendorHeader().getVendorW9SignedDate())) {
                Date signedDate = vDetail.getVendorHeader().getVendorW9SignedDate();
                if (today.compareTo(signedDate) <= 0) {
                    putFieldError(VendorPropertyConstants.VENDOR_W9SIGNED_DATE, VendorKeyConstants.ERROR_VENDOR_W8ANDW9_SIGNED_AFTER_TODAY);
                    return false;
                }
            } else {
                putFieldError(VendorPropertyConstants.VENDOR_W9SIGNED_DATE, VendorKeyConstants.ERROR_VENDOR_W9SINGED_DATE_REQUIRED);
                return false;
            }
        }
    }
    return true;
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) DateTimeService(org.kuali.kfs.core.api.datetime.DateTimeService) Date(java.util.Date)

Aggregations

DateTimeService (org.kuali.kfs.core.api.datetime.DateTimeService)22 Date (java.util.Date)7 Date (java.sql.Date)4 ConfigurationService (org.kuali.kfs.core.api.config.property.ConfigurationService)4 ParameterService (org.kuali.kfs.coreservice.framework.parameter.ParameterService)4 Person (org.kuali.kfs.kim.api.identity.Person)4 CustomerProfile (org.kuali.kfs.pdp.businessobject.CustomerProfile)4 ArrayList (java.util.ArrayList)3 ParseException (java.text.ParseException)2 KualiDecimal (org.kuali.kfs.core.api.util.type.KualiDecimal)2 FormatProcessSummary (org.kuali.kfs.pdp.businessobject.FormatProcessSummary)2 FormatSelection (org.kuali.kfs.pdp.businessobject.FormatSelection)2 CuDisbursementVoucherDefaultDueDateService (edu.cornell.kfs.fp.document.service.CuDisbursementVoucherDefaultDueDateService)1 CuFormatService (edu.cornell.kfs.pdp.service.CuFormatService)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 StringBufferInputStream (java.io.StringBufferInputStream)1 SimpleDateFormat (java.text.SimpleDateFormat)1 HashMap (java.util.HashMap)1 List (java.util.List)1 ServletOutputStream (javax.servlet.ServletOutputStream)1