From 25bfb77b0b00f5de8dba2ee001a1ae57f47183e0 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 16 Apr 2026 11:01:32 +0000 Subject: [PATCH] Bug 42397: Atomicupdate 1) Enable ILLModule and IllLog system preferences. 2) Install a metadata enrichment plugin that supports ILL batches (restart plack if needed), e.g.: https://github.com/openfifth/koha-plugin-api-pubmed/releases 3) Visit ILL module: /cgi-bin/koha/ill/ill-requests.pl 4) Click the 'New ILL requests batch' button 5) Enter any name, cardnumber '42' and any library. Click 'Continue' 6) Add a pubmedid (e.g. '123') and click process identifiers. 7) Click 'Add items to batch' and 'Finish and view batch'. 8) Visit the ILL request we just created: /cgi-bin/koha/ill/ill-requests.pl?op=illview&illrequest_id=1 9) Confirm it explodes with a nasty 500 error 10) Apply patches, updatedatabase and restart plack. 11) Repeat 8). Confirm it no longer explodes 12) Click' ILL request log'. Confirm it shows the correct log(s) relative to this ILL request 13) Visit the log viewer and query for 'Interlibrary loans': http://localhost:8081/cgi-bin/koha/tools/viewlog.pl?src=&user=&modules=ILL&actions=&object=&info=&interfaces=&from=&to=&output=screen&basename=Export&report_name=&do_it=1 14) Confirm only ILL requests are shown, do the same for ILL batches: http://localhost:8081/cgi-bin/koha/tools/viewlog.pl?do_it=1&src=&user=&modules=ILL_BATCHES&actions=&object=&info=&interfaces=&from=&to=&output=screen&basename=Export&report_name=&do_it=1 15) Confirm only ILL batches are shown 16) Run all ILL batch relevant tests: prove t/db_dependent/Koha/ILL/Batch* Signed-off-by: David Nind Signed-off-by: Lisette Scheer Signed-off-by: Pedro Amorim --- .../data/mysql/atomicupdate/bug_42397.pl | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_42397.pl diff --git a/installer/data/mysql/atomicupdate/bug_42397.pl b/installer/data/mysql/atomicupdate/bug_42397.pl new file mode 100755 index 0000000000..dda9dabe41 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_42397.pl @@ -0,0 +1,46 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "42397", + description => "Migrate ILL batch action_logs entries to ILL_BATCHES module", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + my ($count) = $dbh->selectrow_array( + q{ + SELECT COUNT(*) FROM action_logs + WHERE module = 'ILL' + AND action IN ( + 'batch_create', + 'batch_update', + 'batch_delete', + 'batch_status_create', + 'batch_status_update', + 'batch_status_delete' + ) + } + ); + + if ($count) { + $dbh->do( + q{ + UPDATE action_logs + SET module = 'ILL_BATCHES' + WHERE module = 'ILL' + AND action IN ( + 'batch_create', + 'batch_update', + 'batch_delete', + 'batch_status_create', + 'batch_status_update', + 'batch_status_delete' + ) + } + ); + + say_success( $out, "Migrated $count action_logs entries from module 'ILL' to 'ILL_BATCHES'" ); + } + }, +};