View | Details | Raw Unified | Return to bug 10129
Collapse All | Expand All

(-)a/opac/opac-search.pl (-38 / +33 lines)
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
568
569
569
            if (C4::Context->preference('COinSinOPACResults')) {
570
        my $tag_quantity;
570
                my $record = GetMarcBiblio($res->{'biblionumber'});
571
        if (C4::Context->preference('TagsEnabled') and
571
                $res->{coins} = GetCOinSBiblio($record);
572
            $tag_quantity = C4::Context->preference('TagsShowOnList')) {
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
                my $isbn = Business::ISBN->new( $res->{normalized_isbn} );
581
        if (C4::Context->preference('COinSinOPACResults')) {
575
                next if not $isbn;
582
            foreach (@newresults) {
576
                $isbn = $isbn->as_isbn13->as_string;
583
                my $record = GetMarcBiblio($_->{'biblionumber'});
577
                $isbn =~ s/-//g;
584
                $_->{coins} = GetCOinSBiblio($record);
578
                my $social_datas = C4::SocialData::get_data( $isbn );
585
                if ( C4::Context->preference( "Babeltheque" ) and $_->{normalized_isbn} ) {
579
                next if not $social_datas;
586
                    my $isbn = Business::ISBN->new( $_->{normalized_isbn} );
580
                for my $key ( keys %$social_datas ) {
587
                    next if not $isbn;
581
                    $res->{$key} = $$social_datas{$key};
588
                    $isbn = $isbn->as_isbn13->as_string;
582
                    if ( $key eq 'score_avg' ){
589
                    $isbn =~ s/-//g;
583
                        $res->{score_int} = sprintf("%.0f", $$social_datas{score_avg} );
590
                    my $social_datas = C4::SocialData::get_data( $isbn );
591
                    next if not $social_datas;
592
                    for my $key ( keys %$social_datas ) {
593
                        $_->{$key} = $$social_datas{$key};
594
                        if ( $key eq 'score_avg' ){
595
                            $_->{score_int} = sprintf("%.0f", $$social_datas{score_avg} );
596
                        }
597
                    }
584
                    }
598
                }
585
                }
599
            }
586
            }
600
        }
601
587
588
            if (C4::Context->preference('TagsEnabled') and
589
                C4::Context->preference('TagsShowOnList')) {
590
                my $bibnum = $res->{biblionumber} or next;
591
                $res->{itemsissued} = CountItemsIssued( $bibnum );
592
                $res->{'TagLoop'} = get_tags({
593
                    biblionumber => $bibnum,
594
                    approved => 1,
595
                    sort => '-weight',
596
                    limit => C4::Context->preference('TagsShowOnList')
597
                });
598
            }
602
599
603
        if ( C4::Context->preference('OpacStarRatings') eq 'all' ) {
600
            if ( C4::Context->preference('OpacStarRatings') eq 'all' ) {
604
            foreach my $res (@newresults) {
605
                my $rating = GetRating( $res->{'biblionumber'}, $borrowernumber );
601
                my $rating = GetRating( $res->{'biblionumber'}, $borrowernumber );
606
                $res->{'rating_value'}  = $rating->{'rating_value'};
602
                $res->{'rating_value'}  = $rating->{'rating_value'};
607
                $res->{'rating_total'}  = $rating->{'rating_total'};
603
                $res->{'rating_total'}  = $rating->{'rating_total'};
608
- 

Return to bug 10129