diff --git a/src/main/java/org/folio/service/pieces/flows/update/PieceUpdateFlowInventoryManager.java b/src/main/java/org/folio/service/pieces/flows/update/PieceUpdateFlowInventoryManager.java index 8074b8632..9f8b99fb0 100644 --- a/src/main/java/org/folio/service/pieces/flows/update/PieceUpdateFlowInventoryManager.java +++ b/src/main/java/org/folio/service/pieces/flows/update/PieceUpdateFlowInventoryManager.java @@ -111,11 +111,11 @@ private Future handleItem(PieceUpdateHolder holder, RequestContext reque } return inventoryManager.getItemRecordById(pieceToUpdate.getItemId(), true, requestContext) .compose(jsonItem -> { - boolean noJsonItem = jsonItem == null || jsonItem.isEmpty(); - if (holder.isCreateItem() && noJsonItem && pieceToUpdate.getHoldingId() != null) { + boolean jsonItemFound = jsonItem != null && !jsonItem.isEmpty(); + if (holder.isCreateItem() && !jsonItemFound && pieceToUpdate.getHoldingId() != null) { return pieceUpdateInventoryService.manualPieceFlowCreateItemRecord(pieceToUpdate, poLineToSave, requestContext); } - if (!noJsonItem) { + if (jsonItemFound) { return updateItemWithFields(jsonItem, poLineToSave, pieceToUpdate) .compose(ignored -> inventoryManager.updateItem(jsonItem, requestContext).map(item -> jsonItem.getString(ID))); }