use of org.kuali.kfs.module.purap.businessobject.PurApAccountingLine in project cu-kfs by CU-CommunityApps.
the class CuPurchasingAccountsPayableObjectCodeOverrideBranchingValidation method determineBranch.
@Override
protected String determineBranch(AttributedDocumentEvent event) {
if (!StringUtils.isBlank(propertyPath)) {
refreshByPath(accountingLineForValidation);
}
boolean isTaxApproval = false;
// KFSPTS-1891 : treasury manager also skip this object type allowed check
boolean isTreasuryApproval = false;
// or if this accounting line is from a Tax Charge line.
if (accountingDocumentForValidation instanceof PaymentRequestDocument) {
PaymentRequestDocument preq = (PaymentRequestDocument) accountingDocumentForValidation;
PurApAccountingLine purapAccountingLine = (PurApAccountingLine) accountingLineForValidation;
PurApItem item = purapAccountingLine.getPurapItem();
if (StringUtils.equals(PaymentRequestStatuses.APPDOC_AWAITING_TAX_REVIEW, preq.getApplicationDocumentStatus())) {
isTaxApproval = true;
} else if (StringUtils.equals(PaymentRequestStatuses.APPDOC_PAYMENT_METHOD_REVIEW, preq.getApplicationDocumentStatus())) {
isTreasuryApproval = true;
} else if (StringUtils.equals(PaymentRequestStatuses.APPDOC_DEPARTMENT_APPROVED, preq.getApplicationDocumentStatus()) && (ObjectUtils.isNotNull(item) && item.getItemType().getIsTaxCharge())) {
isTaxApproval = true;
}
}
if (isTaxApproval || isTreasuryApproval) {
return null;
} else if (isAccountingLineValueAllowed(accountingDocumentForValidation.getClass(), accountingLineForValidation, parameterToCheckAgainst, propertyPath, (responsibleProperty != null ? responsibleProperty : propertyPath))) {
return OBJECT_CODE_OVERRIDEN;
} else {
return OBJECT_CODE_NOT_OVERRIDEN;
}
}
use of org.kuali.kfs.module.purap.businessobject.PurApAccountingLine in project cu-kfs by CU-CommunityApps.
the class CuPurchaseOrderAmendmentAccountValidation method validate.
/**
* Overridden to allow POAs to use expired accounts.
*
* @see org.kuali.kfs.module.purap.document.validation.impl.PurchaseOrderAmendmentAccountValidation#validate(
* org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent)
*/
@Override
public boolean validate(AttributedDocumentEvent event) {
boolean valid = true;
PurchaseOrderDocument poaDocument = (PurchaseOrderDocument) event.getDocument();
List<PurApItem> items = poaDocument.getItemsActiveOnly();
PurchaseOrderDocument po = SpringContext.getBean(PurchaseOrderService.class).getCurrentPurchaseOrder(poaDocument.getPurapDocumentIdentifier());
List<PurApItem> poItems = po.getItems();
for (PurApItem item : items) {
String identifierString = item.getItemIdentifierString();
if (item.getItemTypeCode().equals(PurapConstants.ItemTypeCodes.ITEM_TYPE_ITEM_CODE) && item.getSourceAccountingLines() != null && item.getSourceAccountingLines().size() > 0) {
if (isItemChanged(item, poItems)) {
List<PurApAccountingLine> accountingLines = item.getSourceAccountingLines();
for (PurApAccountingLine accountingLine : accountingLines) {
if (!accountingLine.getAccount().isActive()) {
valid = false;
GlobalVariables.getMessageMap().putError(PurapConstants.ITEM_TAB_ERROR_PROPERTY, PurapKeyConstants.ERROR_ITEM_ACCOUNT_INACTIVE, accountingLine.getAccount().getAccountNumber());
break;
}
}
}
}
}
return valid;
}
Aggregations