Search in sources :

Example 51 with Person

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

the class FormatAction method prepare.

/**
 * This method marks the payments for format
 *
 * @param mapping
 * @param form
 * @param request
 * @param response
 * @return
 * @throws Exception
 */
public ActionForward prepare(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    FormatForm formatForm = (FormatForm) form;
    DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
    if (formatForm.getCampus() == null) {
        return mapping.findForward(PdpConstants.MAPPING_SELECTION);
    }
    // Figure out which ones they have selected
    List<CustomerProfile> selectedCustomers = new ArrayList<>();
    for (CustomerProfile customer : formatForm.getCustomers()) {
        if (customer.isSelectedForFormat()) {
            selectedCustomers.add(customer);
        }
    }
    Date paymentDate = dateTimeService.convertToSqlDate(formatForm.getPaymentDate());
    Person kualiUser = GlobalVariables.getUserSession().getPerson();
    FormatProcessSummary formatProcessSummary = formatService.startFormatProcess(kualiUser, formatForm.getCampus(), selectedCustomers, paymentDate, formatForm.getPaymentTypes());
    if (formatProcessSummary.getProcessSummaryList().size() == 0) {
        KNSGlobalVariables.getMessageList().add(PdpKeyConstants.Format.ERROR_PDP_NO_MATCHING_PAYMENT_FOR_FORMAT);
        return mapping.findForward(PdpConstants.MAPPING_SELECTION);
    }
    formatForm.setFormatProcessSummary(formatProcessSummary);
    return mapping.findForward(PdpConstants.MAPPING_CONTINUE);
}
Also used : FormatProcessSummary(org.kuali.kfs.pdp.businessobject.FormatProcessSummary) ArrayList(java.util.ArrayList) CustomerProfile(org.kuali.kfs.pdp.businessobject.CustomerProfile) DateTimeService(org.kuali.kfs.core.api.datetime.DateTimeService) Person(org.kuali.kfs.kim.api.identity.Person) Date(java.util.Date)

Example 52 with Person

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

the class CreateAccountingDocumentServiceImplTest method buildMockPersonService.

private PersonService buildMockPersonService() throws Exception {
    PersonService personService = Mockito.mock(PersonService.class);
    Person systemUser = MockPersonUtil.createMockPerson(UserNameFixture.kfs);
    Mockito.when(personService.getPersonByPrincipalName(KFSConstants.SYSTEM_USER)).thenReturn(systemUser);
    Person testUser = MockPersonUtil.createMockPerson(TestUserFixture.TEST_USER);
    Mockito.when(personService.getPersonByEmployeeId(TestUserFixture.TEST_USER.employeeId)).thenReturn(testUser);
    return personService;
}
Also used : PersonService(org.kuali.kfs.kim.api.identity.PersonService) Person(org.kuali.kfs.kim.api.identity.Person) AdHocRoutePerson(org.kuali.kfs.krad.bo.AdHocRoutePerson) TestAdHocRoutePerson(edu.cornell.kfs.sys.util.MockDocumentUtils.TestAdHocRoutePerson)

Example 53 with Person

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

the class ConcurEmployeeInfoValidationServiceImpl method validPdpAddress.

@Override
public boolean validPdpAddress(String employeeId) {
    Person employee = findPerson(employeeId);
    boolean validPerson = validPerson(employee);
    boolean validAddress = validPerson;
    if (validPerson) {
        String state = employee.getAddressStateProvinceCodeUnmasked();
        String country = employee.getAddressCountryCodeUnmasked();
        if (StringUtils.isBlank(state) && StringUtils.isBlank(country)) {
            validAddress = false;
            LOG.error("validPdpAddress, " + employee.getName() + " does not have a Country Code or a State/Province code.");
        } else {
            if (LOG.isDebugEnabled()) {
                StringBuilder sb = new StringBuilder("validPdpAddress, The employee ");
                sb.append(employee.getName()).append(" has a valid PDP address.  The state code was '").append(state);
                sb.append("' and the country code was '").append(country).append("'.");
                LOG.debug(sb.toString());
            }
        }
    }
    return validAddress;
}
Also used : Person(org.kuali.kfs.kim.api.identity.Person)

