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

(-)a/C4/Biblio.pm (-1 / +12 lines)
Lines 1495-1501 sub GetMarcISSN { Link Here
1495
=cut
1495
=cut
1496
1496
1497
sub GetMarcNotes {
1497
sub GetMarcNotes {
1498
    my ( $record, $marcflavour ) = @_;
1498
    my ( $record, $marcflavour, $opac ) = @_;
1499
    if (!$record) {
1499
    if (!$record) {
1500
        carp 'GetMarcNotes called on undefined record';
1500
        carp 'GetMarcNotes called on undefined record';
1501
        return;
1501
        return;
Lines 1503-1513 sub GetMarcNotes { Link Here
1503
1503
1504
    my $scope = $marcflavour eq "UNIMARC"? '3..': '5..';
1504
    my $scope = $marcflavour eq "UNIMARC"? '3..': '5..';
1505
    my @marcnotes;
1505
    my @marcnotes;
1506
1507
    #MARC21 specs indicate some notes should be private if first indicator 0
1508
    my %maybe_private = (
1509
        541 => 1,
1510
        542 => 1,
1511
        561 => 1,
1512
        583 => 1,
1513
        590 => 1
1514
    );
1515
1506
    my %blacklist = map { $_ => 1 }
1516
    my %blacklist = map { $_ => 1 }
1507
        split( /,/, C4::Context->preference('NotesBlacklist'));
1517
        split( /,/, C4::Context->preference('NotesBlacklist'));
1508
    foreach my $field ( $record->field($scope) ) {
1518
    foreach my $field ( $record->field($scope) ) {
1509
        my $tag = $field->tag();
1519
        my $tag = $field->tag();
1510
        next if $blacklist{ $tag };
1520
        next if $blacklist{ $tag };
1521
        next if $opac && $maybe_private{$tag} && !$field->indicator(1);
1511
        if( $marcflavour ne 'UNIMARC' && $field->subfield('u') ) {
1522
        if( $marcflavour ne 'UNIMARC' && $field->subfield('u') ) {
1512
            # Field 5XX$u always contains URI
1523
            # Field 5XX$u always contains URI
1513
            # Examples: 505u, 506u, 510u, 514u, 520u, 530u, 538u, 540u, 542u, 552u, 555u, 561u, 563u, 583u
1524
            # Examples: 505u, 506u, 510u, 514u, 520u, 530u, 538u, 540u, 542u, 552u, 555u, 561u, 563u, 583u
(-)a/Koha/Cache.pm (+1 lines)
Lines 249-254 sub set_in_cache { Link Here
249
          ? $set_sub->( $key, $value )
249
          ? $set_sub->( $key, $value )
250
          : $self->{$cache}->set( $key, $value );
250
          : $self->{$cache}->set( $key, $value );
251
    }
251
    }
252
    warn $expiry;
252
}
253
}
253
254
254
=head2 get_from_cache
255
=head2 get_from_cache
(-)a/opac/opac-basket.pl (-1 / +1 lines)
Lines 81-87 foreach my $biblionumber ( @bibs ) { Link Here
81
    });
81
    });
82
    $record_processor->process($record);
82
    $record_processor->process($record);
83
    next unless $record;
83
    next unless $record;
84
    my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
84
    my $marcnotesarray   = GetMarcNotes( $record, $marcflavour, 1 );
85
    my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
85
    my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
86
    my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
86
    my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
87
    my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
87
    my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
(-)a/opac/opac-detail.pl (-1 / +1 lines)
Lines 766-772 if (!C4::Context->preference("OPACXSLTDetailsDisplay") ) { Link Here
766
    );
766
    );
767
}
767
}
768
768
769
my $marcnotesarray   = GetMarcNotes   ($record,$marcflavour);
769
my $marcnotesarray   = GetMarcNotes   ($record,$marcflavour,1);
770
770
771
if( C4::Context->preference('ArticleRequests') ) {
771
if( C4::Context->preference('ArticleRequests') ) {
772
    my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef;
772
    my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef;
(-)a/t/Biblio/GetMarcNotes.t (-3 / +13 lines)
Lines 26-32 use MARC::Record; Link Here
26
use C4::Biblio;
26
use C4::Biblio;
27
27
28
subtest 'GetMarcNotes MARC21' => sub {
28
subtest 'GetMarcNotes MARC21' => sub {
29
    plan tests => 4;
29
    plan tests => 11;
30
    t::lib::Mocks::mock_preference( 'NotesBlacklist', '520' );
30
    t::lib::Mocks::mock_preference( 'NotesBlacklist', '520' );
31
31
32
    my $record = MARC::Record->new;
32
    my $record = MARC::Record->new;
Lines 34-45 subtest 'GetMarcNotes MARC21' => sub { Link Here
34
        MARC::Field->new( '500', '', '', a => 'Note1' ),
34
        MARC::Field->new( '500', '', '', a => 'Note1' ),
35
        MARC::Field->new( '505', '', '', a => 'Note2', u => 'http://someserver.com' ),
35
        MARC::Field->new( '505', '', '', a => 'Note2', u => 'http://someserver.com' ),
36
        MARC::Field->new( '520', '', '', a => 'Note3 skipped' ),
36
        MARC::Field->new( '520', '', '', a => 'Note3 skipped' ),
37
        MARC::Field->new( '541', '0', '', a => 'Note4 skipped on opac' ),
38
        MARC::Field->new( '541', '', '', a => 'Note5' ),
37
    );
39
    );
38
    my $notes = C4::Biblio::GetMarcNotes( $record, 'MARC21' );
40
    my $notes = C4::Biblio::GetMarcNotes( $record, 'MARC21' );
39
    is( $notes->[0]->{marcnote}, 'Note1', 'First note' );
41
    is( $notes->[0]->{marcnote}, 'Note1', 'First note' );
40
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
42
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
41
    is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
43
    is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
42
    is( @$notes, 3, 'No more notes' );
44
    is( $notes->[3]->{marcnote}, 'Note4 skipped on opac',"Not shows if not opac" );
45
    is( $notes->[4]->{marcnote}, 'Note5', 'Fifth note' );
46
    is( @$notes, 5, 'No more notes' );
47
    $notes = C4::Biblio::GetMarcNotes( $record, 'MARC21', 1 );
48
    is( $notes->[0]->{marcnote}, 'Note1', 'First note' );
49
    is( $notes->[1]->{marcnote}, 'Note2', 'Second note' );
50
    is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' );
51
    is( $notes->[3]->{marcnote}, 'Note5', 'Fifth note shows after fourth skipped' );
52
    is( @$notes, 4, 'No more notes' );
53
43
};
54
};
44
55
45
subtest 'GetMarcNotes UNIMARC' => sub {
56
subtest 'GetMarcNotes UNIMARC' => sub {
46
- 

Return to bug 23392