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>
(cherry picked from commit c72fc81b76)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
parent
b232569a78
commit
dc84e37030
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue