From 33cc3233dea0bcb32f101208943749315ff53ecb Mon Sep 17 00:00:00 2001 From: Serhii_Nosko Date: Thu, 8 Feb 2024 14:16:26 +0200 Subject: [PATCH 1/2] MODORDERS-1022. Add receipt Date to the CheckIng Piece schema --- ramls/acq-models | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ramls/acq-models b/ramls/acq-models index d3cfe3c19..0502772fd 160000 --- a/ramls/acq-models +++ b/ramls/acq-models @@ -1 +1 @@ -Subproject commit d3cfe3c19baf07a03465bb6a51161a40ed294877 +Subproject commit 0502772fdadd941734a132501c0cfe9baab243d8 From 039fd0c3d35d4ed8f5ad6fa1bdde885e8e71341d Mon Sep 17 00:00:00 2001 From: Serhii_Nosko Date: Thu, 8 Feb 2024 17:33:47 +0200 Subject: [PATCH 2/2] MODORDERS-1022. Update conversion logic --- .../java/org/folio/helper/CheckinHelper.java | 4 ++ .../org/folio/helper/CheckinHelperTest.java | 54 +++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/src/main/java/org/folio/helper/CheckinHelper.java b/src/main/java/org/folio/helper/CheckinHelper.java index de2879589..d195c8293 100644 --- a/src/main/java/org/folio/helper/CheckinHelper.java +++ b/src/main/java/org/folio/helper/CheckinHelper.java @@ -241,9 +241,13 @@ private void updatePieceWithCheckinInfo(Piece piece) { piece.setEnumeration(checkinPiece.getEnumeration()); piece.setChronology(checkinPiece.getChronology()); piece.setCopyNumber(checkinPiece.getCopyNumber()); + piece.setAccessionNumber(checkinPiece.getAccessionNumber()); piece.setDisplayOnHolding(checkinPiece.getDisplayOnHolding()); piece.setDiscoverySuppress(checkinPiece.getDiscoverySuppress()); piece.setSupplement(checkinPiece.getSupplement()); + piece.setBarcode(checkinPiece.getBarcode()); + piece.setReceiptDate(checkinPiece.getReceiptDate()); + piece.setCallNumber(checkinPiece.getCallNumber()); // Piece record might be received or rolled-back to Expected if (inventoryManager.isOnOrderPieceStatus(checkinPiece)) { piece.setReceivedDate(null); diff --git a/src/test/java/org/folio/helper/CheckinHelperTest.java b/src/test/java/org/folio/helper/CheckinHelperTest.java index fee42774d..d6553af12 100644 --- a/src/test/java/org/folio/helper/CheckinHelperTest.java +++ b/src/test/java/org/folio/helper/CheckinHelperTest.java @@ -13,9 +13,14 @@ import static org.folio.rest.RestConstants.OKAPI_URL; import static org.folio.rest.impl.PurchaseOrdersApiTest.X_OKAPI_TENANT; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -27,6 +32,7 @@ import org.folio.rest.core.models.RequestContext; import org.folio.rest.jaxrs.model.CheckInPiece; import org.folio.rest.jaxrs.model.CheckinCollection; +import org.folio.rest.jaxrs.model.Piece; import org.folio.rest.jaxrs.model.ToBeCheckedIn; import org.folio.service.ProtectionService; import org.folio.service.configuration.ConfigurationEntriesService; @@ -138,6 +144,54 @@ void shouldTestGetItemCreateNeededCheckinPieces() { assertEquals(false, actCheckInPiece2.getDisplayOnHolding()); } + @Test + void allCheckingPieceFieldsShouldBePopulated() { + String poLineId = UUID.randomUUID().toString(); + String pieceId = UUID.randomUUID().toString(); + CheckinCollection checkinCollection = new CheckinCollection(); + checkinCollection.withToBeCheckedIn(Collections.singletonList(new ToBeCheckedIn() + .withPoLineId(poLineId) + .withCheckInPieces(Collections.singletonList(new CheckInPiece() + .withId(pieceId) + .withDisplaySummary("displaySummary") + .withComment("comment") + .withEnumeration("enumeration") + .withChronology("chronology") + .withCopyNumber("copyNumber") + .withAccessionNumber("accessionNumber") + .withDisplayOnHolding(true) + .withDiscoverySuppress(true) + .withSupplement(true) + .withBarcode("barcode") + .withReceiptDate(new Date()) + .withCallNumber("callNumber") + )))); + CheckinHelper checkinHelper = spy(new CheckinHelper(checkinCollection, okapiHeadersMock, requestContext.getContext())); + Map> map = new HashMap<>(); + List pieces = new ArrayList<>(); + pieces.add(new Piece() + .withId(pieceId) + .withPoLineId(poLineId)); + map.put(poLineId, pieces); + Map> res = checkinHelper.updatePieceRecordsWithoutItems(map); + + Piece piece = res.get(poLineId).get(0); + assertEquals("displaySummary", piece.getDisplaySummary()); + assertEquals("comment", piece.getComment()); + assertEquals("enumeration", piece.getEnumeration()); + assertEquals("chronology", piece.getChronology()); + assertEquals("copyNumber", piece.getCopyNumber()); + assertEquals("accessionNumber", piece.getAccessionNumber()); + assertTrue(piece.getDisplayOnHolding()); + assertTrue(piece.getDiscoverySuppress()); + assertTrue(piece.getSupplement()); + assertEquals("barcode", piece.getBarcode()); + assertNotNull(piece.getReceiptDate()); + assertEquals("callNumber", piece.getCallNumber()); + assertNotNull(piece.getReceivedDate()); + assertEquals(Piece.ReceivingStatus.RECEIVED, piece.getReceivingStatus()); + } + private static class ContextConfiguration { @Bean PieceCreateFlowInventoryManager pieceCreateFlowInventoryManager() { return mock(PieceCreateFlowInventoryManager.class);