Example 54 with Person

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

the class CuElectronicInvoiceHelperServiceImpl method createPaymentRequest.

@Override
protected PaymentRequestDocument createPaymentRequest(ElectronicInvoiceOrderHolder orderHolder) {
    LOG.info("Creating Payment Request document");
    KNSGlobalVariables.getMessageList().clear();
    validateInvoiceOrderValidForPREQCreation(orderHolder);
    if (LOG.isInfoEnabled()) {
        if (orderHolder.isInvoiceRejected()) {
            LOG.info("Not possible to convert einvoice details into payment request");
        } else {
            LOG.info("Payment request document creation validation succeeded");
        }
    }
    if (orderHolder.isInvoiceRejected()) {
        return null;
    }
    PaymentRequestDocument preqDoc = null;
    try {
        preqDoc = (PaymentRequestDocument) documentService.getNewDocument("PREQ");
    } catch (WorkflowException e) {
        String extraDescription = "Error=" + e.getMessage();
        ElectronicInvoiceRejectReason rejectReason = matchingService.createRejectReason(PurapConstants.ElectronicInvoice.PREQ_WORKLOW_EXCEPTION, extraDescription, orderHolder.getFileName());
        orderHolder.addInvoiceOrderRejectReason(rejectReason);
        LOG.error("Error creating Payment request document - " + e.getMessage());
        return null;
    }
    PurchaseOrderDocument poDoc = orderHolder.getPurchaseOrderDocument();
    if (poDoc == null) {
        throw new RuntimeException("Purchase Order document (POId=" + poDoc.getPurapDocumentIdentifier() + ") does not exist in the system");
    }
    preqDoc.getDocumentHeader().setDocumentDescription(generatePREQDocumentDescription(poDoc));
    try {
        preqDoc.updateAndSaveAppDocStatus(PaymentRequestStatuses.APPDOC_IN_PROCESS);
    } catch (WorkflowException we) {
        throw new RuntimeException("Unable to save route status data for document: " + preqDoc.getDocumentNumber(), we);
    }
    preqDoc.setInvoiceDate(orderHolder.getInvoiceDate());
    preqDoc.setInvoiceNumber(orderHolder.getInvoiceNumber());
    preqDoc.setVendorInvoiceAmount(new KualiDecimal(orderHolder.getInvoiceNetAmount()));
    preqDoc.setAccountsPayableProcessorIdentifier("E-Invoice");
    preqDoc.setVendorCustomerNumber(orderHolder.getCustomerNumber());
    preqDoc.setPaymentRequestElectronicInvoiceIndicator(true);
    if (orderHolder.getAccountsPayablePurchasingDocumentLinkIdentifier() != null) {
        preqDoc.setAccountsPayablePurchasingDocumentLinkIdentifier(orderHolder.getAccountsPayablePurchasingDocumentLinkIdentifier());
    }
    // Copied from PaymentRequestServiceImpl.populatePaymentRequest()
    // set bank code to default bank code in the system parameter
    // KFSPTS-1891
    boolean hasPaymentMethodCode = false;
    if (preqDoc instanceof PaymentRequestDocument) {
        String vendorPaymentMethodCode = ((VendorDetailExtension) poDoc.getVendorDetail().getExtension()).getDefaultB2BPaymentMethodCode();
        if (StringUtils.isNotEmpty(vendorPaymentMethodCode)) {
            ((CuPaymentRequestDocument) preqDoc).setPaymentMethodCode(vendorPaymentMethodCode);
            hasPaymentMethodCode = true;
        } else {
            ((CuPaymentRequestDocument) preqDoc).setPaymentMethodCode(DEFAULT_EINVOICE_PAYMENT_METHOD_CODE);
        }
    }
    Bank defaultBank = null;
    if (hasPaymentMethodCode) {
        defaultBank = cUPaymentMethodGeneralLedgerPendingEntryService.getBankForPaymentMethod(((CuPaymentRequestDocument) preqDoc).getPaymentMethodCode());
    } else {
        // default to baseline behavior - extended documents not in use
        // Copied from PaymentRequestServiceImpl.populatePaymentRequest()
        // set bank code to default bank code in the system parameter
        defaultBank = bankService.getDefaultBankByDocType(preqDoc.getClass());
    }
    if (defaultBank != null) {
        preqDoc.setBankCode(defaultBank.getBankCode());
        preqDoc.setBank(defaultBank);
    }
    RequisitionDocument reqDoc = getRequisitionService().getRequisitionById(poDoc.getRequisitionIdentifier());
    String reqDocInitiator = reqDoc.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId();
    try {
        Person user = KimApiServiceLocator.getPersonService().getPerson(reqDocInitiator);
        setProcessingCampus(preqDoc, user.getCampusCode());
    } catch (Exception e) {
        String extraDescription = "Error setting processing campus code - " + e.getMessage();
        ElectronicInvoiceRejectReason rejectReason = matchingService.createRejectReason(PurapConstants.ElectronicInvoice.PREQ_ROUTING_VALIDATION_ERROR, extraDescription, orderHolder.getFileName());
        orderHolder.addInvoiceOrderRejectReason(rejectReason);
        return null;
    }
    HashMap<String, ExpiredOrClosedAccountEntry> expiredOrClosedAccountList = getAccountsPayableService().expiredOrClosedAccountsList(poDoc);
    if (expiredOrClosedAccountList == null) {
        expiredOrClosedAccountList = new HashMap();
    }
    if (LOG.isInfoEnabled()) {
        LOG.info(expiredOrClosedAccountList.size() + " accounts has been found as Expired or Closed");
    }
    preqDoc.populatePaymentRequestFromPurchaseOrder(orderHolder.getPurchaseOrderDocument(), expiredOrClosedAccountList);
    // need to populate here for ext price.  it become per item
    // KFSPTS-1719.  convert 1st matching inv item that is qty, but po is non-qty
    checkQtyInvItemForNoQtyOrder(preqDoc, orderHolder);
    populateItemDetails(preqDoc, orderHolder);
    // KFSUPGRADE-485, KFSPTS-1719
    if (CollectionUtils.isNotEmpty(((CuElectronicInvoiceOrderHolder) orderHolder).getNonMatchItems())) {
        for (ElectronicInvoiceItemHolder invItem : ((CuElectronicInvoiceOrderHolder) orderHolder).getNonMatchItems()) {
            PurchaseOrderItem item = (PurchaseOrderItem) ObjectUtils.deepCopy((Serializable) orderHolder.getPurchaseOrderDocument().getItems().get(invItem.getInvoiceItemLineNumber() - 1));
            item.setItemLineNumber(invItem.getInvoiceItemLineNumber());
            item.setItemDescription(((CuElectronicInvoiceItemHolder) invItem).getReferenceDescription());
            // this will be populated to reqitem.poitemunitprice
            item.setItemUnitPrice(invItem.getInvoiceItemUnitPrice());
            PaymentRequestItem paymentRequestItem = new PaymentRequestItem(item, preqDoc, expiredOrClosedAccountList);
            ((CuPaymentRequestItemExtension) paymentRequestItem.getExtension()).setInvLineNumber(Integer.parseInt(((CuElectronicInvoiceItemHolder) invItem).getInvLineNumber()));
            // need following in case inv item is qty item
            paymentRequestItem.setItemQuantity(new KualiDecimal(invItem.getInvoiceItemQuantity()));
            paymentRequestItem.setItemUnitOfMeasureCode(invItem.getInvoiceItemUnitOfMeasureCode());
            paymentRequestItem.setPurchaseOrderItemUnitPrice(invItem.getInvoiceItemUnitPrice());
            // if non qty don't need this unit price set, then this need to have a check
            if (invItem.getInvoiceItemQuantity() != null && (new KualiDecimal(invItem.getInvoiceItemQuantity())).isPositive()) {
                paymentRequestItem.setItemUnitPrice(invItem.getInvoiceItemUnitPrice());
            }
            paymentRequestItem.setItemCatalogNumber(invItem.getCatalogNumberStripped());
            preqDoc.getItems().add(paymentRequestItem);
            ((CuElectronicInvoiceOrderHolder) orderHolder).setMisMatchItem((CuElectronicInvoiceItemHolder) invItem);
            populateItemDetailsForNonMatching(preqDoc, orderHolder);
            ((CuElectronicInvoiceOrderHolder) orderHolder).setMisMatchItem(null);
        }
    }
    /**
     * Validate totals,paydate
     */
    // PaymentRequestDocumentRule.processCalculateAccountsPayableBusinessRules
    kualiRuleService.applyRules(new AttributedCalculateAccountsPayableEvent(preqDoc));
    paymentRequestService.calculatePaymentRequest(preqDoc, true);
    processItemsForDiscount(preqDoc, orderHolder);
    if (orderHolder.isInvoiceRejected()) {
        return null;
    }
    paymentRequestService.calculatePaymentRequest(preqDoc, false);
    /**
     * PaymentRequestReview
     */
    // PaymentRequestDocumentRule.processRouteDocumentBusinessRules
    kualiRuleService.applyRules(new AttributedPaymentRequestForEInvoiceEvent(preqDoc));
    if (GlobalVariables.getMessageMap().hasErrors()) {
        if (LOG.isInfoEnabled()) {
            LOG.info("***************Error in rules processing - " + GlobalVariables.getMessageMap());
        }
        Map<String, AutoPopulatingList<ErrorMessage>> errorMessages = GlobalVariables.getMessageMap().getErrorMessages();
        String errors = errorMessages.toString();
        ElectronicInvoiceRejectReason rejectReason = matchingService.createRejectReason(PurapConstants.ElectronicInvoice.PREQ_ROUTING_VALIDATION_ERROR, errors, orderHolder.getFileName());
        orderHolder.addInvoiceOrderRejectReason(rejectReason);
        return null;
    }
    if (KNSGlobalVariables.getMessageList().size() > 0) {
        if (LOG.isInfoEnabled()) {
            LOG.info("Payment request contains " + KNSGlobalVariables.getMessageList().size() + " warning message(s)");
            for (int i = 0; i < KNSGlobalVariables.getMessageList().size(); i++) {
                LOG.info("Warning " + i + "  - " + KNSGlobalVariables.getMessageList().get(i));
            }
        }
    }
    addShipToNotes(preqDoc, orderHolder);
    try {
        // KFSUPGRADE-490: Do save-only operations for just non-EIRT-generated PREQs.
        if (orderHolder.isRejectDocumentHolder()) {
            documentService.routeDocument(preqDoc, null, null);
        } else {
            documentService.saveDocument(preqDoc, DocumentSystemSaveEvent.class);
        }
    } catch (WorkflowException e) {
        e.printStackTrace();
        ElectronicInvoiceRejectReason rejectReason = matchingService.createRejectReason(PurapConstants.ElectronicInvoice.PREQ_ROUTING_FAILURE, e.getMessage(), orderHolder.getFileName());
        orderHolder.addInvoiceOrderRejectReason(rejectReason);
        return null;
    } catch (ValidationException e) {
        String extraDescription = GlobalVariables.getMessageMap().toString();
        ElectronicInvoiceRejectReason rejectReason = matchingService.createRejectReason(PurapConstants.ElectronicInvoice.PREQ_ROUTING_VALIDATION_ERROR, extraDescription, orderHolder.getFileName());
        orderHolder.addInvoiceOrderRejectReason(rejectReason);
        return null;
    }
    return preqDoc;
}
Also used : Serializable(java.io.Serializable) Bank(org.kuali.kfs.sys.businessobject.Bank) ValidationException(org.kuali.kfs.krad.exception.ValidationException) ElectronicInvoiceItemHolder(org.kuali.kfs.module.purap.service.impl.ElectronicInvoiceItemHolder) HashMap(java.util.HashMap) RequisitionDocument(org.kuali.kfs.module.purap.document.RequisitionDocument) CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) PurchaseOrderDocument(org.kuali.kfs.module.purap.document.PurchaseOrderDocument) KualiDecimal(org.kuali.kfs.core.api.util.type.KualiDecimal) VendorDetailExtension(edu.cornell.kfs.vnd.businessobject.VendorDetailExtension) ExpiredOrClosedAccountEntry(org.kuali.kfs.module.purap.util.ExpiredOrClosedAccountEntry) CuPaymentRequestItemExtension(edu.cornell.kfs.module.purap.businessobject.CuPaymentRequestItemExtension) AttributedCalculateAccountsPayableEvent(org.kuali.kfs.module.purap.document.validation.event.AttributedCalculateAccountsPayableEvent) WorkflowException(org.kuali.kfs.kew.api.exception.WorkflowException) CuPaymentRequestDocument(edu.cornell.kfs.module.purap.document.CuPaymentRequestDocument) PaymentRequestDocument(org.kuali.kfs.module.purap.document.PaymentRequestDocument) ElectronicInvoiceRejectReason(org.kuali.kfs.module.purap.businessobject.ElectronicInvoiceRejectReason) ValidationException(org.kuali.kfs.krad.exception.ValidationException) WorkflowException(org.kuali.kfs.kew.api.exception.WorkflowException) TransformerException(javax.xml.transform.TransformerException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) RemoteException(java.rmi.RemoteException) CxmlParseException(org.kuali.kfs.module.purap.exception.CxmlParseException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) PurchaseOrderItem(org.kuali.kfs.module.purap.businessobject.PurchaseOrderItem) PaymentRequestItem(org.kuali.kfs.module.purap.businessobject.PaymentRequestItem) AttributedPaymentRequestForEInvoiceEvent(org.kuali.kfs.module.purap.document.validation.event.AttributedPaymentRequestForEInvoiceEvent) Person(org.kuali.kfs.kim.api.identity.Person) AutoPopulatingList(org.springframework.util.AutoPopulatingList)

