From 7acb7e14faed07ff987e58356d3faaa95a2cf194 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sun, 24 Apr 2016 17:51:56 +0100 Subject: [PATCH] Bug 16276: Make the batch patron deletion tool deal with last_seen This patch adds the same change as the previous one to the batch patron deletion tool. If the pref TrackLastPatronActivity is enabled, the librarians will be able to delete patrons who do not have been connected since a given time. Test plan: Define a date for the "who have not been connected since" options and confirm that it works as expected. Sponsored-by: BULAC - http://www.bulac.fr/ Signed-off-by: Nicolas Legrand https://bugs.koha-community.org/show_bug.cgi?id=12276 Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall --- .../prog/en/modules/tools/cleanborrowers.tt | 12 +++++++++++- tools/cleanborrowers.pl | 14 +++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cleanborrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cleanborrowers.tt index 7ff66d6e89..dc78a068eb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cleanborrowers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/cleanborrowers.tt @@ -13,7 +13,7 @@ */ function checkForm(form) { if((form.checkbox[0].checked)){ - if ( (!form.date1.value) && (!form.borrower_dateexpiry.value) && (!form.borrower_categorycode.value) && (!form.patron_list_id.value)){ + if ( (!form.date1.value) && (!form.borrower_dateexpiry.value) [% IF Koha.Preference('TrackLastPatronActivity') %]&& (!form.borrower_lastseen.value) [% END %]&& (!form.borrower_categorycode.value) && (!form.patron_list_id.value)){ alert(_("Please enter at least one criterion for deletion!")); return false; } @@ -107,6 +107,13 @@ [% INCLUDE 'date-format.inc' %] + [% IF Koha.Preference('TrackLastPatronActivity') %] +
  • + + + [% INCLUDE 'date-format.inc' %] +
  • + [% END %]
  • + [% IF Koha.Preference('TrackLastPatronActivity') %] + + [% END %] diff --git a/tools/cleanborrowers.pl b/tools/cleanborrowers.pl index 5d392a5c1d..1b7e0f84d0 100755 --- a/tools/cleanborrowers.pl +++ b/tools/cleanborrowers.pl @@ -64,6 +64,10 @@ my $borrower_dateexpiry = $params->{borrower_dateexpiry} ? dt_from_string $params->{borrower_dateexpiry} : undef; +my $borrower_lastseen = + $params->{borrower_lastseen} + ? dt_from_string $params->{borrower_lastseen} + : undef; my $patron_list_id = $params->{patron_list_id}; my $borrower_categorycode = $params->{'borrower_categorycode'} || q{}; @@ -92,6 +96,7 @@ if ( $step == 2 ) { _get_selection_params( $not_borrowed_since, $borrower_dateexpiry, + $borrower_lastseen, $borrower_categorycode, $patron_list_id, $branch @@ -128,6 +133,7 @@ elsif ( $step == 3 ) { _get_selection_params( $not_borrowed_since, $borrower_dateexpiry, + $borrower_lastseen, $borrower_categorycode, $patron_list_id, $branch @@ -179,6 +185,7 @@ $template->param( step => $step, not_borrowed_since => $not_borrowed_since, borrower_dateexpiry => $borrower_dateexpiry, + borrower_lastseen => $borrower_lastseen, last_issue_date => $last_issue_date, borrower_categorycodes => $patron_categories, borrower_categorycode => $borrower_categorycode, @@ -197,7 +204,7 @@ sub _skip_borrowers_with_nonzero_balance { } sub _get_selection_params { - my ($not_borrowed_since, $borrower_dateexpiry, + my ($not_borrowed_since, $borrower_dateexpiry, $borrower_lastseen, $borrower_categorycode, $patron_list_id, $branch) = @_; my $params = {}; @@ -211,6 +218,11 @@ sub _get_selection_params { dateformat => 'iso', dateonly => 1 }) if $borrower_dateexpiry; + $params->{last_seen} = output_pref({ + dt => $borrower_lastseen, + dateformat => 'iso', + dateonly => 1 + }) if $borrower_lastseen; $params->{category_code} = $borrower_categorycode if $borrower_categorycode; $params->{patron_list_id} = $patron_list_id if $patron_list_id; -- 2.39.5