Bug 21585 - Missing firstnames should be gracefully ignored in ILL requests table
Summary: Missing firstnames should be gracefully ignored in ILL requests table
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: ILL (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Target Milestone: ---
Assignee: Magnus Enger
QA Contact: Josef Moravec
URL:
Whiteboard:
Keywords:
Depends on: 7317
Blocks:
  Show dependency treegraph
 
Reported: 2018-10-16 19:13 UTC by Magnus Enger
Modified: 2018-11-28 14:07 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 21585 - Ignore missing firstname in ILL requests table (1.87 KB, patch)
2018-10-16 19:34 UTC, Magnus Enger
Details | Diff | Splinter Review
Bug 21585 - Ignore missing firstname in ILL requests table (1.93 KB, patch)
2018-10-31 09:27 UTC, Andrew Isherwood
Details | Diff | Splinter Review
Bug 21585: Ignore missing firstname in ILL requests table (1.98 KB, patch)
2018-10-31 13:23 UTC, Josef Moravec
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Enger 2018-10-16 19:13:20 UTC
I have some libraries that are entered into Koha as borrowers, using the surname field for the name of the library and not using the firstname field. When these libraries are listed in the Patron column of the ILL requests table, the missing firstname is shown as "null", so the name is displayed as "null Some Library". 

I think the problem is somewhere in the conversion from DB "NULL" to JSON.
Comment 1 Magnus Enger 2018-10-16 19:16:44 UTC
The JSON looks like this:

"firstname":null,"surname":"Uppsala universitetsbibliotek"
Comment 2 Magnus Enger 2018-10-16 19:34:48 UTC
Created attachment 80679 [details] [review]
Bug 21585 - Ignore missing firstname in ILL requests table

To test:
- Make sure you have a patron with just a surname and no firstname
- Create an ILL request so that the name of this patron shows up in
  the Patron column of the ILL requests table
- Before the patch, the name will display as "null Surname"
- Apply the patch
- Reload the ILL requests page
- The name should now display as just "Surname"
- Sign ye merrily off
Comment 3 Andrew Isherwood 2018-10-29 13:52:53 UTC
I can't replicate this on master now. I'm wondering if one of the ILL bugs that has been merged recently has inadvertently fixed it. Can you still replicate it Magnus?
Comment 4 Owen Leonard 2018-10-30 17:53:50 UTC
I can't reproduce this bug either.
Comment 5 Magnus Enger 2018-10-31 09:06:26 UTC
Thanks for testing, Andrew and Owen! 

I still see the problem, and I think I know what is happening:

If you create a regular, adult type user and give it only a surname, the firstname field in the database will be the empty string. This will display fine in the Patron column of the "List requests" table. 

If you create a user that is of the Organization type, the field for firstname will not be displayed, and the database column will be NULL. This will display as "null" in the Patron column. 

Could you please check your borrowers.firstname columns and see if this could explain what you are seeing?
Comment 6 Andrew Isherwood 2018-10-31 09:25:53 UTC
Aha! You're right! Creating an organisational user then creating a request for them does indeed demonstrate the problem. I'll test your patch now and sign off.
Comment 7 Andrew Isherwood 2018-10-31 09:27:25 UTC
Created attachment 81686 [details] [review]
Bug 21585 - Ignore missing firstname in ILL requests table

To test:
- Make sure you have a patron with just a surname and no firstname
- Create an ILL request so that the name of this patron shows up in
  the Patron column of the ILL requests table
- Before the patch, the name will display as "null Surname"
- Apply the patch
- Reload the ILL requests page
- The name should now display as just "Surname"
- Sign ye merrily off

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Comment 8 Josef Moravec 2018-10-31 13:23:23 UTC
Created attachment 81723 [details] [review]
Bug 21585: Ignore missing firstname in ILL requests table

To test:
- Make sure you have a patron with just a surname and no firstname
- Create an ILL request so that the name of this patron shows up in
  the Patron column of the ILL requests table
- Before the patch, the name will display as "null Surname"
- Apply the patch
- Reload the ILL requests page
- The name should now display as just "Surname"
- Sign ye merrily off

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 9 Nick Clemens 2018-11-01 19:09:44 UTC
Awesome work all!

Pushed to master for 18.11
Comment 10 Martin Renvoize 2018-11-09 16:34:25 UTC
Pushed to 18.05.x for 18.05.06
Comment 11 Fridolin SOMERS 2018-11-28 14:07:49 UTC
Pushed to 17.11.x for 17.11.13