Search in sources :

Example 1 with Person

use of org.kuali.rice.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.

the class AccountingDocumentGeneratorBase method buildDocumentNoteAttachment.

protected Note buildDocumentNoteAttachment(T document, AccountingXmlDocumentBackupLink backupLink) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("buildDocumentNoteAttachment: " + backupLink);
    }
    Person systemUser = personService.getPersonByPrincipalName(KFSConstants.SYSTEM_USER);
    Note note = emptyNoteGenerator.get();
    note.setAuthorUniversalIdentifier(systemUser.getPrincipalId());
    note.setNotePostedTimestampToCurrent();
    addAttachmentToNote(document, backupLink, note);
    note.setNoteText(backupLink.getDescription());
    return note;
}
Also used : AccountingXmlDocumentNote(edu.cornell.kfs.fp.batch.xml.AccountingXmlDocumentNote) Note(org.kuali.kfs.krad.bo.Note) AdHocRoutePerson(org.kuali.kfs.krad.bo.AdHocRoutePerson) Person(org.kuali.rice.kim.api.identity.Person)

Example 2 with Person

use of org.kuali.rice.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.

the class AdvanceDepositServiceImpl method retrieveAdvanceDepositDocumentsToRoute.

/**
 * Returns a list of all initiated but not yet routed advance deposit documents, using the WorkflowDocumentService.
 *
 * @return a list of advance deposit documents to route
 */
protected List<String> retrieveAdvanceDepositDocumentsToRoute(String statusCode) throws WorkflowException, RemoteException {
    List<String> documentIds = new ArrayList<String>();
    List<DocumentStatus> routeStatuses = new ArrayList<DocumentStatus>();
    routeStatuses.add(DocumentStatus.fromCode(statusCode));
    Person systemUser = getPersonService().getPersonByPrincipalName(KFSConstants.SYSTEM_USER);
    String principalName = systemUser.getPrincipalName();
    DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
    criteria.setDocumentTypeName(KFSConstants.FinancialDocumentTypeCodes.ADVANCE_DEPOSIT);
    criteria.setDocumentStatuses(routeStatuses);
    criteria.setInitiatorPrincipalName(principalName);
    DocumentSearchResults results = getWorkflowDocumentService().documentSearch(systemUser.getPrincipalId(), criteria.build());
    for (DocumentSearchResult resultRow : results.getSearchResults()) {
        Document document = resultRow.getDocument();
        if (ObjectUtils.isNotNull(document)) {
            documentIds.add(document.getDocumentId());
        }
    }
    return documentIds;
}
Also used : DocumentStatus(org.kuali.rice.kew.api.document.DocumentStatus) DocumentSearchResult(org.kuali.rice.kew.api.document.search.DocumentSearchResult) DocumentSearchCriteria(org.kuali.rice.kew.api.document.search.DocumentSearchCriteria) DocumentSearchResults(org.kuali.rice.kew.api.document.search.DocumentSearchResults) ArrayList(java.util.ArrayList) Document(org.kuali.rice.kew.api.document.Document) AdvanceDepositDocument(org.kuali.kfs.fp.document.AdvanceDepositDocument) Person(org.kuali.rice.kim.api.identity.Person)

Example 3 with Person

use of org.kuali.rice.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.

the class CuPurchaseOrderAmendmentDocument method isSeparationOfDutiesReviewRequired.

protected boolean isSeparationOfDutiesReviewRequired() {
    try {
        Set<Person> priorApprovers = getAllPriorApprovers();
        // then no need for separation of duties
        if (priorApprovers.size() > 0) {
            return false;
        }
    } catch (WorkflowException we) {
        LOG.error("Exception while attempting to retrieve all prior approvers from workflow: " + we);
    }
    ParameterService parameterService = SpringContext.getBean(ParameterService.class);
    KualiDecimal maxAllowedAmount = new KualiDecimal(parameterService.getParameterValueAsString(RequisitionDocument.class, PurapParameterConstants.SEPARATION_OF_DUTIES_DOLLAR_AMOUNT));
    // if app param amount is greater than or equal to documentTotalAmount... no need for separation of duties
    KualiDecimal totalAmount = getFinancialSystemDocumentHeader().getFinancialDocumentTotalAmount();
    if (ObjectUtils.isNotNull(maxAllowedAmount) && ObjectUtils.isNotNull(totalAmount) && (maxAllowedAmount.compareTo(totalAmount) >= 0)) {
        return false;
    } else {
        return true;
    }
}
Also used : RequisitionDocument(org.kuali.kfs.module.purap.document.RequisitionDocument) ParameterService(org.kuali.kfs.coreservice.framework.parameter.ParameterService) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) KualiDecimal(org.kuali.rice.core.api.util.type.KualiDecimal) Person(org.kuali.rice.kim.api.identity.Person)

Example 4 with Person

use of org.kuali.rice.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.

the class CuRequisitionDocument method initiateDocument.

/**
 * Overridden to unmask name and phone number. This will be able to be removed once this fix is in the base code.
 */
@Override
public void initiateDocument() throws WorkflowException {
    super.initiateDocument();
    Person currentUser = GlobalVariables.getUserSession().getPerson();
    this.setDeliveryToName(currentUser.getNameUnmasked());
    this.setDeliveryToPhoneNumber(SpringContext.getBean(PhoneNumberService.class).formatNumberIfPossible(currentUser.getPhoneNumberUnmasked()));
    this.setRequestorPersonName(currentUser.getNameUnmasked());
    this.setRequestorPersonPhoneNumber(SpringContext.getBean(PhoneNumberService.class).formatNumberIfPossible(currentUser.getPhoneNumberUnmasked()));
}
Also used : Person(org.kuali.rice.kim.api.identity.Person)

