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

(-)a/C4/Biblio.pm (+2 lines)
Lines 2343-2348 sub TransformMarcToKoha { Link Here
2343
    my %tables = ( biblio => 1, biblioitems => 1, items => 1 );
2343
    my %tables = ( biblio => 1, biblioitems => 1, items => 1 );
2344
    if( $limit_table eq 'items' ) {
2344
    if( $limit_table eq 'items' ) {
2345
        %tables = ( items => 1 );
2345
        %tables = ( items => 1 );
2346
    } elsif ( $limit_table eq 'no_items' ){
2347
        %tables = ( biblio => 1, biblioitems => 1 );
2346
    }
2348
    }
2347
2349
2348
    # The next call acknowledges Default as the authoritative framework
2350
    # The next call acknowledges Default as the authoritative framework
(-)a/C4/Search.pm (-4 / +4 lines)
Lines 1648-1659 sub searchResults { Link Here
1648
    }
1648
    }
1649
1649
1650
    # handle which records to actually retrieve
1650
    # handle which records to actually retrieve
1651
    my $times;
1651
    my $times; # Times is which record to process up to
1652
    if ( $hits && $offset + $results_per_page <= $hits ) {
1652
    if ( $hits && $offset + $results_per_page <= $hits ) {
1653
        $times = $offset + $results_per_page;
1653
        $times = $offset + $results_per_page;
1654
    }
1654
    }
1655
    else {
1655
    else {
1656
        $times = $hits;	 # FIXME: if $hits is undefined, why do we want to equal it?
1656
        $times = $hits;	 # If less hits than results_per_page+offset we go to the end
1657
    }
1657
    }
1658
1658
1659
    my $marcflavour = C4::Context->preference("marcflavour");
1659
    my $marcflavour = C4::Context->preference("marcflavour");
Lines 1707-1719 sub searchResults { Link Here
1707
               : GetFrameworkCode($marcrecord->subfield($bibliotag,$bibliosubf));
1707
               : GetFrameworkCode($marcrecord->subfield($bibliotag,$bibliosubf));
1708
1708
1709
        SetUTF8Flag($marcrecord);
1709
        SetUTF8Flag($marcrecord);
1710
        my $oldbiblio = TransformMarcToKoha( $marcrecord, $fw );
1710
        my $oldbiblio = TransformMarcToKoha( $marcrecord, $fw, 'no_items' );
1711
        $oldbiblio->{result_number} = $i + 1;
1711
        $oldbiblio->{result_number} = $i + 1;
1712
1712
1713
		$oldbiblio->{normalized_upc}  = GetNormalizedUPC(       $marcrecord,$marcflavour);
1713
		$oldbiblio->{normalized_upc}  = GetNormalizedUPC(       $marcrecord,$marcflavour);
1714
		$oldbiblio->{normalized_ean}  = GetNormalizedEAN(       $marcrecord,$marcflavour);
1714
		$oldbiblio->{normalized_ean}  = GetNormalizedEAN(       $marcrecord,$marcflavour);
1715
		$oldbiblio->{normalized_oclc} = GetNormalizedOCLCNumber($marcrecord,$marcflavour);
1715
		$oldbiblio->{normalized_oclc} = GetNormalizedOCLCNumber($marcrecord,$marcflavour);
1716
		$oldbiblio->{normalized_isbn} = GetNormalizedISBN(undef,$marcrecord,$marcflavour);
1716
        $oldbiblio->{normalized_isbn} = GetNormalizedISBN($oldbiblio->{isbn},$marcrecord,$marcflavour); # Use existing ISBN from record if we got one
1717
		$oldbiblio->{content_identifier_exists} = 1 if ($oldbiblio->{normalized_isbn} or $oldbiblio->{normalized_oclc} or $oldbiblio->{normalized_ean} or $oldbiblio->{normalized_upc});
1717
		$oldbiblio->{content_identifier_exists} = 1 if ($oldbiblio->{normalized_isbn} or $oldbiblio->{normalized_oclc} or $oldbiblio->{normalized_ean} or $oldbiblio->{normalized_upc});
1718
1718
1719
		# edition information, if any
1719
		# edition information, if any
(-)a/t/db_dependent/Biblio/TransformMarcToKoha.t (-2 / +10 lines)
Lines 111-117 subtest 'Testing _adjust_pubyear' => sub { Link Here
111
};
111
};
112
112
113
subtest 'Test repeatable subfields' => sub {
113
subtest 'Test repeatable subfields' => sub {
114
    plan tests => 2;
114
    plan tests => 5;
115
115
116
    # Make 510x repeatable and 510y not
116
    # Make 510x repeatable and 510y not
117
    Koha::MarcSubfieldStructures->search({ frameworkcode => '', tagfield => '510' })->delete;
117
    Koha::MarcSubfieldStructures->search({ frameworkcode => '', tagfield => '510' })->delete;
Lines 125-130 subtest 'Test repeatable subfields' => sub { Link Here
125
    my $result = C4::Biblio::TransformMarcToKoha( $marc );
125
    my $result = C4::Biblio::TransformMarcToKoha( $marc );
126
    is( $result->{test}, '1 | 2', 'Check 510x for two values' );
126
    is( $result->{test}, '1 | 2', 'Check 510x for two values' );
127
    is( $result->{norepeat}, '3 | 4 | 5', 'Check 510y too' );
127
    is( $result->{norepeat}, '3 | 4 | 5', 'Check 510y too' );
128
129
    Koha::MarcSubfieldStructure->new({ frameworkcode => '', tagfield => '510', tagsubfield => 'a', kohafield => 'biblio.field1' })->store;
130
    Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" );
131
    $marc->append_fields( MARC::Field->new( '510', '', '', a => '1' ) ); # actually, we should only have one $y (BZ 24652)
132
133
    $result = C4::Biblio::TransformMarcToKoha( $marc, '', 'no_items' );
134
    is( $result->{test}, undef, 'Item field not returned when "no_items" passed' );
135
    is( $result->{norepeat}, undef, 'Item field not returned when "no_items" passed' );
136
    is( $result->{field1}, 1, 'Biblio field returned when "no_items" passed' );
128
};
137
};
129
138
130
# Cleanup
139
# Cleanup
131
- 

Return to bug 28384