Search in sources :

Example 26 with Note

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

the class CuSubAccountTrickleDownInactivationServiceImpl method addNotesToAccountObject.

/**
 * Adds an inactivation note at account object level
 *
 * @param documentNumber
 * @param inactivatedAccount
 * @param inactivatedSubAccounts
 * @param alreadyLockedSubAccounts
 * @param errorPersistingSubAccounts
 */
protected void addNotesToAccountObject(String documentNumber, Account inactivatedAccount, List<SubAccount> inactivatedSubAccounts, Map<SubAccount, String> alreadyLockedSubAccounts, List<SubAccount> errorPersistingSubAccounts) {
    if (inactivatedSubAccounts.isEmpty() && alreadyLockedSubAccounts.isEmpty() && errorPersistingSubAccounts.isEmpty()) {
        // if we didn't try to inactivate any sub-accounts, then don't bother
        return;
    }
    Note newNote = new Note();
    addNotes(documentNumber, inactivatedSubAccounts, KFSKeyConstants.SUB_ACCOUNT_TRICKLE_DOWN_INACTIVATION, inactivatedAccount, newNote);
    addNotes(documentNumber, errorPersistingSubAccounts, KFSKeyConstants.SUB_ACCOUNT_TRICKLE_DOWN_INACTIVATION_ERROR_DURING_PERSISTENCE, inactivatedAccount, newNote);
    addMaintenanceLockedNotes(documentNumber, alreadyLockedSubAccounts, KFSKeyConstants.SUB_ACCOUNT_TRICKLE_DOWN_INACTIVATION_RECORD_ALREADY_MAINTENANCE_LOCKED, inactivatedAccount, newNote);
}
Also used : Note(org.kuali.kfs.krad.bo.Note)

Example 27 with Note

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

the class CuSubObjectTrickleDownInactivationServiceImpl method addNotesToAccountObject.

/**
 * Adds an inactivation note at account object level
 *
 * @param trickleDownInactivationStatus
 * @param documentNumber
 * @param inactivatedAccount
 */
protected void addNotesToAccountObject(TrickleDownInactivationStatus trickleDownInactivationStatus, String documentNumber, Account inactivatedAccount) {
    if (trickleDownInactivationStatus.inactivatedSubObjCds.isEmpty() && trickleDownInactivationStatus.alreadyLockedSubObjCds.isEmpty() && trickleDownInactivationStatus.errorPersistingSubObjCds.isEmpty()) {
        // if we didn't try to inactivate any sub-objects, then don't bother
        return;
    }
    Note newNote = new Note();
    addNotes(documentNumber, trickleDownInactivationStatus.inactivatedSubObjCds, KFSKeyConstants.SUB_OBJECT_TRICKLE_DOWN_INACTIVATION, inactivatedAccount, newNote);
    addNotes(documentNumber, trickleDownInactivationStatus.errorPersistingSubObjCds, KFSKeyConstants.SUB_OBJECT_TRICKLE_DOWN_INACTIVATION_ERROR_DURING_PERSISTENCE, inactivatedAccount, newNote);
    addMaintenanceLockedNotes(documentNumber, trickleDownInactivationStatus.alreadyLockedSubObjCds, KFSKeyConstants.SUB_OBJECT_TRICKLE_DOWN_INACTIVATION_RECORD_ALREADY_MAINTENANCE_LOCKED, inactivatedAccount, newNote);
}
Also used : Note(org.kuali.kfs.krad.bo.Note)

Example 28 with Note

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

the class RecurringDisbursementVoucherDocumentServiceImpl method addNoteToAutoApproveDv.

private void addNoteToAutoApproveDv(CuDisbursementVoucherDocument dv, String noteText) throws WorkflowException {
    Note note = buildNoteBase();
    note.setNoteText(noteText);
    dv.addNote(note);
    try {
        getDocumentService().saveDocument(dv);
    } catch (WorkflowException e) {
        LOG.error("addNoteToAutoApproveDv: Unable to save note for DV Document ID::" + dv.getDocumentNumber() + "the exception was: ", e);
        throw e;
    }
}
Also used : Note(org.kuali.kfs.krad.bo.Note) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException)

Example 29 with Note

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

the class CuPendingTransactionServiceImpl method reverseSourceDocumentsEntries.

/**
 * Reverses the entries of the source documents
 *
 * @param paymentDetail
 * @param sequenceHelper
 */
