Bug 30697 - Cannot renew when record is on hold under specific conditions
Summary: Cannot renew when record is on hold under specific conditions
Status: ASSIGNED
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low trivial
Assignee: Shi Yao Wang
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-05 20:41 UTC by Shi Yao Wang
Modified: 2022-05-12 19:57 UTC (History)
6 users (show)

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


Attachments
Bug 30697: Fix return value when $items_any_available is defined (1.06 KB, patch)
2022-05-05 20:45 UTC, Shi Yao Wang
Details | Diff | Splinter Review
Bug 30697: Fix return value when $items_any_available is defined (2.05 KB, patch)
2022-05-05 21:32 UTC, Shi Yao Wang
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Shi Yao Wang 2022-05-05 20:41:57 UTC
The IsAvailableForItemLevelRequest subroutine returns wrong value when $items_any_available is defined
Comment 1 Shi Yao Wang 2022-05-05 20:45:45 UTC
Created attachment 134661 [details] [review]
Bug 30697: Fix return value when $items_any_available is defined

Return the value of $item_any_available when it is defined instead of
the opposite value.
Comment 2 Arthur Suzuki 2022-05-05 20:49:50 UTC
missing automated tests, and a test plan demonstrating the error and the fix.
Comment 3 Shi Yao Wang 2022-05-05 21:32:03 UTC
Created attachment 134666 [details] [review]
Bug 30697: Fix return value when $items_any_available is defined

Return the value of $item_any_available when it is defined instead of
the opposite value.

Here is a test plan to reproduce an issue created by this bug

Test plan:
1- Go to administration > system preferences >
AllowRenewalIfOtherItemsAvailable and select "Allow"
2- Go to administration > circulation and fine rules and create an
All/All rule where "on shelf holds allowed" is set to "if all unavailable"
3- Have at least 2 library branches
Go to administration > libraries > new library
to create them
4- Have 2 users, one from each library
Go to patrons > new patron
to create them
5- Have 2 items of the same record, but one item from each library
Go to catalog > create or find a record > new > new item
to create them
6- Make the first user check out the first item
7- Make the second user place a hold on the same record (even though it
is not allowd)
8- Go back to the first user's page and try to renew
9- Notice it is written "on hold" under "Renew" even though the first user should be
able to renew his item
10- Apply the patch
11- Refresh and notice it now shows the usual checkbox to renew
Comment 4 Arthur Suzuki 2022-05-06 07:29:23 UTC
Thank you for the test case!
Still missing automated tests though...
Have a look at the file t/db_dependant/Reserves.t
You may find some help in writing unit_tests in this bug too (actually, your patch may solve my problem!) : https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20985

Do you know how to run unit tests?
If you use Koha-testing-docker (ktd) this is very easy :
when in Koha source dir, within ktd (after kshell on the host), you can run this command :
prove t/db_dependant/Reserves.t

Best,