Bug 17820: use ->find instead of search->next

From C4::Auth:
  my $patron = Koha::Patrons->search({ userid => $userid })->next;

This should be replaced with
  my $patron = Koha::Patrons->find({ userid => $userid });

userid is a unique key

Caught with NYTProf:
 # spent 78.9ms making 1 call to Koha::Objects::next

Test plan:
Login at the intranet
Reload the page
=> You must still be logged in

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested by enabling TrackLastPatronActivity and logging in again.
Verified lastseen column in borrowers.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-12-28 13:14:06 +01:00 committed by Kyle M Hall
parent 28d81cb7bb
commit af171f9b21
1 changed files with 1 additions and 1 deletions

View File

@ -1185,7 +1185,7 @@ sub checkauth {
if ( $userid ) {
# track_login also depends on pref TrackLastPatronActivity
my $patron = Koha::Patrons->search({ userid => $userid })->next;
my $patron = Koha::Patrons->find({ userid => $userid });
$patron->track_login if $patron;
}