From 19c50828d24084216a29b9a5b89675a2f740ac3b Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 12 Mar 2026 09:23:14 +0000 Subject: [PATCH] Bug 40136: (follow-up) Log newly-filled fields when editing a patron Previously, _unblessed_for_log strips undef/empty fields, so fields that were blank before an edit were absent from $from_storage. Because @keys was built only from keys %{$from_storage}, any field that transitioned from empty to a value was never iterated and the change went unlogged. Fix by unioning keys from both old and new state so that added, changed, and cleared fields are all detected. --- Koha/Patron.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index f2ac42f7577..baebed49ef4 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -382,7 +382,8 @@ sub store { my $from_storage = $self_from_storage->_unblessed_for_log; my $from_object = $self->_unblessed_for_log; - my @keys = C4::Context->preference("BorrowersLog") ? keys %{$from_storage} : ('cardnumber'); + my %all_keys = map { $_ => 1 } ( keys %{$from_storage}, keys %{$from_object} ); + my @keys = C4::Context->preference("BorrowersLog") ? keys %all_keys : ('cardnumber'); my $changed; for my $key (@keys) { my $storage_value = $from_storage->{$key} // q{}; -- 2.53.0