Bug 28293 - Wrong key used in Patrons::Import->generate_patron_attributes
Summary: Wrong key used in Patrons::Import->generate_patron_attributes
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 20443
Blocks: 28220
  Show dependency treegraph
 
Reported: 2021-05-06 10:42 UTC by Jonathan Druart
Modified: 2021-12-13 21:10 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.06,20.05.12


Attachments
Bug 28293: (bug 20443 follow-up) Fix wrong key in Patrons::Import->generate_patron_attributes (1.19 KB, patch)
2021-05-06 10:47 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 28293: (bug 20443 follow-up) Fix wrong key in Patrons::Import->generate_patron_attributes (1.25 KB, patch)
2021-05-11 08:05 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2021-05-06 10:42:28 UTC
Caused by
  commit e37bfe3e4b395ef71a54c65226829248847cf1ce
  Bug 20443: Remove extended_attributes_code_value_arrayref AND C4::Members::Attributes

       sort { $a->{code} cmp $b->{code} || $a->{value} cmp $b->{value} }                                                                                                                                          
       map {                                                                                                                                                                                                      
         my @arr = split /:/, $_, 2;                                                                                                                                                                              
         { code => $arr[0], attribute => $arr[1] } 

First line must be 
      sort { $a->{code} cmp $b->{code} || $a->{attribute} cmp $b->{attribute} }
Comment 1 Jonathan Druart 2021-05-06 10:43:18 UTC
It generates warnings
Use of uninitialized value in string comparison (cmp) at /kohadevbox/koha/Koha/Patrons/Import.pm line 550, <$fh> line 2.                                      

And does not sort correctly (no fallback on the attribute's value for repeatable attributes)
Comment 2 Jonathan Druart 2021-05-06 10:47:08 UTC
Created attachment 120606 [details] [review]
Bug 28293: (bug 20443 follow-up) Fix wrong key in Patrons::Import->generate_patron_attributes

It generates warnings
Use of uninitialized value in string comparison (cmp) at /kohadevbox/koha/Koha/Patrons/Import.pm line 550, <$fh> line 2.

And does not sort correctly (no fallback on the attribute's value for repeatable attributes)
Comment 3 Jonathan Druart 2021-05-06 10:56:56 UTC
Tests on bug 28220 cover this (at least get rid of the warnings)

Test plan: Apply patches from bug 28220. Without this patch you see warnings.
Comment 4 Martin Renvoize 2021-05-11 08:05:22 UTC
Created attachment 120823 [details] [review]
Bug 28293: (bug 20443 follow-up) Fix wrong key in Patrons::Import->generate_patron_attributes

It generates warnings
Use of uninitialized value in string comparison (cmp) at /kohadevbox/koha/Koha/Patrons/Import.pm line 550, <$fh> line 2.

And does not sort correctly (no fallback on the attribute's value for repeatable attributes)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2021-05-11 08:06:14 UTC
Clear fix, works as expected and squashes warnings.. Going straight for QA..
Comment 6 Jonathan Druart 2021-05-11 13:39:41 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 7 Fridolin Somers 2021-05-12 15:11:55 UTC
Pushed to 20.11.x for 20.11.06
Comment 8 Andrew Fuerste-Henry 2021-05-25 13:19:37 UTC
Pushed to 20.05.x for 20.05.12
Comment 9 Victor Grousset/tuxayo 2021-05-25 14:43:15 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.