From b07c29dd4e725f7b65a65878886af96500db6b6b Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 31 Mar 2016 15:53:31 +0000 Subject: [PATCH] Bug 17949: Fix batch patron deletion tool The filter 'who have not borrowed since' was ignored Reword 'not_borrowered_since' to 'not_borrowed_since' This patch is originally a followup of bug 10612 Signed-off-by: Julian Maurice --- C4/Members.pm | 4 ++-- misc/cronjobs/delete_patrons.pl | 2 +- tools/cleanborrowers.pl | 22 +++++++++++----------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index e15301c2a8..f832b08e2d 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1983,7 +1983,7 @@ sub GetHideLostItemsPreference { =head2 GetBorrowersToExpunge $borrowers = &GetBorrowersToExpunge( - not_borrowered_since => $not_borrowered_since, + not_borrowed_since => $not_borrowed_since, expired_before => $expired_before, category_code => $category_code, branchcode => $branchcode @@ -1996,7 +1996,7 @@ sub GetHideLostItemsPreference { sub GetBorrowersToExpunge { my $params = shift; - my $filterdate = $params->{'not_borrowered_since'}; + my $filterdate = $params->{'not_borrowed_since'}; my $filterexpiry = $params->{'expired_before'}; my $filtercategory = $params->{'category_code'}; my $filterbranch = $params->{'branchcode'} || diff --git a/misc/cronjobs/delete_patrons.pl b/misc/cronjobs/delete_patrons.pl index c05126f268..19483e9964 100755 --- a/misc/cronjobs/delete_patrons.pl +++ b/misc/cronjobs/delete_patrons.pl @@ -40,7 +40,7 @@ cronlogaction(); my $members = GetBorrowersToExpunge( { - not_borrowered_since => $not_borrowed_since, + not_borrowed_since => $not_borrowed_since, expired_before => $expired_before, category_code => $category_code, branchcode => $branchcode, diff --git a/tools/cleanborrowers.pl b/tools/cleanborrowers.pl index 7888b990f2..3ed3254006 100755 --- a/tools/cleanborrowers.pl +++ b/tools/cleanborrowers.pl @@ -25,7 +25,7 @@ This script allows to do 2 things. =item * Anonymise the borrowers' issues if issue is older than a given date. see C. -=item * Delete the borrowers who has not borrowered since a given date. see C. +=item * Delete the borrowers who has not borrowed since a given date. see C. =back @@ -51,9 +51,9 @@ my $cgi = new CGI; my $params = $cgi->Vars; my $step = $params->{step} || 1; -my $not_borrowered_since = # the date which filter on issue history. - $params->{not_borrowered_since} - ? dt_from_string $params->{not_borrowered_since} +my $not_borrowed_since = # the date which filter on issue history. + $params->{not_borrowed_since} + ? dt_from_string $params->{not_borrowed_since} : undef; my $last_issue_date = # the date which filter on borrowers last issue. $params->{last_issue_date} @@ -84,7 +84,7 @@ if ( $step == 2 ) { my $membersToDelete; if ( $checkboxes{borrower} ) { $membersToDelete = GetBorrowersToExpunge( - _get_selection_params($not_borrowered_since, $borrower_dateexpiry, $borrower_categorycode) + _get_selection_params($not_borrowed_since, $borrower_dateexpiry, $borrower_categorycode) ); _skip_borrowers_with_nonzero_balance( $membersToDelete ); $totalDel = scalar @$membersToDelete; @@ -114,7 +114,7 @@ elsif ( $step == 3 ) { # delete members if ($do_delete) { my $membersToDelete = GetBorrowersToExpunge( - _get_selection_params($not_borrowered_since, $borrower_dateexpiry, $borrower_categorycode) + _get_selection_params($not_borrowed_since, $borrower_dateexpiry, $borrower_categorycode) ); _skip_borrowers_with_nonzero_balance( $membersToDelete ); $totalDel = scalar(@$membersToDelete); @@ -149,7 +149,7 @@ elsif ( $step == 3 ) { $template->param( step => $step, - not_borrowered_since => $not_borrowered_since, + not_borrowed_since => $not_borrowed_since, borrower_dateexpiry => $borrower_dateexpiry, last_issue_date => $last_issue_date, borrower_categorycodes => GetBorrowercategoryList(), @@ -169,14 +169,14 @@ sub _skip_borrowers_with_nonzero_balance { } sub _get_selection_params { - my ($not_borrowered_since, $borrower_dateexpiry, $borrower_categorycode) = @_; + my ($not_borrowed_since, $borrower_dateexpiry, $borrower_categorycode) = @_; my $params = {}; - $params->{not_borrowered_since} = output_pref({ - dt => $not_borrowered_since, + $params->{not_borrowed_since} = output_pref({ + dt => $not_borrowed_since, dateformat => 'iso', dateonly => 1 - }) if $not_borrowered_since; + }) if $not_borrowed_since; $params->{expired_before} = output_pref({ dt => $borrower_dateexpiry, dateformat => 'iso', -- 2.11.0