From b42b8da0d6b6617aaddf84d9e48c71581631d059 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 13 May 2008 10:56:48 -0500 Subject: [PATCH] kohabug 1573 - properly count patrons to delete When both the patron delete and patron anonymize checkboxes were selected, the patron cleaning tool would not properly register the number of patrons to delete. Fixed by correcting form input handling. Also, count of patrons to delete or anonymous now correct when running with IndependentBranches = ON. Signed-off-by: Joshua Ferraro --- C4/Members.pm | 4 ++-- tools/cleanborrowers.pl | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 3aa3a7183a..41e92dc574 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1860,7 +1860,7 @@ sub GetBorrowersWhoHaveNotBorrowedSince { "; my @query_params; if ($filterbranch && $filterbranch ne ""){ - $query.=" WHERE branchcode= ?"; + $query.=" WHERE borrowers.branchcode= ?"; push @query_params,$filterbranch; } $query.=" GROUP BY borrowers.borrowernumber"; @@ -1911,7 +1911,7 @@ sub GetBorrowersWhoHaveNeverBorrowed { "; my @query_params; if ($filterbranch && $filterbranch ne ""){ - $query.=" AND branchcode= ?"; + $query.=" AND borrowers.branchcode= ?"; push @query_params,$filterbranch; } warn $query if $debug; diff --git a/tools/cleanborrowers.pl b/tools/cleanborrowers.pl index ddfb7e36ee..908ba62978 100755 --- a/tools/cleanborrowers.pl +++ b/tools/cleanborrowers.pl @@ -66,18 +66,18 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( if ( $params->{'step2'} ) { $filterdate1 = format_date_in_iso($params->{'filterdate1'}); $filterdate2 = format_date_in_iso($params->{'filterdate2'}); - my $checkbox = $params->{'checkbox'}; + my %checkboxes = map { $_ => 1 } split /\0/, $params->{'checkbox'}; my $totalDel; my $membersToDelete; - if ($checkbox eq "borrower") { + if ($checkboxes{borrower}) { $membersToDelete = GetBorrowersWhoHaveNotBorrowedSince($filterdate1); $totalDel = scalar @$membersToDelete; } my $totalAno; my $membersToAnonymize; - if ($checkbox eq "issue") { + if ($checkboxes{issue}) { $membersToAnonymize = GetBorrowersWithIssuesHistoryOlderThan($filterdate2); $totalAno = scalar @$membersToAnonymize; -- 2.39.5