From a7392f41af9526a25c7224fb2aa560a30701f857 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sun, 24 Apr 2016 16:04:16 +0100 Subject: [PATCH] Bug 16276: Update borrowers.lastseen when a patron is active Content-Type: text/plain; charset=utf-8 In order to add the ability to delete patrons who have been inactive for more than a given time, we need to track down the last time they were active. To do that, we need a new DB column in the borrowers table (lastseen). Note that the borrowers.lastseen column will not be initialised for existing installations (set to NULL) so inactive existing patrons will never be deleted. A workaround would be to init them at the date when the new column will be added. Test plan: 0/ Set the new pref TrackLastPatronActivity on 1/ Log in as a patron (staff or OPAC) 2/ Check that the borrowers.lastseen field has been updated with the current time Sponsored-by: BULAC - http://www.bulac.fr/ Signed-off-by: Nicolas Legrand https://bugs.koha-community.org/show_bug.cgi?id=12276 Signed-off-by: Marcel de Rooy --- C4/Auth.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/C4/Auth.pm b/C4/Auth.pm index 582eefc..8431e2a 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1182,6 +1182,15 @@ sub checkauth { -HttpOnly => 1 ); } + + if ( $userid ) { + $dbh->do(q| + UPDATE borrowers + SET lastseen = NOW() + WHERE userid = ? + |, undef, $userid); + } + return ( $userid, $cookie, $sessionID, $flags ); } -- 1.7.10.4