Bugzilla – Attachment 186350 Details for
Bug 38549
Make create_superlibrarian.pl script accept a name parameter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38549: Provide surname for create_superlibrarian.pl
Bug-38549-Provide-surname-for-createsuperlibrarian.patch (text/plain), 3.12 KB, created by
Aleisha Amohia
on 2025-09-11 00:29:47 UTC
(
hide
)
Description:
Bug 38549: Provide surname for create_superlibrarian.pl
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2025-09-11 00:29:47 UTC
Size:
3.12 KB
patch
obsolete
>From 398c36213970eac3f2f3f14d8e36d794920664ee Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleisha@catalyst.net.nz> >Date: Thu, 11 Sep 2025 00:25:48 +0000 >Subject: [PATCH] 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 >--- > misc/devel/create_superlibrarian.pl | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > >diff --git a/misc/devel/create_superlibrarian.pl b/misc/devel/create_superlibrarian.pl >index dadf98ea045..94bedf36707 100755 >--- a/misc/devel/create_superlibrarian.pl >+++ b/misc/devel/create_superlibrarian.pl >@@ -39,6 +39,7 @@ GetOptions( > 'branchcode=s' => \$branchcode, > 'categorycode=s' => \$categorycode, > 'cardnumber=s' => \$cardnumber, >+ 'surname=s' => \$surname, > ); > > pod2usage(1) if $help; >@@ -62,6 +63,10 @@ try { > Koha::Exceptions::Object::DuplicateID->throw( duplicate_id => 'cardnumber' ) > if Koha::Patrons->find( { cardnumber => $cardnumber } ); > >+ unless ($surname) { >+ $surname = $userid; >+ } >+ > my $patron = Koha::Patron->new( > { > surname => $surname, >@@ -115,7 +120,7 @@ create_superlibrarian.pl - create a user in Koha with superlibrarian permissions > =head1 SYNOPSIS > > create_superlibrarian.pl >- --userid <userid> --password <password> --branchcode <branchcode> --categorycode <categorycode> --cardnumber <cardnumber> >+ --userid <userid> --password <password> --branchcode <branchcode> --categorycode <categorycode> --cardnumber <cardnumber> --surname <surname> > > Options: > -?|--help brief help message >@@ -124,6 +129,7 @@ create_superlibrarian.pl > --branchcode specify the library code > --categorycode specify the patron category code > --cardnumber specify the cardnumber to be set >+ --surname specify the surname to be set > > =head1 OPTIONS > >@@ -153,6 +159,10 @@ Patron category's code > > Patron's cardnumber > >+=item B<--surname> >+ >+Patron's surname. If not provided, the given userid will be used. >+ > =back > > =head1 DESCRIPTION >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38549
: 186350