|
Lines 556-607
for (my $i=0;$i<@servers;$i++) {
Link Here
|
| 556 |
$results_hashref->{$server}->{"RECORDS"}); |
556 |
$results_hashref->{$server}->{"RECORDS"}); |
| 557 |
} |
557 |
} |
| 558 |
|
558 |
|
| 559 |
# must define a value for size if not present in DB |
559 |
foreach my $res (@newresults) { |
| 560 |
# in order to avoid problems generated by the default size value in TT |
560 |
|
| 561 |
foreach my $line (@newresults) { |
561 |
# must define a value for size if not present in DB |
| 562 |
if ( not exists $line->{'size'} ) { $line->{'size'} = "" } |
562 |
# in order to avoid problems generated by the default size value in TT |
|
|
563 |
if ( not exists $res->{'size'} ) { $res->{'size'} = "" } |
| 563 |
# while we're checking each line, see if item is in the cart |
564 |
# while we're checking each line, see if item is in the cart |
| 564 |
if ( grep {$_ eq $line->{'biblionumber'}} @cart_list) { |
565 |
if ( grep {$_ eq $res->{'biblionumber'}} @cart_list) { |
| 565 |
$line->{'incart'} = 1; |
566 |
$res->{'incart'} = 1; |
| 566 |
} |
567 |
} |
| 567 |
} |
|
|
| 568 |
|
| 569 |
|
568 |
|
| 570 |
my $tag_quantity; |
569 |
if (C4::Context->preference('COinSinOPACResults')) { |
| 571 |
if (C4::Context->preference('TagsEnabled') and |
570 |
my $record = GetMarcBiblio($res->{'biblionumber'}); |
| 572 |
$tag_quantity = C4::Context->preference('TagsShowOnList')) { |
571 |
$res->{coins} = GetCOinSBiblio($record); |
| 573 |
foreach (@newresults) { |
|
|
| 574 |
my $bibnum = $_->{biblionumber} or next; |
| 575 |
$_->{itemsissued} = CountItemsIssued( $bibnum ); |
| 576 |
$_ ->{'TagLoop'} = get_tags({biblionumber=>$bibnum, approved=>1, 'sort'=>'-weight', |
| 577 |
limit=>$tag_quantity }); |
| 578 |
} |
572 |
} |
| 579 |
} |
573 |
if ( C4::Context->preference( "Babeltheque" ) and $res->{normalized_isbn} ) { |
| 580 |
|
574 |
if( my $isbn = Business::ISBN->new( $res->{normalized_isbn} ) ) { |
| 581 |
if (C4::Context->preference('COinSinOPACResults')) { |
|
|
| 582 |
foreach (@newresults) { |
| 583 |
my $record = GetMarcBiblio($_->{'biblionumber'}); |
| 584 |
$_->{coins} = GetCOinSBiblio($record); |
| 585 |
if ( C4::Context->preference( "Babeltheque" ) and $_->{normalized_isbn} ) { |
| 586 |
my $isbn = Business::ISBN->new( $_->{normalized_isbn} ); |
| 587 |
next if not $isbn; |
| 588 |
$isbn = $isbn->as_isbn13->as_string; |
575 |
$isbn = $isbn->as_isbn13->as_string; |
| 589 |
$isbn =~ s/-//g; |
576 |
$isbn =~ s/-//g; |
| 590 |
my $social_datas = C4::SocialData::get_data( $isbn ); |
577 |
my $social_datas = C4::SocialData::get_data( $isbn ); |
| 591 |
next if not $social_datas; |
578 |
if ( $social_datas ) { |
| 592 |
for my $key ( keys %$social_datas ) { |
579 |
for my $key ( keys %$social_datas ) { |
| 593 |
$_->{$key} = $$social_datas{$key}; |
580 |
$res->{$key} = $$social_datas{$key}; |
| 594 |
if ( $key eq 'score_avg' ){ |
581 |
if ( $key eq 'score_avg' ){ |
| 595 |
$_->{score_int} = sprintf("%.0f", $$social_datas{score_avg} ); |
582 |
$res->{score_int} = sprintf("%.0f", $$social_datas{score_avg} ); |
|
|
583 |
} |
| 596 |
} |
584 |
} |
| 597 |
} |
585 |
} |
| 598 |
} |
586 |
} |
| 599 |
} |
587 |
} |
| 600 |
} |
|
|
| 601 |
|
588 |
|
|
|
589 |
if (C4::Context->preference('TagsEnabled') and |
| 590 |
C4::Context->preference('TagsShowOnList')) { |
| 591 |
if ( my $bibnum = $res->{biblionumber} ) { |
| 592 |
$res->{itemsissued} = CountItemsIssued( $bibnum ); |
| 593 |
$res->{'TagLoop'} = get_tags({ |
| 594 |
biblionumber => $bibnum, |
| 595 |
approved => 1, |
| 596 |
sort => '-weight', |
| 597 |
limit => C4::Context->preference('TagsShowOnList') |
| 598 |
}); |
| 599 |
} |
| 600 |
} |
| 602 |
|
601 |
|
| 603 |
if ( C4::Context->preference('OpacStarRatings') eq 'all' ) { |
602 |
if ( C4::Context->preference('OpacStarRatings') eq 'all' ) { |
| 604 |
foreach my $res (@newresults) { |
|
|
| 605 |
my $rating = GetRating( $res->{'biblionumber'}, $borrowernumber ); |
603 |
my $rating = GetRating( $res->{'biblionumber'}, $borrowernumber ); |
| 606 |
$res->{'rating_value'} = $rating->{'rating_value'}; |
604 |
$res->{'rating_value'} = $rating->{'rating_value'}; |
| 607 |
$res->{'rating_total'} = $rating->{'rating_total'}; |
605 |
$res->{'rating_total'} = $rating->{'rating_total'}; |
| 608 |
- |
|
|