From 441493950b481c8cef5733134d28e164d1289386 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 14 Feb 2019 12:28:30 +0000 Subject: [PATCH] Bug 3820: (follow-up) Clean up warnings Signed-off-by: Owen Leonard Signed-off-by: Charles Farmer Signed-off-by: Josef Moravec Signed-off-by: Nick Clemens --- Koha/Patron.pm | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index ad99c2c804..c2b4738a34 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -258,17 +258,47 @@ sub store { # Actionlogs if ( C4::Context->preference("BorrowersLog") ) { my $info; - for my $key ( keys %{ $self_from_storage->unblessed } ) { - if ( $self_from_storage->$key ne $self->$key ) { + my $from_storage = $self_from_storage->unblessed; + my $from_object = $self->unblessed; + for my $key ( keys %{$from_storage} ) { + if ( + ( + !defined( $from_storage->{$key} ) + && defined( $from_object->{$key} ) + ) + || ( defined( $from_storage->{$key} ) + && !defined( $from_object->{$key} ) ) + || ( + defined( $from_storage->{$key} ) + && defined( $from_object->{$key} ) + && ( $from_storage->{$key} ne + $from_object->{$key} ) + ) + ) + { $info->{$key} = { - before => $self_from_storage->$key, - after => $self->$key + before => $from_storage->{$key}, + after => $from_object->{$key} }; } } - logaction( "MEMBERS", "MODIFY", $self->borrowernumber, - to_json( $info, { utf8 => 1, pretty => 1, canonical => 1 } ) ); + if ( defined($info) ) { + logaction( + "MEMBERS", + "MODIFY", + $self->borrowernumber, + to_json( + $info, + { utf8 => 1, pretty => 1, canonical => 1 } + ) + ); + } + else { + logaction( "MEMBERS", "MODIFY", $self->borrowernumber, + "NON-STANDARD FIELD CHANGED" ); + + } } # Final store -- 2.39.5