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

(-)a/Koha/Patron.pm (+2 lines)
Lines 1205-1210 sub anonymize { Link Here
1205
        }
1205
        }
1206
    }
1206
    }
1207
    $self->flgAnonymized(1)->store;
1207
    $self->flgAnonymized(1)->store;
1208
    logaction( "MEMBERS", "ANONYMIZE", $self->borrowernumber, "" ) if C4::Context->preference("BorrowersLog");
1209
1208
}
1210
}
1209
1211
1210
sub _anonymize_column {
1212
sub _anonymize_column {
(-)a/t/db_dependent/Koha/Patrons.t (-2 / +3 lines)
Lines 1582-1588 subtest 'lock' => sub { Link Here
1582
};
1582
};
1583
1583
1584
subtest 'anonymize' => sub {
1584
subtest 'anonymize' => sub {
1585
    plan tests => 9;
1585
    plan tests => 10;
1586
1586
1587
    my $patron1 = $builder->build_object( { class => 'Koha::Patrons' } );
1587
    my $patron1 = $builder->build_object( { class => 'Koha::Patrons' } );
1588
    my $patron2 = $builder->build_object( { class => 'Koha::Patrons' } );
1588
    my $patron2 = $builder->build_object( { class => 'Koha::Patrons' } );
Lines 1593-1602 subtest 'anonymize' => sub { Link Here
1593
    $issue->delete;
1593
    $issue->delete;
1594
1594
1595
    t::lib::Mocks::mock_preference( 'BorrowerMandatoryField', 'surname|email|cardnumber' );
1595
    t::lib::Mocks::mock_preference( 'BorrowerMandatoryField', 'surname|email|cardnumber' );
1596
    t::lib::Mocks::mock_preference( 'BorrowersLog', 1 );
1596
    my $surname = $patron1->surname; # expect change, no clear
1597
    my $surname = $patron1->surname; # expect change, no clear
1597
    my $branchcode = $patron1->branchcode; # expect skip
1598
    my $branchcode = $patron1->branchcode; # expect skip
1598
    $patron1->anonymize;
1599
    $patron1->anonymize;
1599
    is($patron1->flgAnonymized, 1, 'Check flag' );
1600
    is($patron1->flgAnonymized, 1, 'Check flag' );
1601
    is( $schema->resultset('ActionLog')->search({ object => $patron1->borrowernumber, module => 'MEMBERS', action => 'ANONYMIZE' })->count, 1, 'Action has been logged too' );
1600
1602
1601
    is( $patron1->dateofbirth, undef, 'Birth date cleared' );
1603
    is( $patron1->dateofbirth, undef, 'Birth date cleared' );
1602
    is( $patron1->firstname, undef, 'First name cleared' );
1604
    is( $patron1->firstname, undef, 'First name cleared' );
1603
- 

Return to bug 21712