Bugzilla – Attachment 147380 Details for
Bug 30556
OPAC shows "Place hold" button on available items even if on shelf holds aren't allowed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30556: Place hold button doesn't show when not allowed
Bug-30556-Place-hold-button-doesnt-show-when-not-a.patch (text/plain), 5.59 KB, created by
Hammat wele
on 2023-02-24 17:33:23 UTC
(
hide
)
Description:
Bug 30556: Place hold button doesn't show when not allowed
Filename:
MIME Type:
Creator:
Hammat wele
Created:
2023-02-24 17:33:23 UTC
Size:
5.59 KB
patch
obsolete
>From 4068b889f8b745d72aea41688474b2d57f4d9c8f Mon Sep 17 00:00:00 2001 >From: Shi Yao Wang <shi-yao.wang@inlibro.com> >Date: Wed, 27 Apr 2022 12:44:39 -0400 >Subject: [PATCH] Bug 30556: Place hold button doesn't show when not allowed > >When On shelf holds allowed is on "If all unavailable", the Place hold button is not shown. > >To test: > >1. Create a circulation rule with on shelf holds set to "If all unavailable" >2. Create or modify a record to match the items itype to the circulation rule >3. Use a patron matching the circ rule category to log into the opac >4. Look for the record >5. Notice that the Place hold button is there, even thought it's not allowed >6. Apply the patch. >7. The button is not there. >8. Logout of the opac. >9. The button is here again since it should always show when not logged >in. > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: David Nind <david@davidnind.com> >--- > opac/opac-ISBDdetail.pl | 12 +++++++----- > opac/opac-MARCdetail.pl | 12 +++++++----- > opac/opac-detail.pl | 12 ++++++------ > 3 files changed, 20 insertions(+), 16 deletions(-) > >diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl >index b3b29deea7..3f9446583a 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 CanBookBeReserved ); > use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials ); > use C4::Koha qw( > GetNormalizedEAN >@@ -168,7 +168,8 @@ $template->param( > subscriptionsnumber => $subscriptionsnumber, > ); > >-my $allow_onshelf_holds; >+my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef; >+my $is_available; > my $res = GetISBDView({ > 'record' => $record, > 'template' => 'opac', >@@ -178,11 +179,12 @@ 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; >+ $is_available = IsAvailableForItemLevelRequest($item, $patron, $currentbranch) >+ unless $is_available; > } > >-if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { >+my $canReserve = CanBookBeReserved($loggedinuser, $biblionumber, $currentbranch); >+if (!$loggedinuser || ($canReserve->{status} eq "OK" && $is_available)) { > $template->param( ReservableItems => 1 ); > } > >diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl >index f55d6bf5ef..089d978ca5 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 CanBookBeReserved ); > use C4::Members; > use C4::Koha qw( GetNormalizedISBN ); > use List::MoreUtils qw( uniq ); >@@ -136,15 +136,17 @@ $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 $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef; >+my $is_available; > $items->reset; > > while ( my $item = $items->next ) { >- $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } ) >- unless $allow_onshelf_holds; >+ $is_available = IsAvailableForItemLevelRequest($item, $patron, $currentbranch) >+ unless $is_available; > } > >-if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { >+my $canReserve = CanBookBeReserved($loggedinuser, $biblionumber, $currentbranch); >+if (!$loggedinuser || ($canReserve->{status} eq "OK" && $is_available)) { > $template->param( ReservableItems => 1 ); > } > >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 98c4f94a8c..61c3f3c121 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 CanBookBeReserved ); > 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 $is_available; > my ( $itemloop_has_images, $otheritemloop_has_images ); > if ( not $viewallitems and $items->count > $max_items_to_display ) { > $template->param( >@@ -682,9 +682,8 @@ 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; >+ $is_available = IsAvailableForItemLevelRequest($item, $patron, $currentbranch) >+ unless $is_available; > > # get collection code description, too > my $ccode = $item->ccode; >@@ -759,7 +758,8 @@ else { > } > } > >-if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { >+my $canReserve = CanBookBeReserved($borrowernumber, $biblionumber, $currentbranch); >+if (!$borrowernumber || ($canReserve->{status} eq "OK" && $is_available)) { > $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 30556
:
133497
|
133608
|
134172
|
134420
|
134421
|
134436
|
134437
|
134438
|
134617
|
134619
|
134620
|
134621
|
135395
|
137065
|
139289
|
139290
|
139291
|
139292
|
144429
|
147378
|
147379
|
147380
|
147381
|
147382
|
147441
|
147442
|
150218
|
150219
|
150220
|
150221
|
150222
|
156188
|
156189
|
156190
|
156191
|
156192
|
156429
|
157087
|
157088
|
157089
|
157090
|
157091