From b361ff2d7d1d9e0f27ff3d6b728686bc3691c564 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 25 Jul 2017 10:19:20 -0300 Subject: [PATCH] Bug 12598: Re-add some missing stuffs This patch will have to be squashed with previous ones, but for readability I prefer to let it alone for now. It reintroduces 2 missing changes: commit fd123903651435c56ca14d88897e9ce4d7a38bb5 Bug 15010: Import patron tool creates 'duplicate' restrictions ( debarments ) commit 011d8e9855ffeb1779f5c1aadc9f4367c298cee7 Bug 12543 - Add userid as matchpoint for "Import patrons" tool Signed-off-by: Colin Campbell Signed-off-by: Jonathan Druart --- Koha/Patrons/Import.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm index 965db661c9..db6beb0481 100644 --- a/Koha/Patrons/Import.pm +++ b/Koha/Patrons/Import.pm @@ -165,6 +165,9 @@ sub import_patrons { if ( defined($matchpoint) && ( $matchpoint eq 'cardnumber' ) && ( $borrower{'cardnumber'} ) ) { $member = Koha::Patrons->find( { cardnumber => $borrower{'cardnumber'} } ); } + elsif ( ($matchpoint eq 'userid') && ($borrower{'userid'}) ) { + $member = Koha::Patrons->find( { userid => $borrower{userid} } ); + } elsif ($extended) { if ( defined($matchpoint_attr_type) ) { foreach my $attr (@$patron_attributes) { @@ -244,7 +247,8 @@ sub import_patrons { ); next LINE; } - if ( $borrower{debarred} ) { + # Don't add a new restriction if the existing 'combined' restriction matches this one + if ( $borrower{debarred} && ( ( $borrower{debarred} ne $member->{debarred} ) || ( $borrower{debarredcomment} ne $member->{debarredcomment} ) ) ) { # Check to see if this debarment already exists my $debarrments = GetDebarments( -- 2.39.5