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

(-)a/C4/SIP/ILS/Patron.pm (-15 lines)
Lines 501-521 sub charge_denied { Link Here
501
    return "Please contact library staff";
501
    return "Please contact library staff";
502
}
502
}
503
503
504
=head2 update_lastseen
505
506
    $patron->update_lastseen();
507
508
    Patron method to update lastseen field in borrower
509
    to record that patron has been seen via sip connection
510
511
=cut
512
513
sub update_lastseen {
514
    my $self = shift;
515
    my $kohaobj = Koha::Patrons->find( $self->{borrowernumber} );
516
    $kohaobj->track_login if $kohaobj; # track_login checks the pref
517
}
518
519
sub _get_address {
504
sub _get_address {
520
    my $patron = shift;
505
    my $patron = shift;
521
506
(-)a/t/db_dependent/SIP/Patron.t (-24 / +1 lines)
Lines 4-10 Link Here
4
# This needs to be extended! Your help is appreciated..
4
# This needs to be extended! Your help is appreciated..
5
5
6
use Modern::Perl;
6
use Modern::Perl;
7
use Test::More tests => 10;
7
use Test::More tests => 9;
8
8
9
use t::lib::Mocks;
9
use t::lib::Mocks;
10
use t::lib::TestBuilder;
10
use t::lib::TestBuilder;
Lines 188-215 subtest "Test build_custom_field_string" => sub { Link Here
188
188
189
};
189
};
190
190
191
subtest "update_lastseen tests" => sub {
192
    plan tests => 2;
193
194
    my $seen_patron = $builder->build(
195
        {
196
            source => 'Borrower',
197
            value  => {
198
                lastseen    => "2001-01-01",
199
            }
200
        }
201
    );
202
    my $sip_patron = C4::SIP::ILS::Patron->new( $seen_patron->{cardnumber} );
203
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '' );
204
    $sip_patron->update_lastseen();
205
    $seen_patron = Koha::Patrons->find({ cardnumber => $seen_patron->{cardnumber} });
206
    is( output_pref({str => $seen_patron->lastseen(), dateonly => 1}), output_pref({str => '2001-01-01', dateonly => 1}),'Last seen not updated if not tracking patrons');
207
    t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '1' );
208
    $sip_patron->update_lastseen();
209
    $seen_patron = Koha::Patrons->find({ cardnumber => $seen_patron->cardnumber() });
210
    is( output_pref({str => $seen_patron->lastseen(), dateonly => 1}), output_pref({dt => dt_from_string(), dateonly => 1}),'Last seen updated to today if tracking patrons');
211
};
212
213
subtest "fine_items tests" => sub {
191
subtest "fine_items tests" => sub {
214
192
215
    plan tests => 12;
193
    plan tests => 12;
216
- 

Return to bug 15504