use of org.kuali.kfs.module.purap.businessobject.PaymentRequestItem in project cu-kfs by CU-CommunityApps.
the class CuLineItemQuantityNotZero method validate.
public boolean validate(AttributedDocumentEvent event) {
boolean valid = true;
PaymentRequestDocument document = (PaymentRequestDocument) event.getDocument();
GlobalVariables.getMessageMap().clearErrorPath();
GlobalVariables.getMessageMap().addToErrorPath(KFSPropertyConstants.DOCUMENT);
int i = 0;
for (PurApItem item : (List<PurApItem>) document.getItems()) {
KualiDecimal itemQuantity = item.getItemQuantity();
if (!((PaymentRequestItem) item).isNoQtyItem() && itemQuantity != null) {
if (!itemQuantity.isNonZero()) {
GlobalVariables.getMessageMap().putError("item[" + i + "].itemQuantity", PurapKeyConstants.ERROR_PAYMENT_REQUEST_LINE_ITEM_QUANTITY_ZERO);
GlobalVariables.getMessageMap().clearErrorPath();
valid = false;
break;
}
i++;
}
}
return valid;
}
Aggregations