From cb1e3f55c3497f778484763e19da04f2d6d25bcd Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 23 Oct 2025 13:54:24 -0400 Subject: [PATCH] Bug 41052: Add option to specify one or more accounts for marc_ordering_process.pl For debugging it would be helpful to be able to specify to run only for a single account or file/directory Test Plan: 1) Create 3 marc order accounts 2) Run script with no options 2) Script should process all 3 marc order accounts 3) Run script with one -a parameter for one account id 4) Script should run for only that account 5) Run script with two -a parameters for two account ids 6) Script should run for only those two accounts --- misc/cronjobs/marc_ordering_process.pl | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/misc/cronjobs/marc_ordering_process.pl b/misc/cronjobs/marc_ordering_process.pl index 0e51cf7baf3..5ca06ae1545 100755 --- a/misc/cronjobs/marc_ordering_process.pl +++ b/misc/cronjobs/marc_ordering_process.pl @@ -68,12 +68,13 @@ use C4::Log qw( cronlogaction ); my $command_line_options = join( " ", @ARGV ); cronlogaction( { info => $command_line_options } ); -my ( $help, $verbose, $confirm, $delete ); +my ( $help, $verbose, $confirm, $delete, @marc_order_account_ids ); GetOptions( - 'h|help' => \$help, - 'v|verbose' => \$verbose, - 'c|confirm' => \$confirm, - 'd|delete' => \$delete, + 'h|help' => \$help, + 'v|verbose' => \$verbose, + 'c|confirm' => \$confirm, + 'd|delete' => \$delete, + 'a|marc-order-account=i' => \@marc_order_account_ids, ) || pod2usage(1); pod2usage(0) if $help; @@ -81,9 +82,17 @@ pod2usage(0) if $help; $verbose = 1 unless $verbose or $confirm; print "Test run only\n" unless $confirm; -print "Fetching MARC ordering accounts\n" if $verbose; +if ($verbose) { + print "Fetching MARC ordering accounts"; + print " " . join( ", ", @marc_order_account_ids ) if @marc_order_account_ids; + print "\n"; +} + +my $params = {}; +$params = { id => { '-in' => \@marc_order_account_ids } } if @marc_order_account_ids; + my @accounts = Koha::MarcOrderAccounts->search( - {}, + $params, { join => [ 'vendor', 'budget' ] } )->as_list; -- 2.50.1 (Apple Git-155)