Index: src/main/groovy/com/lemans/pricecalc/Mapper.groovy =================================================================== diff -u -r84fe362c16d378d29f13bbff737ed7764b6a8f78 -rd6a6788d307162218552b63a450abd5c72c3e721 --- src/main/groovy/com/lemans/pricecalc/Mapper.groovy (.../Mapper.groovy) (revision 84fe362c16d378d29f13bbff737ed7764b6a8f78) +++ src/main/groovy/com/lemans/pricecalc/Mapper.groovy (.../Mapper.groovy) (revision d6a6788d307162218552b63a450abd5c72c3e721) @@ -4,7 +4,7 @@ class Mapper { static final List PART_MULTI_FILTERS = ['subComCodeId', 'categoryId', 'derivedPartStatusId'] - static final List PART_FILTERS = ['vendorId', 'brandId', 'catalogId', 'isActive', 'isDigiActive', 'productId', 'columnName', 'statusCodeId', 'buyer', 'activeVendorId', '_is_pc_admin_'] + static final List PART_FILTERS = ['vendorId', 'brandId', 'catalogId', 'isActive', 'isDigiActive', 'productId', 'columnName', 'statusCodeId', 'buyer', 'activeVendorId'] static final List PART_LIKE_FILTERS = ['partDescr'] static final List PART_LIKE_NO_SPECIAL_FILTERS = ['vendorPartNumber', 'partNumber', 'lastUpdatedBy'] @@ -37,10 +37,10 @@ } } - static Map selectAndJoin(Map criteria) { + static Map selectAndJoin(String filterName) { List joins = [] String select - switch (criteria.filterName) { + switch (filterName) { case 'brandId': joins << 'INNER JOIN [PartsSource_DS].dbo.Brand b WITH(NOLOCK) ON b.brandId = vp.brandId AND b.dateDeleted IS NULL' select = "[filter] = 'brand', id = b.brandId, code = b.brandCode, descr = b.brandName" @@ -89,12 +89,7 @@ select = "[filter] = 'catalog', id = c.catalogId, code = c.catalogId, descr = c.catalogName" break case 'buyer': - if (criteria._is_pc_admin_ == 'true') { - joins << 'INNER JOIN dbo.vwVendor v WITH(NOLOCK) ON v.vendorId = vp.vendorId' - } else { - joins << """INNER JOIN dbo.vwVendor v WITH(NOLOCK) ON v.vendorId = vp.vendorId - AND (v.buyerGlobalId = "${criteria.username}" OR v.buyerManagerGlobalId = "${criteria.username}")""" - } + joins << 'INNER JOIN dbo.vwVendor v WITH(NOLOCK) ON v.vendorId = vp.vendorId' select = "[filter] = 'buyer', id = v.buyerGlobalId, code = v.buyerGlobalId, descr = v.buyerGlobalId" break case 'activeVendorId': Index: src/main/groovy/com/lemans/pricecalc/controllers/search/SearchController.groovy =================================================================== diff -u -raffa884e54fede454bba680b92e1617e7157607f -rd6a6788d307162218552b63a450abd5c72c3e721 --- src/main/groovy/com/lemans/pricecalc/controllers/search/SearchController.groovy (.../SearchController.groovy) (revision affa884e54fede454bba680b92e1617e7157607f) +++ src/main/groovy/com/lemans/pricecalc/controllers/search/SearchController.groovy (.../SearchController.groovy) (revision d6a6788d307162218552b63a450abd5c72c3e721) @@ -21,7 +21,7 @@ @GetMapping(value = "/part/filter/{filterName}/options") def partsFilterOptions(@PathVariable String filterName) { List errors = [] - Map criteria = partFilters() + [filterName: filterName] + filters(['filterType']) + [username: auditUserNameOnly] + Map criteria = partFilters() + [filterName: filterName] + filters(['filterType']) validateFilterNameAndType(filterName, criteria.filterType, errors) errors ? renderList(errors) : renderPaginated(searchService.filterOptions(criteria)) } Index: src/main/groovy/com/lemans/pricecalc/services/search/SearchService.groovy =================================================================== diff -u -raffa884e54fede454bba680b92e1617e7157607f -rd6a6788d307162218552b63a450abd5c72c3e721 --- src/main/groovy/com/lemans/pricecalc/services/search/SearchService.groovy (.../SearchService.groovy) (revision affa884e54fede454bba680b92e1617e7157607f) +++ src/main/groovy/com/lemans/pricecalc/services/search/SearchService.groovy (.../SearchService.groovy) (revision d6a6788d307162218552b63a450abd5c72c3e721) @@ -15,7 +15,7 @@ CatalogRepository catalogRepository Map filterOptions(Map criteria) { - Map selectAndJoin = Mapper.selectAndJoin(criteria) + Map selectAndJoin = Mapper.selectAndJoin(criteria.filterName) dqx(criteria).executeWithOutCount( "${selectAndJoin.select} \n ${DynamicQueryExecutor.truncateSelect(SqlQueries.PARTS_NOT_IN_CATALOG_SQL)}", partsWithoutCatalogClauses(criteria), @@ -26,7 +26,7 @@ } Map auditLogFilterOptions(Map criteria) { - Map selectAndJoin = Mapper.selectAndJoin(criteria) + Map selectAndJoin = Mapper.selectAndJoin(criteria.filterName) if (criteria.columnName == 'catalogPartStatus') { criteria.columnName = 'statusCodeId' } dqx(criteria).executeWithOutCount( "${selectAndJoin.select} \n ${DynamicQueryExecutor.truncateSelect(SqlQueries.CATALOG_PARTS_AUDIT_LOG_SQL)}",