Bug 30846: 'If any unavailable' doesn't consider negative notforlan values as unavailable
When we set up a circulation rule where 'On shelf holds allowed' is 'If any unavailable' and we have a record with one 'Ordered' item, we cannot place this item on hold.
This patch allows placing hold on item with negative not for loan values, when using rule with 'On shelf holds allowed' set to 'If any unavailable'
To test:
1. Set up a circulation rule where on shelf holds are not allowed and force the choosing of an item (to facilitate the test)
1.1. Go to Administration > Circulation and fines rules
1.2. In the matrix, add a circulation like this
- Patron category: All
- Item type: Books
- Current checkouts allowed: 10
- Current on-site checkouts allowed: 10
- Loan period: 21
- Holds allowed (total): 10
- Holds allowed (daily): 10
- Holds per record (count): 10
- On shelf holds allowed: If any unavailable
- OPAC item level holds: Force
1.3. Click Save
2. Create a record with one 'Ordered' item (or any negative value not for loan status)
2.1. Go to Cataloging
2.2. Click New record
2.3. Fill out the mandatory fields (by default in MARC21: 000, 003, 005, 008, 040, 245, and 942 (942 should be set to Books))
2.4. Click Save
2.5. Fill out the following item fields
- Not for loan: Ordered
- Koha item type: Books
2.6. Click Add item
2.7. Click Normal to go to the detailed record
3. Try to place a hold on the 'Ordered' item
3.1. From the detailed record, click OPAC view: Open in new window.
--> Note that the 'Place hold' option is not present
4. Add a second 'Available' item
4.1. Back in the staff interface tab with the detailed record, click New > New item
4.2. Make sure the item type is set to Books
4.3. Add a barcode in p
4.4. Click Add item
5. Try again to place a hold on the 'Ordered' item
5.1. Go back to the OPAC tab and refresh the page
--> Note that the 'Place hold' option is still not present
6. Check out the available item to a patron
6.1. In the staff interface tab, copy the barcode from the available item
6.2. Go to Patrons
6.3. Click on Search
6.4. Click Check out next to one of the patrons
6.5. Paste the barcode in the box and click Check out
7. Try again to place a hold on the 'Ordered' item
7.1. Go back to the OPAC tab and refresh the page
--> Note that the 'Place hold' option is now present
7.2. Click Place hold
--> Note that only the checked out item is available to place on hold, if you click Show unholdable items, it will show the Ordered item, but you can't place a hold on it.
8. Apply the patch
9. Go to the OPAC tab and click on the book title right next to 'Place a hold on' checkbox to go back to the record details.
--> Note that the 'Place hold' option is still present
9.1. Click Place hold
--> Note that you can now place a hold on the 'Checked out' or the 'Ordered' item.
10. Check in the item to make it available again
10.1. In the staff interface tab, click on 'Show checkouts' button
10.2. Select the Checked out item and click on 'Renew or check in selected items' button.
11. Try again to place a hold on the 'Ordered' item
11.1. Go back to the OPAC tab and click on the book title right next to 'Place a hold on' checkbox to go back to the record details.
--> Note that the 'Place hold' option is still present
11.2. Click Place hold
--> Note that only the 'Ordered' item is available to place on hold, if you click Show unholdable items, it will show the Available item and you can't place a hold on it.
12. Delete the available item to keep only the Ordered item
12.1 in the staff interface tab, click on 'Search catalog' and search for the record
12.2 click on 'Edit' then 'Edit items'
12.3 Delete the available item
13. Try to place a hold on the remain 'Ordered' item
13.1 Go back to the OPAC tab and click on the book title right next to 'Place a hold on' checkbox to go back to the record details.
--> Note that the 'Place hold' option is present
13.2. Click Place hold
--> Note that you can place a hold on the Ordered item.
Signed-off-by: Amaury GAU <amaury.gau@bulac.fr> Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>