Bugzilla – Attachment 119387 Details for
Bug 28001
Fix delete_patrons.pl if no category is passed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28001: (bug 27050 follow-up) Fix delete_patrons if no category passed
Bug-28001-bug-27050-follow-up-Fix-deletepatrons-if.patch (text/plain), 2.50 KB, created by
Owen Leonard
on 2021-04-09 15:02:22 UTC
(
hide
)
Description:
Bug 28001: (bug 27050 follow-up) Fix delete_patrons if no category passed
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2021-04-09 15:02:22 UTC
Size:
2.50 KB
patch
obsolete
>From 73b29cf5a09530360a16c59d6347747aa5165495 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 9 Apr 2021 11:00:37 +0200 >Subject: [PATCH] Bug 28001: (bug 27050 follow-up) Fix delete_patrons if no > category passed > >GetBorrowersToExpunge must not crash if called with an empty patron >category list > >Test plan: >Call delete_patrons.pl with and without patron categories. The script >must work as expected > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > C4/Members.pm | 6 ++++-- > t/db_dependent/Members.t | 4 +++- > 2 files changed, 7 insertions(+), 3 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index f98ddecd43..c52f18add8 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -428,8 +428,10 @@ sub GetBorrowersToExpunge { > if (ref($filtercategory) ne 'ARRAY' ) { > $filtercategory = [ $filtercategory ]; > } >- $query .= " AND categorycode IN (" . join(',', ('?') x @$filtercategory) . ") "; >- push( @query_params, @$filtercategory ); >+ if ( @$filtercategory ) { >+ $query .= " AND categorycode IN (" . join(',', ('?') x @$filtercategory) . ") "; >+ push( @query_params, @$filtercategory ); >+ } > } > if ( $filterpatronlist ){ > $query.=" AND patron_list_id = ? "; >diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t >index b7a1ceea15..367d0d2aff 100755 >--- a/t/db_dependent/Members.t >+++ b/t/db_dependent/Members.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 53; >+use Test::More tests => 54; > use Test::MockModule; > use Test::Exception; > >@@ -303,6 +303,8 @@ $patstodel = GetBorrowersToExpunge( {branchcode => $library3->{branchcode},patro > is( scalar(@$patstodel),1,'Borrower with issue not deleted by branchcode and list'); > $patstodel = GetBorrowersToExpunge( {category_code => 'CIVILIAN',patron_list_id => $list1->patron_list_id() } ); > is( scalar(@$patstodel),1,'Borrower with issue not deleted by category_code and list'); >+$patstodel = GetBorrowersToExpunge( {category_code => [], patron_list_id => $list1->patron_list_id() } ); >+is( scalar(@$patstodel),1,'category_code can contain an empty arrayref'); > $patstodel = GetBorrowersToExpunge( {category_code => ['CIVILIAN','STAFFER'],patron_list_id => $list1->patron_list_id() } ); > is( scalar(@$patstodel),1,'Borrower with issue not deleted by multiple category_code and list'); > $patstodel = GetBorrowersToExpunge( {expired_before => '2015-01-02',patron_list_id => $list1->patron_list_id() } ); >-- >2.11.0
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 28001
:
119363
|
119387
|
119650
|
119651