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

(-)a/C4/XSLT.pm (-2 / +2 lines)
Lines 291-302 sub XSLTParse4Display { Link Here
291
            my $biblio = Koha::Biblios->find( $biblionumber );
291
            my $biblio = Koha::Biblios->find( $biblionumber );
292
            my $max_results = 300;
292
            my $max_results = 300;
293
293
294
            if ( $biblio->components($max_results) ) {
294
            if ( $biblio->get_marc_components($max_results) ) {
295
                my $search_query = Koha::Util::Search::get_component_part_query($biblionumber);
295
                my $search_query = Koha::Util::Search::get_component_part_query($biblionumber);
296
                $variables->{ComponentPartQuery} = $search_query;
296
                $variables->{ComponentPartQuery} = $search_query;
297
297
298
                my @componentPartRecordXML = ('<componentPartRecords>');
298
                my @componentPartRecordXML = ('<componentPartRecords>');
299
                for my $cb ( @{ $biblio->components($max_results) } ) {
299
                for my $cb ( @{ $biblio->get_marc_components($max_results) } ) {
300
                    if( ref $cb eq 'MARC::Record'){
300
                    if( ref $cb eq 'MARC::Record'){
301
                        $cb = $cb->as_xml_record();
301
                        $cb = $cb->as_xml_record();
302
                    } else {
302
                    } else {
(-)a/Koha/Biblio.pm (-3 / +3 lines)
Lines 479-494 sub suggestions { Link Here
479
    return Koha::Suggestions->_new_from_dbic( $suggestions_rs );
479
    return Koha::Suggestions->_new_from_dbic( $suggestions_rs );
480
}
480
}
481
481
482
=head3 components
482
=head3 get_marc_components
483
483
484
my $components = $self->components();
484
  my $components = $self->get_marc_components();
485
485
486
Returns an array of MARCXML data, which are component parts of
486
Returns an array of MARCXML data, which are component parts of
487
this object (MARC21 773$w points to this)
487
this object (MARC21 773$w points to this)
488
488
489
=cut
489
=cut
490
490
491
sub components {
491
sub get_marc_components {
492
    my ($self, $max_results) = @_;
492
    my ($self, $max_results) = @_;
493
493
494
    return if (C4::Context->preference('marcflavour') ne 'MARC21');
494
    return if (C4::Context->preference('marcflavour') ne 'MARC21');
(-)a/t/db_dependent/Koha/Biblio.t (-6 / +5 lines)
Lines 507-513 subtest 'suggestions() tests' => sub { Link Here
507
    $schema->storage->txn_rollback;
507
    $schema->storage->txn_rollback;
508
};
508
};
509
509
510
subtest 'components() tests' => sub {
510
subtest 'get_marc_components() tests' => sub {
511
511
512
    plan tests => 3;
512
    plan tests => 3;
513
513
Lines 519-531 subtest 'components() tests' => sub { Link Here
519
    my $search_mod = Test::MockModule->new( 'Koha::SearchEngine::Zebra::Search' );
519
    my $search_mod = Test::MockModule->new( 'Koha::SearchEngine::Zebra::Search' );
520
    $search_mod->mock( 'simple_search_compat', \&search_component_record2 );
520
    $search_mod->mock( 'simple_search_compat', \&search_component_record2 );
521
521
522
    my @components = $host_biblio->components;
522
    my @components = $host_biblio->get_marc_components;
523
    is( ref(\@components), 'ARRAY', 'Return type is correct' );
523
    is( ref(\@components), 'ARRAY', 'Return type is correct' );
524
524
525
    is_deeply(
525
    is_deeply(
526
        [@components],
526
        [@components],
527
        [()],
527
        [()],
528
        '->components returns an empty ARRAY'
528
        '->get_marc_components returns an empty ARRAY'
529
    );
529
    );
530
530
531
    $search_mod->unmock( 'simple_search_compat');
531
    $search_mod->unmock( 'simple_search_compat');
Lines 533-541 subtest 'components() tests' => sub { Link Here
533
    my $component_record = component_record1()->as_xml();
533
    my $component_record = component_record1()->as_xml();
534
534
535
    is_deeply(
535
    is_deeply(
536
        $host_biblio->components,
536
        $host_biblio->get_marc_components,
537
        [($component_record)],
537
        [($component_record)],
538
        '->components returns the related component part record'
538
        '->get_marc_components returns the related component part record'
539
    );
539
    );
540
    $search_mod->unmock( 'simple_search_compat');
540
    $search_mod->unmock( 'simple_search_compat');
541
541
542
- 

Return to bug 11175