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

(-)a/Koha/Biblio.pm (-2 / +2 lines)
Lines 912-918 sub cover_images { Link Here
912
912
913
=head3 get_marc_notes
913
=head3 get_marc_notes
914
914
915
    $marcnotesarray = $biblio->get_marc_notes({ marcflavour => $marcflavour });
915
    $marcnotesarray = $biblio->get_marc_notes({ opac => 1 });
916
916
917
Get all notes from the MARC record and returns them in an array.
917
Get all notes from the MARC record and returns them in an array.
918
The notes are stored in different fields depending on MARC flavour.
918
The notes are stored in different fields depending on MARC flavour.
Lines 923-929 MARC21 5XX $u subfields receive special attention as they are URIs. Link Here
923
sub get_marc_notes {
923
sub get_marc_notes {
924
    my ( $self, $params ) = @_;
924
    my ( $self, $params ) = @_;
925
925
926
    my $marcflavour = $params->{marcflavour};
926
    my $marcflavour = C4::Context->preference('marcflavour');
927
    my $opac = $params->{opac};
927
    my $opac = $params->{opac};
928
928
929
    my $scope = $marcflavour eq "UNIMARC"? '3..': '5..';
929
    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 (-1 / +1 lines)
Lines 145-151 $template->param( Link Here
145
    normalized_isbn => $isbn,
145
    normalized_isbn => $isbn,
146
);
146
);
147
147
148
my $marcnotesarray   = $biblio->get_marc_notes({ marcflavour => $marcflavour });
148
my $marcnotesarray   = $biblio->get_marc_notes;
149
149
150
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
150
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
151
151
(-)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 782-788 if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) { Link Here
782
    }
782
    }
783
}
783
}
784
784
785
my $marcnotesarray = $biblio->get_marc_notes({ marcflavour => $marcflavour, opac => 1 });
785
my $marcnotesarray = $biblio->get_marc_notes({ opac => 1 });
786
786
787
if( C4::Context->preference('ArticleRequests') ) {
787
if( C4::Context->preference('ArticleRequests') ) {
788
    my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef;
788
    my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef;
(-)a/t/db_dependent/Koha/Biblio.t (-3 / +4 lines)
Lines 702-708 subtest 'get_marc_notes() MARC21 tests' => sub { Link Here
702
    C4::Biblio::ModBiblio( $record, $biblio->biblionumber );
702
    C4::Biblio::ModBiblio( $record, $biblio->biblionumber );
703
    $biblio = Koha::Biblios->find( $biblio->biblionumber);
703
    $biblio = Koha::Biblios->find( $biblio->biblionumber);
704
704
705
    my $notes = $biblio->get_marc_notes({ marcflavour => 'MARC21' });
705
    my $notes = $biblio->get_marc_notes;
706
    is( $notes->[0]->{marcnote}, 'Note1', 'First note' );
706
    is( $notes->[0]->{marcnote}, 'Note1', 'First note' );
707
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
707
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
708
    is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
708
    is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
Lines 710-716 subtest 'get_marc_notes() MARC21 tests' => sub { Link Here
710
    is( $notes->[4]->{marcnote}, 'Note5', 'Fifth note' );
710
    is( $notes->[4]->{marcnote}, 'Note5', 'Fifth note' );
711
    is( $notes->[5]->{marcnote}, 'Description should show', 'Authorised value is correctly parsed to show description rather than code' );
711
    is( $notes->[5]->{marcnote}, 'Description should show', 'Authorised value is correctly parsed to show description rather than code' );
712
    is( @$notes, 6, 'No more notes' );
712
    is( @$notes, 6, 'No more notes' );
713
    $notes = $biblio->get_marc_notes({ marcflavour => 'MARC21', opac => 1 });
713
    $notes = $biblio->get_marc_notes({ opac => 1 });
714
    is( $notes->[0]->{marcnote}, 'Note1', 'First note' );
714
    is( $notes->[0]->{marcnote}, 'Note1', 'First note' );
715
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
715
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
716
    is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
716
    is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
Lines 732-737 subtest 'get_marc_notes() UNIMARC tests' => sub { Link Here
732
    $schema->storage->txn_begin;
732
    $schema->storage->txn_begin;
733
733
734
    t::lib::Mocks::mock_preference( 'NotesToHide', '310' );
734
    t::lib::Mocks::mock_preference( 'NotesToHide', '310' );
735
    t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' );
735
736
736
    my $biblio = $builder->build_sample_biblio;
737
    my $biblio = $builder->build_sample_biblio;
737
    my $record = $biblio->metadata->record;
738
    my $record = $biblio->metadata->record;
Lines 747-752 subtest 'get_marc_notes() UNIMARC tests' => sub { Link Here
747
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
748
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
748
    is( @$notes, 2, 'No more notes' );
749
    is( @$notes, 2, 'No more notes' );
749
750
751
    t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' );
750
    $schema->storage->txn_rollback;
752
    $schema->storage->txn_rollback;
751
};
753
};
752
754
753
- 

Return to bug 29871