Bug 17820: use ->find instead of search->next
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 28 Dec 2016 12:14:06 +0000 (13:14 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 30 Dec 2016 11:51:02 +0000 (11:51 +0000)
commitaf171f9b21da8fa1c22754caa541e826ffeee529
tree914cf2077c20d77a36c42ed83c4ce8c2e222d4b1
parent28d81cb7bbde241cafb7c1cd05860251840d7e04
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>
C4/Auth.pm