use of org.kuali.kfs.krad.rules.rule.event.RouteDocumentEvent in project cu-kfs by CU-CommunityApps.
the class PurchasingDocumentBase method prepareForSave.
/**
* Overrides the method in PurchasingAccountsPayableDocumentBase to remove the
* purchasingCapitalAssetSystem when the system type is either ONE or MULT.
*/
@Override
public void prepareForSave(KualiDocumentEvent event) {
super.prepareForSave(event);
if (StringUtils.isNotBlank(this.getCapitalAssetSystemTypeCode())) {
if (this.getCapitalAssetSystemTypeCode().equals(PurapConstants.CapitalAssetSystemTypes.ONE_SYSTEM) || this.getCapitalAssetSystemTypeCode().equals(PurapConstants.CapitalAssetSystemTypes.MULTIPLE)) {
// If the system state is ONE or MULT, we have to remove all the systems on the items because it's not applicable.
for (PurchasingCapitalAssetItem camsItem : this.getPurchasingCapitalAssetItems()) {
camsItem.setPurchasingCapitalAssetSystem(null);
}
}
}
if (event instanceof RouteDocumentEvent || event instanceof ApproveDocumentEvent) {
boolean defaultUseTaxIndicatorValue = SpringContext.getBean(PurchasingService.class).getDefaultUseTaxIndicatorValue(this);
SpringContext.getBean(PurapService.class).updateUseTaxIndicator(this, defaultUseTaxIndicatorValue);
}
// KFSUPGRADE-583
checkForFederalAccount();
}
use of org.kuali.kfs.krad.rules.rule.event.RouteDocumentEvent in project cu-kfs by CU-CommunityApps.
the class PaymentWorksDataProcessingIntoKfsServiceImpl method kfsVendorMaintenanceDocumentValidated.
private boolean kfsVendorMaintenanceDocumentValidated(MaintenanceDocument vendorMaintenceDoc, PaymentWorksNewVendorRequestsBatchReportData reportData, PaymentWorksVendor pmwVendor) {
boolean documentValidated = false;
try {
vendorMaintenceDoc.validateBusinessRules(new RouteDocumentEvent(vendorMaintenceDoc));
LOG.info("kfsVendorMaintenanceDocumentValidated: vendorMaintenceDoc validate.");
documentValidated = true;
} catch (ValidationException ve) {
List<String> validationErrors = convertReportDataValidationErrors(GlobalVariables.getMessageMap().getErrorMessages());
captureKfsProcessingErrorsForVendor(pmwVendor, reportData, validationErrors);
LOG.error("kfsVendorMaintenanceDocumentValidated: eDoc validation error(s): " + validationErrors.toString());
LOG.error("kfsVendorMaintenanceDocumentValidated: eDoc validation exception caught: " + ve.getMessage());
} finally {
GlobalVariables.getMessageMap().clearErrorMessages();
}
return documentValidated;
}
use of org.kuali.kfs.krad.rules.rule.event.RouteDocumentEvent in project cu-kfs by CU-CommunityApps.
the class IWantDocumentAction method continueToRouting.
/**
* Takes the user to next page
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward continueToRouting(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
IWantDocumentForm iWantForm = (IWantDocumentForm) form;
IWantDocument iWantDocument = iWantForm.getIWantDocument();
// call business rules
KualiRuleService ruleService = SpringContext.getBean(KualiRuleService.class);
boolean rulePassed = true;
rulePassed &= ruleService.applyRules(new RouteDocumentEvent("", iWantDocument));
if (rulePassed) {
iWantForm.setStep(CUPurapConstants.IWantDocumentSteps.ROUTING_STEP);
iWantDocument.setStep(CUPurapConstants.IWantDocumentSteps.ROUTING_STEP);
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.krad.rules.rule.event.RouteDocumentEvent in project cu-kfs by CU-CommunityApps.
the class IWantDocumentAction method continueToVendor.
/**
* Takes the user to next page
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward continueToVendor(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
IWantDocumentForm iWantForm = (IWantDocumentForm) form;
IWantDocument iWantDocument = iWantForm.getIWantDocument();
boolean added = true;
// add new item and new accounting line if not empty
IWantItem item = iWantForm.getNewIWantItemLine();
if (StringUtils.isNotBlank(item.getItemDescription()) || item.getItemUnitPrice() != null || item.getItemQuantity() != null) {
added &= addNewItem(iWantForm, iWantDocument, item);
}
added &= addNewFavoriteAccountIfNecessary(added, iWantDocument);
if (added) {
IWantAccount account = iWantForm.getNewSourceLine();
if (StringUtils.isNotBlank(account.getAccountNumber()) || StringUtils.isNotBlank(account.getSubAccountNumber()) || StringUtils.isNotBlank(account.getFinancialObjectCode()) || StringUtils.isNotBlank(account.getFinancialSubObjectCode()) || StringUtils.isNotBlank(account.getProjectCode()) || StringUtils.isNotBlank(account.getOrganizationReferenceId())) {
added &= addNewAccount(iWantForm, iWantDocument, account);
}
}
// If addition of IWNT item or account failed, then skip the rest of the validation.
if (!added) {
return mapping.findForward(RiceConstants.MAPPING_BASIC);
}
KualiRuleService ruleService = SpringContext.getBean(KualiRuleService.class);
boolean rulePassed = true;
// call business rules
rulePassed &= ruleService.applyRules(new RouteDocumentEvent("", iWantDocument));
if (rulePassed) {
iWantForm.setStep(CUPurapConstants.IWantDocumentSteps.VENDOR_STEP);
iWantDocument.setStep(CUPurapConstants.IWantDocumentSteps.VENDOR_STEP);
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.krad.rules.rule.event.RouteDocumentEvent in project cu-kfs by CU-CommunityApps.
the class IWantDocumentAction method continueToItems.
/**
* Takes the user to next page
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward continueToItems(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
IWantDocumentForm iWantForm = (IWantDocumentForm) form;
IWantDocument iWantDocument = iWantForm.getIWantDocument();
iWantDocument.setExplanation(iWantDocument.getDocumentHeader().getExplanation());
KualiRuleService ruleService = SpringContext.getBean(KualiRuleService.class);
boolean rulePassed = true;
// call business rules
rulePassed &= ruleService.applyRules(new RouteDocumentEvent(KFSConstants.DOCUMENT_HEADER_ERRORS, iWantDocument));
if (rulePassed) {
iWantForm.setStep(CUPurapConstants.IWantDocumentSteps.ITEMS_AND_ACCT_DATA_STEP);
iWantDocument.setStep(CUPurapConstants.IWantDocumentSteps.ITEMS_AND_ACCT_DATA_STEP);
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Aggregations