From 51d9a475e21bbb5c509b94591b5e92827422714f Mon Sep 17 00:00:00 2001 From: Axel Amghar Date: Thu, 11 Apr 2019 17:20:51 +0200 Subject: [PATCH] without this patch , when patrons are merged , you can't see the merge in the log viewer. To test: -Apply the patch -Make sure you have "BorrowersLog" on in you System Preference -Search patrons -Check two ore more patrons -Merge selected patrons -Merge patrons -Go to log viewer - Make sure there is the line with the action : "Merge" https://bugs.koha-community.org/show_bug.cgi?id=22632 --- Koha/Patron.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index cc1892b..2d8bd11 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -465,9 +465,10 @@ sub siblings { =cut sub merge_with { - my ( $self, $patron_ids ) = @_; + my ( $self, $patron_ids, $interface ) = @_; my @patron_ids = @{ $patron_ids }; + my @interface = @{ $interface }; # Ensure the keeper isn't in the list of patrons to merge @patron_ids = grep { $_ ne $self->id } @patron_ids; @@ -475,6 +476,8 @@ sub merge_with { my $schema = Koha::Database->new()->schema(); my $results; + my $patron_merged; + my $info; $self->_result->result_source->schema->txn_do( sub { foreach my $patron_id (@patron_ids) { @@ -493,9 +496,13 @@ sub merge_with { $patron->move_to_deleted(); $patron->delete(); - } - }); + if (C4::Context->preference("BorrowersLog")){ + $info = $patron->firstname. " " . $patron->surname . " ( ".$patron->cardnumber . ")". " has been merged into " . $self->firstname . " " . $self->surname . " ( ".$self->cardnumber . ")" ; + logaction("Patrons", "Merge", $patron_id, $info ,@interface); + } + } + }); return $results; } @@ -506,7 +513,6 @@ sub merge_with { $wants_check = $patron->wants_check_for_previous_checkout; Return 1 if Koha needs to perform PrevIssue checking, else 0. - =cut sub wants_check_for_previous_checkout { -- 2.7.4