use of org.kuali.kfs.krad.util.MessageMap in project cu-kfs by CU-CommunityApps.
the class PaymentFileServiceImpl method processPaymentFiles.
/**
* @see org.kuali.kfs.pdp.service.PaymentFileService#processPaymentFiles(org.kuali.kfs.sys.batch.BatchInputFileType)
*/
@Override
public void processPaymentFiles(BatchInputFileType paymentInputFileType) {
List<String> fileNamesToLoad = batchInputFileService.listInputFileNamesWithDoneFile(paymentInputFileType);
for (String incomingFileName : fileNamesToLoad) {
try {
if (LOG.isDebugEnabled()) {
LOG.debug("processPaymentFiles() Processing " + incomingFileName);
}
// collect various information for status of load
LoadPaymentStatus status = new LoadPaymentStatus();
status.setMessageMap(new MessageMap());
// process payment file
PaymentFileLoad paymentFile = processPaymentFile(paymentInputFileType, incomingFileName, status.getMessageMap());
if (paymentFile != null && paymentFile.isPassedValidation()) {
// load payment data
loadPayments(paymentFile, status, incomingFileName);
createOutputFile(status, incomingFileName);
} else {
// if we encounter an error for the payment file, we will remove the .done file so it will not be parse again
LOG.error("Encounter a problem while processing payment file: " + incomingFileName + " . Removing the done file to stop re-process.");
removeDoneFile(incomingFileName);
}
} catch (RuntimeException e) {
LOG.error("Caught exception trying to load payment file: " + incomingFileName, e);
// swallow exception so we can continue processing files, the errors have been reported by email
}
}
}
use of org.kuali.kfs.krad.util.MessageMap in project cu-kfs by CU-CommunityApps.
the class KualiAccountingDocumentActionBase method insertSourceLine.
/**
* This action executes an insert of a SourceAccountingLine into a document only after validating the accounting line and
* checking any appropriate business rules.
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws Exception
*/
public ActionForward insertSourceLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
KualiAccountingDocumentFormBase financialDocumentForm = (KualiAccountingDocumentFormBase) form;
SourceAccountingLine line = financialDocumentForm.getNewSourceLine();
// populate chartOfAccountsCode from account number if accounts cant cross chart and Javascript is turned off
// SpringContext.getBean(AccountService.class).populateAccountingLineChartIfNeeded(line);
boolean rulePassed = true;
// DV acct line amount got error during form populate; should not insert this line. KFSUPGRADE-847
MessageMap msgMap = GlobalVariables.getMessageMap();
if (msgMap.hasErrors() && msgMap.getErrorMessages().keySet().contains("newSourceLine.amount") && financialDocumentForm.getDocument() instanceof DisbursementVoucherDocument) {
rulePassed = false;
}
// before we check the regular rules we need to check the sales tax rules
// TODO: Refactor rules so we no longer have to call this before a copy of the
// accountingLine
rulePassed &= checkSalesTax((AccountingDocument) financialDocumentForm.getDocument(), line, true, true, 0);
// check any business rules
rulePassed &= SpringContext.getBean(KualiRuleService.class).applyRules(new AddAccountingLineEvent(KFSConstants.NEW_SOURCE_ACCT_LINE_PROPERTY_NAME, financialDocumentForm.getDocument(), line));
if (rulePassed) {
// add accountingLine
SpringContext.getBean(PersistenceService.class).refreshAllNonUpdatingReferences(line);
insertAccountingLine(true, financialDocumentForm, line);
// clear the used newTargetLine
financialDocumentForm.setNewSourceLine(null);
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.krad.util.MessageMap in project cu-kfs by CU-CommunityApps.
the class CuDisbursementVoucherNonResidentAlienInformationValidation method validate.
@Override
public boolean validate(AttributedDocumentEvent event) {
LOG.debug("validate start");
boolean isValid = true;
DisbursementVoucherDocument document = (DisbursementVoucherDocument) accountingDocumentForValidation;
DisbursementVoucherNonResidentAlienTax nonResidentAlienTax = document.getDvNonResidentAlienTax();
DisbursementVoucherPayeeDetail payeeDetail = document.getDvPayeeDetail();
Person financialSystemUser = GlobalVariables.getUserSession().getPerson();
List<String> taxEditMode = this.getTaxEditMode();
if (!payeeDetail.isDisbVchrAlienPaymentCode() || !this.hasRequiredEditMode(document, financialSystemUser, taxEditMode)) {
return true;
}
MessageMap errors = GlobalVariables.getMessageMap();
errors.addToErrorPath(KFSPropertyConstants.DOCUMENT);
errors.addToErrorPath(KFSPropertyConstants.DV_NON_RESIDENT_ALIEN_TAX);
/* income class code required */
if (StringUtils.isBlank(nonResidentAlienTax.getIncomeClassCode())) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_REQUIRED, "Income class code");
return false;
}
/* country code required, unless income type is nonreportable */
if (StringUtils.isBlank(nonResidentAlienTax.getPostalCountryCode()) && !NRA_TAX_INCOME_CLASS_NON_REPORTABLE.equals(nonResidentAlienTax.getIncomeClassCode())) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_REQUIRED, "Country code");
return false;
}
// income class is FELLOWSHIP
if (nonResidentAlienTax.getIncomeClassCode().equals(NRA_TAX_INCOME_CLASS_FELLOWSHIP)) {
// Place holder for logic related to the ICC
}
// income class is INDEPENDENT CONTRACTOR
if (nonResidentAlienTax.getIncomeClassCode().equals(NRA_TAX_INCOME_CLASS_INDEPENDENT_CONTRACTOR)) {
// Place holder for logic related to the ICC
}
// income class is ROYALTIES
if (nonResidentAlienTax.getIncomeClassCode().equals(NRA_TAX_INCOME_CLASS_ROYALTIES)) {
// Place holder for logic related to the ICC
}
// income class is NON_REPORTABLE
if (nonResidentAlienTax.getIncomeClassCode().equals(NRA_TAX_INCOME_CLASS_NON_REPORTABLE)) {
if ((nonResidentAlienTax.isForeignSourceIncomeCode()) || (nonResidentAlienTax.isIncomeTaxTreatyExemptCode()) || (nonResidentAlienTax.isTaxOtherExemptIndicator()) || (nonResidentAlienTax.isIncomeTaxGrossUpCode()) || (nonResidentAlienTax.isTaxUSAIDPerDiemIndicator()) || (nonResidentAlienTax.getTaxSpecialW4Amount() != null) || (nonResidentAlienTax.getReferenceFinancialDocumentNumber() != null) || (nonResidentAlienTax.getTaxNQIId() != null) || (nonResidentAlienTax.getPostalCountryCode() != null)) {
String boxCode = "";
if (nonResidentAlienTax.isForeignSourceIncomeCode()) {
boxCode = "Foreign Source";
}
if (nonResidentAlienTax.isIncomeTaxTreatyExemptCode()) {
boxCode = "Treaty Exempt";
}
if (nonResidentAlienTax.isTaxOtherExemptIndicator()) {
boxCode = "Exempt Under Other Code";
}
if (nonResidentAlienTax.isIncomeTaxGrossUpCode()) {
boxCode = "Gross Up Payment";
}
if (nonResidentAlienTax.isTaxUSAIDPerDiemIndicator()) {
boxCode = "USAID Per Diem";
}
if (nonResidentAlienTax.getTaxSpecialW4Amount() != null) {
boxCode = "Special W-4 Amount";
}
if (nonResidentAlienTax.getReferenceFinancialDocumentNumber() != null) {
boxCode = "Reference Doc";
}
if (nonResidentAlienTax.getTaxNQIId() != null) {
boxCode = "NQI Id";
}
if (nonResidentAlienTax.getPostalCountryCode() != null) {
boxCode = "Country Code";
}
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_NON_REPORTABLE_ONLY, boxCode);
return false;
}
}
/* check tax rates */
if (((nonResidentAlienTax.getFederalIncomeTaxPercent() == null) || (nonResidentAlienTax.getFederalIncomeTaxPercent().equals(KualiDecimal.ZERO))) && (nonResidentAlienTax.getIncomeClassCode().equals(NRA_TAX_INCOME_CLASS_NON_REPORTABLE))) {
nonResidentAlienTax.setFederalIncomeTaxPercent(KualiDecimal.ZERO);
} else {
if (nonResidentAlienTax.getFederalIncomeTaxPercent() == null) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_REQUIRED, "Federal tax percent");
return false;
} else {
// check Federal tax percent is in non-resident alien tax percent table for income class code
NonResidentAlienTaxPercent taxPercent = new NonResidentAlienTaxPercent();
taxPercent.setIncomeClassCode(nonResidentAlienTax.getIncomeClassCode());
taxPercent.setIncomeTaxTypeCode(FEDERAL_TAX_TYPE_CODE);
taxPercent.setIncomeTaxPercent(nonResidentAlienTax.getFederalIncomeTaxPercent());
NonResidentAlienTaxPercent retrievedPercent = (NonResidentAlienTaxPercent) SpringContext.getBean(BusinessObjectService.class).retrieve(taxPercent);
if (retrievedPercent == null) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_INVALID_FED_TAX_PERCENT, new String[] { nonResidentAlienTax.getFederalIncomeTaxPercent().toString(), nonResidentAlienTax.getIncomeClassCode() });
return false;
}
}
}
if (((nonResidentAlienTax.getStateIncomeTaxPercent() == null) || (nonResidentAlienTax.getStateIncomeTaxPercent().equals(KualiDecimal.ZERO))) && (nonResidentAlienTax.getIncomeClassCode().equals(NRA_TAX_INCOME_CLASS_NON_REPORTABLE))) {
nonResidentAlienTax.setStateIncomeTaxPercent(KualiDecimal.ZERO);
} else {
if (nonResidentAlienTax.getStateIncomeTaxPercent() == null) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_REQUIRED, "State tax percent");
return false;
} else {
// check State tax percent is in non-resident alien tax percent table for income class code
NonResidentAlienTaxPercent taxPercent = new NonResidentAlienTaxPercent();
taxPercent.setIncomeClassCode(nonResidentAlienTax.getIncomeClassCode());
taxPercent.setIncomeTaxTypeCode(STATE_TAX_TYPE_CODE);
taxPercent.setIncomeTaxPercent(nonResidentAlienTax.getStateIncomeTaxPercent());
PersistableBusinessObject retrievedPercent = SpringContext.getBean(BusinessObjectService.class).retrieve(taxPercent);
if (retrievedPercent == null) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_INVALID_STATE_TAX_PERCENT, nonResidentAlienTax.getStateIncomeTaxPercent().toString(), nonResidentAlienTax.getIncomeClassCode());
return false;
} else {
if ((!document.getDvNonResidentAlienTax().getIncomeClassCode().equals(NRA_TAX_INCOME_CLASS_ROYALTIES)) && (!document.getDvNonResidentAlienTax().getIncomeClassCode().equals(NRA_TAX_INCOME_CLASS_INDEPENDENT_CONTRACTOR))) {
// If fed tax rate is zero, the state tax rate should be zero.
if ((document.getDvNonResidentAlienTax().getFederalIncomeTaxPercent().equals(KualiDecimal.ZERO)) && (!document.getDvNonResidentAlienTax().getStateIncomeTaxPercent().isZero())) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_STATE_TAX_SHOULD_BE_ZERO);
return false;
}
}
}
}
}
// the 4 check boxes (Foreign Source, Treaty Exempt, Gross Up Payment, Exempt Under Other Code) shall be mutual exclusive
if (OneOrLessBoxesChecked(document)) {
// if Foreign Source is checked
if (nonResidentAlienTax.isForeignSourceIncomeCode()) {
// Federal and State tax rate should be zero.
if ((!nonResidentAlienTax.getFederalIncomeTaxPercent().equals(KualiDecimal.ZERO)) || (!nonResidentAlienTax.getStateIncomeTaxPercent().equals(KualiDecimal.ZERO))) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_NRA_TAX_WHEN_CHECKED_FEDERAL_AND_STATE_TAXES_SHOULD_BE_ZERO, "Foreign Source");
return false;
}
// No other items (mutual exclusiveness checking on USAID Per Diem and Special W-4 Amount are optional here since these are also ensured by their validation later)
if ((nonResidentAlienTax.isTaxUSAIDPerDiemIndicator()) || (nonResidentAlienTax.getTaxSpecialW4Amount() != null) || (nonResidentAlienTax.getReferenceFinancialDocumentNumber() != null) || (nonResidentAlienTax.getTaxNQIId() != null)) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_NRA_TAX_WHEN_CHECKED_CANNOT_HAVE_VALUE, "Foreign Source", "NQI Id, Reference Doc, USAID Per Diem, or Special W-4 Amount");
return false;
}
}
// if Treaty Exempt is checked
if (nonResidentAlienTax.isIncomeTaxTreatyExemptCode()) {
// No other items (mutual exclusiveness checking on USAID Per Diem and Special W-4 Amount are optional here since these are also ensured by their validation later)
if ((nonResidentAlienTax.isTaxUSAIDPerDiemIndicator()) || (nonResidentAlienTax.getTaxSpecialW4Amount() != null) || (nonResidentAlienTax.getReferenceFinancialDocumentNumber() != null) || (nonResidentAlienTax.getTaxNQIId() != null)) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_NRA_TAX_WHEN_CHECKED_CANNOT_HAVE_VALUE, "Treaty Exempt", "NQI Id, Reference Doc, USAID Per Diem, or Special W-4 Amount");
return false;
}
}
// if Gross Up Payment is checked
if (nonResidentAlienTax.isIncomeTaxGrossUpCode()) {
// NOTE: Also, state tax not allowed to be zero for income classes "R" and "I", however, this rule is already checked in the tax rate section, so no need to re-check
if ((nonResidentAlienTax.getFederalIncomeTaxPercent().equals(KualiDecimal.ZERO))) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_NRA_TAX_WHEN_CHECKED_FEDERAL_TAX_CANNOT_BE_ZERO, "Gross Up Payment");
return false;
}
// No other items (mutual exclusiveness checking on USAID Per Diem and Special W-4 Amount are optional here since these are also ensured by their validation later)
if ((nonResidentAlienTax.isTaxUSAIDPerDiemIndicator()) || (nonResidentAlienTax.getTaxSpecialW4Amount() != null) || (nonResidentAlienTax.getReferenceFinancialDocumentNumber() != null) || (nonResidentAlienTax.getTaxNQIId() != null)) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_NRA_TAX_WHEN_CHECKED_CANNOT_HAVE_VALUE, "Gross Up Payment", "NQI Id, Reference Doc, USAID Per Diem, or Special W-4 Amount");
return false;
}
}
// if Exempt Under Other Code is checked
if (nonResidentAlienTax.isTaxOtherExemptIndicator()) {
// Federal and State tax rate should be zero.
if (!(nonResidentAlienTax.getStateIncomeTaxPercent().equals(KualiDecimal.ZERO)) || !(nonResidentAlienTax.getFederalIncomeTaxPercent().equals(KualiDecimal.ZERO))) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_NRA_TAX_WHEN_CHECKED_FEDERAL_AND_STATE_TAXES_SHOULD_BE_ZERO, "Exempt Under Other Code");
return false;
}
}
// if USAID Per Diem is checked
if (nonResidentAlienTax.isTaxUSAIDPerDiemIndicator()) {
// income class code should be fellowship
if (!nonResidentAlienTax.getIncomeClassCode().equals(NRA_TAX_INCOME_CLASS_FELLOWSHIP)) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_NRA_TAX_WHEN_CHECKED_SHOULD_BE_SELECTED, "USAID Per Diem", "Income Class Code : Fellowship");
return false;
}
// Federal and State tax rate should be zero.
if (!(nonResidentAlienTax.getStateIncomeTaxPercent().equals(KualiDecimal.ZERO)) || !(nonResidentAlienTax.getFederalIncomeTaxPercent().equals(KualiDecimal.ZERO))) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_NRA_TAX_WHEN_CHECKED_FEDERAL_AND_STATE_TAXES_SHOULD_BE_ZERO, "USAID Per Diem");
return false;
}
// Exempt Under Other Code should be checked; this will ensure the other 3 check boxes not checked due to mutual exclusiveness
if (!nonResidentAlienTax.isTaxOtherExemptIndicator()) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_NRA_TAX_WHEN_CHECKED_SHOULD_BE_SELECTED, "USAID Per Diem", "Exempt Under Other Code");
return false;
}
// Special W-4 Amount shall have no value
if (nonResidentAlienTax.getTaxSpecialW4Amount() != null) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_NRA_TAX_WHEN_CHECKED_CANNOT_HAVE_VALUE, "USAID Per Diem", "Special W-4 Amount");
return false;
}
}
// if Special W-4 Amount is entered
if (nonResidentAlienTax.getTaxSpecialW4Amount() != null) {
// income class code should be fellowship
if (!nonResidentAlienTax.getIncomeClassCode().equals(NRA_TAX_INCOME_CLASS_FELLOWSHIP)) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_NRA_TAX_WHEN_CHECKED_SHOULD_BE_SELECTED, "Special W-4 Amount", "Income Class Code : Fellowship");
return false;
}
// Federal and State tax rate should be zero.
if (!(nonResidentAlienTax.getStateIncomeTaxPercent().equals(KualiDecimal.ZERO)) || !(nonResidentAlienTax.getFederalIncomeTaxPercent().equals(KualiDecimal.ZERO))) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_NRA_TAX_WHEN_CHECKED_FEDERAL_AND_STATE_TAXES_SHOULD_BE_ZERO, "Special W-4 Amount");
return false;
}
// Exempt Under Other Code should be checked; this will ensure the other 3 check boxes not checked due to mutual exclusiveness
if (!nonResidentAlienTax.isTaxOtherExemptIndicator()) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_NRA_TAX_WHEN_CHECKED_SHOULD_BE_SELECTED, "Special W-4 Amount", "Exempt Under Other Code");
return false;
}
// USAID Per Diem should not be checked (mutual exclusive checking on USAID Per Diem here is optional since this is also ensured by validation on Special W-4 Amount above
if ((nonResidentAlienTax.isTaxUSAIDPerDiemIndicator())) {
errors.putErrorWithoutFullErrorPath("DVNRATaxErrors", KFSKeyConstants.ERROR_DV_NRA_TAX_WHEN_CHECKED_CANNOT_BE_SELECTED, "Special W-4 Amount", "USAID Per Diem");
return false;
}
}
// if NQI Id is entered
if (nonResidentAlienTax.getTaxNQIId() != null) {
}
// if Reference Doc is entered
if (nonResidentAlienTax.getReferenceFinancialDocumentNumber() != null) {
}
}
if (validationType != "GENERATE") {
// verify tax lines have been generated
if ((nonResidentAlienTax.getFederalIncomeTaxPercent().isNonZero() || nonResidentAlienTax.getStateIncomeTaxPercent().isNonZero())) {
if (StringUtils.isBlank(nonResidentAlienTax.getFinancialDocumentAccountingLineText())) {
errors.putErrorWithoutFullErrorPath(KFSConstants.GENERAL_NRATAX_TAB_ERRORS, KFSKeyConstants.ERROR_DV_NRA_NO_TAXLINES_GENERATED);
return false;
}
}
}
errors.removeFromErrorPath(KFSPropertyConstants.DV_NON_RESIDENT_ALIEN_TAX);
errors.removeFromErrorPath(KFSPropertyConstants.DOCUMENT);
return isValid;
}
use of org.kuali.kfs.krad.util.MessageMap in project cu-kfs by CU-CommunityApps.
the class CuPurchasingProcessVendorValidation method validateDataForMethodOfPOTransmissionExistsOnVendorAddress.
/**
* This routine verifies that the data necessary for the Method of PO Transmission chosen on the REQ,
* PO, or POA document exists on the document's VendorAddress record for the chosen Vendor.
* If the required checks pass, true is returned.
* If the required checks fail, false is returned.
*
* NOTE: This routine could not be used for the VendorAddress validation checks on the Vendor maintenance
* document because the Method of PO Transmission value selectable on that document pertains to the specific
* VendorAddress being maintained. The method of PO transmission being used for this routine's validation
* checks is the one that is present on the input parameter purchasing document (REQ, PO, or POA) and could
* be different from the value of the same name that is on the VendorAddress. It is ok if these two values
* are different because the user could have changed it after the default was obtained via the lookup and
* used to populate the REQ, PO, or POA value as long as the data required for the method of PO transmission
* selected in that document exists on the VendorAddress record chosen on the REQ, PO, or POA.
*
* For KFSPTS-1458: This method was changed extensively to address new business rules.
*/
public boolean validateDataForMethodOfPOTransmissionExistsOnVendorAddress(Document document) {
boolean dataExists = true;
MessageMap errorMap = GlobalVariables.getMessageMap();
errorMap.clearErrorPath();
errorMap.addToErrorPath(PurapConstants.VENDOR_ERRORS);
// for REQ, PO, and POA verify that data exists on form for method of PO transmission value selected
if ((document instanceof RequisitionDocument) || (document instanceof PurchaseOrderDocument) || (document instanceof PurchaseOrderAmendmentDocument)) {
PurchaseOrderTransmissionMethodDataRulesServiceImpl purchaseOrderTransmissionMethodDataRulesServiceImpl = SpringContext.getBean(PurchaseOrderTransmissionMethodDataRulesServiceImpl.class);
PurchasingDocumentBase purapDocument = (PurchasingDocumentBase) document;
String poTransMethodCode = purapDocument.getPurchaseOrderTransmissionMethodCode();
if (poTransMethodCode != null && !StringUtils.isBlank(poTransMethodCode)) {
if (poTransMethodCode.equals(PurapConstants.POTransmissionMethods.FAX)) {
dataExists = purchaseOrderTransmissionMethodDataRulesServiceImpl.isFaxNumberValid(purapDocument.getVendorFaxNumber());
if (!dataExists) {
errorMap.putError(VendorPropertyConstants.VENDOR_FAX_NUMBER, CUPurapKeyConstants.PURAP_MOPOT_REQUIRED_DATA_MISSING);
}
} else if (poTransMethodCode.equals(CUPurapConstants.POTransmissionMethods.EMAIL)) {
dataExists = purchaseOrderTransmissionMethodDataRulesServiceImpl.isEmailAddressValid(purapDocument.getVendorEmailAddress());
if (!dataExists) {
errorMap.putError("vendorEmailAddress", CUPurapKeyConstants.PURAP_MOPOT_REQUIRED_DATA_MISSING);
}
} else if (poTransMethodCode.equals(CUPurapConstants.POTransmissionMethods.MANUAL)) {
dataExists = purchaseOrderTransmissionMethodDataRulesServiceImpl.isPostalAddressValid(purapDocument.getVendorLine1Address(), purapDocument.getVendorCityName(), purapDocument.getVendorStateCode(), purapDocument.getVendorPostalCode(), purapDocument.getVendorCountryCode());
if (!dataExists) {
errorMap.putError(VendorPropertyConstants.VENDOR_ADDRESS_LINE_1, CUPurapKeyConstants.PURAP_MOPOT_REQUIRED_DATA_MISSING);
}
}
}
}
return dataExists;
}
use of org.kuali.kfs.krad.util.MessageMap in project cu-kfs by CU-CommunityApps.
the class PaymentRequestForeignDraftValidation method validate.
/**
* @see org.kuali.kfs.sys.document.validation.Validation#validate(org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent)
*/
public boolean validate(AttributedDocumentEvent event) {
if (LOG.isDebugEnabled()) {
LOG.debug("validate start");
}
boolean isValid = true;
PaymentRequestDocument document = (PaymentRequestDocument) accountingDocumentForValidation;
if (!PaymentMethod.PM_CODE_FOREIGN_DRAFT.equals(((CuPaymentRequestDocument) document).getPaymentMethodCode())) {
return true;
}
MessageMap errors = GlobalVariables.getMessageMap();
errors.addToErrorPath(KFSPropertyConstants.DOCUMENT);
errors.addToErrorPath(CUPurapPropertyConstants.PREQ_WIRE_TRANSFER);
/* currency type code required */
if (StringUtils.isBlank(((CuPaymentRequestDocument) document).getPreqWireTransfer().getPreqForeignCurrencyTypeCode())) {
errors.putError(CUPurapPropertyConstants.PREQ_FD_CURRENCY_TYPE_CODE, KFSKeyConstants.ERROR_PAYMENT_SOURCE_CURRENCY_TYPE_CODE);
isValid = false;
}
/* currency type name required */
if (StringUtils.isBlank(((CuPaymentRequestDocument) document).getPreqWireTransfer().getPreqForeignCurrencyTypeName())) {
errors.putError(CUPurapPropertyConstants.PREQ_FD_CURRENCY_TYPE_NAME, KFSKeyConstants.ERROR_PAYMENT_SOURCE_CURRENCY_TYPE_NAME);
isValid = false;
}
errors.removeFromErrorPath(CUPurapPropertyConstants.PREQ_WIRE_TRANSFER);
errors.removeFromErrorPath(KFSPropertyConstants.DOCUMENT);
return isValid;
}
Aggregations