@@ -, +, @@ commit fd123903651435c56ca14d88897e9ce4d7a38bb5 Bug 15010: Import patron tool creates 'duplicate' restrictions ( debarments ) commit 011d8e9855ffeb1779f5c1aadc9f4367c298cee7 Bug 12543 - Add userid as matchpoint for "Import patrons" tool --- Koha/Patrons/Import.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/Koha/Patrons/Import.pm +++ a/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( --