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

(-)a/C4/SIP/ILS/Patron.pm (-15 lines)
Lines 523-543 sub charge_denied { Link Here
523
    return "Please contact library staff";
523
    return "Please contact library staff";
524
}
524
}
525
525
526
=head2 update_lastseen
527
528
    $patron->update_lastseen();
529
530
    Patron method to update lastseen field in borrower
531
    to record that patron has been seen via sip connection
532
533
=cut
534
535
sub update_lastseen {
536
    my $self = shift;
537
    my $kohaobj = Koha::Patrons->find( $self->{borrowernumber} );
538
    $kohaobj->track_login if $kohaobj; # track_login checks the pref
539
}
540
541
sub _get_address {
526
sub _get_address {
542
    my $patron = shift;
527
    my $patron = shift;
543
528
(-)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 => 11;
7
use Test::More tests => 12;
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