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

(-)a/C4/Biblio.pm (-14 / +10 lines)
Lines 1772-1793 sub GetMarcNotes { Link Here
1772
    my %blacklist = map { $_ => 1 } split(/,/,C4::Context->preference('NotesBlacklist'));
1772
    my %blacklist = map { $_ => 1 } split(/,/,C4::Context->preference('NotesBlacklist'));
1773
    foreach my $field ( $record->field($scope) ) {
1773
    foreach my $field ( $record->field($scope) ) {
1774
        my $tag = $field->tag();
1774
        my $tag = $field->tag();
1775
        if (!$blacklist{$tag}) {
1775
        next if $blacklist{$tag};
1776
            my $value = $field->as_string();
1776
1777
            if ( $note ne "" ) {
1777
        my $value = $field->as_string();
1778
                $marcnote = { marcnote => $note, };
1778
        if( $marcflavour ne 'UNIMARC' && $tag =~ /555/ ) {
1779
                push @marcnotes, $marcnote;
1779
            my @sub= $field->subfield('u');
1780
                $note = $value;
1780
            foreach my $s (@sub) {
1781
            }
1781
                next if $s !~ /^http/;
1782
            if ( $note ne $value ) {
1782
                my $i= index( $value, $s);
1783
                $note = $note . " " . $value;
1783
                $value= substr( $value,0, $i) . "<a href=\"$s\" target=\"_blank\">$s</a>" . substr( $value, $i + length($s) );
1784
            }
1784
            }
1785
        }
1785
        }
1786
    }
1786
        push @marcnotes, { marcnote => $value };
1787
1788
    if ($note) {
1789
        $marcnote = { marcnote => $note };
1790
        push @marcnotes, $marcnote;    #load last tag into array
1791
    }
1787
    }
1792
    return \@marcnotes;
1788
    return \@marcnotes;
1793
}    # end GetMarcNotes
1789
}    # end GetMarcNotes
(-)a/basket/sendbasket.pl (-2 lines)
Lines 73-79 if ( $email_add ) { Link Here
73
        my $dat              = GetBiblioData($biblionumber);
73
        my $dat              = GetBiblioData($biblionumber);
74
        next unless $dat;
74
        next unless $dat;
75
        my $record           = GetMarcBiblio($biblionumber, 1);
75
        my $record           = GetMarcBiblio($biblionumber, 1);
76
        my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
77
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
76
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
78
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
77
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
79
78
Lines 85-91 if ( $email_add ) { Link Here
85
        }
84
        }
86
	
85
	
87
86
88
        $dat->{MARCNOTES}      = $marcnotesarray;
89
        $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
87
        $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
90
        $dat->{MARCAUTHORS}    = $marcauthorsarray;
88
        $dat->{MARCAUTHORS}    = $marcauthorsarray;
91
        $dat->{HASAUTHORS}     = $hasauthors;
89
        $dat->{HASAUTHORS}     = $hasauthors;
(-)a/opac/opac-sendbasket.pl (-2 lines)
Lines 86-92 if ( $email_add ) { Link Here
86
        my $dat              = GetBiblioData($biblionumber);
86
        my $dat              = GetBiblioData($biblionumber);
87
        next unless $dat;
87
        next unless $dat;
88
        my $record           = GetMarcBiblio($biblionumber, 1);
88
        my $record           = GetMarcBiblio($biblionumber, 1);
89
        my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
90
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
89
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
91
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
90
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
92
91
Lines 98-104 if ( $email_add ) { Link Here
98
        }
97
        }
99
	
98
	
100
99
101
        $dat->{MARCNOTES}      = $marcnotesarray;
102
        $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
100
        $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
103
        $dat->{MARCAUTHORS}    = $marcauthorsarray;
101
        $dat->{MARCAUTHORS}    = $marcauthorsarray;
104
        $dat->{HASAUTHORS}     = $hasauthors;
102
        $dat->{HASAUTHORS}     = $hasauthors;
(-)a/t/db_dependent/Biblio.t (-5 / +14 lines)
Lines 191-197 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");
197
    my $newincbiblioitemnumber=$biblioitemnumber+1;
196
    my $newincbiblioitemnumber=$biblioitemnumber+1;
Lines 207-212 sub run_tests { Link Here
207
        $biblioitemnumbertotest = $updatedrecord->field($biblioitem_tag)->subfield($biblioitem_subfield);
206
        $biblioitemnumbertotest = $updatedrecord->field($biblioitem_tag)->subfield($biblioitem_subfield);
208
    }
207
    }
209
    is ($newincbiblioitemnumber, $biblioitemnumbertotest);
208
    is ($newincbiblioitemnumber, $biblioitemnumbertotest);
209
210
    # test for GetMarcNotes
211
    my $a1= GetMarcNotes( $marc_record, $marcflavour );
212
    my $field2 = MARC::Field->new( $marcflavour eq 'UNIMARC'? 300: 555, 0, '', a=> 'Some text', u=> 'http://url-1.com', u=> 'nohttp://something_else' );
213
    $marc_record->append_fields( $field2 );
214
    my $a2= GetMarcNotes( $marc_record, $marcflavour );
215
    my $last= @$a2? $a2->[@$a2-1]->{marcnote}: '';
216
    is( @$a2 == @$a1 + 1 && (
217
        ( $marcflavour eq 'UNIMARC' && $last eq $field2->as_string() ) ||
218
        ( $marcflavour ne 'UNIMARC' && $last =~ /\<a href=/ )),
219
        1, 'Test for GetMarcNotes' );
210
}
220
}
211
221
212
sub mock_marcfromkohafield {
222
sub mock_marcfromkohafield {
Lines 273-291 sub create_issn_field { Link Here
273
}
283
}
274
284
275
subtest 'MARC21' => sub {
285
subtest 'MARC21' => sub {
276
    plan tests => 28;
286
    plan tests => 29;
277
    run_tests('MARC21');
287
    run_tests('MARC21');
278
    $dbh->rollback;
288
    $dbh->rollback;
279
};
289
};
280
290
281
subtest 'UNIMARC' => sub {
291
subtest 'UNIMARC' => sub {
282
    plan tests => 28;
292
    plan tests => 29;
283
    run_tests('UNIMARC');
293
    run_tests('UNIMARC');
284
    $dbh->rollback;
294
    $dbh->rollback;
285
};
295
};
286
296
287
subtest 'NORMARC' => sub {
297
subtest 'NORMARC' => sub {
288
    plan tests => 28;
298
    plan tests => 29;
289
    run_tests('NORMARC');
299
    run_tests('NORMARC');
290
    $dbh->rollback;
300
    $dbh->rollback;
291
};
301
};
292
- 

Return to bug 14306