From 0d80debeb877d58373ae3a148706059919855f49 Mon Sep 17 00:00:00 2001 From: Andreas Roussos Date: Wed, 18 Sep 2024 14:01:21 +0000 Subject: [PATCH] Bug 35659: (follow-up) Use new column name in cron script In an earlier patch, the `id` column of the `oai_servers` table was renamed to `oai_server_id`. However, the code in misc/cronjobs/harvest_oai.pl still uses the old column name, which results in the following error: $ misc/cronjobs/harvest_oai.pl --list DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Unknown column 'id' in 'order clause' at /kohadevbox/koha/Koha/Objects.pm line 403 This patch fixes that. Test plan: 1) $ misc/cronjobs/harvest_oai.pl --list [...you get the DBI Exception...] 2) Apply the patch. 3) $ misc/cronjobs/harvest_oai.pl --list [...list of OAI repositories...] Signed-off-by: David Cook --- misc/cronjobs/harvest_oai.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/misc/cronjobs/harvest_oai.pl b/misc/cronjobs/harvest_oai.pl index 3148e89347..554049304a 100755 --- a/misc/cronjobs/harvest_oai.pl +++ b/misc/cronjobs/harvest_oai.pl @@ -44,14 +44,13 @@ my $usage = << 'ENDUSAGE'; This script starts an OAI Harvest -This script has the following parameters : +This script has the following parameters: -h --help: this message -v --verbose -r --repository: id of the OAI repository -d --days: number of days to harvest from (optional) -l --list: list the OAI repositories -f --force: force harvesting (ignore records datestamps) - ENDUSAGE if ($help) { @@ -60,10 +59,10 @@ if ($help) { } if ($list) { - my $servers = Koha::OAIServers->search( {}, { order_by => { -asc => 'id' } } )->unblessed; + my $servers = Koha::OAIServers->search( {}, { order_by => { -asc => 'oai_server_id' } } )->unblessed; print "The following repositories are available: \n\n"; foreach my $server (@$servers) { - print $server->{'id'} . ": " + print $server->{'oai_server_id'} . ": " . $server->{'servername'} . ", endpoint: " . $server->{'endpoint'} @@ -79,6 +78,7 @@ if ($list) { if ( !$id ) { print "The repository parameter is mandatory.\n"; print $usage . "\n"; + exit; } my $server = Koha::OAIServers->find($id); -- 2.39.2