Bug 40542

Summary: Add `cancellation_reason` to holds strings embed
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: REST APIAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: Pushed to main --- QA Contact: Jonathan Druart <jonathan.druart>
Severity: enhancement    
Priority: P5 - low CC: lucas, tomascohen
Version: MainKeywords: additional_work_needed
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
25.11.00
Circulation function:
Bug Depends on: 33568    
Bug Blocks: 40530    
Attachments: Bug 40542: Add cancellation_reason to Koha::Hold->strings_map
Bug 40542: Add strings embed to holds-related endpoints
Bug 40542: Add cancellation_reason to Koha::Hold->strings_map
Bug 40542: Add strings embed to holds-related endpoints
Bug 40542: Add cancellation_reason to Koha::Hold->strings_map
Bug 40542: Add strings embed to holds-related endpoints
Bug 40542: (40174 follow-up) Skip _strings for object creation

Description Tomás Cohen Arazi (tcohen) 2025-07-29 13:45:37 UTC
Bug 33568 introduced the `Koha::Hold->strings_map` method which is only used for embedding srings in the biblios endpoint. The holds-related endpoint themselves don't use it.

We should add `+strings` for using it in bug 40530.
Comment 1 Tomás Cohen Arazi (tcohen) 2025-07-29 14:22:16 UTC
Created attachment 184810 [details] [review]
Bug 40542: Add cancellation_reason to Koha::Hold->strings_map

This patch adds the mentioned AV to the returned strings structure.

It also adds tests for the method.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Hold.t
=> SUCCESS: Tests pass!
3. Sign off :-D
Comment 2 Tomás Cohen Arazi (tcohen) 2025-07-29 14:22:18 UTC
Created attachment 184811 [details] [review]
Bug 40542: Add strings embed to holds-related endpoints

This patch makes holds endpoints be allowed to embed strings.

To test:
1. Use your favourite REST tool to hit /api/v1/holds
2. Add the `x-koha-embed: +strings` header.
=> FAIL: The API rejects because it is not equiped with the feature.
3. Apply this patches
4. Run:
   $ ktd --shell
  k$ yarn api:bundle
  k$ koha-plack --restart kohadev
5. Repeat 2
=> SUCCESS: It works!
6. Sign off :-D
Comment 3 David Nind 2025-07-29 18:01:29 UTC
Created attachment 184836 [details] [review]
Bug 40542: Add cancellation_reason to Koha::Hold->strings_map

This patch adds the mentioned AV to the returned strings structure.

It also adds tests for the method.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Hold.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2025-07-29 18:01:32 UTC
Created attachment 184837 [details] [review]
Bug 40542: Add strings embed to holds-related endpoints

This patch makes holds endpoints be allowed to embed strings.

To test:
1. Use your favourite REST tool to hit /api/v1/holds
2. Add the `x-koha-embed: +strings` header.
=> FAIL: The API rejects because it is not equiped with the feature.
3. Apply this patches
4. Run:
   $ ktd --shell
  k$ yarn api:bundle
  k$ koha-plack --restart kohadev
5. Repeat 2
=> SUCCESS: It works!
6. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 Jonathan Druart 2025-07-30 12:27:25 UTC
Created attachment 184881 [details] [review]
Bug 40542: Add cancellation_reason to Koha::Hold->strings_map

This patch adds the mentioned AV to the returned strings structure.

It also adds tests for the method.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Hold.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 Jonathan Druart 2025-07-30 12:27:27 UTC
Created attachment 184882 [details] [review]
Bug 40542: Add strings embed to holds-related endpoints

This patch makes holds endpoints be allowed to embed strings.

To test:
1. Use your favourite REST tool to hit /api/v1/holds
2. Add the `x-koha-embed: +strings` header.
=> FAIL: The API rejects because it is not equiped with the feature.
3. Apply this patches
4. Run:
   $ ktd --shell
  k$ yarn api:bundle
  k$ koha-plack --restart kohadev
5. Repeat 2
=> SUCCESS: It works!
6. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Lucas Gass (lukeg) 2025-07-31 18:47:51 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 8 Lucas Gass (lukeg) 2025-08-01 16:48:53 UTC
This is causing KohaTable/PendingHolds_spec.ts tests to fail.
Comment 9 Tomás Cohen Arazi (tcohen) 2025-08-01 17:47:40 UTC
Created attachment 185074 [details] [review]
Bug 40542: (40174 follow-up) Skip _strings for object creation

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 10 Lucas Gass (lukeg) 2025-08-01 19:26:19 UTC
Follow-up pushed to main