Bugzilla – Attachment 191013 Details for
Bug 41425
Log entries for merging patrons are untranslatable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41425: Log entries for merging patrons are untranslatable
Bug-41425-Log-entries-for-merging-patrons-are-untr.patch (text/plain), 6.34 KB, created by
David Nind
on 2026-01-07 20:11:46 UTC
(
hide
)
Description:
Bug 41425: Log entries for merging patrons are untranslatable
Filename:
MIME Type:
Creator:
David Nind
Created:
2026-01-07 20:11:46 UTC
Size:
6.34 KB
patch
obsolete
>From c509ddb5d086cb1d5bedc81f7386eecb01e6db52 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 6 Jan 2026 14:08:39 -0500 >Subject: [PATCH] Bug 41425: Log entries for merging patrons are untranslatable > >This patch changes the way information is logged during patron merges. >Instead of building an English sentence to be stored in the log now it >stores JSON containing information about the patron record and the >record which it is being merged with. > >To test, apply the patch and restart_services. > >- If necessary, go to Administration -> System preferences -> Logs and > enable BorrowersLog. >- Perform a patron search which will return more than one result. >- Check the box next to two or more results and click "Merge selected > patrons" in the toolbar. >- Select one of the patron records to be merged with and click "Merge > patrons." >- Go to Tools -> Log viewer and perform a search limited to the > patron module with "Display from" and "Display to" set to today. >- You should see an entry for the patron merge you performed, with the > updated patron linked in the "Object" column and information about the > merge in the "Info" column, e.g. "John Smith (12345) merged with John > Smith (45678). > >Sponsored-by: Athens County Public Libraries >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/Patron.pm | 19 +++++++++++-------- > .../prog/en/modules/tools/viewlog.tt | 11 +++++++++-- > tools/viewlog.pl | 10 ++++++++++ > 3 files changed, 30 insertions(+), 10 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 7b8b69315b..5a9128d933 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -764,14 +764,17 @@ sub merge_with { > $patron->delete(); > > if ( C4::Context->preference("BorrowersLog") ) { >- my $info = >- ( $patron->firstname // "" ) . " " >- . ( $patron->surname // "" ) . " (" >- . ( $patron->cardnumber // "" ) . ")" >- . " has been merged into " >- . ( $self->firstname // "" ) . " " >- . ( $self->surname // "" ) . " (" >- . ( $self->cardnumber // "" ) . ")"; >+ my $info = to_json( >+ { >+ patron_firstname => $patron->firstname || "", >+ patron_surname => $patron->surname || "", >+ patron_cardnumber => $patron->cardnumber || "", >+ merged_firstname => $self->firstname || "", >+ merged_surname => $self->surname || "", >+ merged_cardnumber => $self->cardnumber || "", >+ }, >+ { pretty => 1, canonical => 1 } >+ ); > logaction( "MEMBERS", "PATRON_MERGE", $self->id, $info ); > } > } >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..67a4836ab3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >@@ -327,7 +327,14 @@ > [% END %] > </td> > <td> >- [% IF ( loopro.module == 'CIRCULATION' && loopro.object_found ) %] >+ [% IF ( loopro.module == 'MEMBERS' ) %] >+ [% IF ( loopro.action == 'PATRON_MERGE') %] >+ [% loopro.json.patron_firstname | html %] >+ [% loopro.json.patron_surname | html %] >+ ([% loopro.json.patron_cardnumber | html %]) [% tp("[patron] merged into [patron]", "merged into") | html %] [% loopro.json.merged_firstname | html %] [% loopro.json.merged_surname | html %] >+ ([% loopro.json.merged_cardnumber | html %]) >+ [% END %] >+ [% ELSIF ( loopro.module == 'CIRCULATION' && loopro.object_found ) %] > <a > href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% loopro.info | uri %]&biblionumber=[% loopro.biblionumber | uri %]&bi=[% loopro.biblioitemnumber | uri %]#item[% loopro.info | uri %]" > title="Display detail for this item" >@@ -353,7 +360,7 @@ > <div class="loginfo" id="loginfo[% loopro.action_id | html %]"> > <div> > <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% loopro.json.biblionumber | uri %]" title="Display holds for this record" >- >Hold [% loopro.json.hold | html %] on biblio [% loopro.json.biblionumber | html %]</a >+ >Hold [% loopro.json.hold | html %] on bibliographic record [% loopro.json.biblionumber | html %]</a > > > [% IF loopro.json.itemnumber %] > - >diff --git a/tools/viewlog.pl b/tools/viewlog.pl >index 73d35670c7..02a501e540 100755 >--- a/tools/viewlog.pl >+++ b/tools/viewlog.pl >@@ -205,6 +205,16 @@ if ($do_it) { > > #add firstname and surname for borrower, when using the CIRCULATION, MEMBERS, FINES > if ( $log->module eq "CIRCULATION" || $log->module eq "MEMBERS" || $log->module eq "FINES" ) { >+ my $info = $log->info; >+ my $decoded; >+ my $is_json = eval { >+ $decoded = decode_json($info); >+ 1; >+ }; >+ if ( $is_json && ref($decoded) ) { >+ $result->{'json_found'} = 1; >+ $result->{'json'} = $decoded; >+ } > if ( $log->object ) { > my $patron = Koha::Patrons->find( $log->object ); > if ( $patron && $output eq 'screen' ) { >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41425
:
190954
|
191013
|
192127
|
192474
|
192503