Bug 29736 - Error when placing a hold for a club without members
Summary: Error when placing a hold for a club without members
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-20 11:30 UTC by Jonathan Druart
Modified: 2022-06-06 20:31 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00,21.11.02,21.05.09,20.11.15
Circulation function:


Attachments
Bug 29736: Don't return empty clubs (4.66 KB, patch)
2021-12-20 14:17 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 29736: Don't return empty clubs (4.71 KB, patch)
2021-12-21 13:56 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 29736: Restore searching (2.07 KB, patch)
2021-12-21 13:56 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 29736: (QA follow-up) No need to delete all clubs (1.70 KB, patch)
2021-12-21 13:56 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 29736: Don't return empty clubs (4.77 KB, patch)
2022-01-02 16:36 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 29736: Restore searching (2.13 KB, patch)
2022-01-02 16:36 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 29736: (QA follow-up) No need to delete all clubs (1.75 KB, patch)
2022-01-02 16:36 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2021-12-20 11:30:22 UTC
If a club does not have members and a hold is placed for it, there is a JS error appearing in the console: Uncaught TypeError: err.responseJSON.error is undefined
Comment 1 Jonathan Druart 2021-12-20 11:31:06 UTC
[debug] POST "/api/v1/clubs/1/holds" (72f374a3)
[debug] Routing to controller "Koha::REST::V1::Auth" and action "under"                                                                                                         
[debug] Routing to controller "Koha::REST::V1::Clubs::Holds" and action "add"                                                                                                   
[warn] OpenAPI <<< POST api/v1/clubs/1/holds [{"message":"Properties not allowed: patron_id.","path":"\/body"}]                                                                 
[debug] 400 Bad Request (0.023515s, 42.526/s)
Comment 2 Jonathan Druart 2021-12-20 14:17:30 UTC
Created attachment 128760 [details] [review]
Bug 29736: Don't return empty clubs

There is an error when placing a hold for a club without members:
Uncaught TypeError: err.responseJSON.error is undefined

It seems that we should remove clubs without members from the search.

Test plan:
Create 1 club xx with 2 patrons
Create 1 club xxx with 1 patron and cancel their enrolment
Create 1 club xxxx without patron

Place a hold for club "x", only the first one should be returned with
this patch.
Comment 3 Tomás Cohen Arazi (tcohen) 2021-12-21 13:56:45 UTC
Created attachment 128836 [details] [review]
Bug 29736: Don't return empty clubs

There is an error when placing a hold for a club without members:
Uncaught TypeError: err.responseJSON.error is undefined

It seems that we should remove clubs without members from the search.

Test plan:
Create 1 club xx with 2 patrons
Create 1 club xxx with 1 patron and cancel their enrolment
Create 1 club xxxx without patron

Place a hold for club "x", only the first one should be returned with
this patch.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi (tcohen) 2021-12-21 13:56:51 UTC
Created attachment 128837 [details] [review]
Bug 29736: Restore searching

Without this patch, the list will always display all clubs.

To test:
1. Have two clubs, with enrollemnts:
   - Cthulhu fans
   - The Shadow Out of Time fans
2. Search for the letter c
=> FAIL: You get both results
3. Apply this patch
4. Repeat 2
=> SUCCESS: Only Cthulhu is returned
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Tomás Cohen Arazi (tcohen) 2021-12-21 13:56:55 UTC
Created attachment 128838 [details] [review]
Bug 29736: (QA follow-up) No need to delete all clubs

There's no real need to delete all the existing clubs in the tests.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 6 Katrin Fischer 2022-01-02 16:36:50 UTC
Created attachment 128953 [details] [review]
Bug 29736: Don't return empty clubs

There is an error when placing a hold for a club without members:
Uncaught TypeError: err.responseJSON.error is undefined

It seems that we should remove clubs without members from the search.

Test plan:
Create 1 club xx with 2 patrons
Create 1 club xxx with 1 patron and cancel their enrolment
Create 1 club xxxx without patron

Place a hold for club "x", only the first one should be returned with
this patch.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Katrin Fischer 2022-01-02 16:36:53 UTC
Created attachment 128954 [details] [review]
Bug 29736: Restore searching

Without this patch, the list will always display all clubs.

To test:
1. Have two clubs, with enrollemnts:
   - Cthulhu fans
   - The Shadow Out of Time fans
2. Search for the letter c
=> FAIL: You get both results
3. Apply this patch
4. Repeat 2
=> SUCCESS: Only Cthulhu is returned
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Katrin Fischer 2022-01-02 16:36:58 UTC
Created attachment 128955 [details] [review]
Bug 29736: (QA follow-up) No need to delete all clubs

There's no real need to delete all the existing clubs in the tests.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Jonathan Druart 2022-01-03 14:49:18 UTC
(In reply to Tomás Cohen Arazi from comment #4)
> Created attachment 128837 [details] [review] [review]
> Bug 29736: Restore searching

Oops, thanks Tomas!
Comment 10 Fridolin Somers 2022-01-14 02:38:49 UTC
Pushed to master for 22.05, thanks to everybody involved ﷐[U+1F984]﷑
Comment 11 Kyle M Hall (khall) 2022-01-14 14:35:25 UTC
Pushed to 21.11.x for 21.11.02
Comment 12 Andrew Fuerste-Henry 2022-01-25 17:58:38 UTC
Pushed to 21.05.x for 21.05.09
Comment 13 Victor Grousset/tuxayo 2022-02-11 22:06:09 UTC
Backported: Pushed to 20.11.x branch for 20.11.15
Comment 14 Wainui Witika-Park 2022-02-15 03:57:45 UTC
Do I need to backport this to 19.11.x? I probably won't unless there is a need for it
Comment 15 Wainui Witika-Park 2022-02-21 04:49:11 UTC
Not backported to 19.11.x. Please request it if you need it.