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

(-)a/C4/Biblio.pm (+2 lines)
Lines 2347-2352 sub TransformMarcToKoha { Link Here
2347
    my %tables = ( biblio => 1, biblioitems => 1, items => 1 );
2347
    my %tables = ( biblio => 1, biblioitems => 1, items => 1 );
2348
    if( $limit_table eq 'items' ) {
2348
    if( $limit_table eq 'items' ) {
2349
        %tables = ( items => 1 );
2349
        %tables = ( items => 1 );
2350
    } elsif ( $limit_table eq 'no_items' ){
2351
        %tables = ( biblio => 1, biblioitems => 1 );
2350
    }
2352
    }
2351
2353
2352
    # The next call acknowledges Default as the authoritative framework
2354
    # The next call acknowledges Default as the authoritative framework
(-)a/C4/Search.pm (-4 / +4 lines)
Lines 1635-1646 sub searchResults { Link Here
1635
    }
1635
    }
1636
1636
1637
    # handle which records to actually retrieve
1637
    # handle which records to actually retrieve
1638
    my $times;
1638
    my $times; # Times is which record to process up to
1639
    if ( $hits && $offset + $results_per_page <= $hits ) {
1639
    if ( $hits && $offset + $results_per_page <= $hits ) {
1640
        $times = $offset + $results_per_page;
1640
        $times = $offset + $results_per_page;
1641
    }
1641
    }
1642
    else {
1642
    else {
1643
        $times = $hits;	 # FIXME: if $hits is undefined, why do we want to equal it?
1643
        $times = $hits; # If less hits than results_per_page+offset we go to the end
1644
    }
1644
    }
1645
1645
1646
    my $marcflavour = C4::Context->preference("marcflavour");
1646
    my $marcflavour = C4::Context->preference("marcflavour");
Lines 1694-1706 sub searchResults { Link Here
1694
               : GetFrameworkCode($marcrecord->subfield($bibliotag,$bibliosubf));
1694
               : GetFrameworkCode($marcrecord->subfield($bibliotag,$bibliosubf));
1695
1695
1696
        SetUTF8Flag($marcrecord);
1696
        SetUTF8Flag($marcrecord);
1697
        my $oldbiblio = TransformMarcToKoha( $marcrecord, $fw );
1697
        my $oldbiblio = TransformMarcToKoha( $marcrecord, $fw, 'no_items' );
1698
        $oldbiblio->{result_number} = $i + 1;
1698
        $oldbiblio->{result_number} = $i + 1;
1699
1699
1700
		$oldbiblio->{normalized_upc}  = GetNormalizedUPC(       $marcrecord,$marcflavour);
1700
		$oldbiblio->{normalized_upc}  = GetNormalizedUPC(       $marcrecord,$marcflavour);
1701
		$oldbiblio->{normalized_ean}  = GetNormalizedEAN(       $marcrecord,$marcflavour);
1701
		$oldbiblio->{normalized_ean}  = GetNormalizedEAN(       $marcrecord,$marcflavour);
1702
		$oldbiblio->{normalized_oclc} = GetNormalizedOCLCNumber($marcrecord,$marcflavour);
1702
		$oldbiblio->{normalized_oclc} = GetNormalizedOCLCNumber($marcrecord,$marcflavour);
1703
		$oldbiblio->{normalized_isbn} = GetNormalizedISBN(undef,$marcrecord,$marcflavour);
1703
        $oldbiblio->{normalized_isbn} = GetNormalizedISBN($oldbiblio->{isbn},$marcrecord,$marcflavour); # Use existing ISBN from record if we got one
1704
		$oldbiblio->{content_identifier_exists} = 1 if ($oldbiblio->{normalized_isbn} or $oldbiblio->{normalized_oclc} or $oldbiblio->{normalized_ean} or $oldbiblio->{normalized_upc});
1704
		$oldbiblio->{content_identifier_exists} = 1 if ($oldbiblio->{normalized_isbn} or $oldbiblio->{normalized_oclc} or $oldbiblio->{normalized_ean} or $oldbiblio->{normalized_upc});
1705
1705
1706
		# edition information, if any
1706
		# 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