Bugzilla – Attachment 94262 Details for
Bug 17359
Patron import results use wrong encoding
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17359: Correct encoding when displaying patron import summary
Bug-17359-Correct-encoding-when-displaying-patron-.patch (text/plain), 4.19 KB, created by
Jonathan Druart
on 2019-10-16 08:53:10 UTC
(
hide
)
Description:
Bug 17359: Correct encoding when displaying patron import summary
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-10-16 08:53:10 UTC
Size:
4.19 KB
patch
obsolete
>From c02677b3e31acab4a97cc0cd500613b6efb6dd8d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 16 Oct 2019 10:47:28 +0200 >Subject: [PATCH] Bug 17359: Correct encoding when displaying patron import > summary >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >There is an encoding issue when the patron import summry, the string >must be UTF8 decoded before being sent to the template. > >Test plan: >- Create a patron import CSV file with import issues. Use UTF8 characters. >See file attached to the bug report 'patron_import.csv' >=> The screen should display the line correctly >- Correct the import issue (add a surname for Chloé) >=> The imported patrons should contain the correct values. >--- > Koha/Patrons/Import.pm | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > >diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm >index 3575b8a4e2..cb3ba56134 100644 >--- a/Koha/Patrons/Import.pm >+++ b/Koha/Patrons/Import.pm >@@ -21,6 +21,7 @@ use namespace::clean; > > use Carp; > use Text::CSV; >+use Encode qw( decode_utf8 ); > > use C4::Members; > use C4::Members::Attributes qw(:all); >@@ -101,7 +102,7 @@ sub import_patrons { > my $status = $self->text_csv->parse($borrowerline); > my @columns = $self->text_csv->fields(); > if ( !$status ) { >- push @missing_criticals, { badparse => 1, line => $line_number, lineraw => $borrowerline }; >+ push @missing_criticals, { badparse => 1, line => $line_number, lineraw => decode_utf8($borrowerline) }; > } > elsif ( @columns == @columnkeys ) { > @borrower{@columnkeys} = @columns; >@@ -125,7 +126,7 @@ sub import_patrons { > elsif ( scalar grep { $key eq $_ } @criticals ) { > > # a critical field is undefined >- push @missing_criticals, { key => $key, line => $., lineraw => $borrowerline }; >+ push @missing_criticals, { key => $key, line => $., lineraw => decode_utf8($borrowerline) }; > } > else { > $borrower{$key} = ''; >@@ -483,14 +484,14 @@ sub check_branch_code { > > # No branch code > unless( $branchcode ) { >- push (@$missing_criticals, { key => 'branchcode', line => $line_number, lineraw => $borrowerline, }); >+ push (@$missing_criticals, { key => 'branchcode', line => $line_number, lineraw => decode_utf8($borrowerline), }); > return; > } > > # look for branch code > my $library = Koha::Libraries->find( $branchcode ); > unless( $library ) { >- push (@$missing_criticals, { key => 'branchcode', line => $line_number, lineraw => $borrowerline, >+ push (@$missing_criticals, { key => 'branchcode', line => $line_number, lineraw => decode_utf8($borrowerline), > value => $branchcode, branch_map => 1, }); > } > } >@@ -508,14 +509,14 @@ sub check_borrower_category { > > # No branch code > unless( $categorycode ) { >- push (@$missing_criticals, { key => 'categorycode', line => $line_number, lineraw => $borrowerline, }); >+ push (@$missing_criticals, { key => 'categorycode', line => $line_number, lineraw => decode_utf8($borrowerline), }); > return; > } > > # Looking for borrower category > my $category = Koha::Patron::Categories->find($categorycode); > unless( $category ) { >- push (@$missing_criticals, { key => 'categorycode', line => $line_number, lineraw => $borrowerline, >+ push (@$missing_criticals, { key => 'categorycode', line => $line_number, lineraw => decode_utf8($borrowerline), > value => $categorycode, category_map => 1, }); > } > } >@@ -540,7 +541,7 @@ sub format_dates { > $params->{borrower}->{$date_type} = $formatted_date; > } else { > $params->{borrower}->{$date_type} = ''; >- push (@{$params->{missing_criticals}}, { key => $date_type, line => $params->{line}, lineraw => $params->{lineraw}, bad_date => 1 }); >+ push (@{$params->{missing_criticals}}, { key => $date_type, line => $params->{line}, lineraw => decode_utf8($params->{lineraw}), bad_date => 1 }); > } > } > } >-- >2.11.0
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 17359
:
93926
|
93927
|
93928
|
93929
|
93942
|
94261
|
94262
|
94263
|
94809
|
94810
|
95042
|
95057
|
95058
|
95059