From 45f69913912b6d7c7abebb1c4dc5ff31e4d6aabb Mon Sep 17 00:00:00 2001
From: Lucas Gass <lucas@bywatersolutions.com>
Date: Tue, 13 Aug 2024 21:01:51 +0000
Subject: [PATCH] Bug 37639: Add items.stack to items endpoint

To test:
1. Apply patch and restart_all, and yarn api:bundle
2. Check the items endpoint for items.stack ( http://localhost:8081/api/v1/items/144 )
3. The data is there, and correct.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
---
 Koha/Item.pm                         | 2 +-
 api/v1/swagger/definitions/item.yaml | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Koha/Item.pm b/Koha/Item.pm
index 16f66a8c68e..2d851c42ce4 100644
--- a/Koha/Item.pm
+++ b/Koha/Item.pm
@@ -1832,7 +1832,7 @@ sub to_api_mapping {
         replacementpricedate     => 'replacement_price_date',
         datelastborrowed         => 'last_checkout_date',
         datelastseen             => 'last_seen_date',
-        stack                    => undef,
+        stack                    => 'shelving_control_number',
         notforloan               => 'not_for_loan_status',
         damaged                  => 'damaged_status',
         damaged_on               => 'damaged_date',
diff --git a/api/v1/swagger/definitions/item.yaml b/api/v1/swagger/definitions/item.yaml
index f44b3d5ae3c..b254eb2dc34 100644
--- a/api/v1/swagger/definitions/item.yaml
+++ b/api/v1/swagger/definitions/item.yaml
@@ -192,6 +192,11 @@ properties:
       - string
       - "null"
     description: Materials specified
+  shelving_control_number:
+    type:
+      - number
+      - "null"
+    description: Shelving control number
   uri:
     type:
       - string
-- 
2.47.0