protected void reverseSourceDocumentsEntries(PaymentDetail paymentDetail, GeneralLedgerPendingEntrySequenceHelper sequenceHelper) {
    // Need to reverse the payment document's GL entries if the check is stopped or cancelled
    if (PurapConstants.PurapDocTypeCodes.PAYMENT_REQUEST_DOCUMENT.equalsIgnoreCase(paymentDetail.getFinancialDocumentTypeCode()) || CUPdpConstants.PdpDocumentTypes.DISBURSEMENT_VOUCHER.equalsIgnoreCase(paymentDetail.getFinancialDocumentTypeCode()) || CUPdpConstants.PdpDocumentTypes.CREDIT_MEMO.equalsIgnoreCase(paymentDetail.getFinancialDocumentTypeCode())) {
        try {
            String sourceDocumentNumber = paymentDetail.getCustPaymentDocNbr();
            try {
                Long.valueOf(sourceDocumentNumber);
            } catch (NumberFormatException nfe) {
                sourceDocumentNumber = null;
            }
            if (sourceDocumentNumber != null && StringUtils.isNotBlank(sourceDocumentNumber)) {
                Document doc = (AccountingDocumentBase) SpringContext.getBean(DocumentService.class).getByDocumentHeaderId(paymentDetail.getCustPaymentDocNbr());
                if (ObjectUtils.isNotNull(doc)) {
                    if (doc instanceof DisbursementVoucherDocument) {
                        // KFSUPGRADE-775
                        DisbursementVoucherDocument dv = (DisbursementVoucherDocument) doc;
                        generateDisbursementVoucherReversalEntries(dv, sequenceHelper);
                    // end KFSUPGRADE-775
                    } else if (doc instanceof VendorCreditMemoDocument) {
                        // KFSPTS-2719
                        String crCmCancelNote = parameterService.getParameterValueAsString(VendorCreditMemoDocument.class, CUPurapParameterConstants.PURAP_CR_CM_CANCEL_NOTE);
                        VendorCreditMemoDocument cmDocument = (VendorCreditMemoDocument) doc;
                        String crCancelMaintDocNbr = getCrCancelMaintenancedocumentNumber(paymentDetail);
                        crCmCancelNote = crCmCancelNote + crCancelMaintDocNbr;
                        try {
                            Note noteObj = documentService.createNoteFromDocument(cmDocument, crCmCancelNote);
                            cmDocument.addNote(noteObj);
                            noteService.save(noteObj);
                        } catch (Exception e) {
                            throw new RuntimeException(e.getMessage());
                        }
                        // KFSUPGRADE-775
                        VendorCreditMemoDocument cm = (VendorCreditMemoDocument) doc;
                        AccountsPayableDocumentSpecificService accountsPayableDocumentSpecificService = cm.getDocumentSpecificService();
                        accountsPayableDocumentSpecificService.updateStatusByNode("", cm);
                        // end KFSUPGRADE-775
                        generateCreditMemoReversalEntries((VendorCreditMemoDocument) doc);
                    } else if (doc instanceof PaymentRequestDocument) {
                        // KFSPTS-2719
                        String crPreqCancelNote = parameterService.getParameterValueAsString(PaymentRequestDocument.class, CUPurapParameterConstants.PURAP_CR_PREQ_CANCEL_NOTE);
                        PaymentRequestDocument paymentRequest = (PaymentRequestDocument) doc;
                        String crCancelMaintDocNbr = getCrCancelMaintenancedocumentNumber(paymentDetail);
                        crPreqCancelNote = crPreqCancelNote + crCancelMaintDocNbr;
                        try {
                            Note cancelNote = documentService.createNoteFromDocument(paymentRequest, crPreqCancelNote);
                            paymentRequest.addNote(cancelNote);
                            noteService.save(cancelNote);
                        } catch (Exception e) {
                            throw new RuntimeException(PurapConstants.REQ_UNABLE_TO_CREATE_NOTE + " " + e);
                        }
                        // cancel extracted should not reopen PO
                        paymentRequest.setReopenPurchaseOrderIndicator(false);
                        // KFSUPGRADE-775
                        AccountsPayableDocumentSpecificService accountsPayableDocumentSpecificService = paymentRequest.getDocumentSpecificService();
                        accountsPayableDocumentSpecificService.updateStatusByNode("", paymentRequest);
                        // end KFSUPGRADE-775
                        generatePaymentRequestReversalEntries(paymentRequest);
                    }
                }
            }
        } catch (WorkflowException we) {
            System.out.println("Exception retrieving document " + paymentDetail.getCustPaymentDocNbr());
        }
    }
}
Also used : VendorCreditMemoDocument(org.kuali.kfs.module.purap.document.VendorCreditMemoDocument) AccountsPayableDocumentSpecificService(org.kuali.kfs.module.purap.document.service.AccountsPayableDocumentSpecificService) Note(org.kuali.kfs.krad.bo.Note) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument) AccountingDocumentBase(org.kuali.kfs.sys.document.AccountingDocumentBase) VendorCreditMemoDocument(org.kuali.kfs.module.purap.document.VendorCreditMemoDocument) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument) Document(org.kuali.kfs.krad.document.Document) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument) PurchaseOrderDocument(org.kuali.kfs.module.purap.document.PurchaseOrderDocument) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException)

Example 30 with Note

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

the class CuAutoDisapproveDocumentsServiceImpl method autoDisapprovalYearEndDocument.

protected void autoDisapprovalYearEndDocument(Document document, String annotationForAutoDisapprovalDocument) throws Exception {
    Person systemUser = personService.getPersonByPrincipalName(KFSConstants.SYSTEM_USER);
    Note approveNote = getNoteService().createNote(new Note(), document.getDocumentHeader(), systemUser.getPrincipalId());
    approveNote.setNoteText(annotationForAutoDisapprovalDocument);
    approveNote.setAuthorUniversalIdentifier(systemUser.getPrincipalId());
    approveNote.setNotePostedTimestampToCurrent();
    getNoteService().save(approveNote);
    document.addNote(approveNote);
    getDocumentService().prepareWorkflowDocument(document);
    getDocumentService().superUserDisapproveDocumentWithoutSaving(document, "Disapproval of Outstanding Documents - Year End Cancellation Process");
    UserSessionUtils.addWorkflowDocument(GlobalVariables.getUserSession(), document.getDocumentHeader().getWorkflowDocument());
}
Also used : Note(org.kuali.kfs.krad.bo.Note) Person(org.kuali.rice.kim.api.identity.Person)

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