|
Line 0
Link Here
|
| 0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
| 3 |
# This file is part of Koha. |
| 4 |
# |
| 5 |
# Copyright 2016 Koha Development Team |
| 6 |
# |
| 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. |
| 11 |
# |
| 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. |
| 16 |
# |
| 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>. |
| 19 |
|
| 20 |
|
| 21 |
use Modern::Perl; |
| 22 |
|
| 23 |
use C4::Installer; |
| 24 |
use C4::Context; |
| 25 |
use C4::Members; |
| 26 |
|
| 27 |
use Koha::DateUtils; |
| 28 |
use Koha::Libraries; |
| 29 |
use Koha::Patrons; |
| 30 |
use Koha::Patron::Categories; |
| 31 |
|
| 32 |
my $library = Koha::Libraries->search->next; |
| 33 |
my $patron_category = Koha::Patron::Categories->search->next; |
| 34 |
|
| 35 |
die "Not enough data in the database, library and/or patron category does not exist" |
| 36 |
unless $library and $patron_category; |
| 37 |
|
| 38 |
die "A patron with userid 'koha' already exists" if Koha::Patrons->find( { userid => 'koha' } ); |
| 39 |
die "A patron with cardnumber '42' already exists" if Koha::Patrons->find( { cardnumber => 'koha' } ); |
| 40 |
|
| 41 |
AddMember( |
| 42 |
surname => 'koha', |
| 43 |
userid => 'koha', |
| 44 |
cardnumber => 42, |
| 45 |
branchcode => $library->branchcode, |
| 46 |
categorycode => $patron_category->categorycode, |
| 47 |
password => 'koha', |
| 48 |
flags => 1, |
| 49 |
); |