@@ -, +, @@ --- Koha/Patron/Discharge.pm | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) --- a/Koha/Patron/Discharge.pm +++ a/Koha/Patron/Discharge.pm @@ -6,11 +6,10 @@ use File::Temp qw( :POSIX ); use Carp; use C4::Templates qw ( gettemplate ); -use C4::Members qw( GetPendingIssues ); use Koha::Database; use Koha::DateUtils qw( dt_from_string output_pref ); -use Koha::Patrons; +use Koha::Checkouts; sub count { my ($params) = @_; @@ -34,13 +33,11 @@ sub can_be_discharged { my ($params) = @_; return unless $params->{borrowernumber}; - my $issues = GetPendingIssues( $params->{borrowernumber} ); - if( @$issues ) { - return 0; - } - else { - return 1; - } + my $patron = Koha::Patrons->find( $params->{borrowernumber} ); + return unless $patron; + + my $has_pending_checkouts = $patron->pending_checkouts->count; + return $has_pending_checkouts ? 0 : 1; } sub is_discharged { --