Bugzilla – Attachment 105187 Details for
Bug 14708
The patron set as the anonymous patron should not be deletable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14708: Skip AnonymousPatron in GetBorrowersToExpunge
Bug-14708-Skip-AnonymousPatron-in-GetBorrowersToEx.patch (text/plain), 2.54 KB, created by
Katrin Fischer
on 2020-05-21 13:06:40 UTC
(
hide
)
Description:
Bug 14708: Skip AnonymousPatron in GetBorrowersToExpunge
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-05-21 13:06:40 UTC
Size:
2.54 KB
patch
obsolete
>From 384dc1ca7ff0fda78b12dc11e7da90f4e8f54cb7 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 15 Apr 2020 13:31:59 -0400 >Subject: [PATCH] Bug 14708: Skip AnonymousPatron in GetBorrowersToExpunge > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Members.pm | 5 +++++ > t/db_dependent/Members.t | 12 ++++++++++-- > 2 files changed, 15 insertions(+), 2 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 6c10eeeb2c..854c5c5f10 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -437,6 +437,11 @@ sub GetBorrowersToExpunge { > push @query_params,$filterdate; > } > >+ if ( my $anonymous_patron = C4::Context->preference("AnonymousPatron") ) { >+ $query .= q{ AND borrowernumber != ? }; >+ push( @query_params, $anonymous_patron ); >+ } >+ > warn $query if $debug; > > my $sth = $dbh->prepare($query); >diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t >index ff5fe994ff..cac634f252 100755 >--- a/t/db_dependent/Members.t >+++ b/t/db_dependent/Members.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 47; >+use Test::More tests => 48; > use Test::MockModule; > use Test::Exception; > >@@ -248,11 +248,19 @@ $builder->build({ > # IndependentBranches is off. > t::lib::Mocks::mock_preference('IndependentBranches', 0); > >+my $anonymous_patron = Koha::Patron->new({ categorycode => 'CIVILIAN', branchcode => $library2->{branchcode} })->store->borrowernumber; >+t::lib::Mocks::mock_preference('AnonymousPatron', $anonymous_patron); >+ > my $owner = Koha::Patron->new({ categorycode => 'STAFFER', branchcode => $library2->{branchcode} })->store->borrowernumber; > my $list1 = AddPatronList( { name => 'Test List 1', owner => $owner } ); >+ >+AddPatronsToList( { list => $list1, borrowernumbers => [$anonymous_patron] } ); >+my $patstodel = GetBorrowersToExpunge( { patron_list_id => $list1->patron_list_id() } ); >+is( scalar(@$patstodel), 0, 'Anonymous Patron not deleted from list' ); >+ > my @listpatrons = ($bor1inlist, $bor2inlist); > AddPatronsToList( { list => $list1, borrowernumbers => \@listpatrons }); >-my $patstodel = GetBorrowersToExpunge( {patron_list_id => $list1->patron_list_id() } ); >+$patstodel = GetBorrowersToExpunge( {patron_list_id => $list1->patron_list_id() } ); > is( scalar(@$patstodel),0,'No staff deleted from list of all staff'); > Koha::Patrons->find($bor2inlist)->set({ categorycode => 'CIVILIAN' })->store; > $patstodel = GetBorrowersToExpunge( {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 14708
:
85766
|
85770
|
85783
|
85789
|
103026
|
103027
|
103028
|
103922
|
105024
|
105025
|
105026
|
105027
|
105028
|
105029
|
105184
|
105185
|
105186
| 105187 |
105188
|
105189
|
112830
|
112831
|
112922
|
113121