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

(-)a/C4/XSLT.pm (-2 / +2 lines)
Lines 278-289 sub XSLTParse4Display { Link Here
278
            my $biblio = Koha::Biblios->find( $biblionumber );
278
            my $biblio = Koha::Biblios->find( $biblionumber );
279
            my $max_results = 300;
279
            my $max_results = 300;
280
280
281
            if ( $biblio->components($max_results) ) {
281
            if ( $biblio->get_marc_components($max_results) ) {
282
                my $search_query = Koha::Util::Search::get_component_part_query($biblionumber);
282
                my $search_query = Koha::Util::Search::get_component_part_query($biblionumber);
283
                $variables->{ComponentPartQuery} = $search_query;
283
                $variables->{ComponentPartQuery} = $search_query;
284
284
285
                my @componentPartRecordXML = ('<componentPartRecords>');
285
                my @componentPartRecordXML = ('<componentPartRecords>');
286
                for my $cb ( @{ $biblio->components($max_results) } ) {
286
                for my $cb ( @{ $biblio->get_marc_components($max_results) } ) {
287
                    if( ref $cb eq 'MARC::Record'){
287
                    if( ref $cb eq 'MARC::Record'){
288
                        $cb = $cb->as_xml_record();
288
                        $cb = $cb->as_xml_record();
289
                    } else {
289
                    } else {
(-)a/Koha/Biblio.pm (-3 / +3 lines)
Lines 500-515 sub suggestions { Link Here
500
    return Koha::Suggestions->_new_from_dbic( $suggestions_rs );
500
    return Koha::Suggestions->_new_from_dbic( $suggestions_rs );
501
}
501
}
502
502
503
=head3 components
503
=head3 get_marc_components
504
504
505
my $components = $self->components();
505
  my $components = $self->get_marc_components();
506
506
507
Returns an array of MARCXML data, which are component parts of
507
Returns an array of MARCXML data, which are component parts of
508
this object (MARC21 773$w points to this)
508
this object (MARC21 773$w points to this)
509
509
510
=cut
510
=cut
511
511
512
sub components {
512
sub get_marc_components {
513
    my ($self, $max_results) = @_;
513
    my ($self, $max_results) = @_;
514
514
515
    return if (C4::Context->preference('marcflavour') ne 'MARC21');
515
    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