Example 5 with Person

use of org.kuali.rice.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.

the class IWantDocumentFeedServiceImpl method populateIWantDocDeliverToSection.

/**
 * Populates the Deliver To section of the I Want document.
 *
 * @param batchIWantDocument
 * @param iWantDocument
 *
 * @return true if no errors occur, false otherwise
 */
protected boolean populateIWantDocDeliverToSection(BatchIWantDocument batchIWantDocument, IWantDocument iWantDocument) {
    boolean noErrors = true;
    if (batchIWantDocument.isSameAsInitiator()) {
        iWantDocument.setSameAsInitiator(true);
        iWantDocument.setDeliverToNetID(iWantDocument.getInitiatorNetID());
        iWantDocument.setDeliverToName(iWantDocument.getInitiatorName());
        iWantDocument.setDeliverToEmailAddress(iWantDocument.getInitiatorEmailAddress());
        iWantDocument.setDeliverToPhoneNumber(iWantDocument.getInitiatorPhoneNumber());
        iWantDocument.setDeliverToAddress(iWantDocument.getInitiatorAddress());
    } else {
        if (StringUtils.isNotBlank(batchIWantDocument.getDeliverToNetID())) {
            iWantDocument.setDeliverToNetID(batchIWantDocument.getDeliverToNetID());
            Person deliverToPerson = personService.getPersonByPrincipalName(batchIWantDocument.getDeliverToNetID());
            if (ObjectUtils.isNull(deliverToPerson)) {
                LOG.error("Deliver to net ID is not valid: " + deliverToPerson);
                noErrors = false;
            } else {
                String deliverToName = deliverToPerson.getNameUnmasked();
                String deliverToPhoneNumber = deliverToPerson.getPhoneNumberUnmasked();
                String deliverToEmailAddress = deliverToPerson.getEmailAddressUnmasked();
                String address = iWantDocumentService.getPersonCampusAddress(batchIWantDocument.getDeliverToNetID());
                iWantDocument.setDeliverToName(deliverToName);
                if (StringUtils.isNotBlank(batchIWantDocument.getDeliverToEmailAddress())) {
                    iWantDocument.setDeliverToEmailAddress(batchIWantDocument.getDeliverToEmailAddress());
                } else {
                    iWantDocument.setDeliverToEmailAddress(deliverToEmailAddress);
                }
                if (StringUtils.isNotBlank(batchIWantDocument.getDeliverToPhoneNumber())) {
                    iWantDocument.setDeliverToPhoneNumber(batchIWantDocument.getDeliverToPhoneNumber());
                } else {
                    iWantDocument.setDeliverToPhoneNumber(deliverToPhoneNumber);
                }
                if (StringUtils.isNotBlank(batchIWantDocument.getDeliverToAddress())) {
                    iWantDocument.setDeliverToAddress(batchIWantDocument.getDeliverToAddress());
                } else
                    iWantDocument.setDeliverToAddress(address);
            }
        } else {
            if (StringUtils.isNotBlank(batchIWantDocument.getDeliverToEmailAddress())) {
                iWantDocument.setDeliverToEmailAddress(batchIWantDocument.getDeliverToEmailAddress());
            }
            if (StringUtils.isNotBlank(batchIWantDocument.getDeliverToPhoneNumber())) {
                iWantDocument.setDeliverToPhoneNumber(batchIWantDocument.getDeliverToPhoneNumber());
            }
            if (StringUtils.isNotBlank(batchIWantDocument.getDeliverToAddress())) {
                iWantDocument.setDeliverToAddress(batchIWantDocument.getDeliverToAddress());
            }
        }
    }
    return noErrors;
}
Also used : AdHocRoutePerson(org.kuali.kfs.krad.bo.AdHocRoutePerson) Person(org.kuali.rice.kim.api.identity.Person)

Aggregations

Person (org.kuali.rice.kim.api.identity.Person)64 ArrayList (java.util.ArrayList)12 PersonService (org.kuali.rice.kim.api.identity.PersonService)12 HashMap (java.util.HashMap)10 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)8 List (java.util.List)6 AdHocRoutePerson (org.kuali.kfs.krad.bo.AdHocRoutePerson)6 Map (java.util.Map)5 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)5 Note (org.kuali.kfs.krad.bo.Note)5 VendorDetail (org.kuali.kfs.vnd.businessobject.VendorDetail)5 DateTimeService (org.kuali.rice.core.api.datetime.DateTimeService)5 MessageMap (org.kuali.kfs.krad.util.MessageMap)4 CustomerProfile (org.kuali.kfs.pdp.businessobject.CustomerProfile)4 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)4 WorkflowDocument (org.kuali.rice.kew.api.WorkflowDocument)4 IWantDocument (edu.cornell.kfs.module.purap.document.IWantDocument)3 Date (java.util.Date)3 ChartOrgHolder (org.kuali.kfs.sys.businessobject.ChartOrgHolder)3 AccountingXmlDocumentNote (edu.cornell.kfs.fp.batch.xml.AccountingXmlDocumentNote)2