@@ -, +, @@
Notes/Descriptions
555$u in a html anchor tag.
A closer look revealed that the data was not used; the notes in the
mail of sendbasket are taken from GetBiblioData.
Descriptions.
Verify that you have something in Notes (from 500$a).
---
C4/Biblio.pm | 24 ++++++++++--------------
basket/sendbasket.pl | 2 --
opac/opac-sendbasket.pl | 2 --
t/db_dependent/Biblio.t | 18 ++++++++++++++----
4 files changed, 24 insertions(+), 22 deletions(-)
--- a/C4/Biblio.pm
+++ a/C4/Biblio.pm
@@ -1772,22 +1772,18 @@ sub GetMarcNotes {
my %blacklist = map { $_ => 1 } split(/,/,C4::Context->preference('NotesBlacklist'));
foreach my $field ( $record->field($scope) ) {
my $tag = $field->tag();
- if (!$blacklist{$tag}) {
- my $value = $field->as_string();
- if ( $note ne "" ) {
- $marcnote = { marcnote => $note, };
- push @marcnotes, $marcnote;
- $note = $value;
- }
- if ( $note ne $value ) {
- $note = $note . " " . $value;
+ next if $blacklist{$tag};
+
+ my $value = $field->as_string();
+ if( $marcflavour ne 'UNIMARC' && $tag =~ /555/ ) {
+ my @sub= $field->subfield('u');
+ foreach my $s (@sub) {
+ next if $s !~ /^http/;
+ my $i= index( $value, $s);
+ $value= substr( $value,0, $i) . "$s" . substr( $value, $i + length($s) );
}
}
- }
-
- if ($note) {
- $marcnote = { marcnote => $note };
- push @marcnotes, $marcnote; #load last tag into array
+ push @marcnotes, { marcnote => $value };
}
return \@marcnotes;
} # end GetMarcNotes
--- a/basket/sendbasket.pl
+++ a/basket/sendbasket.pl
@@ -73,7 +73,6 @@ if ( $email_add ) {
my $dat = GetBiblioData($biblionumber);
next unless $dat;
my $record = GetMarcBiblio($biblionumber, 1);
- my $marcnotesarray = GetMarcNotes( $record, $marcflavour );
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
@@ -85,7 +84,6 @@ if ( $email_add ) {
}
- $dat->{MARCNOTES} = $marcnotesarray;
$dat->{MARCSUBJCTS} = $marcsubjctsarray;
$dat->{MARCAUTHORS} = $marcauthorsarray;
$dat->{HASAUTHORS} = $hasauthors;
--- a/opac/opac-sendbasket.pl
+++ a/opac/opac-sendbasket.pl
@@ -86,7 +86,6 @@ if ( $email_add ) {
my $dat = GetBiblioData($biblionumber);
next unless $dat;
my $record = GetMarcBiblio($biblionumber, 1);
- my $marcnotesarray = GetMarcNotes( $record, $marcflavour );
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
@@ -98,7 +97,6 @@ if ( $email_add ) {
}
- $dat->{MARCNOTES} = $marcnotesarray;
$dat->{MARCSUBJCTS} = $marcsubjctsarray;
$dat->{MARCAUTHORS} = $marcauthorsarray;
$dat->{HASAUTHORS} = $hasauthors;
--- a/t/db_dependent/Biblio.t
+++ a/t/db_dependent/Biblio.t
@@ -191,7 +191,6 @@ sub run_tests {
"(GetMarcISBN) Corretly retrieves ISBN #". ($i + 1));
}
-
is( GetMarcPrice( $record_for_isbn, $marcflavour ), 100,
"GetMarcPrice returns the correct value");
my $newincbiblioitemnumber=$biblioitemnumber+1;
@@ -207,6 +206,17 @@ sub run_tests {
$biblioitemnumbertotest = $updatedrecord->field($biblioitem_tag)->subfield($biblioitem_subfield);
}
is ($newincbiblioitemnumber, $biblioitemnumbertotest);
+
+ # test for GetMarcNotes
+ my $a1= GetMarcNotes( $marc_record, $marcflavour );
+ my $field2 = MARC::Field->new( $marcflavour eq 'UNIMARC'? 300: 555, 0, '', a=> 'Some text', u=> 'http://url-1.com', u=> 'nohttp://something_else' );
+ $marc_record->append_fields( $field2 );
+ my $a2= GetMarcNotes( $marc_record, $marcflavour );
+ my $last= @$a2? $a2->[@$a2-1]->{marcnote}: '';
+ is( @$a2 == @$a1 + 1 && (
+ ( $marcflavour eq 'UNIMARC' && $last eq $field2->as_string() ) ||
+ ( $marcflavour ne 'UNIMARC' && $last =~ /\ sub {
- plan tests => 28;
+ plan tests => 29;
run_tests('MARC21');
$dbh->rollback;
};
subtest 'UNIMARC' => sub {
- plan tests => 28;
+ plan tests => 29;
run_tests('UNIMARC');
$dbh->rollback;
};
subtest 'NORMARC' => sub {
- plan tests => 28;
+ plan tests => 29;
run_tests('NORMARC');
$dbh->rollback;
};
--