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 Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
parent
2b2e544f05
commit
f56e6c0a58
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -599,7 +599,7 @@ $template->param(
|
|||
|
||||
# COinS format FIXME: for books Only
|
||||
$template->param(
|
||||
ocoins => GetCOinSBiblio($biblionumber),
|
||||
ocoins => GetCOinSBiblio($record),
|
||||
);
|
||||
|
||||
my $libravatar_enabled = 0;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue