Bugzilla – Attachment 58928 Details for
Bug 17196
Move marcxml out of the biblioitems table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17196: Simplify tests for the different marc flavours
Bug-17196-Simplify-tests-for-the-different-marc-fl.patch (text/plain), 5.89 KB, created by
Marcel de Rooy
on 2017-01-13 09:41:18 UTC
(
hide
)
Description:
Bug 17196: Simplify tests for the different marc flavours
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-01-13 09:41:18 UTC
Size:
5.89 KB
patch
obsolete
>From a6c64b10ec623599b5f7fdeabb669d52b9f48688 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 29 Sep 2016 13:24:12 +0100 >Subject: [PATCH] Bug 17196: Simplify tests for the different marc flavours >Content-Type: text/plain; charset=utf-8 > >centralize the way MARC field are set. > >Signed-off-by: Mason James <mtj@kohaaloha.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >Signed-off-by: Zeno Tajoli <z.tajoli@cineca.it> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Biblio.t | 74 +++++++++++++++++++++++++++++-------------------- > 1 file changed, 44 insertions(+), 30 deletions(-) > >diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t >index 951288c..e6427f4 100755 >--- a/t/db_dependent/Biblio.t >+++ b/t/db_dependent/Biblio.t >@@ -66,29 +66,22 @@ $biblio_module->mock( > sub { > my ($self) = shift; > >- if ( C4::Context->preference('marcflavour') eq 'MARC21' >- || C4::Context->preference('marcflavour') eq 'NORMARC' ) { >- >- return { >- 'biblio.title' => { tagfield => '245', tagsubfield => 'a' }, >- 'biblio.biblionumber' => { tagfield => '999', tagsubfield => 'c' }, >- 'biblioitems.isbn' => { tagfield => '020', tagsubfield => 'a' }, >- 'biblioitems.issn' => { tagfield => '022', tagsubfield => 'a' }, >- 'biblioitems.biblioitemnumber' => { tagfield => '999', tagsubfield => 'd' }, >- 'items.itemnumber' => { tagfield => '952', tagsubfield => '9' }, >- }; >- } elsif ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { >- >- return { >- 'biblio.title' => { tagfield => '200', tagsubfield => 'a' }, >- 'biblio.biblionumber' => { tagfield => '999', tagsubfield => 'c' }, >- 'biblioitems.isbn' => { tagfield => '010', tagsubfield => 'a' }, >- 'biblioitems.issn' => { tagfield => '011', tagsubfield => 'a' }, >- 'biblioitems.biblioitemnumber' => { tagfield => '090', tagsubfield => 'a' }, >- 'items.itemnumber' => { tagfield => '995', tagsubfield => '9' }, >- }; >- } >- } >+ my ( $title_field, $title_subfield ) = get_title_field(); >+ my ( $isbn_field, $isbn_subfield ) = get_isbn_field(); >+ my ( $issn_field, $issn_subfield ) = get_issn_field(); >+ my ( $biblionumber_field, $biblionumber_subfield ) = ( '999', 'c' ); >+ my ( $biblioitemnumber_field, $biblioitemnumber_subfield ) = ( '999', '9' ); >+ my ( $itemnumber_field, $itemnumber_subfield ) = get_itemnumber_field(); >+ >+ return { >+ 'biblio.title' => { tagfield => $title_field, tagsubfield => $title_subfield }, >+ 'biblio.biblionumber' => { tagfield => $biblionumber_field, tagsubfield => $biblionumber_subfield }, >+ 'biblioitems.isbn' => { tagfield => $isbn_field, tagsubfield => $isbn_subfield }, >+ 'biblioitems.issn' => { tagfield => $issn_field, tagsubfield => $issn_subfield }, >+ 'biblioitems.biblioitemnumber' => { tagfield => $biblioitemnumber_field, tagsubfield => $biblioitemnumber_subfield }, >+ 'items.itemnumber' => { tagfield => $itemnumber_subfield, tagsubfield => $itemnumber_subfield }, >+ }; >+ } > ); > > my $currency = new Test::MockModule('Koha::Acquisition::Currencies'); >@@ -275,11 +268,31 @@ sub run_tests { > 'Check the number of returned notes of GetMarcNotes' ); > } > >+sub get_title_field { >+ my $marc_flavour = C4::Context->preference('marcflavour'); >+ return ( $marc_flavour eq 'UNIMARC' ) ? ( '200', 'a' ) : ( '245', 'a' ); >+} >+ >+sub get_isbn_field { >+ my $marc_flavour = C4::Context->preference('marcflavour'); >+ return ( $marc_flavour eq 'UNIMARC' ) ? ( '010', 'a' ) : ( '020', 'a' ); >+} >+ >+sub get_issn_field { >+ my $marc_flavour = C4::Context->preference('marcflavour'); >+ return ( $marc_flavour eq 'UNIMARC' ) ? ( '011', 'a' ) : ( '022', 'a' ); >+} >+ >+sub get_itemnumber_field { >+ my $marc_flavour = C4::Context->preference('marcflavour'); >+ return ( $marc_flavour eq 'UNIMARC' ) ? ( '995', '9' ) : ( '952', '9' ); >+} >+ > sub create_title_field { > my ( $title, $marcflavour ) = @_; > >- my $title_field = ( $marcflavour eq 'UNIMARC' ) ? '200' : '245'; >- my $field = MARC::Field->new( $title_field,'','','a' => $title); >+ my ( $title_field, $title_subfield ) = get_title_field(); >+ my $field = MARC::Field->new( $title_field, '', '', $title_subfield => $title ); > > return $field; > } >@@ -287,10 +300,11 @@ sub create_title_field { > sub create_isbn_field { > my ( $isbn, $marcflavour ) = @_; > >- my $isbn_field = ( $marcflavour eq 'UNIMARC' ) ? '010' : '020'; >- my $field = MARC::Field->new( $isbn_field,'','','a' => $isbn); >+ my ( $isbn_field, $isbn_subfield ) = get_isbn_field(); >+ my $field = MARC::Field->new( $isbn_field, '', '', $isbn_subfield => $isbn ); >+ > # Add the price subfield >- my $price_subfield = ( $marcflavour eq 'UNIMARC' ) ? 'd' : 'c' ; >+ my $price_subfield = ( $marcflavour eq 'UNIMARC' ) ? 'd' : 'c'; > $field->add_subfields( $price_subfield => '$100' ); > > return $field; >@@ -299,8 +313,8 @@ sub create_isbn_field { > sub create_issn_field { > my ( $issn, $marcflavour ) = @_; > >- my $issn_field = ( $marcflavour eq 'UNIMARC' ) ? '011' : '022'; >- my $field = MARC::Field->new( $issn_field,'','','a' => $issn); >+ my ( $issn_field, $issn_subfield ) = get_issn_field(); >+ my $field = MARC::Field->new( $issn_field, '', '', $issn_subfield => $issn ); > > return $field; > } >-- >2.1.4
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 17196
:
54910
|
54911
|
54912
|
54913
|
54914
|
54918
|
55856
|
55857
|
55858
|
55859
|
55860
|
55904
|
55905
|
55906
|
55907
|
55908
|
55921
|
55922
|
55950
|
55951
|
56038
|
57835
|
57836
|
57837
|
57838
|
57839
|
57840
|
57841
|
57842
|
58000
|
58007
|
58008
|
58023
|
58024
|
58025
|
58026
|
58027
|
58028
|
58029
|
58030
|
58031
|
58032
|
58037
|
58038
|
58039
|
58040
|
58041
|
58042
|
58043
|
58044
|
58045
|
58046
|
58047
|
58048
|
58504
|
58505
|
58506
|
58507
|
58508
|
58509
|
58510
|
58511
|
58512
|
58513
|
58514
|
58516
|
58517
|
58923
|
58924
|
58925
|
58926
|
58927
| 58928 |
58929
|
58930
|
58931
|
58932
|
58933
|
58934
|
58935
|
58936
|
58937
|
58938
|
58939
|
58943
|
58946
|
58947