Example 55 with Person

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

the class IWantDocumentAction method docHandler.

/**
 * @see org.kuali.kfs.kns.web.struts.action.KualiDocumentActionBase#docHandler(org.apache.struts.action.ActionMapping,
 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
 * javax.servlet.http.HttpServletResponse)
 */
@Override
public ActionForward docHandler(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    ActionForward actionForward = super.docHandler(mapping, form, request, response);
    IWantDocumentForm iWantForm = (IWantDocumentForm) form;
    IWantDocument iWantDocument = iWantForm.getIWantDocument();
    String command = iWantForm.getCommand();
    String step = request.getParameter(CUPurapConstants.IWNT_STEP_PARAMETER);
    IWantDocumentService iWantDocumentService = SpringContext.getBean(IWantDocumentService.class);
    if (step != null) {
        iWantForm.setStep(step);
    }
    if (iWantDocument != null) {
        if (iWantDocument.getDocumentHeader().getWorkflowDocument().isSaved()) {
            step = CUPurapConstants.IWantDocumentSteps.CUSTOMER_DATA_STEP;
        }
        iWantDocument.setStep(step);
        if (KewApiConstants.INITIATE_COMMAND.equalsIgnoreCase(command)) {
            iWantForm.setDocument(iWantDocument);
            if (iWantDocument != null) {
                String principalId = iWantDocument.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId();
                Principal initiator = KimApiServiceLocator.getIdentityService().getPrincipal(principalId);
                String initiatorPrincipalID = initiator.getPrincipalId();
                String initiatorNetID = initiator.getPrincipalName();
                iWantDocument.setInitiatorNetID(initiatorNetID);
                Person currentUser = GlobalVariables.getUserSession().getPerson();
                String initiatorName = currentUser.getNameUnmasked();
                String initiatorPhoneNumber = currentUser.getPhoneNumberUnmasked();
                String initiatorEmailAddress = currentUser.getEmailAddressUnmasked();
                String address = iWantDocumentService.getPersonCampusAddress(initiatorNetID);
                iWantDocument.setInitiatorName(initiatorName);
                iWantDocument.setInitiatorPhoneNumber(initiatorPhoneNumber);
                iWantDocument.setInitiatorEmailAddress(initiatorEmailAddress);
                iWantDocument.setInitiatorAddress(address);
                // check default user options
                Map<String, String> primaryKeysCollegeOption = new HashMap<String, String>();
                primaryKeysCollegeOption.put(CUPurapConstants.USER_OPTIONS_PRINCIPAL_ID, initiatorPrincipalID);
                primaryKeysCollegeOption.put(CUPurapConstants.USER_OPTIONS_OPTION_ID, CUPurapConstants.USER_OPTIONS_DEFAULT_COLLEGE);
                IWantDocUserOptions userOptionsCollege = (IWantDocUserOptions) getBusinessObjectService().findByPrimaryKey(IWantDocUserOptions.class, primaryKeysCollegeOption);
                Map<String, String> primaryKeysDepartmentOption = new HashMap<String, String>();
                primaryKeysDepartmentOption.put(CUPurapConstants.USER_OPTIONS_PRINCIPAL_ID, initiatorPrincipalID);
                primaryKeysDepartmentOption.put(CUPurapConstants.USER_OPTIONS_OPTION_ID, CUPurapConstants.USER_OPTIONS_DEFAULT_DEPARTMENT);
                IWantDocUserOptions userOptionsDepartment = (IWantDocUserOptions) getBusinessObjectService().findByPrimaryKey(IWantDocUserOptions.class, primaryKeysDepartmentOption);
                // check default deliver to address info
                Map<String, String> primaryKeysdeliverToNetIDOption = new HashMap<String, String>();
                primaryKeysdeliverToNetIDOption.put(CUPurapConstants.USER_OPTIONS_PRINCIPAL_ID, initiatorPrincipalID);
                primaryKeysdeliverToNetIDOption.put(CUPurapConstants.USER_OPTIONS_OPTION_ID, CUPurapConstants.USER_OPTIONS_DEFAULT_DELIVER_TO_NET_ID);
                IWantDocUserOptions userOptionsDeliverToNetID = (IWantDocUserOptions) getBusinessObjectService().findByPrimaryKey(IWantDocUserOptions.class, primaryKeysdeliverToNetIDOption);
                Map<String, String> primaryKeysDeliverToNameOption = new HashMap<String, String>();
                primaryKeysDeliverToNameOption.put(CUPurapConstants.USER_OPTIONS_PRINCIPAL_ID, initiatorPrincipalID);
                primaryKeysDeliverToNameOption.put(CUPurapConstants.USER_OPTIONS_OPTION_ID, CUPurapConstants.USER_OPTIONS_DEFAULT_DELIVER_TO_NAME);
                IWantDocUserOptions userOptionsDeliverToName = (IWantDocUserOptions) getBusinessObjectService().findByPrimaryKey(IWantDocUserOptions.class, primaryKeysDeliverToNameOption);
                Map<String, String> primaryKeysDeliverToEmailOption = new HashMap<String, String>();
                primaryKeysDeliverToEmailOption.put(CUPurapConstants.USER_OPTIONS_PRINCIPAL_ID, initiatorPrincipalID);
                primaryKeysDeliverToEmailOption.put(CUPurapConstants.USER_OPTIONS_OPTION_ID, CUPurapConstants.USER_OPTIONS_DEFAULT_DELIVER_TO_EMAIL_ADDRESS);
                IWantDocUserOptions userOptionsDeliverToEmail = (IWantDocUserOptions) getBusinessObjectService().findByPrimaryKey(IWantDocUserOptions.class, primaryKeysDeliverToEmailOption);
                Map<String, String> primaryKeysDeliverToPhnNbrOption = new HashMap<String, String>();
                primaryKeysDeliverToPhnNbrOption.put(CUPurapConstants.USER_OPTIONS_PRINCIPAL_ID, initiatorPrincipalID);
                primaryKeysDeliverToPhnNbrOption.put(CUPurapConstants.USER_OPTIONS_OPTION_ID, CUPurapConstants.USER_OPTIONS_DEFAULT_DELIVER_TO_PHONE_NUMBER);
                IWantDocUserOptions userOptionsDeliverToPhnNbr = (IWantDocUserOptions) getBusinessObjectService().findByPrimaryKey(IWantDocUserOptions.class, primaryKeysDeliverToPhnNbrOption);
                Map<String, String> primaryKeysDeliverToAddressOption = new HashMap<String, String>();
                primaryKeysDeliverToAddressOption.put(CUPurapConstants.USER_OPTIONS_PRINCIPAL_ID, initiatorPrincipalID);
                primaryKeysDeliverToAddressOption.put(CUPurapConstants.USER_OPTIONS_OPTION_ID, CUPurapConstants.USER_OPTIONS_DEFAULT_DELIVER_TO_ADDRESS);
                IWantDocUserOptions userOptionsDeliverToAddress = (IWantDocUserOptions) getBusinessObjectService().findByPrimaryKey(IWantDocUserOptions.class, primaryKeysDeliverToAddressOption);
                if (ObjectUtils.isNotNull(userOptionsCollege)) {
                    iWantDocument.setCollegeLevelOrganization(userOptionsCollege.getOptionValue());
                }
                if (ObjectUtils.isNotNull(userOptionsDepartment)) {
                    iWantDocument.setDepartmentLevelOrganization(userOptionsDepartment.getOptionValue());
                }
                // if no default user options check primary department
                if (ObjectUtils.isNull(userOptionsCollege) && ObjectUtils.isNull(userOptionsDepartment)) {
                    // / set college and department based on primary id
                    setCollegeAndDepartmentBasedOnPrimaryDepartment(iWantForm);
                }
                if (ObjectUtils.isNotNull(userOptionsDeliverToNetID)) {
                    iWantDocument.setDeliverToNetID(userOptionsDeliverToNetID.getOptionValue());
                }
                if (ObjectUtils.isNotNull(userOptionsDeliverToName)) {
                    iWantDocument.setDeliverToName(userOptionsDeliverToName.getOptionValue());
                }
                if (ObjectUtils.isNotNull(userOptionsDeliverToEmail)) {
                    iWantDocument.setDeliverToEmailAddress(userOptionsDeliverToEmail.getOptionValue());
                }
                if (ObjectUtils.isNotNull(userOptionsDeliverToPhnNbr)) {
                    iWantDocument.setDeliverToPhoneNumber(userOptionsDeliverToPhnNbr.getOptionValue());
                }
                if (ObjectUtils.isNotNull(userOptionsDeliverToAddress)) {
                    iWantDocument.setDeliverToAddress(userOptionsDeliverToAddress.getOptionValue());
                }
            }
            iWantDocumentService.setIWantDocumentDescription(iWantDocument);
        }
    }
    return actionForward;
}
Also used : HashMap(java.util.HashMap) IWantDocUserOptions(edu.cornell.kfs.module.purap.businessobject.IWantDocUserOptions) Person(org.kuali.kfs.kim.api.identity.Person) ActionForward(org.apache.struts.action.ActionForward) Principal(org.kuali.kfs.kim.impl.identity.principal.Principal) IWantDocument(edu.cornell.kfs.module.purap.document.IWantDocument) PurApFavoriteAccountLineBuilderForIWantDocument(edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument) IWantDocumentService(edu.cornell.kfs.module.purap.document.service.IWantDocumentService)

