Bug 9302: Add ability to merge patron records
[koha.git] / misc / devel / create_superlibrarian.pl
blob9a8d0ff9844c6dee6edbe6700d14a5f6433ccc74
1 #!/usr/bin/perl
3 # This file is part of Koha.
5 # Copyright 2016 Koha Development Team
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20 use Modern::Perl;
21 use Getopt::Long;
22 use Pod::Usage;
24 use C4::Members;
26 my ( $help, $surname, $userid, $password, $branchcode, $categorycode, $cardnumber );
27 GetOptions(
28 'help|?' => \$help,
29 'userid=s' => \$userid,
30 'password=s' => \$password,
31 'branchcode=s' => \$branchcode,
32 'categorycode=s' => \$categorycode,
33 'cardnumber=s' => \$cardnumber,
36 pod2usage(1) if $help;
37 pod2usage("userid is mandatory") unless $userid;
38 pod2usage("password is mandatory") unless $password;
39 pod2usage("branchcode is mandatory") unless $branchcode;
40 pod2usage("categorycode is mandatory") unless $categorycode;
41 pod2usage("cardnumber is mandatory") unless $cardnumber;
43 C4::Members::AddMember(
44 surname => $surname,
45 userid => $userid,
46 cardnumber => $cardnumber,
47 branchcode => $branchcode,
48 categorycode => $categorycode,
49 password => $password,
50 flags => 1,
53 =head1 NAME
55 create_superlibrarian.pl - create a user in Koha with superlibrarian permissions
57 =head1 SYNOPSIS
59 create_superlibrarian.pl
60 --userid <userid> --password <password> --branchcode <branchcode> --categorycode <categorycode> --cardnumber <cardnumber>
62 Options:
63 -?|--help brief help message
64 --userid specify the userid to be set
65 --password specify the password to be set
66 --branchcode specify the library code
67 --categorycode specify the patron category code
68 --cardnumber specify the cardnumber to be set
70 =head1 OPTIONS
72 =over 8
74 =item B<--help|-?>
76 Print a brief help message and exits
78 =item B<--userid>
80 To specify the userid to be set in the database
82 =item B<--password>
84 To specify the password to be set in the database
86 =item B<--branchcode>
88 Library code
90 =item B<--categorycode>
92 Patron category's code
94 =item B<--cardnumber>
96 Patron's cardnumber
98 =back
100 =head1 DESCRIPTION
102 A simple script to create a user in the Koha database with superlibrarian permissions
104 =cut