use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.
the class CuRequisitionDocument method isAwardReviewRequired.
protected boolean isAwardReviewRequired() {
boolean requiresAwardReview = false;
this.getAccountsForRouting();
ParameterService parameterService = SpringContext.getBean(ParameterService.class);
// If the award amount is less than the threshold, then there's no reason to review the object codes, return false
if (!isAwardAmountGreaterThanThreshold()) {
return requiresAwardReview;
}
for (PurApItem item : (List<PurApItem>) this.getItems()) {
for (PurApAccountingLine accountingLine : item.getSourceAccountingLines()) {
requiresAwardReview = isObjectCodeAllowedForAwardRouting(accountingLine, parameterService);
// level.
if (requiresAwardReview) {
return requiresAwardReview;
}
}
}
return requiresAwardReview;
}
use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.
the class PurchasingNewIndividualItemValidation method validateContainsAtLeastOneItem.
/**
* Validates that the document contains at least one item.
*
* @param purDocument the purchasing document to be validated
* @return boolean false if the document does not contain at least one item.
*/
public boolean validateContainsAtLeastOneItem(PurchasingDocument purDocument) {
boolean valid = false;
for (PurApItem item : purDocument.getItems()) {
if (!((PurchasingItemBase) item).isEmpty() && item.getItemType().isLineItemIndicator()) {
return true;
}
}
String documentType = getDocumentTypeLabel(purDocument.getDocumentHeader().getWorkflowDocument().getDocumentTypeName());
if (!valid) {
GlobalVariables.getMessageMap().putError(PurapConstants.ITEM_TAB_ERROR_PROPERTY, PurapKeyConstants.ERROR_ITEM_REQUIRED, documentType);
}
return valid;
}
use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method deleteSourceLine.
/**
* @see org.kuali.kfs.sys.web.struts.KualiAccountingDocumentActionBase#deleteSourceLine(org.apache.struts.action.ActionMapping,
* org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public ActionForward deleteSourceLine(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
String[] indexes = getSelectedLineForAccounts(request);
int itemIndex = Integer.parseInt(indexes[0]);
int accountIndex = Integer.parseInt(indexes[1]);
if (itemIndex == -2) {
purchasingForm.getAccountDistributionsourceAccountingLines().remove(accountIndex);
} else {
PurApItem item = ((PurchasingAccountsPayableDocument) purchasingForm.getDocument()).getItem((itemIndex));
item.getSourceAccountingLines().remove(accountIndex);
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method addItem.
/**
* Add a new item to the document.
*
* @param mapping An ActionMapping
* @param form An ActionForm
* @param request The HttpServletRequest
* @param response The HttpServletResponse
* @return An ActionForward
* @throws Exception
*/
@SuppressWarnings("unchecked")
public ActionForward addItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
PurApItem item = purchasingForm.getNewPurchasingItemLine();
PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
boolean rulePassed = SpringContext.getBean(KualiRuleService.class).applyRules(new AttributedAddPurchasingAccountsPayableItemEvent("", purDocument, item));
if (rulePassed) {
item = purchasingForm.getAndResetNewPurchasingItemLine();
purDocument.addItem(item);
// KFSPTS-985
if (((PurchasingDocumentBase) purDocument).isIntegratedWithFavoriteAccount()) {
populatePrimaryFavoriteAccount(item.getSourceAccountingLines(), getAccountClassFromNewPurApAccountingLine(purchasingForm));
}
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method removeAccounts.
/**
* Clear out the accounting lines from all the items.
*
* @param mapping An ActionMapping
* @param form An ActionForm
* @param request The HttpServletRequest
* @param response The HttpServletResponse
* @return An ActionForward
* @throws Exception
*/
public ActionForward removeAccounts(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchasingAccountsPayableFormBase purchasingForm = (PurchasingAccountsPayableFormBase) form;
Object question = request.getParameter(PurapConstants.QUESTION_INDEX);
Object buttonClicked = request.getParameter(KFSConstants.QUESTION_CLICKED_BUTTON);
if (question == null) {
String questionText = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(PurapConstants.QUESTION_REMOVE_ACCOUNTS);
return this.performQuestionWithoutInput(mapping, form, request, response, PurapConstants.REMOVE_ACCOUNTS_QUESTION, questionText, KFSConstants.CONFIRMATION_QUESTION, KFSConstants.ROUTE_METHOD, "0");
} else if (ConfirmationQuestion.YES.equals(buttonClicked)) {
for (PurApItem item : ((PurchasingAccountsPayableDocument) purchasingForm.getDocument()).getItems()) {
item.getSourceAccountingLines().clear();
}
KNSGlobalVariables.getMessageList().add(PurapKeyConstants.PURAP_GENERAL_ACCOUNTS_REMOVED);
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Aggregations