Bug 38148 - Check value of holdallowed circ rule properly (Bug 29087 follow-up)
Summary: Check value of holdallowed circ rule properly (Bug 29087 follow-up)
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: Main
Hardware: All All
: P5 - low critical
Assignee: Aleisha Amohia
QA Contact: Nick Clemens (kidclamp)
URL:
Keywords: rel_23_11_candidate
: 38134 (view as bug list)
Depends on: 29087
Blocks:
  Show dependency treegraph
 
Reported: 2024-10-11 01:51 UTC by Aleisha Amohia
Modified: 2024-12-10 06:28 UTC (History)
14 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00,24.05.05,23.11.10
Circulation function:


Attachments
Bug 38148: Check value of holdallowed circ rule properly (1.67 KB, patch)
2024-10-11 01:55 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 38148: Check value of holdallowed circ rule properly (1.65 KB, patch)
2024-10-11 02:14 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 38148: Check value of holdallowed circ rule properly (1.69 KB, patch)
2024-10-17 19:49 UTC, David Nind
Details | Diff | Splinter Review
Bug 38148: Revert back to get_effective_rule (1.84 KB, patch)
2024-10-22 10:49 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 38148: Check value of holdallowed circ rule properly (1.75 KB, patch)
2024-10-22 13:32 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 38148: Revert back to get_effective_rule (1.89 KB, patch)
2024-10-22 13:32 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 38148: Check value of holdallowed circ rule properly (1.75 KB, patch)
2024-10-22 13:33 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 38148: Revert back to get_effective_rule (1.89 KB, patch)
2024-10-22 13:33 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 38148: Check value of holdallowed circ rule properly (1.80 KB, patch)
2024-10-22 15:34 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 38148: Revert back to get_effective_rule (1.95 KB, patch)
2024-10-22 15:34 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 38148: Unit tests (7.67 KB, patch)
2024-10-22 20:08 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 38148: Check value of holdallowed circ rule properly (2.50 KB, patch)
2024-10-22 20:08 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 38148: (QA follow-up) Code comments (2.33 KB, patch)
2024-10-22 20:08 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 38148: Unit tests (7.67 KB, patch)
2024-10-23 11:51 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 38148: Check value of holdallowed circ rule properly (1.86 KB, patch)
2024-10-23 11:51 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 38148: Revert back to get_effective_rule (2.00 KB, patch)
2024-10-23 11:51 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 38148: (QA follow-up) Code comments (2.33 KB, patch)
2024-10-23 11:51 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Aleisha Amohia 2024-10-11 01:51:47 UTC
This is due to Bug 29087, see comment 39
Comment 1 Aleisha Amohia 2024-10-11 01:55:34 UTC
Created attachment 172680 [details] [review]
Bug 38148: Check value of holdallowed circ rule properly

To test:

1. Search for a record on the OPAC. Notice there is no link to place a hold.
2. Search for this record on the staff interface and place a hold. Go to Circulation -> Holds to pull and notice it is empty

3. Apply patch and restart services

4. Search for a record on the OPAC. Confirm you can see a link to place a hold.
5. Search for this record on the staff interface and place a hold. Go to Circulation -> Holds to pull and confirm your hold shows in the list.

Sponsored-by: Whanganui District Council
Comment 2 Aleisha Amohia 2024-10-11 02:13:03 UTC
So Bug 29087 was the cause of being unable to place OPAC holds and the holds to pull list being empty for this library, and the fix does solve it for them... but I'm not totally sure what combination of their catalogue and circ rules caused it to happen to them. In short, I don't know how to write a test plan for this. I've updated the bug report accordingly and will attach a new test plan.
Comment 3 Aleisha Amohia 2024-10-11 02:14:34 UTC
Created attachment 172681 [details] [review]
Bug 38148: Check value of holdallowed circ rule properly

It was noted on Bug 29087 that the value of circulation rules needs to be checked differently, so this follow-up addresses that.

To test:

1. Apply patch and restart services
2. Search for a record on the OPAC. Confirm you can see a link to place a hold.
3. Search for this record on the staff interface and place a hold. Go to Circulation -> Holds to pull and confirm your hold shows in the list.
4. Confirm tests still pass t/db_dependent/Koha/Holds.t

Sponsored-by: Whanganui District Council
Comment 4 David Nind 2024-10-17 19:49:26 UTC
Created attachment 172929 [details] [review]
Bug 38148: Check value of holdallowed circ rule properly

It was noted on Bug 29087 that the value of circulation rules needs to be checked differently, so this follow-up addresses that.

To test:

