Browse Source
This patch moves C4::Biblio::GetMarcNotes to Koha::Biblio->get_marc_notes. This is so get_marc_notes can be used in templates and notices. To test: 1. Find a record that has a note (3xx for UNIMARC, 5xx for MARC21). Confirm the notes still show as normal under the Descriptions tab. 2. Add the record to the cart. 3. View your cart and click 'more details'. Confirm notes show as normal. 4. Log in to the OPAC. Find the record and add it to the cart 5. View the cart and click 'more details'. Confirm notes show as normal. 6. View the record detail page and confirm the notes show as normal under the Title Notes tab. 7. Confirm tests pass: - t/Biblio.t - t/db_dependent/Koha/Biblio.t Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ) Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>21.05.x
Aleisha Amohia
3 years ago
committed by
Jonathan Druart
10 changed files with 122 additions and 149 deletions
@ -1,70 +0,0 @@ |
|||||
#!/usr/bin/perl |
|
||||
|
|
||||
# This file is part of Koha. |
|
||||
# |
|
||||
# Koha is free software; you can redistribute it and/or modify it |
|
||||
# under the terms of the GNU General Public License as published by |
|
||||
# the Free Software Foundation; either version 3 of the License, or |
|
||||
# (at your option) any later version. |
|
||||
# |
|
||||
# Koha is distributed in the hope that it will be useful, but |
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
# GNU General Public License for more details. |
|
||||
# |
|
||||
# You should have received a copy of the GNU General Public License |
|
||||
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
|
||||
|
|
||||
use Modern::Perl; |
|
||||
|
|
||||
use Test::More tests => 2; |
|
||||
use t::lib::Mocks; |
|
||||
|
|
||||
use MARC::Field; |
|
||||
use MARC::Record; |
|
||||
|
|
||||
use C4::Biblio; |
|
||||
|
|
||||
subtest 'GetMarcNotes MARC21' => sub { |
|
||||
plan tests => 11; |
|
||||
t::lib::Mocks::mock_preference( 'NotesToHide', '520' ); |
|
||||
|
|
||||
my $record = MARC::Record->new; |
|
||||
$record->append_fields( |
|
||||
MARC::Field->new( '500', '', '', a => 'Note1' ), |
|
||||
MARC::Field->new( '505', '', '', a => 'Note2', u => 'http://someserver.com' ), |
|
||||
MARC::Field->new( '520', '', '', a => 'Note3 skipped' ), |
|
||||
MARC::Field->new( '541', '0', '', a => 'Note4 skipped on opac' ), |
|
||||
MARC::Field->new( '541', '', '', a => 'Note5' ), |
|
||||
); |
|
||||
my $notes = C4::Biblio::GetMarcNotes( $record, 'MARC21' ); |
|
||||
is( $notes->[0]->{marcnote}, 'Note1', 'First note' ); |
|
||||
is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); |
|
||||
is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' ); |
|
||||
is( $notes->[3]->{marcnote}, 'Note4 skipped on opac',"Not shows if not opac" ); |
|
||||
is( $notes->[4]->{marcnote}, 'Note5', 'Fifth note' ); |
|
||||
is( @$notes, 5, 'No more notes' ); |
|
||||
$notes = C4::Biblio::GetMarcNotes( $record, 'MARC21', 1 ); |
|
||||
is( $notes->[0]->{marcnote}, 'Note1', 'First note' ); |
|
||||
is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); |
|
||||
is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' ); |
|
||||
is( $notes->[3]->{marcnote}, 'Note5', 'Fifth note shows after fourth skipped' ); |
|
||||
is( @$notes, 4, 'No more notes' ); |
|
||||
|
|
||||
}; |
|
||||
|
|
||||
subtest 'GetMarcNotes UNIMARC' => sub { |
|
||||
plan tests => 3; |
|
||||
t::lib::Mocks::mock_preference( 'NotesToHide', '310' ); |
|
||||
|
|
||||
my $record = MARC::Record->new; |
|
||||
$record->append_fields( |
|
||||
MARC::Field->new( '300', '', '', a => 'Note1' ), |
|
||||
MARC::Field->new( '300', '', '', a => 'Note2' ), |
|
||||
MARC::Field->new( '310', '', '', a => 'Note3 skipped' ), |
|
||||
); |
|
||||
my $notes = C4::Biblio::GetMarcNotes( $record, 'UNIMARC' ); |
|
||||
is( $notes->[0]->{marcnote}, 'Note1', 'First note' ); |
|
||||
is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); |
|
||||
is( @$notes, 2, 'No more notes' ); |
|
||||
}; |
|
Loading…
Reference in new issue