Search in sources :

Example 16 with PaymentRequestItem

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;
}
Also used : PaymentRequestItem(org.kuali.kfs.module.purap.businessobject.PaymentRequestItem) PurApItem(org.kuali.kfs.module.purap.businessobject.PurApItem) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument) List(java.util.List)

Aggregations

PaymentRequestItem (org.kuali.kfs.module.purap.businessobject.PaymentRequestItem)16 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)11 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)9 PaymentRequestDocument (org.kuali.kfs.module.purap.document.PaymentRequestDocument)6 CuPaymentRequestDocument (edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument)5 DocumentService (org.kuali.kfs.krad.service.DocumentService)5 PurchaseOrderItem (org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem)4 CuPaymentRequestItemExtension (edu.cornell.kfs.module.purap.businessobject.CuPaymentRequestItemExtension)3 BigDecimal (java.math.BigDecimal)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 RequisitionDocument (org.kuali.kfs.module.purap.document.RequisitionDocument)3 Iterator (java.util.Iterator)2 List (java.util.List)2 Map (java.util.Map)2 ElectronicInvoiceRejectReason (org.kuali.kfs.module.purap.businessobject.ElectronicInvoiceRejectReason)2 PaymentRequestAccount (org.kuali.kfs.module.purap.businessobject.PaymentRequestAccount)2 PurApItem (org.kuali.kfs.module.purap.businessobject.PurApItem)2 PurchaseOrderAccount (org.kuali.kfs.module.purap.businessobject.PurchaseOrderAccount)2 RequisitionItem (org.kuali.kfs.module.purap.businessobject.RequisitionItem)2