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

(-)a/Koha/Biblio.pm (-2 / +2 lines)
Lines 913-919 sub cover_images { Link Here
913
913
914
=head3 get_marc_notes
914
=head3 get_marc_notes
915
915
916
    $marcnotesarray = $biblio->get_marc_notes({ marcflavour => $marcflavour });
916
    $marcnotesarray = $biblio->get_marc_notes({ opac => 1 });
917
917
918
Get all notes from the MARC record and returns them in an array.
918
Get all notes from the MARC record and returns them in an array.
919
The notes are stored in different fields depending on MARC flavour.
919
The notes are stored in different fields depending on MARC flavour.
Lines 924-930 MARC21 5XX $u subfields receive special attention as they are URIs. Link Here
924
sub get_marc_notes {
924
sub get_marc_notes {
925
    my ( $self, $params ) = @_;
925
    my ( $self, $params ) = @_;
926
926
927
    my $marcflavour = $params->{marcflavour};
927
    my $marcflavour = C4::Context->preference('marcflavour');
928
    my $opac = $params->{opac};
928
    my $opac = $params->{opac};
929
929
930
    my $scope = $marcflavour eq "UNIMARC"? '3..': '5..';
930
    my $scope = $marcflavour eq "UNIMARC"? '3..': '5..';
(-)a/basket/basket.pl (-1 / +1 lines)
Lines 68-74 foreach my $biblionumber ( @bibs ) { Link Here
68
    my $biblio           = Koha::Biblios->find( $biblionumber ) or next;
68
    my $biblio           = Koha::Biblios->find( $biblionumber ) or next;
69
    my $dat              = $biblio->unblessed;
69
    my $dat              = $biblio->unblessed;
70
    my $record           = &GetMarcBiblio({ biblionumber => $biblionumber });
70
    my $record           = &GetMarcBiblio({ biblionumber => $biblionumber });
71
    my $marcnotesarray   = $biblio->get_marc_notes({ marcflavour => $marcflavour });
71
    my $marcnotesarray   = $biblio->get_marc_notes;
72
    my $marcauthorsarray = $biblio->get_marc_authors;
72
    my $marcauthorsarray = $biblio->get_marc_authors;
73
    my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
73
    my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
74
    my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
74
    my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
(-)a/catalogue/detail.pl (-14 / +14 lines)
Lines 464-484 $template->param( Link Here
464
);
464
);
465
465
466
$template->param(
466
$template->param(
467
    MARCNOTES   => $marc_record ? $biblio->get_marc_notes({ marcflavour => $marcflavour }) : undef,
467
    MARCNOTES               => $marc_record ? $biblio->get_marc_notes() : undef,
468
    itemdata_ccode      => $itemfields{ccode},
468
    itemdata_ccode          => $itemfields{ccode},
469
    itemdata_enumchron  => $itemfields{enumchron},
469
    itemdata_enumchron      => $itemfields{enumchron},
470
    itemdata_uri        => $itemfields{uri},
470
    itemdata_uri            => $itemfields{uri},
471
    itemdata_copynumber => $itemfields{copynumber},
471
    itemdata_copynumber     => $itemfields{copynumber},
472
    itemdata_stocknumber => $itemfields{stocknumber},
472
    itemdata_stocknumber    => $itemfields{stocknumber},
473
    itemdata_publisheddate => $itemfields{publisheddate},
473
    itemdata_publisheddate  => $itemfields{publisheddate},
474
    volinfo                => $itemfields{enumchron},
474
    volinfo                 => $itemfields{enumchron},
475
        itemdata_itemnotes  => $itemfields{itemnotes},
475
    itemdata_itemnotes      => $itemfields{itemnotes},
476
        itemdata_nonpublicnotes => $itemfields{itemnotes_nonpublic},
476
    itemdata_nonpublicnotes => $itemfields{itemnotes_nonpublic},
477
    z3950_search_params    => C4::Search::z3950_search_args($dat),
477
    z3950_search_params     => C4::Search::z3950_search_args($dat),
478
        hostrecords         => $hostrecords,
478
    hostrecords             => $hostrecords,
479
    analytics_flag    => $analytics_flag,
479
    analytics_flag          => $analytics_flag,
480
    C4::Search::enabled_staff_search_views,
480
    C4::Search::enabled_staff_search_views,
481
        materials       => $materials_flag,
481
    materials => $materials_flag,
482
);
482
);
483
483
484
if (C4::Context->preference("AlternateHoldingsField") && scalar @items == 0) {
484
if (C4::Context->preference("AlternateHoldingsField") && scalar @items == 0) {
(-)a/opac/opac-basket.pl (-1 / +1 lines)
Lines 90-96 foreach my $biblionumber ( @bibs ) { Link Here
90
    });
90
    });
91
    $record_processor->process($record);
91
    $record_processor->process($record);
92
    next unless $record;
92
    next unless $record;
93
    my $marcnotesarray   = $biblio->get_marc_notes({ marcflavour => $marcflavour, opac => 1 });
93
    my $marcnotesarray   = $biblio->get_marc_notes({ opac => 1 });
94
    my $marcauthorsarray = $biblio->get_marc_authors;
94
    my $marcauthorsarray = $biblio->get_marc_authors;
95
    my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
95
    my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
96
    my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
96
    my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
(-)a/opac/opac-detail.pl (-1 / +1 lines)
Lines 793-799 if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) { Link Here
793
    }
793
    }
