From a880011106e9577597b07091e76d4f030faad9f5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 8 Jun 2023 10:14:33 +0200 Subject: [PATCH] Bug 33950: Don't get marcxml if not necessary - opac-readingrecord.pl We are retrieving normalized_upc from the MARC XML in the controller (opac-readingrec.pl) for all issues to display, but this is only used if BakerTaylor or Syndetics are enabled. Test plan: Have some checkouts and confirm that the checkout history is displayed the same before and after this patch. You should also test BakerTaylor or Syndetics and see if they are working correctly, but I have no idea how to test them! Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi (cherry picked from commit c4e016f4dfdcce272524dfff5abffe01a276d25e) Signed-off-by: Martin Renvoize (cherry picked from commit 0db7678c7bcc8ac5ee494f3cde939180d7215000) Signed-off-by: Matt Blenkinsop --- opac/opac-readingrecord.pl | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/opac/opac-readingrecord.pl b/opac/opac-readingrecord.pl index 927c37b275..ec0740c4be 100755 --- a/opac/opac-readingrecord.pl +++ b/opac/opac-readingrecord.pl @@ -89,13 +89,19 @@ foreach my $issue ( @{$issues} ) { getitemtypeimagelocation( 'opac', $itemtypes->{ $issue->{$itype_attribute} }->{imageurl} ); } - my $marcxml = C4::Biblio::GetXmlBiblio( $issue->{biblionumber} ); - if ( $marcxml ) { - $marcxml = StripNonXmlChars( $marcxml ); - my $marc_rec = - MARC::Record::new_from_xml( $marcxml, 'UTF-8', - C4::Context->preference('marcflavour') ); - $issue->{normalized_upc} = GetNormalizedUPC( $marc_rec, C4::Context->preference('marcflavour') ); + + if ( C4::Context->preference('BakerTaylorEnabled') + || C4::Context->preference('SyndeticsEnabled') + || C4::Context->preference('SyndeticsCoverImages') ) + { + my $marcxml = C4::Biblio::GetXmlBiblio( $issue->{biblionumber} ); + if ( $marcxml ) { + $marcxml = StripNonXmlChars( $marcxml ); + my $marc_rec = + MARC::Record::new_from_xml( $marcxml, 'UTF-8', + C4::Context->preference('marcflavour') ); + $issue->{normalized_upc} = GetNormalizedUPC( $marc_rec, C4::Context->preference('marcflavour') ); + } } # My Summary HTML if ($opac_summary_html) { -- 2.39.5