Bugzilla – Attachment 70236 Details for
Bug 11046
Better handling of uncertain years for publicationyear/copyrightdate
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11046: Add the form YYY-? for uncertain years
Bug-11046-Add-the-form-YYY--for-uncertain-years.patch (text/plain), 2.33 KB, created by
Josef Moravec
on 2018-01-02 21:04:06 UTC
(
hide
)
Description:
Bug 11046: Add the form YYY-? for uncertain years
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-01-02 21:04:06 UTC
Size:
2.33 KB
patch
obsolete
>From ed1920ebb3a3ff672138336f01acbfd5f861954d Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 28 Aug 2017 13:14:08 +0200 >Subject: [PATCH] Bug 11046: Add the form YYY-? for uncertain years > >This form occurred in Dutch ISBD rules. >The question mark should follow the hyphen(s). > >Test plan: >Run t/db_dependent/Biblio/TransformMarcToKoha.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >TransformMarcToKoha tests passed. Also this patch passed QA test tool > >Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > C4/Biblio.pm | 4 ++++ > t/db_dependent/Biblio/TransformMarcToKoha.t | 4 +++- > 2 files changed, 7 insertions(+), 1 deletion(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index d4e007d..b910f40 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -2703,6 +2703,10 @@ sub _adjust_pubyear { > } elsif( $retval =~ m/(\d)[.Xx?]{3}|(\d\d)[.Xx?]{2}|(\d{3})[.Xx?]/ ) { > my $digits = $1 || $2 || $3; > $retval = $digits * ( 10 ** ( 4 - length($digits) )); >+ } elsif( $retval =~ m/(\d)[-]{3}\?|(\d\d)[-]{2}\?|(\d{3})[-]\?/ ) { >+ # the form 198-? occurred in Dutch ISBD rules >+ my $digits = $1 || $2 || $3; >+ $retval = $digits * ( 10 ** ( 4 - length($digits) )); > } > return $retval; > } >diff --git a/t/db_dependent/Biblio/TransformMarcToKoha.t b/t/db_dependent/Biblio/TransformMarcToKoha.t >index 3a47c56..b9c02a8 100644 >--- a/t/db_dependent/Biblio/TransformMarcToKoha.t >+++ b/t/db_dependent/Biblio/TransformMarcToKoha.t >@@ -94,7 +94,7 @@ subtest 'Multiple mappings for one kohafield' => sub { > }; > > subtest 'Testing _adjust_pubyear' => sub { >- plan tests => 8; >+ plan tests => 10; > > is( C4::Biblio::_adjust_pubyear('2004 c2000 2007'), 2000, 'First cYEAR' ); > is( C4::Biblio::_adjust_pubyear('2004 2000 2007'), 2004, 'First year' ); >@@ -104,6 +104,8 @@ subtest 'Testing _adjust_pubyear' => sub { > is( C4::Biblio::_adjust_pubyear('1...'), 1000, '1... on its own' ); > is( C4::Biblio::_adjust_pubyear('12?? 13xx'), 1200, '12?? first' ); > is( C4::Biblio::_adjust_pubyear('12? 1x'), '12? 1x', 'Too short' ); >+ is( C4::Biblio::_adjust_pubyear('198-'), '198-', 'Missing question mark' ); >+ is( C4::Biblio::_adjust_pubyear('198-?'), '1980', '198-?' ); > }; > > # Cleanup >-- >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 11046
:
66549
|
66552
|
68349
|
68350
|
70235
| 70236 |
70394