Bugzilla – Attachment 135347 Details for
Bug 30847
Cleanup opac-reserve.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30847: Don't get biblio/item info when placing holds
Bug-30847-Dont-get-biblioitem-info-when-placing-ho.patch (text/plain), 4.45 KB, created by
Nick Clemens (kidclamp)
on 2022-05-25 15:10:08 UTC
(
hide
)
Description:
Bug 30847: Don't get biblio/item info when placing holds
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-05-25 15:10:08 UTC
Size:
4.45 KB
patch
obsolete
>From aea2a830bfbfb5000aab0450f331d191a69dbd02 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 25 May 2022 14:44:50 +0000 >Subject: [PATCH] Bug 30847: Don't get biblio/item info when placing holds > >The only bit we get form the hash is the rank and title >We can si9mply fetch the biblio once to calculate >no need to fetch all the info as we don't display or use it >--- > opac/opac-reserve.pl | 81 ++++++++++++++++++++++---------------------- > 1 file changed, 40 insertions(+), 41 deletions(-) > >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 7b9720d617..471cd5d519 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -131,43 +131,7 @@ $template->param( branch => $branch ); > > # > # >-# Build hashes of the requested biblio(item)s and items. >-# >-# >- >-my %biblioDataHash; # Hash of biblionumber to biblio/biblioitems record. >-foreach my $biblioNumber (@biblionumbers) { >- >- my $biblioData = GetBiblioData($biblioNumber); >- $biblioDataHash{$biblioNumber} = $biblioData; >- >- my @itemInfos = GetItemsInfo($biblioNumber); >- >- my $marcrecord= GetMarcBiblio({ biblionumber => $biblioNumber }); >- >- # flag indicating existence of at least one item linked via a host record >- # adding items linked via host biblios >- my @hostitemInfos = GetHostItemsInfo($marcrecord); >- if (@hostitemInfos){ >- push (@itemInfos,@hostitemInfos); >- } >- >- $biblioData->{itemInfos} = \@itemInfos; >- >- # Compute the priority rank. >- my $biblio = Koha::Biblios->find( $biblioNumber ); >- next unless $biblio; >- >- $biblioData->{object} = $biblio; >- my $reservecount = $biblio->holds->search({ found => [ {"!=" => "W"},undef] })->count; >- $biblioData->{reservecount} = $reservecount; >- $biblioData->{rank} = $reservecount + 1; >-} >- >-# >-# >-# If this is the second time through this script, it >-# means we are carrying out the hold request, possibly >+# Here we are carrying out the hold request, possibly > # with a specific item for each biblionumber. > # > # >@@ -239,8 +203,6 @@ if ( $query->param('place_reserve') ) { > $biblioNum = $item->biblionumber; > } > >- my $biblioData = $biblioDataHash{$biblioNum}; >- > # Check for user supplied reserve date > my $startdate; > if ( C4::Context->preference('AllowHoldDateInFuture') >@@ -251,7 +213,9 @@ if ( $query->param('place_reserve') ) { > > my $patron_expiration_date = $query->param("expiration_date_$biblioNum"); > >- my $rank = $biblioData->{rank}; >+ my $biblio = Koha::Biblios->find($biblioNum); >+ my $rank = $biblio->holds->search({ found => [ {"!=" => "W"},undef] })->count + 1; >+ > if ( $item ) { > $canreserve = 1 if CanItemBeReserved( $patron, $item, $branch )->{status} eq 'OK'; > } >@@ -292,7 +256,7 @@ if ( $query->param('place_reserve') ) { > reservation_date => $startdate, > expiration_date => $patron_expiration_date, > notes => $notes, >- title => $biblioData->{title}, >+ title => $biblio->title, > itemnumber => $itemNum, > found => undef, > itemtype => $itemtype, >@@ -307,6 +271,41 @@ if ( $query->param('place_reserve') ) { > exit; > } > >+# >+# >+# Build hashes of the requested biblio(item)s and items. >+# >+# >+ >+my %biblioDataHash; # Hash of biblionumber to biblio/biblioitems record. >+foreach my $biblioNumber (@biblionumbers) { >+ >+ my $biblioData = GetBiblioData($biblioNumber); >+ $biblioDataHash{$biblioNumber} = $biblioData; >+ >+ my @itemInfos = GetItemsInfo($biblioNumber); >+ >+ my $marcrecord= GetMarcBiblio({ biblionumber => $biblioNumber }); >+ >+ # flag indicating existence of at least one item linked via a host record >+ # adding items linked via host biblios >+ my @hostitemInfos = GetHostItemsInfo($marcrecord); >+ if (@hostitemInfos){ >+ push (@itemInfos,@hostitemInfos); >+ } >+ >+ $biblioData->{itemInfos} = \@itemInfos; >+ >+ # Compute the priority rank. >+ my $biblio = Koha::Biblios->find( $biblioNumber ); >+ next unless $biblio; >+ >+ $biblioData->{object} = $biblio; >+ my $reservecount = $biblio->holds->search({ found => [ {"!=" => "W"},undef] })->count; >+ $biblioData->{reservecount} = $reservecount; >+ $biblioData->{rank} = $reservecount + 1; >+} >+ > # > # > # Here we check that the borrower can actually make reserves Stage 1. >-- >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 30847
:
135340
|
135341
|
135342
|
135343
|
135344
|
135345
|
135346
|
135347
|
135348
|
137668
|
137669
|
137670
|
137671
|
137672
|
137673
|
137674
|
137675
|
138654
|
138655
|
138934
|
138935
|
138936
|
138937
|
138938
|
138939
|
138940
|
138941
|
139628
|
139629
|
139630
|
139631
|
139632
|
139633
|
139634
|
139635
|
139915
|
139916
|
139917
|
139918
|
139919
|
139920
|
139921
|
139922
|
139923