794
}
794
}
795
795
796
my $marcnotesarray = $biblio->get_marc_notes({ marcflavour => $marcflavour, opac => 1 });
796
my $marcnotesarray = $biblio->get_marc_notes({ opac => 1 });
797
797
798
if( C4::Context->preference('ArticleRequests') ) {
798
if( C4::Context->preference('ArticleRequests') ) {
799
    my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef;
799
    my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef;
(-)a/t/db_dependent/Koha/Biblio.t (-3 / +4 lines)
Lines 699-705 subtest 'get_marc_notes() MARC21 tests' => sub { Link Here
699
    C4::Biblio::ModBiblio( $record, $biblio->biblionumber );
699
    C4::Biblio::ModBiblio( $record, $biblio->biblionumber );
700
    $biblio = Koha::Biblios->find( $biblio->biblionumber);
700
    $biblio = Koha::Biblios->find( $biblio->biblionumber);
701
701
702
    my $notes = $biblio->get_marc_notes({ marcflavour => 'MARC21' });
702
    my $notes = $biblio->get_marc_notes;
703
    is( $notes->[0]->{marcnote}, 'Note1', 'First note' );
703
    is( $notes->[0]->{marcnote}, 'Note1', 'First note' );
704
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
704
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
705
    is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
705
    is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
Lines 707-713 subtest 'get_marc_notes() MARC21 tests' => sub { Link Here
707
    is( $notes->[4]->{marcnote}, 'Note5', 'Fifth note' );
707
    is( $notes->[4]->{marcnote}, 'Note5', 'Fifth note' );
708
    is( $notes->[5]->{marcnote}, 'Description should show', 'Authorised value is correctly parsed to show description rather than code' );
708
    is( $notes->[5]->{marcnote}, 'Description should show', 'Authorised value is correctly parsed to show description rather than code' );
709
    is( @$notes, 6, 'No more notes' );
709
    is( @$notes, 6, 'No more notes' );
710
    $notes = $biblio->get_marc_notes({ marcflavour => 'MARC21', opac => 1 });
710
    $notes = $biblio->get_marc_notes({ opac => 1 });
711
    is( $notes->[0]->{marcnote}, 'Note1', 'First note' );
711
    is( $notes->[0]->{marcnote}, 'Note1', 'First note' );
712
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
712
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
713
    is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
713
    is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
Lines 729-734 subtest 'get_marc_notes() UNIMARC tests' => sub { Link Here
729
    $schema->storage->txn_begin;
729
    $schema->storage->txn_begin;
730
730
731
    t::lib::Mocks::mock_preference( 'NotesToHide', '310' );
731
    t::lib::Mocks::mock_preference( 'NotesToHide', '310' );
732
    t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' );
732
733
733
    my $biblio = $builder->build_sample_biblio;
734
    my $biblio = $builder->build_sample_biblio;
734
    my $record = $biblio->metadata->record;
735
    my $record = $biblio->metadata->record;
Lines 744-749 subtest 'get_marc_notes() UNIMARC tests' => sub { Link Here
744
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
745
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
745
    is( @$notes, 2, 'No more notes' );
746
    is( @$notes, 2, 'No more notes' );
746
747
748
    t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' );
747
    $schema->storage->txn_rollback;
749
    $schema->storage->txn_rollback;
748
};
750
};
749
751
750
- 

Return to bug 29871