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

(-)a/Koha/Patron.pm (-6 / +3 lines)
Lines 21-27 package Koha::Patron; Link Here
21
use Modern::Perl;
21
use Modern::Perl;
22
22
23
use Carp;
23
use Carp;
24
use List::MoreUtils qw( uniq );
24
use List::MoreUtils qw( any uniq );
25
use JSON qw( to_json );
25
use JSON qw( to_json );
26
use Text::Unaccent qw( unac_string );
26
use Text::Unaccent qw( unac_string );
27
27
Lines 260-266 sub store { Link Here
260
                    my $info;
260
                    my $info;
261
                    my $from_storage = $self_from_storage->unblessed;
261
                    my $from_storage = $self_from_storage->unblessed;
262
                    my $from_object  = $self->unblessed;
262
                    my $from_object  = $self->unblessed;
263
                    my @skip_fields  = (qw/lastseen/);
263
                    for my $key ( keys %{$from_storage} ) {
264
                    for my $key ( keys %{$from_storage} ) {
265
                        next if any { /$key/ } @skip_fields;
264
                        if (
266
                        if (
265
                            (
267
                            (
266
                                  !defined( $from_storage->{$key} )
268
                                  !defined( $from_storage->{$key} )
Lines 294-304 sub store { Link Here
294
                            )
296
                            )
295
                        );
297
                        );
296
                    }
298
                    }
297
                    else {
298
                        logaction( "MEMBERS", "MODIFY", $self->borrowernumber,
299
                            "NON-STANDARD FIELD CHANGED" );
300
301
                    }
302
                }
299
                }
303
300
304
                # Final store
301
                # Final store
(-)a/t/db_dependent/Koha/Patrons.t (-3 / +7 lines)
Lines 1399-1406 $nb_of_patrons = Koha::Patrons->search->count; Link Here
1399
$retrieved_patron_1->delete;
1399
$retrieved_patron_1->delete;
1400
is( Koha::Patrons->search->count, $nb_of_patrons - 1, 'Delete should have deleted the patron' );
1400
is( Koha::Patrons->search->count, $nb_of_patrons - 1, 'Delete should have deleted the patron' );
1401
1401
1402
subtest 'Log cardnumber change' => sub {
1402
subtest 'BorrowersLog tests' => sub {
1403
    plan tests => 3;
1403
    plan tests => 4;
1404
1404
1405
    t::lib::Mocks::mock_preference( 'BorrowersLog', 1 );
1405
    t::lib::Mocks::mock_preference( 'BorrowersLog', 1 );
1406
    my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
1406
    my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
Lines 1414-1419 subtest 'Log cardnumber change' => sub { Link Here
1414
    is( $log_info->{cardnumber}->{after}, 'TESTCARDNUMBER', 'Got correct new cardnumber' );
1414
    is( $log_info->{cardnumber}->{after}, 'TESTCARDNUMBER', 'Got correct new cardnumber' );
1415
    is( $log_info->{cardnumber}->{before}, $cardnumber, 'Got correct old cardnumber' );
1415
    is( $log_info->{cardnumber}->{before}, $cardnumber, 'Got correct old cardnumber' );
1416
    is( scalar @logs, 1, 'With BorrowerLogs, one detailed MODIFY action should be logged for the modification.' );
1416
    is( scalar @logs, 1, 'With BorrowerLogs, one detailed MODIFY action should be logged for the modification.' );
1417
1418
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', 1 );
1419
    $patron->track_login();
1420
    @logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'MODIFY', object => $patron->borrowernumber } );
1421
    is( scalar @logs, 1, 'With BorrowerLogs and TrackLastPatronActivity we should not spam the logs');
1417
};
1422
};
1418
1423
1419
$schema->storage->txn_rollback;
1424
$schema->storage->txn_rollback;
1420
- 

Return to bug 3820