Bugzilla – Attachment 28105 Details for
Bug 11975
Tools: Batch patron deletion code should be improved
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11975: (follow-up) simplify construction of params for GetBorrowersToExpunge()
Bug-11975-follow-up-simplify-construction-of-param.patch (text/plain), 4.43 KB, created by
Galen Charlton
on 2014-05-08 15:22:31 UTC
(
hide
)
Description:
Bug 11975: (follow-up) simplify construction of params for GetBorrowersToExpunge()
Filename:
MIME Type:
Creator:
Galen Charlton
Created:
2014-05-08 15:22:31 UTC
Size:
4.43 KB
patch
obsolete
>From c52558f50bc26458b746174281537deb8dceda21 Mon Sep 17 00:00:00 2001 >From: Galen Charlton <gmc@esilibrary.com> >Date: Thu, 8 May 2014 15:13:15 +0000 >Subject: [PATCH] Bug 11975: (follow-up) simplify construction of params for > GetBorrowersToExpunge() > >This patch consolidates the code for constructing the parameters for >GetBorrowersToExpunge() into a subroutine. As a side-effect, this >fixes a regression introduced by the main patch where no patrons would >be deleted when filtering by expiration date. > >To test: > >[1] Follow the test plan in the main patch. > >Signed-off-by: Galen Charlton <gmc@esilibrary.com> >--- > tools/cleanborrowers.pl | 82 ++++++++++++----------------------------------- > 1 file changed, 21 insertions(+), 61 deletions(-) > >diff --git a/tools/cleanborrowers.pl b/tools/cleanborrowers.pl >index f6ebcc2..10d5604 100755 >--- a/tools/cleanborrowers.pl >+++ b/tools/cleanborrowers.pl >@@ -85,39 +85,7 @@ if ( $step == 2 ) { > my $membersToDelete; > if ( $checkboxes{borrower} ) { > $membersToDelete = GetBorrowersToExpunge( >- { >- ( >- $not_borrowered_since >- ? ( >- not_borrowered_since => output_pref( >- { >- dt => $not_borrowered_since, >- dateformat => 'iso', >- dateonly => 1 >- } >- ) >- ) >- : () >- ), >- ( >- $borrower_dateexpiry >- ? ( >- expired_before => output_pref( >- { >- dt => $borrower_dateexpiry, >- dateformat => 'iso', >- dateonly => 1 >- } >- ) >- ) >- : () >- ), >- ( >- $borrower_categorycode >- ? ( category_code => $borrower_categorycode ) >- : () >- ), >- } >+ _get_selection_params($not_borrowered_since, $borrower_dateexpiry, $borrower_categorycode) > ); > _skip_borrowers_with_nonzero_balance( $membersToDelete ); > $totalDel = scalar @$membersToDelete; >@@ -147,34 +115,7 @@ elsif ( $step == 3 ) { > # delete members > if ($do_delete) { > my $membersToDelete = GetBorrowersToExpunge( >- { >- ( >- $not_borrowered_since >- ? ( >- not_borrowered_since => output_pref( >- { >- dt => $not_borrowered_since, >- dateformat => 'iso' >- } >- ) >- ) >- : () >- ), >- ( >- $borrower_dateexpiry >- ? ( >- expired_before => output_pref( >- { dt => $borrower_dateexpiry, dateformat => 'iso' } >- ) >- ) >- : () >- ), >- ( >- $borrower_categorycode >- ? ( category_code => $borrower_categorycode ) >- : () >- ), >- } >+ _get_selection_params($not_borrowered_since, $borrower_dateexpiry, $borrower_categorycode) > ); > _skip_borrowers_with_nonzero_balance( $membersToDelete ); > $totalDel = scalar(@$membersToDelete); >@@ -227,3 +168,22 @@ sub _skip_borrowers_with_nonzero_balance { > ($balance != 0) ? (): ($_); > } @$borrowers; > } >+ >+sub _get_selection_params { >+ my ($not_borrowered_since, $borrower_dateexpiry, $borrower_categorycode) = @_; >+ >+ my $params = {}; >+ $params->{not_borrowered_since} = output_pref({ >+ dt => $not_borrowered_since, >+ dateformat => 'iso', >+ dateonly => 1 >+ }) if $not_borrowered_since; >+ $params->{expired_before} = output_pref({ >+ dt => $borrower_dateexpiry, >+ dateformat => 'iso', >+ dateonly => 1 >+ }) if $borrower_dateexpiry; >+ $params->{borrower_categorycode} = $borrower_categorycode if $borrower_categorycode; >+ >+ return $params; >+}; >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11975
:
26489
|
28104
|
28105
|
28129
|
28130