use of org.kuali.kfs.module.purap.document.VendorCreditMemoDocument in project cu-kfs by CU-CommunityApps.
the class CUVendorCreditMemoTotalMatchesVendorAmountValidation method validate.
public boolean validate(AttributedDocumentEvent event) {
boolean valid = true;
VendorCreditMemoDocument cmDocument = (VendorCreditMemoDocument) event.getDocument();
GlobalVariables.getMessageMap().clearErrorPath();
GlobalVariables.getMessageMap().addToErrorPath(KFSPropertyConstants.DOCUMENT);
if (cmDocument.getGrandTotal().compareTo(cmDocument.getCreditMemoAmount()) != 0 && !cmDocument.isUnmatchedOverride()) {
GlobalVariables.getMessageMap().putError(PurapPropertyConstants.GRAND_TOTAL, PurapKeyConstants.ERROR_CREDIT_MEMO_INVOICE_AMOUNT_NONMATCH);
valid = false;
}
GlobalVariables.getMessageMap().clearErrorPath();
return valid;
}
use of org.kuali.kfs.module.purap.document.VendorCreditMemoDocument in project cu-kfs by CU-CommunityApps.
the class CuAccountsPayableBankCodeValidation method validate.
@Override
public boolean validate(AttributedDocumentEvent event) {
AccountsPayableDocumentBase apDocument = (AccountsPayableDocumentBase) getAccountingDocumentForValidation();
// check if one of the extended UA documents, if so, take the payment method into account, otherwise, revert to baseline behavior
boolean isValid = true;
if (apDocument instanceof PaymentRequestDocument) {
if (StringUtils.isNotBlank(apDocument.getBankCode())) {
// PREQ bank code is not required
isValid = CuBankCodeValidation.validate(apDocument.getBankCode(), "document." + PurapPropertyConstants.BANK_CODE, ((CuPaymentRequestDocument) apDocument).getPaymentMethodCode(), false, true);
if (isValid) {
if (!(event instanceof AttributedRouteDocumentEvent) && StringUtils.isNotBlank(apDocument.getBankCode()) && !CuBankCodeValidation.doesBankCodeNeedToBePopulated(((CuPaymentRequestDocument) apDocument).getPaymentMethodCode())) {
apDocument.setBank(null);
apDocument.setBankCode(null);
}
}
}
} else if (apDocument instanceof VendorCreditMemoDocument) {
if (StringUtils.isNotBlank(apDocument.getBankCode())) {
isValid = CuBankCodeValidation.validate(apDocument.getBankCode(), "document." + PurapPropertyConstants.BANK_CODE, ((CuVendorCreditMemoDocument) apDocument).getPaymentMethodCode(), false, true);
if (isValid) {
// clear out the bank code on the document if not needed (per the message set by the call above)
if (StringUtils.isNotBlank(apDocument.getBankCode()) && !CuBankCodeValidation.doesBankCodeNeedToBePopulated(((CuVendorCreditMemoDocument) apDocument).getPaymentMethodCode())) {
apDocument.setBank(null);
apDocument.setBankCode(null);
}
}
}
} else {
isValid = CuBankCodeValidation.validate(apDocument.getBankCode(), "document." + PurapPropertyConstants.BANK_CODE, false, true);
}
return isValid;
}
use of org.kuali.kfs.module.purap.document.VendorCreditMemoDocument in project cu-kfs by CU-CommunityApps.
the class CuVendorCreditMemoForm method getExtraButtons.
@Override
public List<ExtraButton> getExtraButtons() {
List<ExtraButton> extraButtons = super.getExtraButtons();
VendorCreditMemoDocument cmDocument = (VendorCreditMemoDocument) getDocument();
String appExternalImageURL = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(KFSConstants.EXTERNALIZABLE_IMAGES_URL_KEY);
if (!getEditingMode().containsKey(CreditMemoEditMode.DISPLAY_INIT_TAB)) {
if (!(SpringContext.getBean(PurapService.class).isFullDocumentEntryCompleted(cmDocument) == false && documentActions.containsKey(KRADConstants.KUALI_ACTION_CAN_EDIT))) {
if (getEditingMode().containsKey(CUPaymentRequestEditMode.WAIVE_WIRE_FEE_EDITABLE)) {
addExtraButton("methodToCall.calculate", appExternalImageURL + "buttonsmall_calculate.gif", "Calculate");
}
}
}
return extraButtons;
}
Aggregations