1. Apply patch and restart services
2. Search for a record on the OPAC. Confirm you can see a link to place a hold.
3. Search for this record on the staff interface and place a hold. Go to Circulation -> Holds to pull and confirm your hold shows in the list.
4. Confirm tests still pass t/db_dependent/Koha/Holds.t

Sponsored-by: Whanganui District Council
Signed-off-by: David Nind <david@davidnind.com>
Comment 5 Pedro Amorim 2024-10-21 14:19:43 UTC
Hi guys, thanks for helping here, we're now also experiencing this regression in 23.11.09.
At first glance this patch looks good, but it's causing the following to FAIL:
prove t/db_dependent/Koha/Items.t

I'm adding others involved in bug 29087 to pitch in if they have the chance / are available to.
Comment 6 Pedro Amorim 2024-10-21 16:01:06 UTC
(In reply to Aleisha Amohia from comment #2)
> In short, I don't know how to write
> a test plan for this. I've updated the bug report accordingly and will
> attach a new test plan.

On fresh k-t-d:
1) Search for 'music' on OPAC
2) Notice records have the 'place hold' link
3) Visit circulation rules on Staff:
<staff_url>/cgi-bin/koha/admin/smart-rules.pl
4) On 'Default checkout, hold and return policy' , under 'Hold policy' pick 'From any library'. Hit 'Save'.
5) Repeat 1). Notice the 'place hold' link is gone.
Comment 7 Pedro Amorim 2024-10-22 10:49:47 UTC
Created attachment 173125 [details] [review]
Bug 38148: Revert back to get_effective_rule

And update the first conditional logic.
This patch aims to maintain the logic behind the first patch, but restore get_effective_rule.
get_effective_rule_value is using cache and I believe that is the reason why Items.t fail when using that.

Test plan:
1) Search for 'music' on OPAC
2) Notice records have the 'place hold' link
3) Visit circulation rules on Staff:
<staff_url>/cgi-bin/koha/admin/smart-rules.pl
4) On 'Default checkout, hold and return policy' , under 'Hold policy' pick 'From any library'. Hit 'Save'.
5) Repeat 1). Notice the 'place hold' link is gone.
6) Apply patch. restart plack. Repeat 1). Notice the 'place hold' is shown again

Run:
$ prove t/db_dependent/Koha/Items.t
Comment 8 Pedro Amorim 2024-10-22 10:51:49 UTC
Hi all, asking for someone to take a look here when possible as this bug is causing issues for a lot of our user base.
I've submitted a follow-up with an updated test plan which aims to keep the fix introduced by the original patch but updated to not break tests.
Comment 9 PTFS Europe Sandboxes 2024-10-22 13:32:23 UTC
Created attachment 173141 [details] [review]
Bug 38148: Check value of holdallowed circ rule properly

It was noted on Bug 29087 that the value of circulation rules needs to be checked differently, so this follow-up addresses that.

To test:

1. Apply patch and restart services
2. Search for a record on the OPAC. Confirm you can see a link to place a hold.
3. Search for this record on the staff interface and place a hold. Go to Circulation -> Holds to pull and confirm your hold shows in the list.
4. Confirm tests still pass t/db_dependent/Koha/Holds.t

Sponsored-by: Whanganui District Council
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: andrewa <andrew.auld@ptfs-europe.com>
Comment 10 PTFS Europe Sandboxes 2024-10-22 13:32:26 UTC
Created attachment 173142 [details] [review]
Bug 38148: Revert back to get_effective_rule

And update the first conditional logic.
This patch aims to maintain the logic behind the first patch, but restore get_effective_rule.
get_effective_rule_value is using cache and I believe that is the reason why Items.t fail when using that.

Test plan:
1) Search for 'music' on OPAC
2) Notice records have the 'place hold' link
3) Visit circulation rules on Staff:
<staff_url>/cgi-bin/koha/admin/smart-rules.pl
4) On 'Default checkout, hold and return policy' , under 'Hold policy' pick 'From any library'. Hit 'Save'.
5) Repeat 1). Notice the 'place hold' link is gone.
6) Apply patch. restart plack. Repeat 1). Notice the 'place hold' is shown again

Run:
$ prove t/db_dependent/Koha/Items.t

Signed-off-by: andrewa <andrew.auld@ptfs-europe.com>
Comment 11 PTFS Europe Sandboxes 2024-10-22 13:33:00 UTC
Created attachment 173143 [details] [review]
Bug 38148: Check value of holdallowed circ rule properly

It was noted on Bug 29087 that the value of circulation rules needs to be checked differently, so this follow-up addresses that.

To test:

