From 12cbf2e758786158972fff9326633be90c93a2be Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Wed, 14 Jun 2023 14:14:53 +0000 Subject: [PATCH] Bug 15504: Add triggers to instances of track_login_daily This patch adds a trigger to every instance of track_login_daily Signed-off-by: Martin Renvoize Signed-off-by: David Nind --- C4/Auth.pm | 2 +- C4/Circulation.pm | 9 +++++++-- C4/ILSDI/Services.pm | 2 +- C4/SIP/Sip/MsgType.pm | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index dcaac1dbc2b..9f19ebabc18 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1319,7 +1319,7 @@ sub checkauth { )); } - track_login_daily( $userid ); + track_login_daily( $userid, 'login' ); # In case, that this request was a login attempt, we want to prevent that users can repost the opac login # request. We therefore redirect the user to the requested page again without the login parameters. diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 2ebe5cbe6e3..2842021a4f0 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1677,7 +1677,7 @@ sub AddIssue { )->store; } $issue->discard_changes; - C4::Auth::track_login_daily( $patron->userid ); + C4::Auth::track_login_daily( $patron->userid, 'check_out' ); if ( $item_object->location && $item_object->location eq 'CART' && ( !$item_object->permanent_location || $item_object->permanent_location ne 'CART' ) ) { ## Item was moved to cart via UpdateItemLocationOnCheckin, anything issued should be taken off the cart. @@ -2494,7 +2494,10 @@ sub AddReturn { logaction("CIRCULATION", "RETURN", $borrowernumber, $item->itemnumber) if C4::Context->preference("ReturnLog"); - } + + #Update borrowers.lastseen + C4::Auth::track_login_daily( $patron->userid, 'check_in' ); + } # Check if this item belongs to a biblio record that is attached to an # ILL request, if it is we need to update the ILL request's status @@ -3343,6 +3346,8 @@ sub AddRenewal { interface => C4::Context->interface, } ); + #Update borrowers.lastseen + C4::Auth::track_login_daily( $patron_unblessed->{userid}, 'renewal' ); #Log the renewal logaction("CIRCULATION", "RENEWAL", $borrowernumber, $itemnumber) if C4::Context->preference("RenewalLog"); diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index 77243a882ac..6cb6ff5d896 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -397,7 +397,7 @@ sub AuthenticatePatron { my ($status, $cardnumber, $userid) = C4::Auth::checkpw( $username, $password ); if ( $status == 1 ) { # Track the login - C4::Auth::track_login_daily( $userid ); + C4::Auth::track_login_daily( $userid, 'connection' ); # Get the borrower my $patron = Koha::Patrons->find( { userid => $userid } ); return { id => $patron->borrowernumber }; diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm index e29d390da84..b166551e450 100644 --- a/C4/SIP/Sip/MsgType.pm +++ b/C4/SIP/Sip/MsgType.pm @@ -995,7 +995,7 @@ sub handle_patron_info { $resp = (PATRON_INFO_RESP); if ($patron) { - $patron->update_lastseen(); + C4::Auth::track_login_daily( $patron->userid, 'connection' ); $resp .= patron_status_string( $patron, $server ); $resp .= ( defined($lang) and length($lang) == 3 ) ? $lang : $patron->language; $resp .= timestamp(); -- 2.41.0