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);
}
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);
}
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;
}
}
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());
}
}
}
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());
}
Aggregations