From 58922dd9cc1b1f2dd480db9cb64a1e76596a03a6 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Wed, 14 Jun 2023 14:15:33 +0000 Subject: [PATCH] Bug 15504: Remove update_lastseen method This patch removes update_lastseen which has been replaced by a call to track_login_daily Signed-off-by: Martin Renvoize Signed-off-by: David Nind --- C4/SIP/ILS/Patron.pm | 15 --------------- t/db_dependent/SIP/Patron.t | 24 +----------------------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index 4b3e76f1a8c..b01f0727bef 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -501,21 +501,6 @@ sub charge_denied { return "Please contact library staff"; } -=head2 update_lastseen - - $patron->update_lastseen(); - - Patron method to update lastseen field in borrower - to record that patron has been seen via sip connection - -=cut - -sub update_lastseen { - my $self = shift; - my $kohaobj = Koha::Patrons->find( $self->{borrowernumber} ); - $kohaobj->track_login if $kohaobj; # track_login checks the pref -} - sub _get_address { my $patron = shift; diff --git a/t/db_dependent/SIP/Patron.t b/t/db_dependent/SIP/Patron.t index d7e86eb4447..de1c784ea3c 100755 --- a/t/db_dependent/SIP/Patron.t +++ b/t/db_dependent/SIP/Patron.t @@ -4,7 +4,7 @@ # This needs to be extended! Your help is appreciated.. use Modern::Perl; -use Test::More tests => 10; +use Test::More tests => 9; use t::lib::Mocks; use t::lib::TestBuilder; @@ -188,28 +188,6 @@ subtest "Test build_custom_field_string" => sub { }; -subtest "update_lastseen tests" => sub { - plan tests => 2; - - my $seen_patron = $builder->build( - { - source => 'Borrower', - value => { - lastseen => "2001-01-01", - } - } - ); - my $sip_patron = C4::SIP::ILS::Patron->new( $seen_patron->{cardnumber} ); - t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '' ); - $sip_patron->update_lastseen(); - $seen_patron = Koha::Patrons->find({ cardnumber => $seen_patron->{cardnumber} }); - 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'); - t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '1' ); - $sip_patron->update_lastseen(); - $seen_patron = Koha::Patrons->find({ cardnumber => $seen_patron->cardnumber() }); - 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'); -}; - subtest "fine_items tests" => sub { plan tests => 12; -- 2.41.0