From 261420d129afe125cfae5de17e8c78fe2d41859c Mon Sep 17 00:00:00 2001 From: nielserik Date: Mon, 23 Sep 2024 19:59:58 +0200 Subject: [PATCH] CIRC-2136 fix for npe in check for floating -- when current process is not a check-in but a page request --- src/main/java/org/folio/circulation/domain/Item.java | 5 +++-- .../infrastructure/storage/inventory/ItemRepository.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/folio/circulation/domain/Item.java b/src/main/java/org/folio/circulation/domain/Item.java index 9fa7a7e042..ff6bbbdf9a 100644 --- a/src/main/java/org/folio/circulation/domain/Item.java +++ b/src/main/java/org/folio/circulation/domain/Item.java @@ -357,8 +357,9 @@ public String getFloatDestinationLocationId() { } public boolean canFloatThroughCheckInServicePoint() { - return getLocation() != null && - getLocation().isFloatingCollection() + return getLocation() != null + && getLocation().isFloatingCollection() + && getFloatDestinationLocation() != null && getFloatDestinationLocation().getId() != null; } diff --git a/src/main/java/org/folio/circulation/infrastructure/storage/inventory/ItemRepository.java b/src/main/java/org/folio/circulation/infrastructure/storage/inventory/ItemRepository.java index 9a5cb54d5d..ffe39a8bce 100644 --- a/src/main/java/org/folio/circulation/infrastructure/storage/inventory/ItemRepository.java +++ b/src/main/java/org/folio/circulation/infrastructure/storage/inventory/ItemRepository.java @@ -113,7 +113,7 @@ public CompletableFuture> updateItem(Item item) { if (item.isInStatus(IN_TRANSIT)) { write(updatedItemRepresentation, IN_TRANSIT_DESTINATION_SERVICE_POINT_ID, item.getInTransitDestinationServicePointId()); - } else if (item.canFloatThroughCheckInServicePoint()) { + } else if (item.isInStatus(AVAILABLE) && item.canFloatThroughCheckInServicePoint()) { remove(updatedItemRepresentation, TEMPORARY_LOCATION_ID); write(updatedItemRepresentation, TEMPORARY_LOCATION_ID, item.getFloatDestinationLocationId());