1. Apply patch and restart services
2. Search for a record on the OPAC. Confirm you can see a link to place a hold.
3. Search for this record on the staff interface and place a hold. Go to Circulation -> Holds to pull and confirm your hold shows in the list.
4. Confirm tests still pass t/db_dependent/Koha/Holds.t

Sponsored-by: Whanganui District Council
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: andrewa <andrew.auld@ptfs-europe.com>
Comment 12 PTFS Europe Sandboxes 2024-10-22 13:33:03 UTC
Created attachment 173144 [details] [review]
Bug 38148: Revert back to get_effective_rule

And update the first conditional logic.
This patch aims to maintain the logic behind the first patch, but restore get_effective_rule.
get_effective_rule_value is using cache and I believe that is the reason why Items.t fail when using that.

Test plan:
1) Search for 'music' on OPAC
2) Notice records have the 'place hold' link
3) Visit circulation rules on Staff:
<staff_url>/cgi-bin/koha/admin/smart-rules.pl
4) On 'Default checkout, hold and return policy' , under 'Hold policy' pick 'From any library'. Hit 'Save'.
5) Repeat 1). Notice the 'place hold' link is gone.
6) Apply patch. restart plack. Repeat 1). Notice the 'place hold' is shown again

Run:
$ prove t/db_dependent/Koha/Items.t

Signed-off-by: andrewa <andrew.auld@ptfs-europe.com>
Comment 13 Andrew Auld 2024-10-22 13:34:14 UTC
Great job all! Test plan worked like a breeze.
Comment 14 Andrew Auld 2024-10-22 13:42:51 UTC
Tested in both a sandbox and a ktd.
Comment 15 Pedro Amorim 2024-10-22 15:34:38 UTC
Created attachment 173169 [details] [review]
Bug 38148: Check value of holdallowed circ rule properly

It was noted on Bug 29087 that the value of circulation rules needs to be checked differently, so this follow-up addresses that.

To test:

1. Apply patch and restart services
2. Search for a record on the OPAC. Confirm you can see a link to place a hold.
3. Search for this record on the staff interface and place a hold. Go to Circulation -> Holds to pull and confirm your hold shows in the list.
4. Confirm tests still pass t/db_dependent/Koha/Holds.t

Sponsored-by: Whanganui District Council
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: andrewa <andrew.auld@ptfs-europe.com>
Signed-off-by: Ray Delahunty <r.delahunty@arts.ac.uk>
Comment 16 Pedro Amorim 2024-10-22 15:34:42 UTC
Created attachment 173170 [details] [review]
Bug 38148: Revert back to get_effective_rule

And update the first conditional logic.
This patch aims to maintain the logic behind the first patch, but restore get_effective_rule.
get_effective_rule_value is using cache and I believe that is the reason why Items.t fail when using that.

Test plan:
1) Search for 'music' on OPAC
2) Notice records have the 'place hold' link
3) Visit circulation rules on Staff:
<staff_url>/cgi-bin/koha/admin/smart-rules.pl
4) On 'Default checkout, hold and return policy' , under 'Hold policy' pick 'From any library'. Hit 'Save'.
5) Repeat 1). Notice the 'place hold' link is gone.
6) Apply patch. restart plack. Repeat 1). Notice the 'place hold' is shown again

Run:
$ prove t/db_dependent/Koha/Items.t

Signed-off-by: andrewa <andrew.auld@ptfs-europe.com>
Signed-off-by: Ray Delahunty <r.delahunty@arts.ac.uk>
Comment 17 Nick Clemens (kidclamp) 2024-10-22 20:08:49 UTC
Created attachment 173183 [details] [review]
Bug 38148: Unit tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 18 Nick Clemens (kidclamp) 2024-10-22 20:08:52 UTC
Created attachment 173184 [details] [review]
Bug 38148: Check value of holdallowed circ rule properly

It was noted on Bug 29087 that the value of circulation rules needs to be checked differently, so this follow-up addresses that.

To test:

1. Apply patch and restart services
2. Search for a record on the OPAC. Confirm you can see a link to place a hold.
3. Search for this record on the staff interface and place a hold. Go to Circulation -> Holds to pull and confirm your hold shows in the list.
4. Confirm tests still pass t/db_dependent/Koha/Holds.t

Sponsored-by: Whanganui District Council
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: andrewa <andrew.auld@ptfs-europe.com>
Signed-off-by: Ray Delahunty <r.delahunty@arts.ac.uk>

Bug 38148: Revert back to get_effective_rule

And update the first conditional logic.
This patch aims to maintain the logic behind the first patch, but restore get_effective_rule.
get_effective_rule_value is using cache and I believe that is the reason why Items.t fail when using that.

