Bugzilla – Attachment 151205 Details for
Bug 30358
Strip leading/trailing whitespace characters from input fields when cataloguing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30358: (follow-up) Fixing tests and including for inner newlines
Bug-30358-follow-up-Fixing-tests-and-including-for.patch (text/plain), 3.49 KB, created by
Katrin Fischer
on 2023-05-15 18:05:15 UTC
(
hide
)
Description:
Bug 30358: (follow-up) Fixing tests and including for inner newlines
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-05-15 18:05:15 UTC
Size:
3.49 KB
patch
obsolete
>From f0ee16e913799c21d54e904f4189cc0deacc5da0 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 7 Apr 2022 06:03:20 +0000 >Subject: [PATCH] Bug 30358: (follow-up) Fixing tests and including for inner > newlines > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/AuthoritiesMarc.pm | 4 ++-- > C4/Biblio.pm | 4 ++-- > t/db_dependent/Biblio/ModBiblioMarc.t | 12 ++++++------ > 3 files changed, 10 insertions(+), 10 deletions(-) > >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index ce288efa2a..356a4a53f9 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -663,8 +663,8 @@ sub AddAuthority { > foreach my $subfield ( $field->subfields ) { > my $key = $subfield->[0]; > my $value = $subfield->[1]; >- $value =~ s/^\s+|\s+$|^\t+|\t+$|^\n+|\n+$|^\r+|\r+$//g; >- $value =~ s/\n+|\r+/ /g; >+ $value =~ s/[\n\r]+/ /g; >+ $value =~ s/^\s+|\s+$|^\t+|\t+$//g; > $field->update( $key => $value ); > } > } >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 02f5c624ed..ed3b07658b 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -2816,8 +2816,8 @@ sub ModBiblioMarc { > foreach my $subfield ( $field->subfields ) { > my $key = $subfield->[0]; > my $value = $subfield->[1]; >- $value =~ s/^\s+|\s+$|^\t+|\t+$|^\n+|\n+$|^\r+|\r+$//g; >- $value =~ s/\n+|\r+/ /g; >+ $value =~ s/[\n\r]+/ /g; >+ $value =~ s/^\s+|\s+$|^\t+|\t+$//g; > $field->update( $key => $value ); > } > } >diff --git a/t/db_dependent/Biblio/ModBiblioMarc.t b/t/db_dependent/Biblio/ModBiblioMarc.t >index 5312b85e82..5e33cd23e2 100755 >--- a/t/db_dependent/Biblio/ModBiblioMarc.t >+++ b/t/db_dependent/Biblio/ModBiblioMarc.t >@@ -50,24 +50,24 @@ subtest "Check MARC field length calculation" => sub { > subtest "StripWhitespaceChars tests" => sub { > plan tests => 3; > >- t::lib::Mocks->mock_preference('marcflavour', 'MARC21'); >- t::lib::Mocks->mock_preference('StripWhitespaceChars', 0); >+ t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); >+ t::lib::Mocks::mock_preference('StripWhitespaceChars', 0); > > my $biblio = t::lib::TestBuilder->new->build_sample_biblio; > my $record = MARC::Record->new; > $record->append_fields( >- MARC::Field->new( '245', '', '', a => " My title\n" ), >+ MARC::Field->new( '245', '', '', a => " My\ntitle\n" ), > ); > > my $title = $record->title; >- is( $title, " My title\n", 'Title has whitespace characters' ); >+ is( $title, " My\ntitle\n", 'Title has whitespace characters' ); > > C4::Biblio::ModBiblioMarc( $record, $biblio->biblionumber ); > my $savedrec = C4::Biblio::GetMarcBiblio({ biblionumber => $biblio->biblionumber }); > my $savedtitle = $savedrec->title; >- is( $savedtitle, " My title\n", "Title still has whitespace characters because StripWhitespaceChars is disabled" ); >+ is( $savedtitle, " My\ntitle\n", "Title still has whitespace characters because StripWhitespaceChars is disabled" ); > >- t::lib::Mocks->mock_preference('StripWhitespaceChars', 1); >+ t::lib::Mocks::mock_preference('StripWhitespaceChars', 1); > > C4::Biblio::ModBiblioMarc( $record, $biblio->biblionumber ); > my $amendedrec = C4::Biblio::GetMarcBiblio({ biblionumber => $biblio->biblionumber }); >-- >2.30.2
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 30358
:
132202
|
132275
|
132919
|
133055
|
133056
|
133140
|
133224
|
133225
|
134195
|
134453
|
137451
|
137452
|
137453
|
137454
|
137455
|
137456
|
137457
|
139110
|
142905
|
142906
|
142907
|
142908
|
142909
|
142910
|
142911
|
142912
|
143053
|
143057
|
143058
|
143059
|
143060
|
143061
|
143062
|
143063
|
143064
|
143065
|
144120
|
144121
|
144122
|
144123
|
144124
|
144125
|
144126
|
144127
|
144128
|
144129
|
144130
|
144171
|
145308
|
145309
|
145310
|
145311
|
145312
|
145313
|
145314
|
145315
|
145316
|
145317
|
145318
|
151202
|
151203
|
151204
| 151205 |
151206
|
151207
|
151208
|
151210
|
151212
|
151214
|
151215