Search in sources :

Example 41 with VendorDetail

use of org.kuali.kfs.vnd.businessobject.VendorDetail in project cu-kfs by CU-CommunityApps.

the class CuVendorMaintainableImpl method doRouteStatusChange.

@Override
public void doRouteStatusChange(DocumentHeader header) {
    LOG.debug("doRouteStatusChange: entering");
    super.doRouteStatusChange(header);
    VendorDetail vendorDetail = (VendorDetail) getBusinessObject();
    WorkflowDocument workflowDoc = header.getWorkflowDocument();
    if (workflowDoc.isProcessed()) {
        LOG.debug("doRouteStatusChange: workflow is processed");
        this.saveBusinessObject();
        if (recordPvenRouteStatusChangeForPaymentWorksIsEnabled()) {
            performPaymentWorksApprovalProcessingForVendor(vendorDetail, this.getDocumentNumber(), this.getMaintenanceAction());
        }
    } else if (workflowDoc.isDisapproved() || workflowDoc.isCanceled()) {
        LOG.debug("doRouteStatusChange: disapproved or canceled");
        if (recordPvenRouteStatusChangeForPaymentWorksIsEnabled()) {
            performPaymentWorksDisapprovalCancelProcessingForVendor(vendorDetail, this.getDocumentNumber(), this.getMaintenanceAction());
        }
    }
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) WorkflowDocument(org.kuali.rice.kew.api.WorkflowDocument)

Example 42 with VendorDetail

use of org.kuali.kfs.vnd.businessobject.VendorDetail in project cu-kfs by CU-CommunityApps.

the class CuDisbursementVoucherAction method refreshAfterPayeeSelection.

