Bugzilla – Attachment 48681 Details for
Bug 14306
Show URL from MARC21 field 555$u in basket and detail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 14306: Show URL from MARC21 field 555$u under Title Notes/Descriptions
PASSED-QA-Bug-14306-Show-URL-from-MARC21-field-555.patch (text/plain), 6.13 KB, created by
Katrin Fischer
on 2016-03-04 13:22:51 UTC
(
hide
)
Description:
[PASSED QA] Bug 14306: Show URL from MARC21 field 555$u under Title Notes/Descriptions
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2016-03-04 13:22:51 UTC
Size:
6.13 KB
patch
obsolete
>From 3f1c406f50268fe17272ca77cb7b219e8c2f6636 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 1 Jun 2015 12:58:25 +0200 >Subject: [PATCH] [PASSED QA] Bug 14306: Show URL from MARC21 field 555$u under > Title Notes/Descriptions >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch includes: >[1] Add some logic to GetMarcNotes to embed the contents of MARC21 field > 555$u in a html anchor tag. >[2] Add a unit test for GetMarcNotes in Biblio.t >[3] Remove calls to GetMarcNotes from sendbasket.pl (opac and staff). > A closer look revealed that the data was not used; the notes in the > mail of sendbasket are taken from GetBiblioData. > >Test plan: >[1] Edit a record. Add one or two URLS in 555$u. Add something in 500$a too. >[2] Check if you can click the URLs in opac and staff detail tab Notes or > Descriptions. >[3] Run the unit test t/db../Biblio.t >[4] Add something in the cart. Click More Details and send the cart. > Verify that you have something in Notes (from 500$a). > >Signed-off-by: Marc Veron <veron@veron.ch> >Followed test plan. Works as expected. QA tools OK. > >Tested with all patches together, works as expected >Signed-off-by: Marc Véron <veron@veron.ch> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > 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(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index a2b1d0a..d1ac772 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -1794,22 +1794,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) . "<a href=\"$s\" target=\"_blank\">$s</a>" . 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 >diff --git a/basket/sendbasket.pl b/basket/sendbasket.pl >index 83dab55..254d9ff 100755 >--- a/basket/sendbasket.pl >+++ b/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; >diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl >index 6b2d62f..97b64fd 100755 >--- a/opac/opac-sendbasket.pl >+++ b/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; >diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t >index 1023798..c232384 100755 >--- a/t/db_dependent/Biblio.t >+++ b/t/db_dependent/Biblio.t >@@ -199,7 +199,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; >@@ -215,6 +214,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 =~ /\<a href=/ )), >+ 1, 'Test for GetMarcNotes' ); > } > > sub mock_marcfromkohafield { >@@ -281,19 +291,19 @@ sub create_issn_field { > } > > subtest 'MARC21' => 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; > }; >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14306
:
39737
|
39741
|
41237
|
41987
|
41995
|
42010
|
42011
|
42012
|
42013
|
46221
|
46251
|
46252
|
46253
|
46254
| 48681 |
48682
|
48683
|
48684