Bugzilla – Attachment 161634 Details for
Bug 34886
Regression in when hold button appears
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34886: Adjust other opac detail scripts
Bug-34886-Adjust-other-opac-detail-scripts.patch (text/plain), 7.07 KB, created by
Nick Clemens (kidclamp)
on 2024-01-30 12:53:19 UTC
(
hide
)
Description:
Bug 34886: Adjust other opac detail scripts
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-01-30 12:53:19 UTC
Size:
7.07 KB
patch
obsolete
>From d46769b3ebdf061ae7e0418e2c3636971a973291 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 28 Sep 2023 13:14:54 +0000 >Subject: [PATCH] Bug 34886: Adjust other opac detail scripts > >Same chanegs as before, but for MARC and ISBD details pages > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../en/includes/opac-detail-sidebar.inc | 10 +++---- > opac/opac-ISBDdetail.pl | 26 +++++++++---------- > opac/opac-MARCdetail.pl | 19 +++++++++----- > opac/opac-detail.pl | 20 +++++++------- > 4 files changed, 38 insertions(+), 37 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc >index f1d4e60bdd7..8fd0b64bf2f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc >@@ -1,12 +1,10 @@ > [% USE raw %] > [% USE Biblio %] > <ul id="action"> >- [% UNLESS ( norequests ) %] >- [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] >- [% IF Koha.Preference( 'OPACHoldRequests' ) == 1 %] >- [% IF ( ReservableItems ) %] >- <li><a class="reserve btn btn-link btn-lg" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblio.biblionumber | html %]"><i class="fa fa-fw fa-bookmark" aria-hidden="true"></i> Place hold</a></li> >- [% END %] >+ [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] >+ [% IF Koha.Preference( 'OPACHoldRequests' ) == 1 %] >+ [% IF ( ReservableItems ) %] >+ <li><a class="reserve btn btn-link btn-lg" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% biblio.biblionumber | html %]"><i class="fa fa-fw fa-bookmark" aria-hidden="true"></i> Place hold</a></li> > [% END %] > [% END %] > [% END %] >diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl >index 86685f9239b..b0dd51de307 100755 >--- a/opac/opac-ISBDdetail.pl >+++ b/opac/opac-ISBDdetail.pl >@@ -168,29 +168,29 @@ $template->param( > subscriptionsnumber => $subscriptionsnumber, > ); > >-my $can_item_be_reserved = 0; > my $res = GetISBDView({ > 'record' => $record, > 'template' => 'opac', > 'framework' => $biblio->frameworkcode > }); > >-my $items = $biblio->items; >-while ( my $item = $items->next ) { >+# Count the number of items that allow holds at the 'All libraries' rule level >+my $holdable_items = $biblio->items->filter_by_for_hold->count; > >- $can_item_be_reserved = $can_item_be_reserved || $patron && IsAvailableForItemLevelRequest( $item, $patron, undef ); >-} >- >-if( $can_item_be_reserved || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { >- $template->param( ReservableItems => 1 ); >+# If we have a patron we need to check their policies for holds in the loop below >+# If we don't have a patron, then holdable items determines holdability >+my $can_holds_be_placed = $patron ? 0 : $holdable_items; >+if ($patron) { >+ my $items = $biblio->items; >+ while ( my $item = $items->next ) { >+ $can_holds_be_placed = $can_holds_be_placed || IsAvailableForItemLevelRequest( $item, $patron, undef ); >+ } > } > >-my $norequests = ! $items->filter_by_for_hold->count; >- > $template->param( >- norequests => $norequests, >- ISBD => $res, >- biblio => $biblio, >+ ReservableItems => $can_holds_be_placed, >+ ISBD => $res, >+ biblio => $biblio, > ); > > #Search for title in links >diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl >index 0829341d731..bac3cc2efba 100755 >--- a/opac/opac-MARCdetail.pl >+++ b/opac/opac-MARCdetail.pl >@@ -136,17 +136,22 @@ $template->param( > ) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible. > $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8; # except -8; > >-my $can_item_be_reserved = 0; >-$items->reset; >+# Count the number of items that allow holds at the 'All libraries' rule level >+my $holdable_items = $biblio->items->filter_by_for_hold->count; > >-while ( my $item = $items->next ) { >- $can_item_be_reserved = $can_item_be_reserved || $patron && IsAvailableForItemLevelRequest( $item, $patron, undef ); >-} >+# If we have a patron we need to check their policies for holds in the loop below >+# If we don't have a patron, then holdable items determines holdability >+my $can_holds_be_placed = $patron ? 0 : $holdable_items; > >-if( $can_item_be_reserved || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { >- $template->param( ReservableItems => 1 ); >+if ($patron) { >+ $items->reset; >+ while ( my $item = $items->next ) { >+ $can_holds_be_placed = $can_holds_be_placed || IsAvailableForItemLevelRequest( $item, $patron, undef ); >+ } > } > >+$template->param( ReservableItems => $can_holds_be_placed ); >+ > # fill arrays > my @loop_data = (); > >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index e1d3f5cefc7..36c2670b2a5 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -662,12 +662,12 @@ if ( C4::Context->preference('OPACAcquisitionDetails' ) ) { > }; > } > >-# Count the number of items that allow holds >+# Count the number of items that allow holds at the 'All libraries' rule level > my $holdable_items = $biblio->items->filter_by_for_hold->count; >-# If we have a patron and there are no holdable items - we set to no >-# If we have a patron and there are holdable items we set to no - and we need to check each item specifically >+ >+# If we have a patron we need to check their policies for holds in the loop below > # If we don't have a patron, then holdable items determines holdability >-my $can_holds_be_placed = $patron && $holdable_items ? 0 : $holdable_items; >+my $can_holds_be_placed = $patron ? 0 : $holdable_items; > > my ( $itemloop_has_images, $otheritemloop_has_images ); > if ( not $viewallitems and $items->count > $max_items_to_display ) { >@@ -692,11 +692,10 @@ 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; > >- # We only need to check if we haven't determined holds can be place, and there are items that can >- # be held, and we have a patron to determine holdability >- if( !$can_holds_be_placed && $holdable_items && $patron ){ >- $can_holds_be_placed = IsAvailableForItemLevelRequest($item, $patron, undef); >- } >+ # We only need to check if we haven't determined holds can be placed >+ # and if we don't have patron, we have already decided >+ $can_holds_be_placed = >+ $can_holds_be_placed || $patron && IsAvailableForItemLevelRequest( $item, $patron, undef ); > > # get collection code description, too > my $ccode = $item->ccode; >@@ -772,9 +771,8 @@ else { > } > } > >-$template->param( ReservableItems => $can_holds_be_placed ); >- > $template->param( >+ ReservableItems => $can_holds_be_placed, > itemloop_has_images => $itemloop_has_images, > otheritemloop_has_images => $otheritemloop_has_images, > ); >-- >2.30.2
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 34886
:
156107
|
156114
|
156150
|
156151
|
156152
|
156153
|
156277
|
156278
|
156279
|
156293
|
156294
|
156295
|
156326
|
156327
|
156980
|
156981
|
159678
|
159679
|
161633
|
161634
|
161981
|
161982
|
163674
|
164106
|
164107
|
164108
|
164109
|
164110
|
164159
|
164160
|
164161