protected ActionForward refreshAfterPayeeSelection(ActionMapping mapping, CuDisbursementVoucherForm dvForm, HttpServletRequest request) {
    String refreshCaller = dvForm.getRefreshCaller();
    CuDisbursementVoucherDocument document = (CuDisbursementVoucherDocument) dvForm.getDocument();
    boolean isPayeeLookupable = KFSConstants.KUALI_DISBURSEMENT_PAYEE_LOOKUPABLE_IMPL.equals(refreshCaller);
    boolean isAddressLookupable = KFSConstants.KUALI_VENDOR_ADDRESS_LOOKUPABLE_IMPL.equals(refreshCaller);
    boolean isKualiLookupable = KFSConstants.KUALI_LOOKUPABLE_IMPL.equals(refreshCaller);
    // if a cancel occurred on address lookup we need to reset the payee id and type, rest of fields will still have correct information
    if (refreshCaller == null && hasFullEdit(document)) {
        dvForm.setPayeeIdNumber(dvForm.getTempPayeeIdNumber());
        dvForm.setHasMultipleAddresses(false);
        document.getDvPayeeDetail().setDisbVchrPayeeIdNumber(dvForm.getTempPayeeIdNumber());
        document.getDvPayeeDetail().setDisbursementVoucherPayeeTypeCode(dvForm.getOldPayeeType());
        return null;
    }
    // do not execute the further refreshing logic if the refresh caller is not a lookupable
    if (!isPayeeLookupable && !isAddressLookupable && !isKualiLookupable) {
        return null;
    }
    // do not execute the further refreshing logic if a payee is not selected
    String payeeIdNumber = document.getDvPayeeDetail().getDisbVchrPayeeIdNumber();
    if (payeeIdNumber == null) {
        return null;
    }
    dvForm.setPayeeIdNumber(payeeIdNumber);
    dvForm.setHasMultipleAddresses(false);
    // determine whether the selected vendor has multiple addresses. If so, redirect to the address selection screen
    if (isPayeeLookupable) {
        if (dvForm.isVendor()) {
            VendorDetail refreshVendorDetail = new VendorDetail();
            refreshVendorDetail.setVendorNumber(payeeIdNumber);
            refreshVendorDetail = (VendorDetail) SpringContext.getBean(BusinessObjectService.class).retrieve(refreshVendorDetail);
            VendorAddress defaultVendorAddress = null;
            if (refreshVendorDetail != null) {
                List<VendorAddress> vendorAddresses = refreshVendorDetail.getVendorAddresses();
                boolean hasMultipleAddresses = vendorAddresses != null && vendorAddresses.size() > 1;
                dvForm.setHasMultipleAddresses(hasMultipleAddresses);
                if (vendorAddresses != null && !vendorAddresses.isEmpty()) {
                    defaultVendorAddress = vendorAddresses.get(0);
                }
            }
            if (dvForm.hasMultipleAddresses()) {
                return renderVendorAddressSelection(mapping, request, dvForm);
            } else if (defaultVendorAddress != null) {
                setupPayeeAsVendor(dvForm, payeeIdNumber, defaultVendorAddress.getVendorAddressGeneratedIdentifier().toString());
            }
            return null;
        } else if (dvForm.isEmployee()) {
            this.setupPayeeAsEmployee(dvForm, payeeIdNumber);
        } else if (dvForm.isStudent()) {
            this.setupPayeeAsStudent(dvForm, payeeIdNumber);
        } else if (dvForm.isAlumni()) {
            this.setupPayeeAsAlumni(dvForm, payeeIdNumber);
        }
    }
    String payeeAddressIdentifier = request.getParameter(KFSPropertyConstants.VENDOR_ADDRESS_GENERATED_ID);
    if (isAddressLookupable && StringUtils.isNotBlank(payeeAddressIdentifier)) {
        setupPayeeAsVendor(dvForm, payeeIdNumber, payeeAddressIdentifier);
    }
    // check for multiple custom addresses
    if (isPayeeLookupable && dvForm.isCustomer()) {
        AccountsReceivableCustomer customer = SpringContext.getBean(AccountsReceivableModuleService.class).findCustomer(payeeIdNumber);
        AccountsReceivableCustomerAddress defaultCustomerAddress = null;
        if (customer != null) {
            defaultCustomerAddress = customer.getPrimaryAddress();
            Map<String, String> addressSearch = new HashMap<String, String>();
            addressSearch.put(KFSPropertyConstants.CUSTOMER_NUMBER, payeeIdNumber);
            List<AccountsReceivableCustomerAddress> customerAddresses = (List<AccountsReceivableCustomerAddress>) SpringContext.getBean(AccountsReceivableModuleService.class).searchForCustomerAddresses(addressSearch);
            if (customerAddresses != null && !customerAddresses.isEmpty()) {
                if (customerAddresses.size() > 1) {
                    dvForm.setHasMultipleAddresses(true);
                } else if (defaultCustomerAddress == null) {
                    defaultCustomerAddress = customerAddresses.get(0);
                }
            }
        }
        if (dvForm.hasMultipleAddresses()) {
            return renderCustomerAddressSelection(mapping, request, dvForm);
        } else if (defaultCustomerAddress != null) {
            setupPayeeAsCustomer(dvForm, payeeIdNumber, defaultCustomerAddress.getCustomerAddressIdentifier().toString());
        }
    }
    String customerAddressIdentifier = request.getParameter(KFSPropertyConstants.CUSTOMER_ADDRESS_IDENTIFIER);
    if (isKualiLookupable && StringUtils.isNotBlank(customerAddressIdentifier)) {
        setupPayeeAsCustomer(dvForm, payeeIdNumber, customerAddressIdentifier);
    }
    String paymentReasonCode = document.getDvPayeeDetail().getDisbVchrPaymentReasonCode();
    addPaymentCodeWarningMessage(dvForm, paymentReasonCode);
    return null;
}
Also used : HashMap(java.util.HashMap) AccountsReceivableModuleService(org.kuali.kfs.integration.ar.AccountsReceivableModuleService) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService) VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) CuDisbursementVoucherDocument(edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument) AccountsReceivableCustomerAddress(org.kuali.kfs.integration.ar.AccountsReceivableCustomerAddress) AccountsReceivableCustomer(org.kuali.kfs.integration.ar.AccountsReceivableCustomer) List(java.util.List) VendorAddress(org.kuali.kfs.vnd.businessobject.VendorAddress)

Example 43 with VendorDetail

use of org.kuali.kfs.vnd.businessobject.VendorDetail in project cu-kfs by CU-CommunityApps.

the class PaymentGroup method setPayeeOwnerCdFromVendor.

/**
 * @param string
 */
