Search in sources :

Example 66 with Note

use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.

the class CuCreditMemoServiceImpl method addHoldOnCreditMemo.

@Override
public VendorCreditMemoDocument addHoldOnCreditMemo(VendorCreditMemoDocument cmDocument, String note) throws Exception {
    // save the note
    Note noteObj = documentService.createNoteFromDocument(cmDocument, note);
    cmDocument.addNote(noteObj);
    noteService.save(noteObj);
    // retrieve and save with hold indicator set to true
    VendorCreditMemoDocument cmDoc = getCreditMemoDocumentById(cmDocument.getPurapDocumentIdentifier());
    cmDoc.setHoldIndicator(true);
    cmDoc.setLastActionPerformedByPersonId(GlobalVariables.getUserSession().getPerson().getPrincipalId());
    purapService.saveDocumentNoValidation(cmDoc);
    // force reindexing
    reIndexDocument(cmDoc);
    // must also save it on the incoming document
    cmDocument.setHoldIndicator(true);
    cmDocument.setLastActionPerformedByPersonId(GlobalVariables.getUserSession().getPerson().getPrincipalId());
    // force reindexing
    reIndexDocument(cmDocument);
    return cmDoc;
}
Also used : VendorCreditMemoDocument(org.kuali.kfs.module.purap.document.VendorCreditMemoDocument) CuVendorCreditMemoDocument(edu.cornell.kfs.module.purap.document.CuVendorCreditMemoDocument) Note(org.kuali.kfs.krad.bo.Note)

Example 67 with Note

use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.

the class CuPaymentRequestServiceImpl method requestCancelOnPaymentRequest.

@Override
@NonTransactional
public void requestCancelOnPaymentRequest(PaymentRequestDocument document, String note) throws Exception {
    // save the note
    Note noteObj = documentService.createNoteFromDocument(document, note);
    document.addNote(noteObj);
    noteService.save(noteObj);
    document.setPaymentRequestedCancelIndicator(true);
    document.setLastActionPerformedByPersonId(GlobalVariables.getUserSession().getPerson().getPrincipalId());
    document.setAccountsPayableRequestCancelIdentifier(GlobalVariables.getUserSession().getPerson().getPrincipalId());
    purapService.saveDocumentNoValidation(document);
    // force reindexing
    reIndexDocument(document);
}
Also used : Note(org.kuali.kfs.krad.bo.Note) NonTransactional(org.kuali.kfs.sys.service.NonTransactional)

Example 68 with Note

use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.

the class CuPaymentRequestServiceImpl method removeHoldOnPaymentRequest.

/**
 * @see org.kuali.kfs.module.purap.document.service.PaymentRequestService#removeHoldOnPaymentRequest(org.kuali.kfs.module.purap.document.PaymentRequestDocument)
 */
@Override
@NonTransactional
public PaymentRequestDocument removeHoldOnPaymentRequest(PaymentRequestDocument document, String note) throws Exception {
    // save the note
    Note noteObj = documentService.createNoteFromDocument(document, note);
    document.addNote(noteObj);
    noteService.save(noteObj);
    document.setHoldIndicator(false);
    document.setLastActionPerformedByPersonId(null);
    purapService.saveDocumentNoValidation(document);
    // force reindexing
    reIndexDocument(document);
    return document;
}
Also used : Note(org.kuali.kfs.krad.bo.Note) NonTransactional(org.kuali.kfs.sys.service.NonTransactional)

Example 69 with Note

use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.

the class CuPurchaseOrderServiceImpl method completeB2BPurchaseOrderAmendment.

protected boolean completeB2BPurchaseOrderAmendment(PurchaseOrderDocument poa) {
    String errors = b2bPurchaseOrderService.sendPurchaseOrder(poa);
    if (StringUtils.isEmpty(errors)) {
        // POA sent successfully; change status to OPEN
        LOG.info("Setting poa document id " + poa.getDocumentNumber() + " status from '" + poa.getApplicationDocumentStatus() + "' to '" + PurchaseOrderStatuses.APPDOC_OPEN + "'");
        // purapService.updateStatus(poa, PurchaseOrderStatuses.OPEN);
        poa.setPurchaseOrderLastTransmitTimestamp(dateTimeService.getCurrentTimestamp());
        return true;
    } else {
        // POA transmission failed; record errors and change status to "cxml failed"
        try {
            Note note = documentService.createNoteFromDocument(poa, "Unable to transmit the PO for the following reasons:\n" + errors);
            poa.addNote(note);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        // purapService.updateStatus(poa, PurchaseOrderStatuses.CXML_ERROR);
        return false;
    }
}
Also used : Note(org.kuali.kfs.krad.bo.Note) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException)

Example 70 with Note

use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.

the class CuPurchaseOrderServiceImpl method getPurchaseOrderNotes.

// mjmc end
/**
 * Overridden to use the PO's note target object ID to retrieve the notes, instead of always using the doc header as the target.
 *
 * @see org.kuali.kfs.module.purap.document.service.impl.PurchaseOrderServiceImpl#getPurchaseOrderNotes(java.lang.Integer)
 */
@Override
public List<Note> getPurchaseOrderNotes(Integer id) {
    List<Note> notes = new ArrayList<>();
    PurchaseOrderDocument po = getPurchaseOrderByDocumentNumber(purchaseOrderDao.getOldestPurchaseOrderDocumentNumber(id));
    if (ObjectUtils.isNotNull(po)) {
        // ==== CU Customization: Use the PO's actual note target instead of assuming that the doc header is the target. ====
        notes = noteService.getByRemoteObjectId(po.getNoteTarget().getObjectId());
    }
    return notes;
}
Also used : Note(org.kuali.kfs.krad.bo.Note) ArrayList(java.util.ArrayList) PurchaseOrderDocument(org.kuali.kfs.module.purap.document.PurchaseOrderDocument) AccountingLineOverride(org.kuali.kfs.sys.businessobject.AccountingLineOverride)

Aggregations

Note (org.kuali.kfs.krad.bo.Note)76 Attachment (org.kuali.kfs.krad.bo.Attachment)14 WorkflowException (org.kuali.rice.kew.api.exception.WorkflowException)12 IOException (java.io.IOException)9 FileNotFoundException (java.io.FileNotFoundException)7 ArrayList (java.util.ArrayList)7 NoteService (org.kuali.kfs.krad.service.NoteService)7 FileInputStream (java.io.FileInputStream)6 KualiDocumentFormBase (org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase)6 NonTransactional (org.kuali.kfs.sys.service.NonTransactional)6 File (java.io.File)5 Iterator (java.util.Iterator)5 DocumentService (org.kuali.kfs.krad.service.DocumentService)5 Person (org.kuali.rice.kim.api.identity.Person)5 NoteExtendedAttribute (edu.cornell.kfs.sys.businessobject.NoteExtendedAttribute)4 SimpleDateFormat (java.text.SimpleDateFormat)4 Document (org.kuali.kfs.krad.document.Document)4 PurchaseOrderDocument (org.kuali.kfs.module.purap.document.PurchaseOrderDocument)4 HashMap (java.util.HashMap)3 List (java.util.List)3