Browse Source

Bug 10612: (QA followup)

Rename not_borrowered_since to not_borrowed_since

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
new_12478_elasticsearch
Nick Clemens 6 years ago
committed by Brendan A Gallagher
parent
commit
9658085d1e
  1. 4
      C4/Members.pm
  2. 2
      misc/cronjobs/delete_patrons.pl
  3. 6
      t/db_dependent/Members.t
  4. 22
      tools/cleanborrowers.pl

4
C4/Members.pm

@ -1738,7 +1738,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,
patron_list_id => $patron_list_id,
@ -1752,7 +1752,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'} ||

2
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,

6
t/db_dependent/Members.t

@ -313,7 +313,7 @@ $patstodel = GetBorrowersToExpunge( {branchcode => $library3->{branchcode},patro
ok( scalar(@$patstodel) == 1 && $patstodel->[0]->{'borrowernumber'} eq $bor2inlist,'Staff patron not deleted by branchcode and list');
$patstodel = GetBorrowersToExpunge( {expired_before => '2015-01-02', patron_list_id => $list1->patron_list_id() } );
ok( scalar(@$patstodel) == 1 && $patstodel->[0]->{'borrowernumber'} eq $bor2inlist,'Staff patron not deleted by expirationdate and list');
$patstodel = GetBorrowersToExpunge( {not_borrowered_since => '2016-01-02', patron_list_id => $list1->patron_list_id() } );
$patstodel = GetBorrowersToExpunge( {not_borrowed_since => '2016-01-02', patron_list_id => $list1->patron_list_id() } );
ok( scalar(@$patstodel) == 1 && $patstodel->[0]->{'borrowernumber'} eq $bor2inlist,'Staff patron not deleted by last issue date');
ModMember( borrowernumber => $bor1inlist, categorycode => 'CIVILIAN' );
@ -325,7 +325,7 @@ $patstodel = GetBorrowersToExpunge( {branchcode => $library3->{branchcode},patro
ok( scalar(@$patstodel) == 1 && $patstodel->[0]->{'borrowernumber'} eq $bor2inlist,'Guarantor patron not deleted by branchcode and list');
$patstodel = GetBorrowersToExpunge( {expired_before => '2015-01-02', patron_list_id => $list1->patron_list_id() } );
ok( scalar(@$patstodel) == 1 && $patstodel->[0]->{'borrowernumber'} eq $bor2inlist,'Guarantor patron not deleted by expirationdate and list');
$patstodel = GetBorrowersToExpunge( {not_borrowered_since => '2016-01-02', patron_list_id => $list1->patron_list_id() } );
$patstodel = GetBorrowersToExpunge( {not_borrowed_since => '2016-01-02', patron_list_id => $list1->patron_list_id() } );
ok( scalar(@$patstodel) == 1 && $patstodel->[0]->{'borrowernumber'} eq $bor2inlist,'Guarantor patron not deleted by last issue date');
ModMember( borrowernumber => $guarantee->{borrowernumber}, guarantorid=>'' );
@ -350,7 +350,7 @@ $patstodel = GetBorrowersToExpunge( {category_code => 'CIVILIAN',patron_list_id
is( scalar(@$patstodel),2,'Borrowers without issues deleted by category_code and list');
$patstodel = GetBorrowersToExpunge( {expired_before => '2015-01-02',patron_list_id => $list1->patron_list_id() } );
is( scalar(@$patstodel),2,'Borrowers without issues deleted by expiration_date and list');
$patstodel = GetBorrowersToExpunge( {not_borrowered_since => '2016-01-02', patron_list_id => $list1->patron_list_id() } );
$patstodel = GetBorrowersToExpunge( {not_borrowed_since => '2016-01-02', patron_list_id => $list1->patron_list_id() } );
is( scalar(@$patstodel),2,'Borrowers without issues deleted by last issue date');

22
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<datefilter1>.
=item * Delete the borrowers who has not borrowered since a given date. see C<datefilter2>.
=item * Delete the borrowers who has not borrowed since a given date. see C<datefilter2>.
=back
@ -52,9 +52,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}
@ -86,7 +86,7 @@ if ( $step == 2 ) {
if ( $checkboxes{borrower} ) {
$patrons_to_delete = GetBorrowersToExpunge(
_get_selection_params(
$not_borrowered_since,
$not_borrowed_since,
$borrower_dateexpiry,
$borrower_categorycode,
$patron_list_id,
@ -117,7 +117,7 @@ elsif ( $step == 3 ) {
if ($do_delete) {
my $patrons_to_delete = GetBorrowersToExpunge(
_get_selection_params(
$not_borrowered_since, $borrower_dateexpiry,
$not_borrowed_since, $borrower_dateexpiry,
$borrower_categorycode, $patron_list_id
)
);
@ -163,7 +163,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(),
@ -183,14 +183,14 @@ sub _skip_borrowers_with_nonzero_balance {
}
sub _get_selection_params {
my ($not_borrowered_since, $borrower_dateexpiry, $borrower_categorycode, $patron_list_id) = @_;
my ($not_borrowed_since, $borrower_dateexpiry, $borrower_categorycode, $patron_list_id) = @_;
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',

Loading…
Cancel
Save