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

(-)a/C4/SIP/ILS/Patron.pm (-15 lines)
Lines 515-535 sub charge_denied { Link Here
515
    return "Please contact library staff";
515
    return "Please contact library staff";
516
}
516
}
517
517
518
=head2 update_lastseen
519
520
    $patron->update_lastseen();
521
522
    Patron method to update lastseen field in borrower
523
    to record that patron has been seen via sip connection
524
525
=cut
526
527
sub update_lastseen {
528
    my $self = shift;
529
    my $kohaobj = Koha::Patrons->find( $self->{borrowernumber} );
530
    $kohaobj->track_login if $kohaobj; # track_login checks the pref
531
}
532
533
sub _get_address {
518
sub _get_address {
534
    my $patron = shift;
519
    my $patron = shift;
535
520
(-)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