Lines 27-32
use Koha::DateUtils qw( dt_from_string );
Link Here
|
27 |
use Koha::Library; |
27 |
use Koha::Library; |
28 |
use Koha::Libraries; |
28 |
use Koha::Libraries; |
29 |
|
29 |
|
|
|
30 |
use t::lib::TestBuilder; |
31 |
|
30 |
use DateTime::Duration; |
32 |
use DateTime::Duration; |
31 |
use Test::More tests => 102; |
33 |
use Test::More tests => 102; |
32 |
use Test::Warn; |
34 |
use Test::Warn; |
Lines 42-47
my $sql;
Link Here
|
42 |
$dbh->{AutoCommit} = 0; |
44 |
$dbh->{AutoCommit} = 0; |
43 |
$dbh->{RaiseError} = 1; |
45 |
$dbh->{RaiseError} = 1; |
44 |
|
46 |
|
|
|
47 |
my $builder = t::lib::TestBuilder->new; |
45 |
# Reset item types to only the default ones |
48 |
# Reset item types to only the default ones |
46 |
$dbh->do(q|DELETE FROM itemtypes;|); |
49 |
$dbh->do(q|DELETE FROM itemtypes;|); |
47 |
$sql = " |
50 |
$sql = " |
Lines 67-90
if (not defined Koha::Libraries->find('CPL')) {
Link Here
|
67 |
Koha::Library->new({ branchcode => 'CPL', branchname => 'Centerville' })->store; |
70 |
Koha::Library->new({ branchcode => 'CPL', branchname => 'Centerville' })->store; |
68 |
} |
71 |
} |
69 |
|
72 |
|
70 |
my $sth = $dbh->prepare("SELECT * FROM categories WHERE categorycode='S';"); |
73 |
my $patron_category = $builder->build({ source => 'Category' }); |
71 |
$sth->execute(); |
|
|
72 |
if (!$sth->fetchrow_hashref) { |
73 |
$sql = "INSERT INTO categories |
74 |
(categorycode,description,enrolmentperiod,upperagelimit, |
75 |
dateofbirthrequired,finetype,bulk,enrolmentfee, |
76 |
overduenoticerequired,issuelimit,reservefee,category_type) |
77 |
VALUES |
78 |
('S','Staff',99,999, |
79 |
18,NULL,NULL,'0.000000', |
80 |
0,NULL,'0.000000','S');"; |
81 |
$dbh->do($sql); |
82 |
} |
83 |
|
74 |
|
84 |
my $member = { |
75 |
my $member = { |
85 |
firstname => 'my firstname', |
76 |
firstname => 'my firstname', |
86 |
surname => 'my surname', |
77 |
surname => 'my surname', |
87 |
categorycode => 'S', |
78 |
categorycode => $patron_category->{categorycode}, |
88 |
branchcode => 'CPL', |
79 |
branchcode => 'CPL', |
89 |
}; |
80 |
}; |
90 |
my $borrowernumber = AddMember(%$member); |
81 |
my $borrowernumber = AddMember(%$member); |
91 |
- |
|
|