Bug 38549 - Make create_superlibrarian.pl script accept a name parameter
Summary: Make create_superlibrarian.pl script accept a name parameter
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Aleisha Amohia
QA Contact: Lucas Gass (lukeg)
URL:
Keywords:
Depends on: 37368
Blocks:
  Show dependency treegraph
 
Reported: 2024-11-29 00:25 UTC by Aleisha Amohia
Modified: 2026-02-27 18:40 UTC (History)
3 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: Sponsored
Comma delimited list of Sponsors:
Crowdfunding goal: 0
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 script create_superlibrarian.pl. 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:
26.05.00
Circulation function:


Attachments
Bug 38549: Provide surname for create_superlibrarian.pl (3.12 KB, patch)
2025-09-11 00:29 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 38549: Provide surname for create_superlibrarian.pl (3.18 KB, patch)
2026-01-27 07:04 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 38549: Provide surname for create_superlibrarian.pl (3.23 KB, patch)
2026-02-13 16:20 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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
Comment 3 Katrin Fischer 2026-01-27 07:04:27 UTC
1) QA checks - pass!
2) Code review - nothing spotted
3) Testing - all works as expected
Comment 4 Katrin Fischer 2026-01-27 07:04:50 UTC
Created attachment 192077 [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
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Lucas Gass (lukeg) 2026-02-13 16:20:25 UTC
Created attachment 193113 [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
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 6 Lucas Gass (lukeg) 2026-02-27 18:40:26 UTC
Nice work everyone!

Pushed to main for 26.05