use of org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader in project cu-kfs by CU-CommunityApps.
the class MockDocumentUtils method performInitializationFromSkippedConstructor.
private static void performInitializationFromSkippedConstructor(Document document) {
document.setDocumentHeader(new FinancialSystemDocumentHeader());
document.setAdHocRoutePersons(new ArrayList<>());
document.setAdHocRouteWorkgroups(new ArrayList<>());
document.setNotes(new ArrayList<>());
if (document instanceof AccountingDocument) {
AccountingDocument accountingDocument = (AccountingDocument) document;
accountingDocument.setSourceAccountingLines(new ArrayList<>());
accountingDocument.setTargetAccountingLines(new ArrayList<>());
accountingDocument.setNextSourceLineNumber(Integer.valueOf(1));
accountingDocument.setNextTargetLineNumber(Integer.valueOf(1));
}
if (document instanceof InternalBillingDocument) {
InternalBillingDocument internalBillingDocument = (InternalBillingDocument) document;
internalBillingDocument.setItems(new ArrayList<>());
internalBillingDocument.setNextItemLineNumber(Integer.valueOf(1));
}
}
use of org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader in project cu-kfs by CU-CommunityApps.
the class CuAdvanceDepositDocumentPresentationController method canEdit.
/**
* @see org.kuali.kfs.kns.document.authorization.DocumentPresentationControllerBase#canEdit(org.kuali.kfs.kns.document.Document)
*/
@Override
public boolean canEdit(Document document) {
WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
FinancialSystemDocumentHeader documentheader = (FinancialSystemDocumentHeader) (document.getDocumentHeader());
if (workflowDocument.isCanceled() || documentheader.getFinancialDocumentInErrorNumber() != null) {
return false;
}
boolean canEdit = false;
if (workflowDocument.isInitiated() || workflowDocument.isSaved() || workflowDocument.isEnroute() || workflowDocument.isException()) {
canEdit = true;
}
return canEdit;
}
use of org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader in project cu-kfs by CU-CommunityApps.
the class PurchasingCommodityCodeValidation method shouldCheckCommodityCodeIsActive.
/**
* This method analyzes the document status and determines if the commodity codes associated with this item should be verified as active.
* The current implementation only checks that a commodity code is active if the document associated is in either INITIATED or SAVED status.
* For all other statuses the document may be in, the commodity code will not be checked for active status and the method will simply return
* true unconditionally.
*
* @param item
* @return
*/
private boolean shouldCheckCommodityCodeIsActive(PurApItem item) {
if (ObjectUtils.isNotNull(item.getPurapDocument())) {
String docNum = item.getPurapDocument().getDocumentNumber();
PurchasingAccountsPayableDocument purapDoc = item.getPurapDocument();
// Ran into issues with workflow doc not being populated in doc header for some PURAP docs, so needed to add check and retrieval.
FinancialSystemDocumentHeader docHdr = (FinancialSystemDocumentHeader) purapDoc.getDocumentHeader();
WorkflowDocument kwd = null;
kwd = WorkflowDocumentFactory.loadDocument(GlobalVariables.getUserSession().getPrincipalId(), docNum);
docHdr.setWorkflowDocument(kwd);
// Only check for active commodity codes if the doc is in initiated or saved status.
if (ObjectUtils.isNull(kwd)) {
kwd = docHdr.getWorkflowDocument();
}
if (!(kwd.isInitiated() || kwd.isSaved())) {
return false;
}
}
return true;
}
use of org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader in project cu-kfs by CU-CommunityApps.
the class AccountingLineAccessibleValidation method isAccountingLineFo.
// CU customization
/*
* KFSPTS-1273
*/
private boolean isAccountingLineFo(Document document) {
Person currentUser = GlobalVariables.getUserSession().getPerson();
List<String> roleIds = new ArrayList<String>();
roleIds.add(KimApiServiceLocator.getRoleService().getRoleIdByNamespaceCodeAndName(KFSConstants.ParameterNamespaces.KFS, KFSConstants.SysKimApiConstants.FISCAL_OFFICER_KIM_ROLE_NAME));
roleIds.add(KimApiServiceLocator.getRoleService().getRoleIdByNamespaceCodeAndName(KFSConstants.ParameterNamespaces.KFS, KFSConstants.SysKimApiConstants.FISCAL_OFFICER_PRIMARY_DELEGATE_KIM_ROLE_NAME));
roleIds.add(KimApiServiceLocator.getRoleService().getRoleIdByNamespaceCodeAndName(KFSConstants.ParameterNamespaces.KFS, KFSConstants.SysKimApiConstants.FISCAL_OFFICER_SECONDARY_DELEGATE_KIM_ROLE_NAME));
Map<String, String> roleQualifier = new HashMap<String, String>();
roleQualifier.put(KimConstants.AttributeConstants.DOCUMENT_NUMBER, document.getDocumentNumber());
roleQualifier.put(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME, document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName());
roleQualifier.put(KfsKimAttributes.FINANCIAL_DOCUMENT_TOTAL_AMOUNT, ((FinancialSystemDocumentHeader) document.getDocumentHeader()).getFinancialDocumentTotalAmount().toString());
roleQualifier.put(KfsKimAttributes.CHART_OF_ACCOUNTS_CODE, accountingLineForValidation.getChartOfAccountsCode());
roleQualifier.put(KfsKimAttributes.ACCOUNT_NUMBER, accountingLineForValidation.getAccountNumber());
return KimApiServiceLocator.getRoleService().principalHasRole(currentUser.getPrincipalId(), roleIds, roleQualifier);
}
use of org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader in project cu-kfs by CU-CommunityApps.
the class CuAutoDisapproveDocumentsServiceImpl method processAutoDisapproveDocuments.
@Override
protected boolean processAutoDisapproveDocuments(String principalId, String annotation) {
boolean success = true;
Collection<FinancialSystemDocumentHeader> documentList = getDocumentsToDisapprove();
LOG.info("Total documents to process " + documentList.size());
String documentHeaderId = null;
// CU Customization: Filter out documents whose workflow statuses are not actually ENROUTE (see referenced method for details).
documentList = getDocumentsWithActualWorkflowStatus(documentList, DocumentStatus.ENROUTE);
for (FinancialSystemDocumentHeader result : documentList) {
documentHeaderId = result.getDocumentNumber();
Document document = findDocumentForAutoDisapproval(documentHeaderId);
if (document != null) {
if (checkIfDocumentEligibleForAutoDispproval(document.getDocumentHeader())) {
try {
String successMessage = buildSuccessMessage(document);
autoDisapprovalYearEndDocument(document, annotation);
sendAcknowledgement(document.getDocumentHeader(), annotation);
LOG.info("The document with header id: " + documentHeaderId + " is automatically disapproved by this job.");
getAutoDisapproveErrorReportWriterService().writeFormattedMessageLine(successMessage);
} catch (Exception e) {
LOG.error("Exception encountered trying to auto disapprove the document " + e.getMessage());
String message = ("Exception encountered trying to auto disapprove the document: ").concat(documentHeaderId);
getAutoDisapproveErrorReportWriterService().writeFormattedMessageLine(message);
}
}
} else {
LOG.error("Document is NULL. It should never have been null");
String message = ("Error: Document with id: ").concat(documentHeaderId).concat(" - Document is NULL. It should never have been null");
getAutoDisapproveErrorReportWriterService().writeFormattedMessageLine(message);
}
}
return success;
}
Aggregations