Bug 40542 - Add `cancellation_reason` to holds strings embed
Summary: Add `cancellation_reason` to holds strings embed
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on: 33568
Blocks: 40530
  Show dependency treegraph
 
Reported: 2025-07-29 13:45 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2025-07-31 20:07 UTC (History)
2 users (show)

See Also:
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:


Attachments
Bug 40542: Add cancellation_reason to Koha::Hold->strings_map (4.13 KB, patch)
2025-07-29 14:22 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 40542: Add strings embed to holds-related endpoints (2.01 KB, patch)
2025-07-29 14:22 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 40542: Add cancellation_reason to Koha::Hold->strings_map (4.18 KB, patch)
2025-07-29 18:01 UTC, David Nind
Details | Diff | Splinter Review
Bug 40542: Add strings embed to holds-related endpoints (2.06 KB, patch)
2025-07-29 18:01 UTC, David Nind
Details | Diff | Splinter Review
Bug 40542: Add cancellation_reason to Koha::Hold->strings_map (4.25 KB, patch)
2025-07-30 12:27 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40542: Add strings embed to holds-related endpoints (2.13 KB, patch)
2025-07-30 12:27 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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