Line 0
Link Here
|
0 |
- |
1 |
|
|
|
2 |
#!/usr/bin/perl |
3 |
|
4 |
use Modern::Perl; |
5 |
|
6 |
use Koha::Suggestion; |
7 |
use Koha::AuthorisedValue; |
8 |
|
9 |
use String::Random qw( random_string ); |
10 |
|
11 |
my @status_list = ( 'TEST', 'TEST2', 'ASKED', 'ACCEPTED', 'REJECTED', 'CHECKED', 'ORDERED', 'AVAILABLE' ); |
12 |
my @branches = ( "CPL", "FFL", "FPL", "FRL", "IPT", "LPL", "MPL", "PVL", "RPL", "SPL", "TPL", "UPL" ); |
13 |
my @dates = ( "2025-05-01", "2025-05-02", "2025-05-03", "2025-05-04", "2025-05-05" ); |
14 |
|
15 |
my $av1 = Koha::AuthorisedValue->new( |
16 |
{ |
17 |
category => 'SUGGEST_STATUS', |
18 |
authorised_value => 'TEST', |
19 |
lib => 'Test', |
20 |
lib_opac => 'Test', |
21 |
imageurl => '', |
22 |
} |
23 |
)->store(); |
24 |
my $av2 = Koha::AuthorisedValue->new( |
25 |
{ |
26 |
category => 'SUGGEST_STATUS', |
27 |
authorised_value => 'TEST2', |
28 |
lib => 'Another test', |
29 |
lib_opac => 'Another test', |
30 |
imageurl => '', |
31 |
} |
32 |
)->store(); |
33 |
|
34 |
foreach my $i ( 1 .. 2000 ) { |
35 |
warn $i . " created\n" if $i % 100 == 0; |
36 |
my $title = random_string("cccccccccc"); |
37 |
|
38 |
my $status_index = rand(8); |
39 |
my $branch_index = rand(12); |
40 |
my $dates_index = rand(5); |
41 |
my $patron_id = rand(50) + 1; |
42 |
my $suggestion = Koha::Suggestion->new( |
43 |
{ |
44 |
suggestedby => $patron_id, STATUS => $status_list[$status_index], |
45 |
branchcode => $branches[$branch_index], managedby => 51, itemtype => 'BOOK', |
46 |
suggesteddate => $dates[$dates_index], |
47 |
archived => 0, title => $title |
48 |
} |
49 |
)->store; |
50 |
} |
51 |
|
52 |
warn "Complete"; |