[Koha-patches] [PATCH] Fix performance issue with GetCOinS
Frédéric Demians
f.demians at tamil.fr
Thu Jun 18 09:49:12 CEST 2009
---
C4/Biblio.pm | 5 ++---
C4/Search.pm | 1 +
C4/VirtualShelves/Page.pm | 5 ++++-
opac/opac-detail.pl | 4 +---
opac/opac-search.pl | 3 ---
5 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index 8bebb25..a1f5f8e 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -1031,7 +1031,7 @@ sub GetXmlBiblio {
=over 4
-my $coins = GetCOinSBiblio($biblionumber);
+my $coins = GetCOinSBiblio($record);
Returns the COinS(a span) which can be included in a biblio record
@@ -1040,8 +1040,7 @@ 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
my $pos7 = substr $record->leader(), 7,1;
diff --git a/C4/Search.pm b/C4/Search.pm
index 13f504f..3889fef 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -1242,6 +1242,7 @@ sub searchResults {
$oldbiblio->{subtitle} = C4::Biblio::get_koha_field_from_marc('bibliosubtitle', 'subtitle', $marcrecord, '');
$oldbiblio->{result_number} = $i + 1;
+ $oldbiblio->{coins} = GetCOinSBiblio( $marcrecord );
# add imageurl to itemtype if there is one
$oldbiblio->{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes{ $oldbiblio->{itemtype} }->{imageurl} );
diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm
index ac47219..079b982 100644
--- a/C4/VirtualShelves/Page.pm
+++ b/C4/VirtualShelves/Page.pm
@@ -178,7 +178,10 @@ SWITCH: {
#$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'});
+ # FIXME: COinS is disabled
+ # I could be enable again, but it has a price.
+ # Each biblio record has to be read and deserialized.
+ #$this_item->{'coins'} = GetCOinSBiblio($this_item->{'biblionumber'});
}
push @paramsloop, {display => 'privateshelves'} if $category == 1;
$showadd = 1;
diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
index 679a48b..ffa11cb 100755
--- a/opac/opac-detail.pl
+++ b/opac/opac-detail.pl
@@ -225,9 +225,7 @@ $template->param(
);
# COinS format FIXME: for books Only
-$template->param(
- ocoins => GetCOinSBiblio($biblionumber),
-);
+$template->param( ocoins => GetCOinSBiblio( $record ) );
my $reviews = getreviews( $biblionumber, 1 );
my $loggedincommenter;
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index e1e66a9..34a1492 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -443,9 +443,6 @@ for (my $i=0;$i<=@servers;$i++) {
limit=>$tag_quantity });
}
}
- foreach (@newresults) {
- $_->{coins} = GetCOinSBiblio($_->{'biblionumber'});
- }
if ($results_hashref->{$server}->{"hits"}){
$total = $total + $results_hashref->{$server}->{"hits"};
--
1.5.6.5
More information about the Koha-patches
mailing list