use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.
the class CuPaymentRequestServiceImpl method addTaxItem.
@Override
protected PurApItem addTaxItem(PaymentRequestDocument preq, String itemTypeCode, BigDecimal taxableAmount) {
PurApItem item = super.addTaxItem(preq, itemTypeCode, taxableAmount);
PurApAccountingLine taxLine = item.getSourceAccountingLines().get(0);
// KFSPTS-1891. added to fix validation required field error. especially after calculate tax
if (taxLine.getAccountLinePercent() == null) {
taxLine.setAccountLinePercent(BigDecimal.ZERO);
}
return item;
}
use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.
the class CuRequisitionDocument method getAccountsForAwardRouting.
public List<Account> getAccountsForAwardRouting() {
List<Account> accounts = new ArrayList<Account>();
ParameterService parameterService = SpringContext.getBean(ParameterService.class);
for (PurApItem item : (List<PurApItem>) this.getItems()) {
for (PurApAccountingLine accountingLine : item.getSourceAccountingLines()) {
if (isObjectCodeAllowedForAwardRouting(accountingLine, parameterService)) {
if (ObjectUtils.isNull(accountingLine.getAccount())) {
accountingLine.refreshReferenceObject("account");
}
if (accountingLine.getAccount() != null && !accounts.contains(accountingLine.getAccount())) {
accounts.add(accountingLine.getAccount());
}
}
}
}
return accounts;
}
use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.
the class CuPurchaseOrderAmendmentDocumentPresentationController method getEditModes.
@Override
public Set<String> getEditModes(Document document) {
Set<String> editModes = super.getEditModes(document);
PurchaseOrderDocument poDocument = (PurchaseOrderDocument) document;
if (PurapConstants.PurchaseOrderStatuses.APPDOC_CHANGE_IN_PROCESS.equals(poDocument.getApplicationDocumentStatus())) {
WorkflowDocument workflowDocument = poDocument.getFinancialSystemDocumentHeader().getWorkflowDocument();
// amendment doc needs to lock its field for initiator while enroute
if (workflowDocument.isInitiated() || workflowDocument.isSaved() || workflowDocument.isCompletionRequested()) {
editModes.add(PurchaseOrderEditMode.AMENDMENT_ENTRY);
}
}
// KFSUPGRADE-339
if (PurchaseOrderStatuses.APPDOC_AWAITING_FISCAL_REVIEW.equals(((PurchaseOrderDocument) document).getApplicationDocumentStatus())) {
editModes.add(PurchaseOrderEditMode.AMENDMENT_ENTRY);
}
if (SpringContext.getBean(PurapService.class).isDocumentStoppedInRouteNode((PurchasingAccountsPayableDocument) document, "New Unordered Items")) {
editModes.add(PurchaseOrderEditMode.UNORDERED_ITEM_ACCOUNT_ENTRY);
}
boolean showDisableRemoveAccounts = true;
PurchaseOrderAmendmentDocument purchaseOrderAmendmentDocument = (PurchaseOrderAmendmentDocument) document;
List<PurApItem> aboveTheLinePOItems = PurApItemUtils.getAboveTheLineOnly(purchaseOrderAmendmentDocument.getItems());
PurchaseOrderDocument po = (PurchaseOrderDocument) document;
boolean containsUnpaidPaymentRequestsOrCreditMemos = po.getContainsUnpaidPaymentRequestsOrCreditMemos();
ItemLoop: for (PurApItem poItem : aboveTheLinePOItems) {
boolean acctLinesEditable = allowAccountingLinesAreEditable((PurchaseOrderItem) poItem, containsUnpaidPaymentRequestsOrCreditMemos);
for (PurApAccountingLine poAccoutingLine : poItem.getSourceAccountingLines()) {
if (!acctLinesEditable) {
showDisableRemoveAccounts = false;
break ItemLoop;
}
}
}
if (!showDisableRemoveAccounts) {
editModes.add(PurchaseOrderEditMode.DISABLE_REMOVE_ACCTS);
}
// KFSPTS-985
if (document instanceof PurchaseOrderDocument && !editModes.contains(RequisitionEditMode.DISABLE_SETUP_ACCT_DISTRIBUTION) && !hasEmptyAcctline((PurchaseOrderDocument) document)) {
editModes.add(RequisitionEditMode.DISABLE_SETUP_ACCT_DISTRIBUTION);
}
return editModes;
}
use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.
the class CuLineItemQuantityNotZero method validate.
public boolean validate(AttributedDocumentEvent event) {
boolean valid = true;
PaymentRequestDocument document = (PaymentRequestDocument) event.getDocument();
GlobalVariables.getMessageMap().clearErrorPath();
GlobalVariables.getMessageMap().addToErrorPath(KFSPropertyConstants.DOCUMENT);
int i = 0;
for (PurApItem item : (List<PurApItem>) document.getItems()) {
KualiDecimal itemQuantity = item.getItemQuantity();
if (!((PaymentRequestItem) item).isNoQtyItem() && itemQuantity != null) {
if (!itemQuantity.isNonZero()) {
GlobalVariables.getMessageMap().putError("item[" + i + "].itemQuantity", PurapKeyConstants.ERROR_PAYMENT_REQUEST_LINE_ITEM_QUANTITY_ZERO);
GlobalVariables.getMessageMap().clearErrorPath();
valid = false;
break;
}
i++;
}
}
return valid;
}
use of org.kuali.kfs.module.purap.businessobject.PurApItem in project cu-kfs by CU-CommunityApps.
the class PurchasingProcessItemValidation method validate.
/* (non-Javadoc)
* @see org.kuali.kfs.sys.document.validation.Validation#validate(org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent)
*/
public boolean validate(AttributedDocumentEvent event) {
boolean valid = true;
PurchasingDocument purDocument = (PurchasingDocument) event.getDocument();
MessageMap errorMap = GlobalVariables.getMessageMap();
errorMap.clearErrorPath();
// errorMap.addToErrorPath(PurapConstants.ITEM_TAB_ERRORS);
// KFSPTS-1719 : remove this validation
// // Check that item isn't a non-qty item on an e-invoice vendor order
// Check that there aren't any req items that already have non-qty values entered
List<PurApItem> reqItems = purDocument.getItems();
// KFSPTS-2096
if (!reqItems.isEmpty()) {
String itemTypeCode = KFSConstants.EMPTY_STRING;
int i = 0;
for (PurApItem item : reqItems) {
if (StringUtils.isEmpty(itemTypeCode) && (PurapConstants.ItemTypeCodes.ITEM_TYPE_SERVICE_CODE.equalsIgnoreCase(item.getItemTypeCode()) || PurapConstants.ItemTypeCodes.ITEM_TYPE_ITEM_CODE.equalsIgnoreCase(item.getItemTypeCode()))) {
itemTypeCode = item.getItemTypeCode();
}
if (StringUtils.isNotBlank(itemTypeCode) && (PurapConstants.ItemTypeCodes.ITEM_TYPE_SERVICE_CODE.equalsIgnoreCase(item.getItemTypeCode()) || PurapConstants.ItemTypeCodes.ITEM_TYPE_ITEM_CODE.equalsIgnoreCase(item.getItemTypeCode())) && !itemTypeCode.equalsIgnoreCase(item.getItemTypeCode())) {
// Throw error that mix qty and no-qty
// errorMap.addToErrorPath("document.item["+ i + "].itemTypeCode");
errorMap.putError("document.item[" + i + "].itemTypeCode", CUPurapKeyConstants.PURAP_MIX_ITEM_QTY_NONQTY);
// errorMap.removeFromErrorPath("document.item["+ i + "].itemTypeCode");
valid &= false;
}
if (PurapConstants.ItemTypeCodes.ITEM_TYPE_SERVICE_CODE.equalsIgnoreCase(item.getItemTypeCode()) || PurapConstants.ItemTypeCodes.ITEM_TYPE_ITEM_CODE.equalsIgnoreCase(item.getItemTypeCode())) {
i++;
}
}
}
// errorMap.clearErrorPath();
return valid;
}
Aggregations