Bugzilla – Attachment 6014 Details for
Bug 7073
GetCOinSBiblio should take $record, not $biblionumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed Patch
0001-Bug-7073-GetCOinSBiblio-should-take-record-object-no.patch (text/plain), 4.20 KB, created by
Ian Walls
on 2011-10-20 20:11:10 UTC
(
hide
)
Description:
Proposed Patch
Filename:
MIME Type:
Creator:
Ian Walls
Created:
2011-10-20 20:11:10 UTC
Size:
4.20 KB
patch
obsolete
>From 9e8997072ae2da26c2ee05258ef27217c1ad3728 Mon Sep 17 00:00:00 2001 >From: Ian Walls <ian.walls@bywatersolutions.com> >Date: Thu, 20 Oct 2011 15:54:07 -0400 >Subject: [PATCH] Bug 7073: GetCOinSBiblio should take $record object, not biblionumber > >This patch changes the GetCOinsBiblio subroutine to take a MARC record object >(as returned from GetMarcBiblio) instead of a biblionumber. The first thing the subroutine >did was GetMarcBiblio, and the $biblionumber passed was never used again. > >This subroutine was only used 3 places: opac/opac-search.pl, opac/opac-detail.pl, >and C4/VirtualShelves/Page.pm. In the first and last cases, it was used in a loop. >In the last two cases, a call to GetMarcBiblio had already been done. This is expensive, and >we were doing it twice per record. > >For opac/opac-search.pl, the call to GetMarcBiblio was moved to just outside GetCOinSBiblio; >this will not change the performance at all. But for opac/opac-detail.pl and C4/VirtualShelves/Page.pm, >a redudant call to GetMarcBiblio is now avoided. > >To Test: >1. Enable COinSinOPACResults in system preferences. Perform a search in the OPAC. > Verify that the COinS spans are showing up >2. View the detail record of one of the returned items. Confirm that the COinS span exists on the detail page. >3. View a list in the OPAC. Confirm that COinS spans are still showing up >--- > C4/Biblio.pm | 9 +++------ > C4/VirtualShelves/Page.pm | 2 +- > opac/opac-detail.pl | 2 +- > opac/opac-search.pl | 3 ++- > 4 files changed, 7 insertions(+), 9 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 4a9735f..d06aff5 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -1104,20 +1104,17 @@ sub GetXmlBiblio { > > =head2 GetCOinSBiblio > >- my $coins = GetCOinSBiblio($biblionumber); >+ my $coins = GetCOinSBiblio($record); > >-Returns the COinS(a span) which can be included in a biblio record >+Returns the COinS (a span) which can be included in a biblio record > > =cut > > sub GetCOinSBiblio { >- my ($biblionumber) = @_; >- my $record = GetMarcBiblio($biblionumber); >+ my $record = shift; > > # get the coin format > if ( ! $record ) { >- # can't get a valid MARC::Record object, bail out at this point >- warn "We called GetMarcBiblio with a biblionumber that doesn't exist biblionumber=$biblionumber"; > return; > } > my $pos7 = substr $record->leader(), 7, 1; >diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm >index 161a7aa..e169ca3 100644 >--- a/C4/VirtualShelves/Page.pm >+++ b/C4/VirtualShelves/Page.pm >@@ -217,7 +217,7 @@ sub shelfpage ($$$$$) { > #$this_item->{'description'} = $itemtypes->{ $this_item->{itemtype} }->{'description'}; > $this_item->{'dateadded'} = format_date( $this_item->{'dateadded'} ); > $this_item->{'imageurl'} = getitemtypeinfo( $this_item->{'itemtype'} )->{'imageurl'}; >- $this_item->{'coins'} = GetCOinSBiblio( $this_item->{'biblionumber'} ); >+ $this_item->{'coins'} = GetCOinSBiblio( $record ); > $this_item->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($this_item->{'biblionumber'})); > $this_item->{'normalized_upc'} = GetNormalizedUPC( $record,$marcflavour); > $this_item->{'normalized_ean'} = GetNormalizedEAN( $record,$marcflavour); >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index d3c7e2a..e2fb069 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -599,7 +599,7 @@ $template->param( > > # COinS format FIXME: for books Only > $template->param( >- ocoins => GetCOinSBiblio($biblionumber), >+ ocoins => GetCOinSBiblio($record), > ); > > my $libravatar_enabled = 0; >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 716b164..42eb0ec 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -506,7 +506,8 @@ for (my $i=0;$i<@servers;$i++) { > } > if (C4::Context->preference('COinSinOPACResults')) { > foreach (@newresults) { >- $_->{coins} = GetCOinSBiblio($_->{'biblionumber'}); >+ my $record = GetMarcBiblio($_->{'biblionumber'}); >+ $_->{coins} = GetCOinSBiblio($record); > } > } > >-- >1.7.4.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 7073
:
6014
|
6174