Bug 38549

Summary: Make create_superlibrarian.pl script accept a name parameter
Product: Koha Reporter: Aleisha Amohia <aleisha>
Component: Command-line UtilitiesAssignee: Aleisha Amohia <aleisha>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: fridolin.somers, robin
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: Sponsored
Patch complexity: Small patch Documentation contact:
Documentation submission: Text to go in the release notes:
This enhancement enables the user to supply a surname parameter when creating a superlibrarian user via the commandline create_superlibrarian.pl script. Koha patrons MUST have a name, so if no surname is provided, the userid will be used for the surname instead.
Version(s) released in:
Circulation function:
Bug Depends on: 37368    
Bug Blocks:    
Attachments: Bug 38549: Provide surname for create_superlibrarian.pl

Description Aleisha Amohia 2024-11-29 00:25:42 UTC
As reported in Bug 37368, patron searches break if there are patrons with no firstname AND no surname.

We often use the create_superlibrarian.pl script to create Koha admin users. Sometimes we forget to edit the patron record and add a firstname/surname. That's now causing these errors as seen in Bug 37368.

create_superlibrarian.pl should accept firstname and surname parameters and require at least one of either.
Comment 1 Fridolin Somers 2024-12-19 13:21:46 UTC
When name not provided we may use uppercase userid
My 2c
Comment 2 Aleisha Amohia 2025-09-11 00:29:47 UTC
Created attachment 186350 [details] [review]
Bug 38549: Provide surname for create_superlibrarian.pl

Interestingly this script already had a $surname variable, just never accepted a parameter for it.

This enhancement enables the user to supply a surname parameter when creating a superlibrarian user via the commandline create_superlibrarian.pl script. Koha patrons MUST have a name, so if no surname is provided, the userid will be used for the surname instead.

To test:

1. Apply the patch and restart services
2. Attempt to create a superlibrarian with no surname provided.
  In KTD: misc/devel/create_superlibrarian.pl --userid test --cardnumber test --password XXXX --branchcode CPL --categorycode S
3. Search for your patron in Koha. Confirm the surname was automatically set to the userid 'test'
4. Attempt to create a superlibrarian, this time provide a surname that is different from the userid so easy to tell apart.
  In KTD: misc/devel/create_superlibrarian.pl --userid test1 --cardnumber test1 --password XXXX --branchcode CPL --categorycode S --surname testsurname
5. Search for your patron in Koha. Confirm the surname was set correctly using the given surname.

Sponsored-by: Catalyst IT