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

(-)a/Koha/Patron.pm (+3 lines)
Lines 359-364 other lists are kept. Link Here
359
sub delete {
359
sub delete {
360
    my ($self) = @_;
360
    my ($self) = @_;
361
361
362
    my $anonymous_patron = C4::Context->preference("AnonymousPatron");
363
    return $self if $anonymous_patron && $self->id eq $anonymous_patron;
364
362
    $self->_result->result_source->schema->txn_do(
365
    $self->_result->result_source->schema->txn_do(
363
        sub {
366
        sub {
364
            # Cancel Patron's holds
367
            # Cancel Patron's holds
(-)a/t/db_dependent/Koha/Patrons.t (-2 / +10 lines)
Lines 1051-1057 subtest 'notice_email_address' => sub { Link Here
1051
};
1051
};
1052
1052
1053
subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub {
1053
subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub {
1054
    plan tests => 4;
1054
    plan tests => 5;
1055
1055
1056
    # TODO create a subroutine in t::lib::Mocks
1056
    # TODO create a subroutine in t::lib::Mocks
1057
    my $branch = $builder->build({ source => 'Branch' });
1057
    my $branch = $builder->build({ source => 'Branch' });
Lines 1065-1070 subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub { Link Here
1065
1065
1066
    t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous->{borrowernumber} );
1066
    t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous->{borrowernumber} );
1067
1067
1068
    subtest 'Anonymous Patron should be undeleteable' => sub {
1069
        plan tests => 1;
1070
1071
        my $anonymous_patron = Koha::Patrons->find( $anonymous->{borrowernumber} );
1072
        $anonymous_patron->delete();
1073
        $anonymous_patron = Koha::Patrons->find( $anonymous->{borrowernumber} );
1074
        is( $anonymous_patron->id, $anonymous->{borrowernumber}, "Anonymous Patron was not deleted" );
1075
    };
1076
1068
    subtest 'patron privacy is 1 (default)' => sub {
1077
    subtest 'patron privacy is 1 (default)' => sub {
1069
        plan tests => 9;
1078
        plan tests => 9;
1070
1079
1071
- 

Return to bug 14708