View | Details | Raw Unified | Return to bug 14708
Collapse All | Expand All

(-)a/C4/Members.pm (+5 lines)
Lines 437-442 sub GetBorrowersToExpunge { Link Here
437
        push @query_params,$filterdate;
437
        push @query_params,$filterdate;
438
    }
438
    }
439
439
440
    if ( my $anonymous_patron = C4::Context->preference("AnonymousPatron") ) {
441
        $query .= q{ AND borrowernumber != ? };
442
        push( @query_params, $anonymous_patron );
443
    }
444
440
    warn $query if $debug;
445
    warn $query if $debug;
441
446
442
    my $sth = $dbh->prepare($query);
447
    my $sth = $dbh->prepare($query);
(-)a/t/db_dependent/Members.t (-3 / +10 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 47;
20
use Test::More tests => 48;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Exception;
22
use Test::Exception;
23
23
Lines 248-258 $builder->build({ Link Here
248
# IndependentBranches is off.
248
# IndependentBranches is off.
249
t::lib::Mocks::mock_preference('IndependentBranches', 0);
249
t::lib::Mocks::mock_preference('IndependentBranches', 0);
250
250
251
my $anonymous_patron = Koha::Patron->new({ categorycode => 'CIVILIAN', branchcode => $library2->{branchcode} })->store->borrowernumber;
252
t::lib::Mocks::mock_preference('AnonymousPatron', $anonymous_patron);
253
251
my $owner = Koha::Patron->new({ categorycode => 'STAFFER', branchcode => $library2->{branchcode} })->store->borrowernumber;
254
my $owner = Koha::Patron->new({ categorycode => 'STAFFER', branchcode => $library2->{branchcode} })->store->borrowernumber;
252
my $list1 = AddPatronList( { name => 'Test List 1', owner => $owner } );
255
my $list1 = AddPatronList( { name => 'Test List 1', owner => $owner } );
256
257
AddPatronsToList( { list => $list1, borrowernumbers => [$anonymous_patron] } );
258
my $patstodel = GetBorrowersToExpunge( { patron_list_id => $list1->patron_list_id() } );
259
is( scalar(@$patstodel), 0, 'Anonymous Patron not deleted from list' );
260
253
my @listpatrons = ($bor1inlist, $bor2inlist);
261
my @listpatrons = ($bor1inlist, $bor2inlist);
254
AddPatronsToList(  { list => $list1, borrowernumbers => \@listpatrons });
262
AddPatronsToList(  { list => $list1, borrowernumbers => \@listpatrons });
255
my $patstodel = GetBorrowersToExpunge( {patron_list_id => $list1->patron_list_id() } );
263
$patstodel = GetBorrowersToExpunge( {patron_list_id => $list1->patron_list_id() } );
256
is( scalar(@$patstodel),0,'No staff deleted from list of all staff');
264
is( scalar(@$patstodel),0,'No staff deleted from list of all staff');
257
Koha::Patrons->find($bor2inlist)->set({ categorycode => 'CIVILIAN' })->store;
265
Koha::Patrons->find($bor2inlist)->set({ categorycode => 'CIVILIAN' })->store;
258
$patstodel = GetBorrowersToExpunge( {patron_list_id => $list1->patron_list_id()} );
266
$patstodel = GetBorrowersToExpunge( {patron_list_id => $list1->patron_list_id()} );
259
- 

Return to bug 14708