diff --git a/src/main/java/org/opensrp/repository/postgres/StocksRepositoryImpl.java b/src/main/java/org/opensrp/repository/postgres/StocksRepositoryImpl.java index 795d1b15e..29b9ed3ae 100755 --- a/src/main/java/org/opensrp/repository/postgres/StocksRepositoryImpl.java +++ b/src/main/java/org/opensrp/repository/postgres/StocksRepositoryImpl.java @@ -20,6 +20,7 @@ import org.opensrp.repository.postgres.mapper.custom.CustomStockMetadataMapper; import org.opensrp.search.StockSearchBean; import org.opensrp.util.RepositoryUtil; +import org.opensrp.util.Utils; import org.smartregister.converters.StockConverter; import org.smartregister.domain.PhysicalLocation; import org.smartregister.domain.ProductCatalogue; @@ -453,8 +454,12 @@ public List getInventoryWithProductDetailsByStockId(Stri } private List convertToFHIR(List stockAndProductDetails) { - return stockAndProductDetails.stream().map(stockAndProductDetail -> StockConverter.convertStockToBundleResource(stockAndProductDetail)) - .collect(Collectors.toList()); + return stockAndProductDetails.stream().map(stockAndProductDetail -> { + String productNameWithProperWhiteSpacing = Utils.replaceConsecutiveSpaces(stockAndProductDetail.getProductCatalogue().getProductName()); + stockAndProductDetail.getProductCatalogue().setProductName(productNameWithProperWhiteSpacing); + return StockConverter.convertStockToBundleResource(stockAndProductDetail); + }) + .collect(Collectors.toList()); } }