Bug 27454

Summary: Additional patron attributes change sequence on every reload of edit page
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: PatronsAssignee: Martin Renvoize <martin.renvoize>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: trivial    
Priority: P5 - low CC: andrewfh, caroline.cyr-la-rose, david, fridolin.somers, gmcharlt, jonathan.druart, kyle.m.hall, martin.renvoize, victor
Version: MainKeywords: Academy
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes the order that additional patron attributes are displayed on the patron edit form. They are now sorted by the attribute code, before this they displayed in a random order.
Version(s) released in:
21.05.00,20.11.03,20.05.09
Attachments: Bug 27454: Add sorting of patron attributes
Bug 27454 - Display of paytron attributes after apply patch
Bug 27454: Pass the arrayref
Bug 27454: Add sorting of patron attributes
Bug 27454: Pass the arrayref
Bug 27454: Add sorting of patron attributes
Bug 27454: Pass the arrayref

Description Katrin Fischer 2021-01-17 15:59:08 UTC
This is a bit irritating and makes it a little harder when you want to fill out the form quickly.

To test:
- Create 2 PA_CLASS values and an empty one
- Create 3 patron attributes, one for each (I had A, B and the preinstalled SHOW_BCODE)
- Open any patron form for editing
- Note sequence of additional attributes
- Reload page
- Verify the sequence changes with reloads
Comment 1 Martin Renvoize 2021-01-17 20:05:58 UTC
I noticed this.. it's due to hash order randomisation I believe.. pretty sure I identified where it could be fixed.. will take a look on Monday
Comment 2 Martin Renvoize 2021-01-18 10:29:03 UTC
Created attachment 115238 [details] [review]
Bug 27454: Add sorting of patron attributes

This patch adds sorting on class code for the patrons attributes forms
on the memberentry page.

Test plan
1) Create a couple of different patron attributes
2) Go to the patron add page
3) Note the order in which the patron attributes load at the bottom of
   the page.
4) Reload the page and note the order of those attribues may change (if
   it doesn't, try reloading again.. it's random)
5) Apply the patch
6) Reload the page a few times and confirm the attributes are now
   ordered.
7) Signoff
Comment 3 David Nind 2021-02-03 10:12:37 UTC
Created attachment 116244 [details]
Bug 27454 - Display of paytron attributes after apply patch

Hi Martin.

I could replicate the problem, but after applying the patch the display of the additional attributes goes really weird - see screenshot.

I created three patron attrributes: PA0, PA1, and PA2. I flushed the cached and restarted all after applying the patch.

David
Comment 4 Jonathan Druart 2021-02-03 12:55:12 UTC
Created attachment 116254 [details] [review]
Bug 27454: Pass the arrayref

Otherwise you mess with the following hash elements :)
Comment 5 David Nind 2021-02-03 18:41:19 UTC
Created attachment 116291 [details] [review]
Bug 27454: Add sorting of patron attributes

This patch adds sorting on class code for the patrons attributes forms
on the memberentry page.

Test plan
1) Create a couple of different patron attributes
2) Go to the patron add page
3) Note the order in which the patron attributes load at the bottom of
   the page.
4) Reload the page and note the order of those attribues may change (if
   it doesn't, try reloading again.. it's random)
5) Apply the patch
6) Reload the page a few times and confirm the attributes are now
   ordered.
7) Signoff

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 David Nind 2021-02-03 18:41:23 UTC
Created attachment 116292 [details] [review]
Bug 27454: Pass the arrayref

Otherwise you mess with the following hash elements :)

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 Martin Renvoize 2021-02-03 20:16:22 UTC
Oops, thanks for the fix Jonathan.
Comment 8 Katrin Fischer 2021-02-07 11:35:22 UTC
Created attachment 116461 [details] [review]
Bug 27454: Add sorting of patron attributes

This patch adds sorting on class code for the patrons attributes forms
on the memberentry page.

Test plan
1) Create a couple of different patron attributes
2) Go to the patron add page
3) Note the order in which the patron attributes load at the bottom of
   the page.
4) Reload the page and note the order of those attribues may change (if
   it doesn't, try reloading again.. it's random)
5) Apply the patch
6) Reload the page a few times and confirm the attributes are now
   ordered.
7) Signoff

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Katrin Fischer 2021-02-07 11:35:25 UTC
Created attachment 116462 [details] [review]
Bug 27454: Pass the arrayref

Otherwise you mess with the following hash elements :)

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Jonathan Druart 2021-02-08 13:57:43 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 11 Fridolin Somers 2021-02-12 13:47:18 UTC
Pushed to 20.11.x for 20.11.03
Comment 12 Andrew Fuerste-Henry 2021-02-18 13:26:37 UTC
Pushed to 20.05.x for 20.05.09
Comment 13 Victor Grousset/tuxayo 2021-02-21 00:16:35 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.