From dded5b7207088e6729b78788b9357fb74a2f2bb6 Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Thu, 8 May 2025 19:48:48 +0000 Subject: [PATCH] Bug 39054: a need to distinguish between manual bibliographic record modifications and those being a consequence of authority modification Now, in action_logs, Koha does not distinguish between manual bibliographic record modifications and those being a consequence of authority modification. Both are logged in the same way: module: CATALOGUING ; operation: MODIFY ; interface: intranet. It will be helpful to be able to distinguish this two cases (for instance to be able to evaluate a librarian's 'koha' in the cataloguing process: a single action of modification of one authority record launching a modification of, say, 100 bibliographic records does not equal to manual modification of 100 bibliographic records. Also, if we trace issues in bibliographic records after modification being performed and want librarians to correct themselves, a biblio modification being a consequence of an authority modification should not be taken into account, etc.). Test plan: ========== 1. Have CataloguingLog system preference set to Log. 2. Find any bibliographic record linked with a authority record (e.g. sn:1 linked to Heylin, Clinton). 3. Modify the bibliographic record (Edit > Edit record > [make an edit] > Save). 3. In a separate tab, open the authority record and modify the heading. 4. Go back to the bibliographic record tab and chose Modification log. You will see the two recent operations marked as 'Modify'. You are not able to distinguish between the 'real' manual modification from the second being the result of an authority record modification. 5. Apply the patch ; restart all. 6. Repeat p. 3 and 4. You should now see the last action (resulting from authority modification) marked as 'Merge', which allows you to distinguish the two different actions. Signed-off-by: Roman Dolny --- C4/AuthoritiesMarc.pm | 2 +- C4/Biblio.pm | 3 ++- koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc | 2 ++ koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index f0fe2c1325..c4b3563402 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -1788,7 +1788,7 @@ sub merge { $indexer->index_records( $biblio->biblionumber, "specialUpdate", "biblioserver" ); } next if !$update; - ModBiblio( $marcrecord, $biblio->biblionumber, $biblio->frameworkcode, { disable_autolink => 1 } ); + ModBiblio( $marcrecord, $biblio->biblionumber, $biblio->frameworkcode, { disable_autolink => 1, merge => 1 } ); $counteditedbiblio++; } return $counteditedbiblio; diff --git a/C4/Biblio.pm b/C4/Biblio.pm index cdfde492d6..ff713d547d 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -408,7 +408,8 @@ sub ModBiblio { $decoding_error = "There was an error with this bibliographic record: " . $exception; $record = $biblio->metadata->record_strip_nonxml; } - logaction( "CATALOGUING", "MODIFY", $biblionumber, "biblio $decoding_error BEFORE=>" . $record->as_formatted ); + my $action = $options->{'merge'} ? 'MERGE' : 'MODIFY'; + logaction( "CATALOGUING", $action, $biblionumber, "biblio $decoding_error BEFORE=>" . $record->as_formatted ); } if ( !$options->{disable_autolink} && C4::Context->preference('AutoLinkBiblios') ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc index 9df6b43226..488717f553 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/action-logs.inc @@ -55,6 +55,8 @@ Delete [% CASE 'MODIFY' %] Modify + [% CASE 'MERGE' %] + Merge [% CASE 'ISSUE' %] Checkout [% CASE 'RETURN' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt index 6e434a5c67..596fba6379 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt @@ -147,7 +147,7 @@ [% END %] - [% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'FILL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'MODCIRCMESSAGE' 'DELCIRCMESSAGE' 'STATUS_CHANGE' 'PATRON_NOTICE' 'CHANGE PASS' 'RESET PASS' 'Run' 'End' 'PATRON_MERGE' 'EDIT_MAPPINGS' 'RESET_MAPPINGS' 'ADD_BASKET' 'MODIFY_BASKET' 'MODIFY_BASKET_HEADER' 'MODIFY_BASKET_USERS' 'CLOSE_BASKET' 'APPROVE_BASKET' 'REOPEN_BASKET' 'CANCEL_ORDER' 'CREATE_ORDER' 'MODIFY_ORDER' 'CREATE_INVOICE_ADJUSTMENT' 'UPDATE_INVOICE_ADJUSTMENT' 'DELETE_INVOICE_ADJUSTMENT' 'RECEIVE_ORDER' 'MODIFY_BUDGET' 'MODIFY_FUND' 'CREATE_FUND' 'DELETE_FUND' 'ACQUISITION CLAIM' 'ACQUISITION ORDER' 'OVERDUE' 'EXPIRE' 'CREATE_RESTRICTION' 'MODIFY_RESTRICTION' 'DELETE_RESTRICTION' 'MODIFY_CARDNUMBER' 'RESET 2FA' ] %] + [% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'MERGE' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'FILL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'MODCIRCMESSAGE' 'DELCIRCMESSAGE' 'STATUS_CHANGE' 'PATRON_NOTICE' 'CHANGE PASS' 'RESET PASS' 'Run' 'End' 'PATRON_MERGE' 'EDIT_MAPPINGS' 'RESET_MAPPINGS' 'ADD_BASKET' 'MODIFY_BASKET' 'MODIFY_BASKET_HEADER' 'MODIFY_BASKET_USERS' 'CLOSE_BASKET' 'APPROVE_BASKET' 'REOPEN_BASKET' 'CANCEL_ORDER' 'CREATE_ORDER' 'MODIFY_ORDER' 'CREATE_INVOICE_ADJUSTMENT' 'UPDATE_INVOICE_ADJUSTMENT' 'DELETE_INVOICE_ADJUSTMENT' 'RECEIVE_ORDER' 'MODIFY_BUDGET' 'MODIFY_FUND' 'CREATE_FUND' 'DELETE_FUND' 'ACQUISITION CLAIM' 'ACQUISITION ORDER' 'OVERDUE' 'EXPIRE' 'CREATE_RESTRICTION' 'MODIFY_RESTRICTION' 'DELETE_RESTRICTION' 'MODIFY_CARDNUMBER' 'RESET 2FA' ] %] [% IF actions.grep(actx).size %]