Bugzilla – Attachment 103027 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.44 KB, created by
Kyle M Hall (khall)
on 2020-04-15 17:32:23 UTC
(
hide
)
Description:
Bug 14708: Skip AnonymousPatron in GetBorrowersToExpunge
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-04-15 17:32:23 UTC
Size:
2.44 KB
patch
obsolete
>From 5385e333c9e5556a4a214eaf14824e0852a2e714 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 > >--- > 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.24.1 (Apple Git-126)
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