1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.fp.document.validation.impl;
17
18 import static org.kuali.ole.sys.document.validation.impl.AccountingDocumentRuleBaseConstants.ERROR_PATH.DOCUMENT_ERROR_PREFIX;
19
20 import org.kuali.ole.sys.OLEKeyConstants.CashReceipt;
21 import org.kuali.ole.sys.OLEPropertyConstants;
22 import org.kuali.ole.sys.document.AccountingDocument;
23 import org.kuali.ole.sys.document.validation.GenericValidation;
24 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
25 import org.kuali.rice.krad.util.GlobalVariables;
26
27
28
29
30
31 public class CashReceiptFamilyAccountingLineTotalValidation extends GenericValidation {
32 private AccountingDocument accountingDocumentForValidation;
33
34
35
36
37
38 public boolean validate(AttributedDocumentEvent event) {
39 boolean isValid = true;
40
41 if (getAccountingDocumentForValidation().getSourceTotal().isZero()) {
42 String errorProperty = DOCUMENT_ERROR_PREFIX + OLEPropertyConstants.SOURCE_ACCOUNTING_LINES;
43
44 isValid = false;
45 GlobalVariables.getMessageMap().putError(errorProperty, CashReceipt.ERROR_ZERO_TOTAL, "Accounting Line Total");
46 }
47
48 return isValid;
49 }
50
51
52
53
54
55 public AccountingDocument getAccountingDocumentForValidation() {
56 return accountingDocumentForValidation;
57 }
58
59
60
61
62
63 public void setAccountingDocumentForValidation(AccountingDocument accountingDocumentForValidation) {
64 this.accountingDocumentForValidation = accountingDocumentForValidation;
65 }
66 }