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

(-)a/Koha/Patron.pm (-1 / +3 lines)
Lines 1358-1364 sub anonymize { Link Here
1358
        warn "Exiting anonymize: patron ".$self->borrowernumber." still has issues";
1358
        warn "Exiting anonymize: patron ".$self->borrowernumber." still has issues";
1359
        return;
1359
        return;
1360
    }
1360
    }
1361
    my $mandatory = { map { (lc $_, 1); }
1361
    # Mandatory fields come from the corresponding pref, but email fields
1362
    # are removed since scrambled email addresses only generate errors
1363
    my $mandatory = { map { (lc $_, 1); } grep { !/email/ }
1362
        split /\s*\|\s*/, C4::Context->preference('BorrowerMandatoryField') };
1364
        split /\s*\|\s*/, C4::Context->preference('BorrowerMandatoryField') };
1363
    $mandatory->{userid} = 1; # needed since sub store does not clear field
1365
    $mandatory->{userid} = 1; # needed since sub store does not clear field
1364
    my @columns = $self->_result->result_source->columns;
1366
    my @columns = $self->_result->result_source->columns;
(-)a/t/db_dependent/Koha/Patrons.t (-2 / +2 lines)
Lines 1761-1767 subtest 'lock' => sub { Link Here
1761
};
1761
};
1762
1762
1763
subtest 'anonymize' => sub {
1763
subtest 'anonymize' => sub {
1764
    plan tests => 9;
1764
    plan tests => 10;
1765
1765
1766
    my $patron1 = $builder->build_object( { class => 'Koha::Patrons' } );
1766
    my $patron1 = $builder->build_object( { class => 'Koha::Patrons' } );
1767
    my $patron2 = $builder->build_object( { class => 'Koha::Patrons' } );
1767
    my $patron2 = $builder->build_object( { class => 'Koha::Patrons' } );
Lines 1782-1787 subtest 'anonymize' => sub { Link Here
1782
    isnt( $patron1->surname, $surname, 'Surname changed' );
1782
    isnt( $patron1->surname, $surname, 'Surname changed' );
1783
    ok( $patron1->surname =~ /^\w{10}$/, 'Mandatory surname randomized' );
1783
    ok( $patron1->surname =~ /^\w{10}$/, 'Mandatory surname randomized' );
1784
    is( $patron1->branchcode, $branchcode, 'Branch code skipped' );
1784
    is( $patron1->branchcode, $branchcode, 'Branch code skipped' );
1785
    is( $patron1->email, undef, 'Email was mandatory, must be cleared' );
1785
1786
1786
    # Test wrapper in Koha::Patrons
1787
    # Test wrapper in Koha::Patrons
1787
    $patron1->surname($surname)->store; # restore
1788
    $patron1->surname($surname)->store; # restore
1788
- 

Return to bug 21535