From afebb0a5cc4216353c8f78048a3c422303149021 Mon Sep 17 00:00:00 2001 From: Janis Saldabols Date: Thu, 12 Sep 2024 13:49:58 +0300 Subject: [PATCH] MODNCIP-68 Send field only if not null --- .../java/org/folio/ncip/FolioRemoteServiceManager.java | 7 ++++++- src/test/resources/mockdata/ncip-acceptItem-blocked.xml | 5 +---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/folio/ncip/FolioRemoteServiceManager.java b/src/main/java/org/folio/ncip/FolioRemoteServiceManager.java index d899dd5..5714098 100644 --- a/src/main/java/org/folio/ncip/FolioRemoteServiceManager.java +++ b/src/main/java/org/folio/ncip/FolioRemoteServiceManager.java @@ -547,7 +547,12 @@ public JsonObject acceptItem(AcceptItemInitiationData initData, UserId userId, S item.put(Constants.ID, itemUuid.toString()); item.put("holdingsRecordId", holdingsUuid.toString()); item.put("discoverySuppress", true); - item.put("itemLevelCallNumber", itemId.getItemIdentifierValue()); + if (initData.getItemOptionalFields() != null && initData.getItemOptionalFields().getItemDescription() != null && + initData.getItemOptionalFields().getItemDescription().getCallNumber() != null) { + item.put("itemLevelCallNumber", initData.getItemOptionalFields().getItemDescription().getCallNumber()); + } else { + item.put("itemLevelCallNumber", itemId.getItemIdentifierValue()); + } // PLACE HOLD DOES NOT WORK UNLESS THE ITEM HAS A PERM LOCATION JsonObject permLocation = new JsonObject(); permLocation.put(Constants.ID, itemLocation); diff --git a/src/test/resources/mockdata/ncip-acceptItem-blocked.xml b/src/test/resources/mockdata/ncip-acceptItem-blocked.xml index 7656abb..2920c8c 100644 --- a/src/test/resources/mockdata/ncip-acceptItem-blocked.xml +++ b/src/test/resources/mockdata/ncip-acceptItem-blocked.xml @@ -26,10 +26,7 @@ Author TEST ONE - - - Call Number - + DELIVERY