Skip to content

Commit

Permalink
Merge pull request #1073 from NSSuresh11/OLE-8532
Browse files Browse the repository at this point in the history
OLE-8532 : Sufficient funds check giving unexpected warnings
  • Loading branch information
NSSuresh11 authored Jun 16, 2017
2 parents dda2648 + 0a91fe7 commit 8c5783f
Show file tree
Hide file tree
Showing 18 changed files with 340 additions and 163 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1188,10 +1188,10 @@ public boolean answerSplitNodeQuestion(String nodeName) throws UnsupportedOperat
if (nodeName.equals(PurapWorkflowConstants.REQUIRES_IMAGE_ATTACHMENT)) {
return requiresAccountsPayableReviewRouting();
}
if (nodeName.equals(PurapWorkflowConstants.PURCHASE_WAS_RECEIVED)) {
else if (nodeName.equals(PurapWorkflowConstants.PURCHASE_WAS_RECEIVED)) {
return shouldWaitForReceiving();
}
if (nodeName.equals(PurapWorkflowConstants.VENDOR_IS_EMPLOYEE_OR_NON_RESIDENT_ALIEN)) {
else if (nodeName.equals(PurapWorkflowConstants.VENDOR_IS_EMPLOYEE_OR_NON_RESIDENT_ALIEN)) {
return isVendorEmployeeOrNonResidentAlien();
}
throw new UnsupportedOperationException("Cannot answer split question for this node you call \"" + nodeName + "\"");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1174,10 +1174,10 @@ public boolean answerSplitNodeQuestion(String nodeName) throws UnsupportedOperat
if (nodeName.equals(PurapWorkflowConstants.REQUIRES_IMAGE_ATTACHMENT)) {
return requiresAccountsPayableReviewRouting();
}
if (nodeName.equals(PurapWorkflowConstants.PURCHASE_WAS_RECEIVED)) {
else if (nodeName.equals(PurapWorkflowConstants.PURCHASE_WAS_RECEIVED)) {
return shouldWaitForReceiving();
}
if (nodeName.equals(PurapWorkflowConstants.VENDOR_IS_EMPLOYEE_OR_NON_RESIDENT_ALIEN)) {
else if (nodeName.equals(PurapWorkflowConstants.VENDOR_IS_EMPLOYEE_OR_NON_RESIDENT_ALIEN)) {
return isVendorEmployeeOrNonResidentAlien();
}
throw new UnsupportedOperationException("Cannot answer split question for this node you call \"" + nodeName + "\"");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,8 @@ protected boolean isObjectCodeAllowedForAwardRouting(PurApAccountingLine account

protected boolean isBudgetReviewRequired() {
// if document's fiscal year is less than or equal to the current fiscal year
if (SpringContext.getBean(UniversityDateService.class).getCurrentFiscalYear().compareTo(getPostingYear()) >= 0) {
int fiscalYear = SpringContext.getBean(UniversityDateService.class).getCurrentFiscalYear();
if (new Integer(fiscalYear).compareTo(getPostingYear()) >= 0) {

List<SourceAccountingLine> sourceAccountingLineList = this.getSourceAccountingLines();
boolean sufficientFundCheck = false;
Expand All @@ -1653,15 +1654,22 @@ protected boolean isBudgetReviewRequired() {
}
if (notificationOption != null
&& (notificationOption.equals(OLEPropertyConstants.BUD_REVIEW) )) {
OleRequisitionDocumentService oleRequisitionDocumentService = (OleRequisitionDocumentService) SpringContext
.getBean("oleRequisitionDocumentService");
sufficientFundCheck = oleRequisitionDocumentService.hasSufficientFundsOnRequisition(accLine,notificationOption,fiscalYear);
if (sufficientFundCheck) {
return true;
}

// get list of sufficientfundItems

// delete and recreate the GL entries for this document so they do not get included in the SF check
// This is *NOT* ideal. The SF service needs to be updated to allow it to provide the current
// document number so that it can be exlcuded from pending entry checks.
List<GeneralLedgerPendingEntry> pendingEntries = getPendingLedgerEntriesForSufficientFundsChecking();
// List<GeneralLedgerPendingEntry> pendingEntries = getPendingLedgerEntriesForSufficientFundsChecking();
// dumb loop to just force OJB to load the objects. Otherwise, the proxy object above
// only gets resolved *after* the delete below and no SF check happens.
for (GeneralLedgerPendingEntry glpe : pendingEntries) {
/* for (GeneralLedgerPendingEntry glpe : pendingEntries) {
glpe.getChartOfAccountsCode();
}
SpringContext.getBean(GeneralLedgerPendingEntryService.class).delete(getDocumentNumber());
Expand All @@ -1670,7 +1678,7 @@ protected boolean isBudgetReviewRequired() {
SpringContext.getBean(BusinessObjectService.class).save(getGeneralLedgerPendingEntries());
if (fundsItems.size() > 0) {
return true;
}
}*/
}
/*Commented for jira OLE-2359
* for (SufficientFundsItem fundsItem : fundsItems) {
Expand Down Expand Up @@ -1705,7 +1713,7 @@ private boolean isNotificationRequired() {
notificationOption = account.getNotificationOption();
}
if (notificationOption != null && notificationOption.equals(OLEPropertyConstants.NOTIFICATION)) {
sufficientFundCheck = oleRequisitionDocumentService.hasSufficientFundsOnRequisition(accLine);
sufficientFundCheck = oleRequisitionDocumentService.hasSufficientFundsOnRequisition(accLine,notificationOption,SpringContext.getBean(UniversityDateService.class).getCurrentFiscalYear());
if (sufficientFundCheck) {
return sufficientFundCheck;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public boolean answerSplitNodeQuestion(String nodeName) throws UnsupportedOperat
if (nodeName.equals(PurapWorkflowConstants.HAS_ACCOUNTING_LINES)) {
return !isMissingAccountingLines();
}
if (nodeName.equals(PurapWorkflowConstants.AMOUNT_REQUIRES_SEPARATION_OF_DUTIES_REVIEW_SPLIT)) {
else if (nodeName.equals(PurapWorkflowConstants.AMOUNT_REQUIRES_SEPARATION_OF_DUTIES_REVIEW_SPLIT)) {
return isSeparationOfDutiesReviewRequired();
}
return super.answerSplitNodeQuestion(nodeName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import org.kuali.ole.sys.businessobject.SourceAccountingLine;
import org.kuali.ole.sys.context.SpringContext;
import org.kuali.ole.sys.document.validation.event.AddAccountingLineEvent;
import org.kuali.ole.sys.service.UniversityDateService;
import org.kuali.ole.vnd.VendorConstants;
import org.kuali.ole.vnd.businessobject.*;
import org.kuali.ole.vnd.document.service.VendorService;
Expand Down Expand Up @@ -283,7 +284,7 @@ public ActionForward calculate(ActionMapping mapping, ActionForm form, HttpServl
notificationOption = account.getNotificationOption();
}
if (notificationOption != null && notificationOption.equals(OLEPropertyConstants.BLOCK_USE)) {
sufficientFundCheck = oleRequisitionDocumentService.hasSufficientFundsOnRequisition(accLine);
sufficientFundCheck = oleRequisitionDocumentService.hasSufficientFundsOnRequisition(accLine, notificationOption, SpringContext.getBean(UniversityDateService.class).getCurrentFiscalYear());
if (sufficientFundCheck) {
GlobalVariables.getMessageMap().putError(
OLEConstants.SufficientFundCheck.ERROR_MSG_FOR_INSUFF_FUND, RiceKeyConstants.ERROR_CUSTOM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import org.kuali.ole.sys.businessobject.SourceAccountingLine;
import org.kuali.ole.sys.context.SpringContext;
import org.kuali.ole.sys.document.validation.event.AddAccountingLineEvent;
import org.kuali.ole.sys.service.UniversityDateService;
import org.kuali.ole.vnd.VendorConstants;
import org.kuali.ole.vnd.businessobject.*;
import org.kuali.ole.vnd.document.service.VendorService;
Expand Down Expand Up @@ -271,7 +272,7 @@ public ActionForward calculate(ActionMapping mapping, ActionForm form, HttpServl
notificationOption = account.getNotificationOption();
}
if (notificationOption != null && notificationOption.equals(OLEPropertyConstants.BLOCK_USE)) {
sufficientFundCheck = oleRequisitionDocumentService.hasSufficientFundsOnRequisition(accLine);
sufficientFundCheck = oleRequisitionDocumentService.hasSufficientFundsOnRequisition(accLine, notificationOption, SpringContext.getBean(UniversityDateService.class).getCurrentFiscalYear());
if (sufficientFundCheck) {
GlobalVariables.getMessageMap().putError(
OLEConstants.SufficientFundCheck.ERROR_MSG_FOR_INSUFF_FUND, RiceKeyConstants.ERROR_CUSTOM,
Expand Down Expand Up @@ -1172,7 +1173,7 @@ public boolean isBudgetReviewRequired(OleRequisitionDocument document) {
}
if (notificationOption != null
&& (notificationOption.equals(OLEPropertyConstants.BUD_REVIEW))) {
sufficientFundCheck = oleRequisitionDocumentService.hasSufficientFundsOnBlanketApproveRequisition(accLine);
sufficientFundCheck = oleRequisitionDocumentService.hasSufficientFundsOnBlanketApproveRequisition(accLine,notificationOption,SpringContext.getBean(UniversityDateService.class).getCurrentFiscalYear());
if (sufficientFundCheck) {
return sufficientFundCheck;
}
Expand Down Expand Up @@ -1410,4 +1411,4 @@ protected ActionForward performQuestionWithInputAgainBecauseOfErrors(ActionMappi
return performQuestion(mapping, form, request, response, questionId, questionText, questionType, caller, context, true, reason, errorKey, errorPropertyName, errorParameter);
}*/

}
}
Loading

0 comments on commit 8c5783f

Please sign in to comment.