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

(-)a/C4/XSLT.pm (-2 / +2 lines)
Lines 294-305 sub XSLTParse4Display { Link Here
294
            my $biblio = Koha::Biblios->find( $biblionumber );
294
            my $biblio = Koha::Biblios->find( $biblionumber );
295
            my $max_results = 300;
295
            my $max_results = 300;
296
296
297
            if ( $biblio->components($max_results) ) {
297
            if ( $biblio->get_marc_components($max_results) ) {
298
                my $search_query = Koha::Util::Search::get_component_part_query($biblionumber);
298
                my $search_query = Koha::Util::Search::get_component_part_query($biblionumber);
299
                $variables->{ComponentPartQuery} = $search_query;
299
                $variables->{ComponentPartQuery} = $search_query;
300
300
301
                my @componentPartRecordXML = ('<componentPartRecords>');
301
                my @componentPartRecordXML = ('<componentPartRecords>');
302
                for my $cb ( @{ $biblio->components($max_results) } ) {
302
                for my $cb ( @{ $biblio->get_marc_components($max_results) } ) {
303
                    if( ref $cb eq 'MARC::Record'){
303
                    if( ref $cb eq 'MARC::Record'){
304
                        $cb = $cb->as_xml_record();
304
                        $cb = $cb->as_xml_record();
305
                    } else {
305
                    } else {
(-)a/Koha/Biblio.pm (-3 / +3 lines)
Lines 498-513 sub suggestions { Link Here
498
    return Koha::Suggestions->_new_from_dbic( $suggestions_rs );
498
    return Koha::Suggestions->_new_from_dbic( $suggestions_rs );
499
}
499
}
500
500
501
=head3 components
501
=head3 get_marc_components
502
502
503
my $components = $self->components();
503
  my $components = $self->get_marc_components();
504
504
505
Returns an array of MARCXML data, which are component parts of
505
Returns an array of MARCXML data, which are component parts of
506
this object (MARC21 773$w points to this)
506
this object (MARC21 773$w points to this)
507
507
508
=cut
508
=cut
509
509
510
sub components {
510
sub get_marc_components {
511
    my ($self, $max_results) = @_;
511
    my ($self, $max_results) = @_;
512
512
513
    return if (C4::Context->preference('marcflavour') ne 'MARC21');
513
    return if (C4::Context->preference('marcflavour') ne 'MARC21');
(-)a/t/db_dependent/Koha/Biblio.t (-6 / +5 lines)
Lines 503-509 subtest 'suggestions() tests' => sub { Link Here
503
    $schema->storage->txn_rollback;
503
    $schema->storage->txn_rollback;
504
};
504
};
505
505
506
subtest 'components() tests' => sub {
506
subtest 'get_marc_components() tests' => sub {
507
507
508
    plan tests => 3;
508
    plan tests => 3;
509
509
Lines 515-527 subtest 'components() tests' => sub { Link Here
515
    my $search_mod = Test::MockModule->new( 'Koha::SearchEngine::Zebra::Search' );
515
    my $search_mod = Test::MockModule->new( 'Koha::SearchEngine::Zebra::Search' );
516
    $search_mod->mock( 'simple_search_compat', \&search_component_record2 );
516
    $search_mod->mock( 'simple_search_compat', \&search_component_record2 );
517
517
518
    my @components = $host_biblio->components;
518
    my @components = $host_biblio->get_marc_components;
519
    is( ref(\@components), 'ARRAY', 'Return type is correct' );
519
    is( ref(\@components), 'ARRAY', 'Return type is correct' );
520
520
521
    is_deeply(
521
    is_deeply(
522
        [@components],
522
        [@components],
523
        [()],
523
        [()],
524
        '->components returns an empty ARRAY'
524
        '->get_marc_components returns an empty ARRAY'
525
    );
525
    );
526
526
527
    $search_mod->unmock( 'simple_search_compat');
527
    $search_mod->unmock( 'simple_search_compat');
Lines 529-537 subtest 'components() tests' => sub { Link Here
529
    my $component_record = component_record1()->as_xml();
529
    my $component_record = component_record1()->as_xml();
530
530
531
    is_deeply(
531
    is_deeply(
532
        $host_biblio->components,
532
        $host_biblio->get_marc_components,
533
        [($component_record)],
533
        [($component_record)],
534
        '->components returns the related component part record'
534
        '->get_marc_components returns the related component part record'
535
    );
535
    );
536
    $search_mod->unmock( 'simple_search_compat');
536
    $search_mod->unmock( 'simple_search_compat');
537
537
538
- 

Return to bug 11175