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

(-)a/Koha/Patron.pm (+5 lines)
Lines 567-572 sub merge_with { Link Here
567
567
568
    $self->_result->result_source->schema->txn_do( sub {
568
    $self->_result->result_source->schema->txn_do( sub {
569
        foreach my $patron_id (@patron_ids) {
569
        foreach my $patron_id (@patron_ids) {
570
571
            if ( my $anonymous_patron = C4::Context->preference("AnonymousPatron") ) {
572
                next if $patron_id eq $anonymous_patron;
573
            }
574
570
            my $patron = Koha::Patrons->find( $patron_id );
575
            my $patron = Koha::Patrons->find( $patron_id );
571
576
572
            next unless $patron;
577
            next unless $patron;
(-)a/t/db_dependent/Koha/Patrons.t (-2 / +7 lines)
Lines 1692-1698 subtest 'BorrowersLog tests' => sub { Link Here
1692
$schema->storage->txn_rollback;
1692
$schema->storage->txn_rollback;
1693
1693
1694
subtest 'Test Koha::Patrons::merge' => sub {
1694
subtest 'Test Koha::Patrons::merge' => sub {
1695
    plan tests => 110;
1695
    plan tests => 111;
1696
1696
1697
    my $schema = Koha::Database->new()->schema();
1697
    my $schema = Koha::Database->new()->schema();
1698
1698
Lines 1704-1709 subtest 'Test Koha::Patrons::merge' => sub { Link Here
1704
    my $loser_1 = $builder->build({ source => 'Borrower' })->{borrowernumber};
1704
    my $loser_1 = $builder->build({ source => 'Borrower' })->{borrowernumber};
1705
    my $loser_2 = $builder->build({ source => 'Borrower' })->{borrowernumber};
1705
    my $loser_2 = $builder->build({ source => 'Borrower' })->{borrowernumber};
1706
1706
1707
    my $anonymous_patron_orig = C4::Context->preference('AnonymousPatron');
1708
    my $anonymous_patron = $builder->build({ source => 'Borrower' })->{borrowernumber};
1709
    t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous_patron );
1710
1707
    while (my ($r, $field) = each(%$resultsets)) {
1711
    while (my ($r, $field) = each(%$resultsets)) {
1708
        $builder->build({ source => $r, value => { $field => $keeper->id } });
1712
        $builder->build({ source => $r, value => { $field => $keeper->id } });
1709
        $builder->build({ source => $r, value => { $field => $loser_1 } });
1713
        $builder->build({ source => $r, value => { $field => $loser_1 } });
Lines 1732-1738 subtest 'Test Koha::Patrons::merge' => sub { Link Here
1732
1736
1733
    is( Koha::Patrons->find($loser_1), undef, 'Loser 1 has been deleted' );
1737
    is( Koha::Patrons->find($loser_1), undef, 'Loser 1 has been deleted' );
1734
    is( Koha::Patrons->find($loser_2), undef, 'Loser 2 has been deleted' );
1738
    is( Koha::Patrons->find($loser_2), undef, 'Loser 2 has been deleted' );
1739
    is( ref Koha::Patrons->find($anonymous_patron), 'Koha::Patron', 'Anonymous Patron was not deleted' );
1735
1740
1741
    t::lib::Mocks::mock_preference( 'AnonymousPatron', '' );
1736
    $schema->storage->txn_rollback;
1742
    $schema->storage->txn_rollback;
1737
};
1743
};
1738
1744
1739
- 

Return to bug 14708