Aggregations

Person (org.kuali.kfs.kim.api.identity.Person)84 ArrayList (java.util.ArrayList)11 PersonService (org.kuali.kfs.kim.api.identity.PersonService)11 HashMap (java.util.HashMap)9 Note (org.kuali.kfs.krad.bo.Note)9 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)8 WorkflowDocument (org.kuali.kfs.kew.api.WorkflowDocument)6 AdHocRoutePerson (org.kuali.kfs.krad.bo.AdHocRoutePerson)6 DateTimeService (org.kuali.kfs.core.api.datetime.DateTimeService)5 KualiDecimal (org.kuali.kfs.core.api.util.type.KualiDecimal)5 VendorDetail (org.kuali.kfs.vnd.businessobject.VendorDetail)5 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)4 WorkflowException (org.kuali.kfs.kew.api.exception.WorkflowException)4 CustomerProfile (org.kuali.kfs.pdp.businessobject.CustomerProfile)4 IWantDocument (edu.cornell.kfs.module.purap.document.IWantDocument)3 PayeeACHAccount (org.kuali.kfs.pdp.businessobject.PayeeACHAccount)3 Bank (org.kuali.kfs.sys.businessobject.Bank)3 ChartOrgHolder (org.kuali.kfs.sys.businessobject.ChartOrgHolder)3 AccountingXmlDocumentNote (edu.cornell.kfs.fp.batch.xml.AccountingXmlDocumentNote)2 CuDisbursementPayee (edu.cornell.kfs.fp.businessobject.CuDisbursementPayee)2