1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.module.purap.document.validation.impl;
17
18 import org.kuali.ole.module.purap.PurapParameterConstants;
19 import org.kuali.ole.module.purap.PurapRuleConstants;
20 import org.kuali.ole.module.purap.businessobject.PurchaseOrderItem;
21 import org.kuali.ole.module.purap.document.PurchaseOrderDocument;
22 import org.kuali.ole.sys.context.SpringContext;
23 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
24 import org.kuali.ole.sys.service.impl.OleParameterConstants;
25 import org.kuali.rice.coreservice.framework.parameter.ParameterService;
26
27 public class PurchaseOrderNewIndividualItemValidation extends PurchasingNewIndividualItemValidation {
28
29 PurchaseOrderEmptyItemWithAccountsValidation emptyItemsWithAccountsValidation;
30
31 public boolean validate(AttributedDocumentEvent event) {
32 boolean valid = super.validate(event);
33 emptyItemsWithAccountsValidation.setItemForValidation((PurchaseOrderItem) super.getItemForValidation());
34 valid &= emptyItemsWithAccountsValidation.validate(event);
35
36 return valid;
37 }
38
39 @Override
40 protected boolean commodityCodeIsRequired() {
41
42
43 boolean enableCommodityCode = SpringContext.getBean(ParameterService.class).getParameterValueAsBoolean(OleParameterConstants.PURCHASING_DOCUMENT.class, PurapParameterConstants.ENABLE_COMMODITY_CODE_IND);
44 if (!enableCommodityCode) {
45 return false;
46 } else {
47 return getParameterService().getParameterValueAsBoolean(PurchaseOrderDocument.class, PurapRuleConstants.ITEMS_REQUIRE_COMMODITY_CODE_IND);
48 }
49 }
50
51 public PurchaseOrderEmptyItemWithAccountsValidation getEmptyItemsWithAccountsValidation() {
52 return emptyItemsWithAccountsValidation;
53 }
54
55 public void setEmptyItemsWithAccountsValidation(PurchaseOrderEmptyItemWithAccountsValidation emptyItemsWithAccountsValidation) {
56 this.emptyItemsWithAccountsValidation = emptyItemsWithAccountsValidation;
57 }
58
59 }