From 2cd967771d7b601fbec33f5fc8cbf232ae57e36c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 25 Aug 2022 08:56:54 +0100 Subject: [PATCH] Bug 31095: Remove GetDebarments from Patron::Import This patch replaced GetDebarments with $patron->restrictions->search in Koha::Patron::Import. Test plan 1. Confirm that importing patrons with debarred and debarredcomment fields in the import still works as expected --- Koha/Patrons/Import.pm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm index bb5f820400..e2fdeef2a0 100644 --- a/Koha/Patrons/Import.pm +++ b/Koha/Patrons/Import.pm @@ -29,7 +29,7 @@ use C4::Letters qw( GetPreparedLetter EnqueueLetter ); use Koha::Libraries; use Koha::Patrons; use Koha::Patron::Categories; -use Koha::Patron::Debarments qw( AddDebarment GetDebarments ); +use Koha::Patron::Debarments qw( AddDebarment ); use Koha::DateUtils qw( dt_from_string output_pref ); =head1 NAME @@ -290,16 +290,15 @@ sub import_patrons { if ( $borrower{debarred} && ( ( $borrower{debarred} ne $member->{debarred} ) || ( $borrower{debarredcomment} ne $member->{debarredcomment} ) ) ) { # Check to see if this debarment already exists - my $debarrments = GetDebarments( + my $restrictions = $patron->restrictions->search( { - borrowernumber => $borrowernumber, - expiration => $borrower{debarred}, - comment => $borrower{debarredcomment} + expiration => $borrower{debarred}, + comment => $borrower{debarredcomment} } ); # If it doesn't, then add it! - unless (@$debarrments) { + unless ($restrictions->count) { AddDebarment( { borrowernumber => $borrowernumber, -- 2.20.1