Bugzilla – Attachment 17932 Details for
Bug 10129
Babeltheque does not depend on COinSinOPACResults
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 10129: Babeltheque does not depend on COinSinOPACResults
SIGNED-OFF-Bug-10129-Babeltheque-does-not-depend-o.patch (text/plain), 5.29 KB, created by
Owen Leonard
on 2013-05-03 14:23:26 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 10129: Babeltheque does not depend on COinSinOPACResults
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2013-05-03 14:23:26 UTC
Size:
5.29 KB
patch
obsolete
>From d7a320816b49774518bea2f2ffeaa4bd54da97aa Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 26 Apr 2013 16:02:19 +0200 >Subject: [PATCH] [SIGNED-OFF] Bug 10129: Babeltheque does not depend on > COinSinOPACResults >Content-Type: text/plain; charset="utf-8" > >This patch groups all loops on the new_results array into one. >It is useless to loop on the same results array several times. > >Test plan: >Quite hard to test all cases. >This patch deals with 5 sysprefs: >COinSinOPACResults, Babeltheque, TagsEnabled, TagsShowOnList and >OpacStarRatings. > >Try to enable/disable all of them and verify there is no difference with >and without this patch. >The only different will be: The Babeltheque information should be displayed >even if the COinSinOPACResults syspref is disabled. > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >This revised patch works fine for me, thanks. >--- > opac/opac-search.pl | 64 +++++++++++++++++++++++++-------------------------- > 1 file changed, 31 insertions(+), 33 deletions(-) > >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 363a11e..57e520c 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -556,52 +556,50 @@ for (my $i=0;$i<@servers;$i++) { > $results_hashref->{$server}->{"RECORDS"}); > } > >- # must define a value for size if not present in DB >- # in order to avoid problems generated by the default size value in TT >- foreach my $line (@newresults) { >- if ( not exists $line->{'size'} ) { $line->{'size'} = "" } >+ foreach my $res (@newresults) { >+ >+ # must define a value for size if not present in DB >+ # in order to avoid problems generated by the default size value in TT >+ if ( not exists $res->{'size'} ) { $res->{'size'} = "" } > # while we're checking each line, see if item is in the cart >- if ( grep {$_ eq $line->{'biblionumber'}} @cart_list) { >- $line->{'incart'} = 1; >+ if ( grep {$_ eq $res->{'biblionumber'}} @cart_list) { >+ $res->{'incart'} = 1; > } >- } >- > >- my $tag_quantity; >- if (C4::Context->preference('TagsEnabled') and >- $tag_quantity = C4::Context->preference('TagsShowOnList')) { >- foreach (@newresults) { >- my $bibnum = $_->{biblionumber} or next; >- $_->{itemsissued} = CountItemsIssued( $bibnum ); >- $_ ->{'TagLoop'} = get_tags({biblionumber=>$bibnum, approved=>1, 'sort'=>'-weight', >- limit=>$tag_quantity }); >+ if (C4::Context->preference('COinSinOPACResults')) { >+ my $record = GetMarcBiblio($res->{'biblionumber'}); >+ $res->{coins} = GetCOinSBiblio($record); > } >- } >- >- if (C4::Context->preference('COinSinOPACResults')) { >- foreach (@newresults) { >- my $record = GetMarcBiblio($_->{'biblionumber'}); >- $_->{coins} = GetCOinSBiblio($record); >- if ( C4::Context->preference( "Babeltheque" ) and $_->{normalized_isbn} ) { >- my $isbn = Business::ISBN->new( $_->{normalized_isbn} ); >- next if not $isbn; >+ if ( C4::Context->preference( "Babeltheque" ) and $res->{normalized_isbn} ) { >+ if( my $isbn = Business::ISBN->new( $res->{normalized_isbn} ) ) { > $isbn = $isbn->as_isbn13->as_string; > $isbn =~ s/-//g; > my $social_datas = C4::SocialData::get_data( $isbn ); >- next if not $social_datas; >- for my $key ( keys %$social_datas ) { >- $_->{$key} = $$social_datas{$key}; >- if ( $key eq 'score_avg' ){ >- $_->{score_int} = sprintf("%.0f", $$social_datas{score_avg} ); >+ if ( $social_datas ) { >+ for my $key ( keys %$social_datas ) { >+ $res->{$key} = $$social_datas{$key}; >+ if ( $key eq 'score_avg' ){ >+ $res->{score_int} = sprintf("%.0f", $$social_datas{score_avg} ); >+ } > } > } > } > } >- } > >+ if (C4::Context->preference('TagsEnabled') and >+ C4::Context->preference('TagsShowOnList')) { >+ if ( my $bibnum = $res->{biblionumber} ) { >+ $res->{itemsissued} = CountItemsIssued( $bibnum ); >+ $res->{'TagLoop'} = get_tags({ >+ biblionumber => $bibnum, >+ approved => 1, >+ sort => '-weight', >+ limit => C4::Context->preference('TagsShowOnList') >+ }); >+ } >+ } > >- if ( C4::Context->preference('OpacStarRatings') eq 'all' ) { >- foreach my $res (@newresults) { >+ if ( C4::Context->preference('OpacStarRatings') eq 'all' ) { > my $rating = GetRating( $res->{'biblionumber'}, $borrowernumber ); > $res->{'rating_value'} = $rating->{'rating_value'}; > $res->{'rating_total'} = $rating->{'rating_total'}; >-- >1.7.9.5
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 10129
:
17716
|
17884
|
17932
|
18099