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

(-)a/Koha/Patron.pm (+3 lines)
Lines 360-365 other lists are kept. Link Here
360
sub delete {
360
sub delete {
361
    my ($self) = @_;
361
    my ($self) = @_;
362
362
363
    my $anonymous_patron = C4::Context->preference("AnonymousPatron");
364
    return $self if $anonymous_patron && $self->id eq $anonymous_patron;
365
363
    $self->_result->result_source->schema->txn_do(
366
    $self->_result->result_source->schema->txn_do(
364
        sub {
367
        sub {
365
            # Cancel Patron's holds
368
            # Cancel Patron's holds
(-)a/t/db_dependent/Koha/Patrons.t (-2 / +10 lines)
Lines 1063-1069 subtest 'notice_email_address' => sub { Link Here
1063
};
1063
};
1064
1064
1065
subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub {
1065
subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub {
1066
    plan tests => 4;
1066
    plan tests => 5;
1067
1067
1068
    # TODO create a subroutine in t::lib::Mocks
1068
    # TODO create a subroutine in t::lib::Mocks
1069
    my $branch = $builder->build({ source => 'Branch' });
1069
    my $branch = $builder->build({ source => 'Branch' });
Lines 1077-1082 subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub { Link Here
1077
1077
1078
    t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous->{borrowernumber} );
1078
    t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous->{borrowernumber} );
1079
1079
1080
    subtest 'Anonymous Patron should be undeleteable' => sub {
1081
        plan tests => 1;
1082
1083
        my $anonymous_patron = Koha::Patrons->find( $anonymous->{borrowernumber} );
1084
        $anonymous_patron->delete();
1085
        $anonymous_patron = Koha::Patrons->find( $anonymous->{borrowernumber} );
1086
        is( $anonymous_patron->id, $anonymous->{borrowernumber}, "Anonymous Patron was not deleted" );
1087
    };
1088
1080
    subtest 'patron privacy is 1 (default)' => sub {
1089
    subtest 'patron privacy is 1 (default)' => sub {
1081
        plan tests => 9;
1090
        plan tests => 9;
1082
1091
1083
- 

Return to bug 14708