Bugzilla – Attachment 127582 Details for
Bug 28375
Inefficiencies in fetching COinS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28375: Inefficiencies in fetching COinS
Bug-28375-Inefficiencies-in-fetching-COinS.patch (text/plain), 6.34 KB, created by
Nick Clemens (kidclamp)
on 2021-11-12 12:02:15 UTC
(
hide
)
Description:
Bug 28375: Inefficiencies in fetching COinS
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-11-12 12:02:15 UTC
Size:
6.34 KB
patch
obsolete
>From c4fb98f596fc59c8bb5225dac26fa936f09447f0 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 18 May 2021 15:59:53 +0000 >Subject: [PATCH] Bug 28375: Inefficiencies in fetching COinS > >This patchset adds an 'interface' parameter to XSLTParseForDisplay to avoid fetching >coins when not needed > >Additionally we move some logic from the scripts to searchResults to avoid an extra fetch fo the biblio object > >To test: >1 - Enable COinSinOPACResults syspref >2 - Also enable OPACShowOpenURL and OPACOpenURLItemTypes - adding an itemtype that you can find >3 - Perform a search on the OPAC and confirm coins are included and openurl shown >4 - Perform a search on staff client and confirm openurls do not show >5 - Apply patch >6 - Results should be the same >--- > C4/Search.pm | 7 ++++++- > C4/XSLT.pm | 3 ++- > catalogue/detail.pl | 2 ++ > opac/opac-detail.pl | 2 ++ > opac/opac-search.pl | 5 ----- > opac/opac-shelves.pl | 1 + > opac/opac-tags.pl | 3 ++- > virtualshelves/shelves.pl | 1 + > 8 files changed, 16 insertions(+), 8 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index 0bf8c6d209..7be34a8d30 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -1981,13 +1981,18 @@ sub searchResults { > ), > fix_amps => 1, > hidden_items => \@hiddenitems, >- xslt_variables => $xslt_variables >+ xslt_variables => $xslt_variables, >+ interface => $search_context->{'interface'} > } > ); > } > > my $biblio_object = Koha::Biblios->find( $oldbiblio->{biblionumber} ); > $oldbiblio->{biblio_object} = $biblio_object; >+ $oldbiblio->{coins} = eval { $oldbiblio_object->get_coins } >+ if $oldbiblio_object >+ && C4::Context->preference('COinSinOPACResults') >+ && $is_opac; > > my $can_place_holds = 1; > # if biblio level itypes are used and itemtype is notforloan, it can't be reserved either >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index 125f887cb0..cbb24c74cc 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -250,6 +250,7 @@ sub XSLTParse4Display { > my $hidden_items = $params->{hidden_items} || []; > my $variables = $params->{xslt_variables}; > my $items_rs = $params->{items_rs}; >+ my $interface = $params->{interface}; > > my $xslfilename = get_xsl_filename( $xslsyspref); > >@@ -265,7 +266,7 @@ sub XSLTParse4Display { > > $variables ||= {}; > my $biblio; >- if (C4::Context->preference('OPACShowOpenURL')) { >+ if ( $interface eq 'opac' && C4::Context->preference('OPACShowOpenURL')) { > my @biblio_itemtypes; > $biblio //= Koha::Biblios->find($biblionumber); > if (C4::Context->preference('item-level_itypes')) { >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index bc28f29cc1..a49e8d5e64 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -214,6 +214,7 @@ if ( $showcomp eq 'both' || $showcomp eq 'staff' ) { > record => $part, > xsl_syspref => "XSLTResultsDisplay", > fix_amps => 1, >+ interface => 'intranet' > } > ); > } >@@ -235,6 +236,7 @@ $template->param( > xsl_syspref => "XSLTDetailsDisplay", > fix_amps => 1, > xslt_variables => $xslt_variables, >+ interface => 'intranet' > }), > ); > >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 3b47a19628..3e0960916f 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -642,6 +642,7 @@ if ( $showcomp eq 'both' || $showcomp eq 'opac' ) { > record => $part, > xsl_syspref => 'OPACXSLTResultsDisplay', > fix_amps => 1, >+ interface => 'opac' > } > ); > } >@@ -674,6 +675,7 @@ $template->param( > xsl_syspref => 'OPACXSLTDetailsDisplay', > fix_amps => 1, > xslt_variables => $variables, >+ interface => 'opac' > }), > ); > >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 8f93d68984..2bc588183e 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -628,11 +628,6 @@ for (my $i=0;$i<@servers;$i++) { > $res->{'incart'} = 1; > } > >- if (C4::Context->preference('COinSinOPACResults')) { >- my $biblio = Koha::Biblios->find( $res->{'biblionumber'} ); >- # Catch the exception as Koha::Biblio::Metadata->record can explode if the MARCXML is invalid >- $res->{coins} = $biblio ? eval {$biblio->get_coins} : q{}; # FIXME This should be moved at the beginning of the @newresults loop >- } > if ( C4::Context->preference( "Babeltheque" ) and $res->{normalized_isbn} ) { > if( my $isbn = Business::ISBN->new( $res->{normalized_isbn} ) ) { > $isbn = $isbn->as_isbn13->as_string; >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index 78ce49da0e..85934f1e2e 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -376,6 +376,7 @@ if ( $op eq 'view' ) { > fix_amps => 1, > xslt_variables => $variables, > items_rs => $items->reset, >+ interface => 'opac' > } > ); > >diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl >index 63169e812a..73242be979 100755 >--- a/opac/opac-tags.pl >+++ b/opac/opac-tags.pl >@@ -295,7 +295,8 @@ if ($loggedinuser) { > xsl_filename => 'OPACXSLTResultsDisplay', > fix_amps => 1, > hidden_items => $hidden_items, >- xslt_variables => $variables >+ xslt_variables => $variables, >+ interface => 'opac' > } > ); > >diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl >index d1ce868e4b..97da0b0b0a 100755 >--- a/virtualshelves/shelves.pl >+++ b/virtualshelves/shelves.pl >@@ -270,6 +270,7 @@ if ( $op eq 'view' ) { > record => $record, > xsl_filename => "XSLTListsDisplay", > fix_amps => 1, >+ interface => 'intranet' > } > ); > >-- >2.20.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 28375
:
121123
|
121124
|
127582
|
140955
|
141051
|
141126
|
141490
|
141491
|
141497
|
141955
|
141956
|
141957
|
141958