Bugzilla – Attachment 153797 Details for
Bug 30846
"If any unavailable" doesn't consider negative notforloan values as unavailable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30846: 'If any unavailable' doesn't consider negative notforlan values as unavailable
Bug-30846-If-any-unavailable-doesnt-consider-negat.patch (text/plain), 9.38 KB, created by
Hammat wele
on 2023-07-21 14:41:50 UTC
(
hide
)
Description:
Bug 30846: 'If any unavailable' doesn't consider negative notforlan values as unavailable
Filename:
MIME Type:
Creator:
Hammat wele
Created:
2023-07-21 14:41:50 UTC
Size:
9.38 KB
patch
obsolete
>From 63a68d8e5a9d349010cb321e87d1df3ef35cf73a Mon Sep 17 00:00:00 2001 >From: Hammat Wele <hammat.wele@inlibro.com> >Date: Mon, 23 Jan 2023 15:41:41 +0000 >Subject: [PATCH] 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> >--- > C4/Reserves.pm | 2 +- > opac/opac-ISBDdetail.pl | 9 ++++----- > opac/opac-MARCdetail.pl | 9 ++++----- > opac/opac-detail.pl | 10 ++++------ > 4 files changed, 13 insertions(+), 17 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 69f81df6e1..fd8f7e58bd 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1388,7 +1388,7 @@ sub IsAvailableForItemLevelRequest { > return $any_available ? 0 : 1; > > } else { # on_shelf_holds == 0 "If any unavailable" (the description is rather cryptic and could still be improved) >- return $item->onloan || IsItemOnHoldAndFound( $item->itemnumber ); >+ return $item->notforloan < 0 || $item->onloan || IsItemOnHoldAndFound( $item->itemnumber ); > } > } > >diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl >index b3b29deea7..fb7fc05bf5 100755 >--- a/opac/opac-ISBDdetail.pl >+++ b/opac/opac-ISBDdetail.pl >@@ -52,7 +52,7 @@ use C4::Biblio qw( > GetMarcISSN > TransformMarcToKoha > ); >-use C4::Reserves; >+use C4::Reserves qw( IsAvailableForItemLevelRequest ); > use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials ); > use C4::Koha qw( > GetNormalizedEAN >@@ -168,7 +168,7 @@ $template->param( > subscriptionsnumber => $subscriptionsnumber, > ); > >-my $allow_onshelf_holds; >+my $can_item_be_reserved = 0; > my $res = GetISBDView({ > 'record' => $record, > 'template' => 'opac', >@@ -178,11 +178,10 @@ my $res = GetISBDView({ > my $items = $biblio->items; > while ( my $item = $items->next ) { > >- $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } ) >- unless $allow_onshelf_holds; >+ $can_item_be_reserved = $can_item_be_reserved || IsAvailableForItemLevelRequest($item, $patron, undef); > } > >-if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { >+if( $can_item_be_reserved || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { > $template->param( ReservableItems => 1 ); > } > >diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl >index f55d6bf5ef..c42d73abf0 100755 >--- a/opac/opac-MARCdetail.pl >+++ b/opac/opac-MARCdetail.pl >@@ -58,7 +58,7 @@ use C4::Biblio qw( > GetMarcStructure > TransformMarcToKoha > ); >-use C4::Reserves; >+use C4::Reserves qw( IsAvailableForItemLevelRequest ); > use C4::Members; > use C4::Koha qw( GetNormalizedISBN ); > use List::MoreUtils qw( uniq ); >@@ -136,15 +136,14 @@ $template->param( > ) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible. > $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8; # except -8; > >-my $allow_onshelf_holds; >+my $can_item_be_reserved = 0; > $items->reset; > > while ( my $item = $items->next ) { >- $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } ) >- unless $allow_onshelf_holds; >+ $can_item_be_reserved = $can_item_be_reserved || IsAvailableForItemLevelRequest($item, $patron, undef); > } > >-if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { >+if( $can_item_be_reserved || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { > $template->param( ReservableItems => 1 ); > } > >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 52e161205a..b62de56458 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -60,7 +60,7 @@ use C4::External::Syndetics qw( > use C4::Members; > use C4::XSLT qw( XSLTParse4Display ); > use C4::ShelfBrowser qw( GetNearbyItems ); >-use C4::Reserves qw( GetReserveStatus ); >+use C4::Reserves qw( GetReserveStatus IsAvailableForItemLevelRequest ); > use C4::Charset qw( SetUTF8Flag ); > use MARC::Field; > use List::MoreUtils qw( any ); >@@ -658,7 +658,7 @@ if ( C4::Context->preference('OPACAcquisitionDetails' ) ) { > }; > } > >-my $allow_onshelf_holds; >+my $can_item_be_reserved = 0; > my ( $itemloop_has_images, $otheritemloop_has_images ); > if ( not $viewallitems and $items->count > $max_items_to_display ) { > $template->param( >@@ -682,9 +682,7 @@ else { > $item_info->{holding_library_info} = $opac_info_holding->content if $opac_info_holding; > $item_info->{home_library_info} = $opac_info_home->content if $opac_info_home; > >- $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( >- { item => $item, patron => $patron } ) >- unless $allow_onshelf_holds; >+ $can_item_be_reserved = $can_item_be_reserved || IsAvailableForItemLevelRequest($item, $patron, undef); > > # get collection code description, too > my $ccode = $item->ccode; >@@ -760,7 +758,7 @@ else { > } > } > >-if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { >+if( $can_item_be_reserved || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { > $template->param( ReservableItems => 1 ); > } > >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30846
:
145586
|
145660
|
147443
|
147444
|
151648
|
151649
| 153797 |
153798
|
154404