Bug 20287: Move ModMember to Koha::Patron
[srvgit] / members / deletemem.pl
index 96f6251..bc0c924 100755 (executable)
@@ -31,6 +31,7 @@ use C4::Members;
 use Module::Load;
 use Koha::Patrons;
 use Koha::Token;
+use Koha::Patron::Categories;
 
 if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
     load Koha::NorwegianPatronDB, qw( NLMarkForDeletion NLSync );
@@ -74,10 +75,8 @@ if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preferen
     }
 }
 
-my $issues = GetPendingIssues($member);     # FIXME: wasteful call when really, we only want the count
-my $countissues = scalar(@$issues);
-
 my $charges = $patron->account->non_issues_charges;
+my $countissues = $patron->checkouts->count;
 my $userenv = C4::Context->userenv;
 
 if ($patron->category->category_type eq "S") {
@@ -102,6 +101,12 @@ if (C4::Context->preference("IndependentBranches")) {
     }
 }
 
+if ( $patron->is_child ) {
+    my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']});
+    $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1;
+    $template->param( 'catcode' => $patron_categories->next->categorycode )  if $patron_categories->count == 1;
+}
+
 my $op = $input->param('op') || 'delete_confirm';
 my $dbh = C4::Context->dbh;
 my $is_guarantor = $dbh->selectrow_array("SELECT COUNT(*) FROM borrowers WHERE guarantorid=?", undef, $member);