-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanypatrons.pl
45 lines (35 loc) · 1.2 KB
/
manypatrons.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use Modern::Perl;
use Koha::Patrons;
use t::lib::TestBuilder;
use Koha::Libraries;
my @branchcodes = Koha::Libraries->search()->get_column('branchcode');
my @categories = Koha::Patron::Categories->search()->get_column('categorycode');
my $card = Koha::Patrons->search({ cardnumber => { "like", "2%" }})->_resultset->get_column("cardnumber")->max;
my $created = 0;
my $builder = t::lib::TestBuilder->new();
while( $created < 100000 ){
$card++;
my $patron = $builder->build({ source => "Borrower", value =>{
branchcode => $branchcodes[ rand @branchcodes],
categorycode => $categories[ rand @categories ],
sms_provider_id => undef,
cardnumber => $card,
}
});
$created++;
}
$created = 1000;
my @total;
while( $created < 100 ){
$card++;
my $patron = $builder->build_object({ class => "Koha::Patrons", value =>{
branchcode => $branchcodes[ rand @branchcodes],
categorycode => $categories[ rand @categories ],
sms_provider_id => undef,
cardnumber => $card,
}
});
push @total, $patron->unblessed;
$created++;
}
Koha::Patrons->_resultset->populate(\@total) if scalar @total;