Bug 25137

Summary: PatronSelfRegistrationLibraryList results in empty branch list on opac-memberentry.pl
Product: Koha Reporter: Andrew Fuerste-Henry <andrewfh>
Component: OPACAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: 1joynelson, bgkriegel, jonathan.druart, lucas, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00
Bug Depends on: 23084    
Bug Blocks: 25136    
Attachments: Bug 25137: (bug 23084 follow-up) Fix incorrect grep ternary condition
Bug 25137: (bug 23084 follow-up) Fix incorrect grep ternary condition
Bug 25137: (bug 23084 follow-up) Fix incorrect grep ternary condition

Description Andrew Fuerste-Henry 2020-04-13 19:48:46 UTC
Putting any value into PatronSelfRegistrationLibraryList results in a completely empty branch list on opac-memberentry.pl for both self-reg and self-mod. 
To Test:
- confirm you have a branch with code X
- confirm PatronSelfRegistrationBorrowerUnwantedField and PatronSelfModificationBorrowerUnwantedField are empty
- enter X in PatronSelfRegistrationLibraryList
- go to cgi-bin/koha/opac-memberentry.pl (either as a logged in patron or as a self-reg patron)
- confirm branch dropdown is empty
- empty out PatronSelfRegistrationLibraryList
- reload cgi-bin/koha/opac-memberentry.pl and confirm branches show

Found this while trying to test a bug around this same syspref in 19.05, bug 25136
Comment 1 Jonathan Druart 2020-04-14 09:59:48 UTC
Caused by
  commit 82716a01727f143ba2c167cd86233a531f330390
  Bug 23084: Replace grep {^$var$} with grep {$_ eq $var}
Comment 2 Jonathan Druart 2020-04-14 10:01:57 UTC
Created attachment 102917 [details] [review]
Bug 25137: (bug 23084 follow-up) Fix incorrect grep ternary condition

The lack of parenthesis makes the condition evaluated wrong.

Test plan:
- confirm you have a branch with code X
- enter X in PatronSelfRegistrationLibraryList
- go to cgi-bin/koha/opac-memberentry.pl (either as a logged in patron or as a self-reg patron)
- confirm branch dropdown is not empty and contain X
- empty out PatronSelfRegistrationLibraryList
- reload cgi-bin/koha/opac-memberentry.pl and confirm branches show
Comment 3 Jonathan Druart 2020-04-14 10:04:26 UTC
@QA I did check the other occurrences modified by bug 23084 and they appear correct. Another look would be good anyway!
Comment 4 Bernardo Gonzalez Kriegel 2020-04-14 10:47:11 UTC
Was the lack of () the reason?
If that is the case perhaps C4/Utils/DataTables/Members.pm lines 59/60

Why write a logical test not surrounded by parenthesis?

Tested, fix the error.
Comment 5 Bernardo Gonzalez Kriegel 2020-04-14 10:52:49 UTC
Created attachment 102921 [details] [review]
Bug 25137: (bug 23084 follow-up) Fix incorrect grep ternary condition

The lack of parenthesis makes the condition evaluated wrong.

Test plan:
- confirm you have a branch with code X
- enter X in PatronSelfRegistrationLibraryList
- go to cgi-bin/koha/opac-memberentry.pl (either as a logged in patron or as a self-reg patron)
- confirm branch dropdown is not empty and contain X
- empty out PatronSelfRegistrationLibraryList
- reload cgi-bin/koha/opac-memberentry.pl and confirm branches show

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment 9 Katrin Fischer 2020-04-14 21:39:48 UTC
Created attachment 102951 [details] [review]
Bug 25137: (bug 23084 follow-up) Fix incorrect grep ternary condition

The lack of parenthesis makes the condition evaluated wrong.

Test plan:
- confirm you have a branch with code X
- enter X in PatronSelfRegistrationLibraryList
- go to cgi-bin/koha/opac-memberentry.pl (either as a logged in patron or as a self-reg patron)
- confirm branch dropdown is not empty and contain X
- empty out PatronSelfRegistrationLibraryList
- reload cgi-bin/koha/opac-memberentry.pl and confirm branches show

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Martin Renvoize 2020-04-15 07:35:57 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 11 Joy Nelson 2020-05-05 22:32:18 UTC
missing dependencies - not backported to 19.11.x