public void setPayeeOwnerCdFromVendor(String string) {
    // payeeOwnerCd = string;
    BusinessObjectService bos = SpringContext.getBean(BusinessObjectService.class);
    String[] headerDetails = payeeId.split("-");
    Map<String, String> fieldValues = new HashMap<String, String>();
    fieldValues.put("vendorHeaderGeneratedIdentifier", headerDetails[0]);
    fieldValues.put("vendorDetailAssignedIdentifier", headerDetails[1]);
    List<VendorDetail> details = (List<VendorDetail>) bos.findMatching(VendorDetail.class, fieldValues);
    if (details.size() == 1) {
        payeeOwnerCd = details.get(0).getVendorHeader().getVendorOwnershipCode();
    } else {
        throw new RuntimeException("Could not locate Vendor Ownership Code for payeeId [ " + string + " ]");
    }
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) List(java.util.List) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 44 with VendorDetail

use of org.kuali.kfs.vnd.businessobject.VendorDetail in project cu-kfs by CU-CommunityApps.

the class PaymentWorksDataProcessingIntoKfsServiceImpl method buildVendorMaintenanceDocument.

private MaintenanceDocument buildVendorMaintenanceDocument(PaymentWorksVendor paymentWorksVendor, KfsVendorDataWrapper kfsVendorDataWrapper) throws WorkflowException {
    boolean isNewVendor = true;
    MaintenanceDocument vendorMaintDoc = buildVendorMaintenanceDocumentBase(kfsVendorDataWrapper.getVendorDetail(), new VendorDetail(), KFSConstants.MAINTENANCE_NEW_ACTION, isNewVendor, kfsVendorDataWrapper.getVendorNotes());
    return vendorMaintDoc;
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) MaintenanceDocument(org.kuali.kfs.kns.document.MaintenanceDocument)

Example 45 with VendorDetail

use of org.kuali.kfs.vnd.businessobject.VendorDetail in project cu-kfs by CU-CommunityApps.

the class CuVendorServiceImplTest method testGetVendorByVendorName.

public void testGetVendorByVendorName() {
    VendorDetail anakFixtureDetail = VendorDetailFixture.ANAK_INC.createVendorDetail();
    VendorDetail anakDBDetail = cuVendorService.getVendorByVendorName("Anak Inc");
    VendorDetail addFixtureDetail = VendorDetailFixture.ADD_ASSOCIATES_INC.createVendorDetail();
    VendorDetail addDBDetail = cuVendorService.getVendorByVendorName("ADD Associates Inc");
    assertEquals(anakFixtureDetail.isVendorParentIndicator(), anakDBDetail.isVendorParentIndicator());
    assertEquals(anakFixtureDetail.getVendorDetailAssignedIdentifier(), anakDBDetail.getVendorDetailAssignedIdentifier());
    assertEquals(addFixtureDetail.isVendorParentIndicator(), addDBDetail.isVendorParentIndicator());
    assertEquals(addFixtureDetail.getVendorDetailAssignedIdentifier(), addDBDetail.getVendorDetailAssignedIdentifier());
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail)

Aggregations

VendorDetail (org.kuali.kfs.vnd.businessobject.VendorDetail)54 ArrayList (java.util.ArrayList)14 VendorAddress (org.kuali.kfs.vnd.businessobject.VendorAddress)12 Date (java.util.Date)10 List (java.util.List)10 VendorDetailExtension (edu.cornell.kfs.vnd.businessobject.VendorDetailExtension)9 HashMap (java.util.HashMap)9 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)7 VendorHeader (org.kuali.kfs.vnd.businessobject.VendorHeader)7 VendorService (org.kuali.kfs.vnd.document.service.VendorService)7 Iterator (java.util.Iterator)6 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)5 MessageMap (org.kuali.kfs.krad.util.MessageMap)5 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)5 Person (org.kuali.rice.kim.api.identity.Person)5 IOException (java.io.IOException)4 VendorCommodityCode (org.kuali.kfs.vnd.businessobject.VendorCommodityCode)4 VendorContract (org.kuali.kfs.vnd.businessobject.VendorContract)4 VendorSupplierDiversity (org.kuali.kfs.vnd.businessobject.VendorSupplierDiversity)4 FileNotFoundException (java.io.FileNotFoundException)3