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 <nicolas.legrand@bulac.fr> https://bugs.koha-community.org/show_bug.cgi?id=12276 Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
1d50d8cc0c
commit
7acb7e14fa
|
|
@ -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 @@
|
|||
<input size="10" id="borrower_dateexpiry" name="borrower_dateexpiry" type="text" class="datepicker" />
|
||||
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
|
||||
</li>
|
||||
[% IF Koha.Preference('TrackLastPatronActivity') %]
|
||||
<li>
|
||||
<label for="borrower_lastseen">who have not been connected since:</label>
|
||||
<input size="10" id="borrower_lastseen" name="borrower_lastseen" type="text" class="datepicker" />
|
||||
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
|
||||
</li>
|
||||
[% END %]
|
||||
<li>
|
||||
<label for="borrower_categorycode">whose patron category is:</label>
|
||||
<select id="borrower_categorycode" name="borrower_categorycode">
|
||||
|
|
@ -191,6 +198,9 @@
|
|||
<input type="hidden" name="not_borrowed_since" value="[% not_borrowed_since | $KohaDates %]" />
|
||||
<input type="hidden" name="last_issue_date" value="[% last_issue_date | $KohaDates %]" />
|
||||
<input type="hidden" name="borrower_dateexpiry" value="[% borrower_dateexpiry | $KohaDates %]" />
|
||||
[% IF Koha.Preference('TrackLastPatronActivity') %]
|
||||
<input type="hidden" name="borrower_lastseen" value="[% borrower_lastseen | $KohaDates %]" />
|
||||
[% END %]
|
||||
<input type="hidden" name="borrower_categorycode" value="[% borrower_categorycode %]" />
|
||||
<input type="hidden" name="patron_list_id" value="[% patron_list_id %]" />
|
||||
<input type="hidden" name="branch" value="[% current_branch %]" />
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue