Bug 14570: Make it possible to add multiple guarantors to a record
[koha.git] / members / deletemem.pl
index 440f9d0..b30d28d 100755 (executable)
@@ -84,7 +84,7 @@ if (C4::Context->preference("IndependentBranches")) {
 
 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);
+my $is_guarantor = $patron->guarantee_relationships->count;
 my $countholds = $dbh->selectrow_array("SELECT COUNT(*) FROM reserves WHERE borrowernumber=?", undef, $member);
 if ( $op eq 'delete_confirm' or $countissues > 0 or $charges or $is_guarantor ) {
 
@@ -97,8 +97,8 @@ if ( $op eq 'delete_confirm' or $countissues > 0 or $charges or $is_guarantor )
     if ( $charges > 0 ) {
         $template->param(charges => $charges);
     }
-    if ($is_guarantor) {
-        $template->param(guarantees => 1);
+    if ( $is_guarantor ) {
+        $template->param( guarantees => 1 );
     }
     if($countholds > 0){
         $template->param(ItemsOnHold => $countholds);