Search in sources :

Example 1 with VendorService

use of org.kuali.kfs.vnd.document.service.VendorService in project cu-kfs by CU-CommunityApps.

the class VendorDetailInquiryPresentationController method getConditionallyHiddenPropertyNames.

/**
 * Implement this method to hide fields based on specific data in the record being inquired into
 *
 * @return Set of property names that should be hidden
 */
@Override
public Set<String> getConditionallyHiddenPropertyNames(BusinessObject businessObject) {
    Set<String> retVal = new HashSet<String>();
    IdentityManagementService idService = SpringContext.getBean(IdentityManagementService.class);
    UserSession uSession = GlobalVariables.getUserSession();
    Map<String, String> permissionDetails = new HashMap<String, String>();
    permissionDetails.put(KewApiConstants.DOCUMENT_TYPE_NAME_DETAIL, "PVEN");
    boolean canViewAttachments = idService.isAuthorizedByTemplateName(uSession.getPrincipalId(), KRADConstants.KNS_NAMESPACE, KimConstants.PermissionTemplateNames.VIEW_NOTE_ATTACHMENT, permissionDetails, null);
    if (!canViewAttachments) {
        VendorDetail detail = (VendorDetail) businessObject;
        VendorService vendorService = SpringContext.getBean(VendorService.class);
        List<Note> boNotes = vendorService.getVendorNotes(detail);
        for (int i = 0; i < boNotes.size(); i++) retVal.add("boNotes[" + i + "].attachmentLink");
    }
    return retVal;
}
Also used : HashMap(java.util.HashMap) VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) VendorService(org.kuali.kfs.vnd.document.service.VendorService) IdentityManagementService(org.kuali.rice.kim.api.services.IdentityManagementService) UserSession(org.kuali.kfs.krad.UserSession) Note(org.kuali.kfs.krad.bo.Note) HashSet(java.util.HashSet)

Example 2 with VendorService

use of org.kuali.kfs.vnd.document.service.VendorService in project cu-kfs by CU-CommunityApps.

the class PurchaseOrderDocument method isVendorEmployeeOrNonResidentAlien.

protected boolean isVendorEmployeeOrNonResidentAlien() {
    if (ObjectUtils.isNull(this.getVendorHeaderGeneratedIdentifier())) {
        // no vendor header id so can't check for proper tax routing
        return false;
    }
    String vendorHeaderGeneratedId = this.getVendorHeaderGeneratedIdentifier().toString();
    VendorService vendorService = SpringContext.getBean(VendorService.class);
    boolean routeDocumentAsEmployeeVendor = vendorService.isVendorInstitutionEmployee(Integer.valueOf(vendorHeaderGeneratedId));
    boolean routeDocumentAsForeignVendor = vendorService.isVendorForeign(Integer.valueOf(vendorHeaderGeneratedId));
    if ((!routeDocumentAsEmployeeVendor) && (!routeDocumentAsForeignVendor)) {
        // no need to route
        return false;
    }
    return true;
}
Also used : VendorService(org.kuali.kfs.vnd.document.service.VendorService)

Example 3 with VendorService

use of org.kuali.kfs.vnd.document.service.VendorService in project cu-kfs by CU-CommunityApps.

the class PurchasingAccountsPayableDocumentBase method buildDocumentTitle.

/**
 * build document title based on the properties of current document
 *
 * @param the default document title
 * @return the combine information of the given title and additional payment indicators
 */
protected String buildDocumentTitle(String title) {
    if (this.getVendorDetail() == null) {
        return title;
    }
    Integer vendorHeaderGeneratedIdentifier = this.getVendorDetail().getVendorHeaderGeneratedIdentifier();
    VendorService vendorService = SpringContext.getBean(VendorService.class);
    Object[] indicators = new String[2];
    boolean isEmployeeVendor = vendorService.isVendorInstitutionEmployee(vendorHeaderGeneratedIdentifier);
    indicators[0] = isEmployeeVendor ? AdHocPaymentIndicator.EMPLOYEE_VENDOR : AdHocPaymentIndicator.OTHER;
    boolean isVendorForeign = vendorService.isVendorForeign(vendorHeaderGeneratedIdentifier);
    indicators[1] = isVendorForeign ? AdHocPaymentIndicator.ALIEN_VENDOR : AdHocPaymentIndicator.OTHER;
    for (Object indicator : indicators) {
        if (!AdHocPaymentIndicator.OTHER.equals(indicator)) {
            String titlePattern = title + " [{0}:{1}]";
            return MessageFormat.format(titlePattern, indicators);
        }
    }
    return title;
}
Also used : VendorService(org.kuali.kfs.vnd.document.service.VendorService) PersistableBusinessObject(org.kuali.kfs.krad.bo.PersistableBusinessObject)

Aggregations

VendorService (org.kuali.kfs.vnd.document.service.VendorService)3 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 UserSession (org.kuali.kfs.krad.UserSession)1 Note (org.kuali.kfs.krad.bo.Note)1 PersistableBusinessObject (org.kuali.kfs.krad.bo.PersistableBusinessObject)1 VendorDetail (org.kuali.kfs.vnd.businessobject.VendorDetail)1 IdentityManagementService (org.kuali.rice.kim.api.services.IdentityManagementService)1