use of edu.cornell.kfs.fp.document.PreEncumbranceDocument in project cu-kfs by CU-CommunityApps.
the class CuPreEncumbranceActionTest method setUp.
@Before
public void setUp() {
preEncumbranceDocument = createMock(PreEncumbranceDocument.class);
preEncumbranceDocument.setSourceAccountingLines(new ArrayList());
kualiAccountingDocumentFormBase = createMock(KualiAccountingDocumentFormBase.class);
kualiAccountingDocumentFormBase.setTabStates(new HashMap<>());
kualiAccountingDocumentFormBase.setDocument(preEncumbranceDocument);
cuPreEncumbranceAction = new CuPreEncumbranceAction();
}
use of edu.cornell.kfs.fp.document.PreEncumbranceDocument in project cu-kfs by CU-CommunityApps.
the class PreEncumbranceAutoDisEncumberValidation method validate.
public boolean validate(AttributedDocumentEvent event) {
boolean success = true;
ParameterService ps = SpringContext.getBean(ParameterService.class);
try {
DateFormat transactionDateFormat = new SimpleDateFormat(TRANSACTION_DATE_FORMAT_STRING);
annualClosingDate = new Date(transactionDateFormat.parse(ps.getParameterValueAsString(KfsParameterConstants.GENERAL_LEDGER_BATCH.class, GeneralLedgerConstants.ANNUAL_CLOSING_TRANSACTION_DATE_PARM)).getTime());
// this needs to be changed
annualClosingDate.setYear(annualClosingDate.getYear() + 1);
LOG.info("Annual closing Date of: " + annualClosingDate);
} catch (ParseException e) {
LOG.error("PreEncumbrance validation nnable to parse transaction date", e);
throw new IllegalArgumentException("Unable to parse transaction date");
}
PreEncumbranceDocument ped = (PreEncumbranceDocument) getAccountingDocumentForValidation();
Iterator<PreEncumbranceSourceAccountingLine> it = ped.getSourceAccountingLines().iterator();
while (it.hasNext()) {
PreEncumbranceSourceAccountingLine pesal = it.next();
auto = true;
if (checkMinimumRequirements(pesal) && auto) {
success &= checkDates(pesal);
success &= checkGenerationValidity(pesal);
} else {
if (auto) {
success &= false;
}
}
}
return success;
}
Aggregations