Bugzilla – Attachment 192127 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.60 KB, created by
Owen Leonard
on 2026-01-28 17:15:17 UTC
(
hide
)
Description:
Bug 41425: Log entries for merging patrons are untranslatable
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2026-01-28 17:15:17 UTC
Size:
6.60 KB
patch
obsolete
>From dba65f424b9b869e47489d92d47da945ba9ae02d 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 >--- > Koha/Patron.pm | 21 +++++++++++-------- > .../prog/en/modules/tools/viewlog.tt | 11 ++++++++-- > tools/viewlog.pl | 10 +++++++++ > 3 files changed, 31 insertions(+), 11 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index b174636cdd4..708dc1c33d7 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 ); > } > } >@@ -1088,7 +1091,7 @@ sub set_password { > module => 'members', > letter_code => 'PASSWORD_CHANGE', > branchcode => $self_from_storage->branchcode, >- , >+ > lang => $self_from_storage->lang || 'default', > tables => { > 'branches' => $self_from_storage->branchcode, >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 42634a034e8..32ff528fbff 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >@@ -337,7 +337,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" >@@ -363,7 +370,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 770e4c47ace..fcae8a93bc8 100755 >--- a/tools/viewlog.pl >+++ b/tools/viewlog.pl >@@ -209,6 +209,16 @@ if ($do_it) { > || $log->module eq "FINES" > || $log->module eq "APIKEYS" ) > { >+ 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