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

(-)a/Koha/Patron.pm (-1 / +3 lines)
Lines 1111-1117 sub anonymize { Link Here
1111
        warn "Exiting anonymize: patron ".$self->borrowernumber." still has issues";
1111
        warn "Exiting anonymize: patron ".$self->borrowernumber." still has issues";
1112
        return;
1112
        return;
1113
    }
1113
    }
1114
    my $mandatory = { map { (lc $_, 1); }
1114
    # Mandatory fields come from the corresponding pref, but email fields
1115
    # are removed since scrambled email addresses only generate errors
1116
    my $mandatory = { map { (lc $_, 1); } grep { !/email/ }
1115
        split /\s*\|\s*/, C4::Context->preference('BorrowerMandatoryField') };
1117
        split /\s*\|\s*/, C4::Context->preference('BorrowerMandatoryField') };
1116
    $mandatory->{userid} = 1; # needed since sub store does not clear field
1118
    $mandatory->{userid} = 1; # needed since sub store does not clear field
1117
    my @columns = $self->_result->result_source->columns;
1119
    my @columns = $self->_result->result_source->columns;
(-)a/t/db_dependent/Koha/Patrons.t (-2 / +2 lines)
Lines 1581-1587 subtest 'lock' => sub { Link Here
1581
};
1581
};
1582
1582
1583
subtest 'anonymize' => sub {
1583
subtest 'anonymize' => sub {
1584
    plan tests => 9;
1584
    plan tests => 10;
1585
1585
1586
    my $patron1 = $builder->build_object( { class => 'Koha::Patrons' } );
1586
    my $patron1 = $builder->build_object( { class => 'Koha::Patrons' } );
1587
    my $patron2 = $builder->build_object( { class => 'Koha::Patrons' } );
1587
    my $patron2 = $builder->build_object( { class => 'Koha::Patrons' } );
Lines 1602-1607 subtest 'anonymize' => sub { Link Here
1602
    isnt( $patron1->surname, $surname, 'Surname changed' );
1602
    isnt( $patron1->surname, $surname, 'Surname changed' );
1603
    ok( $patron1->surname =~ /^\w{10}$/, 'Mandatory surname randomized' );
1603
    ok( $patron1->surname =~ /^\w{10}$/, 'Mandatory surname randomized' );
1604
    is( $patron1->branchcode, $branchcode, 'Branch code skipped' );
1604
    is( $patron1->branchcode, $branchcode, 'Branch code skipped' );
1605
    is( $patron1->email, undef, 'Email was mandatory, must be cleared' );
1605
1606
1606
    # Test wrapper in Koha::Patrons
1607
    # Test wrapper in Koha::Patrons
1607
    $patron1->surname($surname)->store; # restore
1608
    $patron1->surname($surname)->store; # restore
1608
- 

Return to bug 21535