use of org.kuali.rice.kew.api.WorkflowDocument 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.rice.kew.api.WorkflowDocument in project cu-kfs by CU-CommunityApps.
the class CuRequisitionAccountingLineAuthorizer method renderNewLine.
@Override
public boolean renderNewLine(AccountingDocument accountingDocument, String accountingGroupProperty) {
WorkflowDocument workflowDocument = ((PurchasingAccountsPayableDocument) accountingDocument).getFinancialSystemDocumentHeader().getWorkflowDocument();
Set<String> currentNodes = workflowDocument.getCurrentNodeNames();
if (CollectionUtils.isNotEmpty(currentNodes) && (currentNodes.contains(RequisitionAccountingLineAuthorizer.INITIATOR_NODE) || currentNodes.contains(RequisitionAccountingLineAuthorizer.CONTENT_REVIEW_NODE)) || (currentNodes.contains(RequisitionStatuses.NODE_ACCOUNT) && SpringContext.getBean(CuPurapAccountingService.class).isFiscalOfficersForAllAcctLines((RequisitionDocument) accountingDocument))) {
return true;
}
return super.renderNewLine(accountingDocument, accountingGroupProperty);
}
use of org.kuali.rice.kew.api.WorkflowDocument in project cu-kfs by CU-CommunityApps.
the class IWantDocumentServiceImpl method buildDocumentFinalizedMessage.
/**
* Builds an email message to be sent when the input document has been finalized.
*
* @param iWantDocument
* @return an email message to be sent when the input document has been finalized
*/
private BodyMailMessage buildDocumentFinalizedMessage(IWantDocument iWantDocument) {
WorkflowDocument workflowDocument = iWantDocument.getDocumentHeader().getWorkflowDocument();
String initiator = workflowDocument.getInitiatorPrincipalId();
String documentNumber = iWantDocument.getDocumentNumber();
Person initiatorPerson = personService.getPerson(initiator);
String initiatorEmail = initiatorPerson.getEmailAddressUnmasked();
BodyMailMessage message = new BodyMailMessage();
message.addToAddress(initiatorEmail);
message.setFromAddress(initiatorEmail);
message.setSubject("I Want document: " + documentNumber + " has been finalized");
StringBuilder emailBody = new StringBuilder();
String vendorName = iWantDocument.getVendorName();
if (vendorName == null) {
vendorName = StringUtils.EMPTY;
}
emailBody.append("This is a message to inform you that the I Want document ").append(iWantDocument.getDocumentNumber()).append(" has been finalized: ").append(KRADConstants.NEWLINE).append(KRADConstants.NEWLINE);
emailBody.append("From: ").append(initiatorPerson.getNameUnmasked()).append(KRADConstants.NEWLINE);
emailBody.append("Title: ").append(iWantDocument.getDocumentTitle()).append(KRADConstants.NEWLINE);
emailBody.append("Type: ").append(workflowDocument.getDocumentTypeName()).append(KRADConstants.NEWLINE);
emailBody.append("Id: ").append(documentNumber).append(KRADConstants.NEWLINE);
emailBody.append("Vendor Name: ").append(vendorName).append("\n\n");
String docUrl = getDocumentURL(documentNumber, workflowDocument);
emailBody.append(" Go here to view this item: ").append(docUrl).append(KRADConstants.NEWLINE);
message.setMessage(emailBody.toString());
return message;
}
use of org.kuali.rice.kew.api.WorkflowDocument in project cu-kfs by CU-CommunityApps.
the class IWantDocumentAction method save.
@Override
public ActionForward save(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
IWantDocumentService iWantDocumentService = SpringContext.getBean(IWantDocumentService.class);
// Only recreate document description if in INITIATED or SAVED status.
WorkflowDocument workflowDocument = ((KualiDocumentFormBase) form).getDocument().getDocumentHeader().getWorkflowDocument();
if (workflowDocument.isInitiated() || workflowDocument.isSaved()) {
iWantDocumentService.setIWantDocumentDescription((IWantDocument) ((KualiDocumentFormBase) form).getDocument());
}
ActionForward actionForward = super.save(mapping, form, request, response);
IWantDocumentForm iWantDocForm = (IWantDocumentForm) form;
IWantDocument iWantDocument = iWantDocForm.getIWantDocument();
boolean added = true;
// add new item and new accounting line if not empty
IWantItem item = iWantDocForm.getNewIWantItemLine();
if (StringUtils.isNotBlank(item.getItemDescription()) || item.getItemUnitPrice() != null || item.getItemQuantity() != null) {
added &= addNewItem(iWantDocForm, iWantDocument, item);
}
added &= addNewFavoriteAccountIfNecessary(added, iWantDocument);
if (added) {
IWantAccount account = iWantDocForm.getNewSourceLine();
if (StringUtils.isNotBlank(account.getAccountNumber()) || StringUtils.isNotBlank(account.getSubAccountNumber()) || StringUtils.isNotBlank(account.getFinancialObjectCode()) || StringUtils.isNotBlank(account.getFinancialSubObjectCode()) || StringUtils.isNotBlank(account.getProjectCode()) || StringUtils.isNotBlank(account.getOrganizationReferenceId())) {
added &= addNewAccount(iWantDocForm, iWantDocument, account);
}
}
// Do not save if item or account additions failed.
if (!added) {
return mapping.findForward(RiceConstants.MAPPING_BASIC);
}
iWantDocument.setExplanation(iWantDocument.getDocumentHeader().getExplanation());
if (StringUtils.isNotBlank(iWantDocForm.getNewAdHocRoutePerson().getId())) {
iWantDocument.setCurrentRouteToNetId(iWantDocForm.getNewAdHocRoutePerson().getId());
}
return actionForward;
}
use of org.kuali.rice.kew.api.WorkflowDocument in project cu-kfs by CU-CommunityApps.
the class IWantDocumentAction method copy.
/**
* Overridden to guarantee that form of copied document is set to whatever the entry
* mode of the document is
* @see org.kuali.kfs.kns.web.struts.action.KualiTransactionalDocumentActionBase#copy(org.apache.struts.action.ActionMapping,
* org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse)
*/
@Override
public ActionForward copy(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionForward forward = null;
if (request.getParameter(KRADConstants.PARAMETER_DOC_ID) == null) {
forward = super.copy(mapping, form, request, response);
} else {
// this is copy document from Procurement Gateway:
// use this link to call: http://localhost:8080/kfs-dev/purapIWant.do?methodToCall=copy&docId=xxxx
String docId = request.getParameter(KRADConstants.PARAMETER_DOC_ID);
KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
IWantDocument document = null;
document = (IWantDocument) getDocumentService().getByDocumentHeaderId(docId);
document.toCopyFromGateway();
kualiDocumentFormBase.setDocument(document);
WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument();
kualiDocumentFormBase.setDocTypeName(workflowDocument.getDocumentTypeName());
UserSessionUtils.addWorkflowDocument(GlobalVariables.getUserSession(), workflowDocument);
forward = mapping.findForward(RiceConstants.MAPPING_BASIC);
}
return forward;
}
Aggregations