Test plan:
1) Search for 'music' on OPAC
2) Notice records have the 'place hold' link
3) Visit circulation rules on Staff:
<staff_url>/cgi-bin/koha/admin/smart-rules.pl
4) On 'Default checkout, hold and return policy' , under 'Hold policy' pick 'From any library'. Hit 'Save'.
5) Repeat 1). Notice the 'place hold' link is gone.
6) Apply patch. restart plack. Repeat 1). Notice the 'place hold' is shown again

Run:
$ prove t/db_dependent/Koha/Items.t

Squashed during QA - wnc

Signed-off-by: andrewa <andrew.auld@ptfs-europe.com>
Signed-off-by: Ray Delahunty <r.delahunty@arts.ac.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 19 Nick Clemens (kidclamp) 2024-10-22 20:08:54 UTC
Created attachment 173185 [details] [review]
Bug 38148: (QA follow-up) Code comments

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 20 Nick Clemens (kidclamp) 2024-10-22 20:11:25 UTC
I squashed the two existing patches - I added test to confirm that an all allowed rule doesn't break, they fail before and pass after these.

I added an optional patch with comments if RM finds them useful
Comment 21 Nick Clemens (kidclamp) 2024-10-23 11:51:21 UTC
Created attachment 173205 [details] [review]
Bug 38148: Unit tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 22 Nick Clemens (kidclamp) 2024-10-23 11:51:23 UTC
Created attachment 173206 [details] [review]
Bug 38148: Check value of holdallowed circ rule properly

It was noted on Bug 29087 that the value of circulation rules needs to be checked differently, so this follow-up addresses that.

To test:

1. Apply patch and restart services
2. Search for a record on the OPAC. Confirm you can see a link to place a hold.
3. Search for this record on the staff interface and place a hold. Go to Circulation -> Holds to pull and confirm your hold shows in the list.
4. Confirm tests still pass t/db_dependent/Koha/Holds.t

Sponsored-by: Whanganui District Council
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: andrewa <andrew.auld@ptfs-europe.com>
Signed-off-by: Ray Delahunty <r.delahunty@arts.ac.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 23 Nick Clemens (kidclamp) 2024-10-23 11:51:26 UTC
Created attachment 173207 [details] [review]
Bug 38148: Revert back to get_effective_rule

And update the first conditional logic.
This patch aims to maintain the logic behind the first patch, but restore get_effective_rule.
get_effective_rule_value is using cache and I believe that is the reason why Items.t fail when using that.

Test plan:
1) Search for 'music' on OPAC
2) Notice records have the 'place hold' link
3) Visit circulation rules on Staff:
<staff_url>/cgi-bin/koha/admin/smart-rules.pl
4) On 'Default checkout, hold and return policy' , under 'Hold policy' pick 'From any library'. Hit 'Save'.
5) Repeat 1). Notice the 'place hold' link is gone.
6) Apply patch. restart plack. Repeat 1). Notice the 'place hold' is shown again

Run:
$ prove t/db_dependent/Koha/Items.t

Signed-off-by: andrewa <andrew.auld@ptfs-europe.com>
Signed-off-by: Ray Delahunty <r.delahunty@arts.ac.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 24 Nick Clemens (kidclamp) 2024-10-23 11:51:28 UTC
Created attachment 173208 [details] [review]
Bug 38148: (QA follow-up) Code comments

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 25 Katrin Fischer 2024-10-23 16:44:47 UTC
Thanks for the quick work here!
Comment 26 Katrin Fischer 2024-10-23 17:18:50 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 27 Christopher Brannon 2024-10-23 19:43:01 UTC
Backport to 24.05????
Comment 28 Aleisha Amohia 2024-10-23 19:46:40 UTC
(In reply to Christopher Brannon from comment #27)
> Backport to 24.05????

Yes please, and 23.11
Comment 29 Lucas Gass (lukeg) 2024-10-23 22:33:01 UTC
Backported to 24.05.x for upcoming 24.05.05
Comment 30 Fridolin Somers 2024-10-25 13:54:10 UTC
Pushed to 23.11.x for 23.11.10
Comment 31 Wainui Witika-Park 2024-11-04 00:03:36 UTC
Not backporting to 23.05.x unless requested
Comment 32 Pedro Amorim 2024-11-04 09:45:45 UTC
(In reply to Wainui Witika-Park from comment #31)
> Not backporting to 23.05.x unless requested

Should not be needed. I believe this was caused by bug 29087 (not in 23.05.x).
Comment 33 Andreas Jonsson 2024-12-10 06:28:47 UTC
*** Bug 38134 has been marked as a duplicate of this bug. ***