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

(-)a/C4/Biblio.pm (-14 / +10 lines)
Lines 1764-1785 sub GetMarcNotes { Link Here
1764
    my %blacklist = map { $_ => 1 } split(/,/,C4::Context->preference('NotesBlacklist'));
1764
    my %blacklist = map { $_ => 1 } split(/,/,C4::Context->preference('NotesBlacklist'));
1765
    foreach my $field ( $record->field($scope) ) {
1765
    foreach my $field ( $record->field($scope) ) {
1766
        my $tag = $field->tag();
1766
        my $tag = $field->tag();
1767
        if (!$blacklist{$tag}) {
1767
        next if $blacklist{$tag};
1768
            my $value = $field->as_string();
1768
1769
            if ( $note ne "" ) {
1769
        my $value = $field->as_string();
1770
                $marcnote = { marcnote => $note, };
1770
        if( $marcflavour ne 'UNIMARC' && $tag =~ /555/ ) {
1771
                push @marcnotes, $marcnote;
1771
            my @sub= $field->subfield('u');
1772
                $note = $value;
1772
            foreach my $s (@sub) {
1773
            }
1773
                next if $s !~ /^http/;
1774
            if ( $note ne $value ) {
1774
                my $i= index( $value, $s);
1775
                $note = $note . " " . $value;
1775
                $value= substr( $value,0, $i) . "<a href=\"$s\" target=\"_blank\">$s</a>" . substr( $value, $i + length($s) );
1776
            }
1776
            }
1777
        }
1777
        }
1778
    }
1778
        push @marcnotes, { marcnote => $value };
1779
1780
    if ($note) {
1781
        $marcnote = { marcnote => $note };
1782
        push @marcnotes, $marcnote;    #load last tag into array
1783
    }
1779
    }
1784
    return \@marcnotes;
1780
    return \@marcnotes;
1785
}    # end GetMarcNotes
1781
}    # end GetMarcNotes
(-)a/basket/sendbasket.pl (-2 lines)
Lines 74-80 if ( $email_add ) { Link Here
74
        my $dat              = GetBiblioData($biblionumber);
74
        my $dat              = GetBiblioData($biblionumber);
75
        next unless $dat;
75
        next unless $dat;
76
        my $record           = GetMarcBiblio($biblionumber, 1);
76
        my $record           = GetMarcBiblio($biblionumber, 1);
77
        my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
78
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
77
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
79
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
78
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
80
79
Lines 86-92 if ( $email_add ) { Link Here
86
        }
85
        }
87
	
86
	
88
87
89
        $dat->{MARCNOTES}      = $marcnotesarray;
90
        $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
88
        $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
91
        $dat->{MARCAUTHORS}    = $marcauthorsarray;
89
        $dat->{MARCAUTHORS}    = $marcauthorsarray;
92
        $dat->{HASAUTHORS}     = $hasauthors;
90
        $dat->{HASAUTHORS}     = $hasauthors;
(-)a/opac/opac-sendbasket.pl (-2 lines)
Lines 89-95 if ( $email_add ) { Link Here
89
        my $dat              = GetBiblioData($biblionumber);
89
        my $dat              = GetBiblioData($biblionumber);
90
        next unless $dat;
90
        next unless $dat;
91
        my $record           = GetMarcBiblio($biblionumber, 1);
91
        my $record           = GetMarcBiblio($biblionumber, 1);
92
        my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
93
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
92
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
94
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
93
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
95
94
Lines 101-107 if ( $email_add ) { Link Here
101
        }
100
        }
102
	
101
	
103
102
104
        $dat->{MARCNOTES}      = $marcnotesarray;
105
        $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
103
        $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
106
        $dat->{MARCAUTHORS}    = $marcauthorsarray;
104
        $dat->{MARCAUTHORS}    = $marcauthorsarray;
107
        $dat->{HASAUTHORS}     = $hasauthors;
105
        $dat->{HASAUTHORS}     = $hasauthors;
(-)a/t/db_dependent/Biblio.t (-5 / +14 lines)
Lines 191-199 sub run_tests { Link Here
191
            "(GetMarcISBN) Corretly retrieves ISBN #". ($i + 1));
191
            "(GetMarcISBN) Corretly retrieves ISBN #". ($i + 1));
192
    }
192
    }
193
193
194
195
    is( GetMarcPrice( $record_for_isbn, $marcflavour ), 100,
194
    is( GetMarcPrice( $record_for_isbn, $marcflavour ), 100,
196
        "GetMarcPrice returns the correct value");
195
        "GetMarcPrice returns the correct value");
196
197
    # test for GetMarcNotes
198
    my $a1= GetMarcNotes( $marc_record, $marcflavour );
199
    my $field2 = MARC::Field->new( $marcflavour eq 'UNIMARC'? 300: 555, 0, '', a=> 'Some text', u=> 'http://url-1.com', u=> 'nohttp://something_else' );
200
    $marc_record->append_fields( $field2 );
201
    my $a2= GetMarcNotes( $marc_record, $marcflavour );
202
    my $last= @$a2? $a2->[@$a2-1]->{marcnote}: '';
203
    is( @$a2 == @$a1 + 1 && (
204
        ( $marcflavour eq 'UNIMARC' && $last eq $field2->as_string() ) ||
205
        ( $marcflavour ne 'UNIMARC' && $last =~ /\<a href=/ )),
206
        1, 'Test for GetMarcNotes' );
197
}
207
}
198
208
199
sub mock_marcfromkohafield {
209
sub mock_marcfromkohafield {
Lines 260-278 sub create_issn_field { Link Here
260
}
270
}
261
271
262
subtest 'MARC21' => sub {
272
subtest 'MARC21' => sub {
263
    plan tests => 27;
273
    plan tests => 28;
264
    run_tests('MARC21');
274
    run_tests('MARC21');
265
    $dbh->rollback;
275
    $dbh->rollback;
266
};
276
};
267
277
268
subtest 'UNIMARC' => sub {
278
subtest 'UNIMARC' => sub {
269
    plan tests => 27;
279
    plan tests => 28;
270
    run_tests('UNIMARC');
280
    run_tests('UNIMARC');
271
    $dbh->rollback;
281
    $dbh->rollback;
272
};
282
};
273
283
274
subtest 'NORMARC' => sub {
284
subtest 'NORMARC' => sub {
275
    plan tests => 27;
285
    plan tests => 28;
276
    run_tests('NORMARC');
286
    run_tests('NORMARC');
277
    $dbh->rollback;
287
    $dbh->rollback;
278
};
288
};
279
- 

Return to bug 14306