From 670fac0d724e9c7ee7d74fe3cac100ca48b6525e Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Fri, 2 May 2025 14:10:37 +0100 Subject: [PATCH] Bug 33430: DO NOT PUSH - data script Signed-off-by: Emily Lamancusa --- dummySuggestions.pl | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 dummySuggestions.pl diff --git a/dummySuggestions.pl b/dummySuggestions.pl new file mode 100644 index 0000000000..13089bb4d8 --- /dev/null +++ b/dummySuggestions.pl @@ -0,0 +1,52 @@ + +#!/usr/bin/perl + +use Modern::Perl; + +use Koha::Suggestion; +use Koha::AuthorisedValue; + +use String::Random qw( random_string ); + +my @status_list = ( 'TEST', 'TEST2', 'ASKED', 'ACCEPTED', 'REJECTED', 'CHECKED', 'ORDERED', 'AVAILABLE' ); +my @branches = ( "CPL", "FFL", "FPL", "FRL", "IPT", "LPL", "MPL", "PVL", "RPL", "SPL", "TPL", "UPL" ); +my @dates = ( "2025-05-01", "2025-05-02", "2025-05-03", "2025-05-04", "2025-05-05" ); + +my $av1 = Koha::AuthorisedValue->new( + { + category => 'SUGGEST_STATUS', + authorised_value => 'TEST', + lib => 'Test', + lib_opac => 'Test', + imageurl => '', + } +)->store(); +my $av2 = Koha::AuthorisedValue->new( + { + category => 'SUGGEST_STATUS', + authorised_value => 'TEST2', + lib => 'Another test', + lib_opac => 'Another test', + imageurl => '', + } +)->store(); + +foreach my $i ( 1 .. 2000 ) { + warn $i . " created\n" if $i % 100 == 0; + my $title = random_string("cccccccccc"); + + my $status_index = rand(8); + my $branch_index = rand(12); + my $dates_index = rand(5); + my $patron_id = rand(50) + 1; + my $suggestion = Koha::Suggestion->new( + { + suggestedby => $patron_id, STATUS => $status_list[$status_index], + branchcode => $branches[$branch_index], managedby => 51, itemtype => 'BOOK', + suggesteddate => $dates[$dates_index], + archived => 0, title => $title + } + )->store; +} + +warn "Complete"; -- 2.34.1