Bugzilla – Attachment 64660 Details for
Bug 17554
Move GetBorrowersWithEmail to Koha::Patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17554: Koha::Patrons - Remove GetBorrowersWithEmail
Bug-17554-KohaPatrons---Remove-GetBorrowersWithEma.patch (text/plain), 2.86 KB, created by
Tomás Cohen Arazi (tcohen)
on 2017-06-26 18:27:31 UTC
(
hide
)
Description:
Bug 17554: Koha::Patrons - Remove GetBorrowersWithEmail
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2017-06-26 18:27:31 UTC
Size:
2.86 KB
patch
obsolete
>From dbeff037e8d87733076e2926b74152d02c866a99 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 4 Nov 2016 14:43:21 +0000 >Subject: [PATCH] Bug 17554: Koha::Patrons - Remove GetBorrowersWithEmail > >C4::Members::GetBorrowersWithEmail can be easily replaced with >Koha::Patrons->search({ email => $email }); > >Test plan: >Confirm that you are still able to use PKI authentication > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > C4/Auth.pm | 8 ++++---- > C4/Members.pm | 28 ---------------------------- > 2 files changed, 4 insertions(+), 32 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 9e787c0..549ece9 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -995,12 +995,12 @@ sub checkauth { > # doesn't have a userid. So if there is none, we pass along the > # borrower number, and the bits of code that need to know the user > # ID will have to be smart enough to handle that. >- require C4::Members; >- my @users_info = C4::Members::GetBorrowersWithEmail($value); >- if (@users_info) { >+ my $patrons = Koha::Patrons->search({ email => $value }); >+ if ($patrons->count) { > > # First the userid, then the borrowernum >- $value = $users_info[0][1] || $users_info[0][0]; >+ my $patron = $patrons->next; >+ $value = $patron->userid || $patron->borrowernumber; > } else { > undef $value; > } >diff --git a/C4/Members.pm b/C4/Members.pm >index 6527c79..a251fa0 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -74,7 +74,6 @@ BEGIN { > &GetBorrowersToExpunge > > &IssueSlip >- GetBorrowersWithEmail > > GetOverduesForPatron > ); >@@ -1245,33 +1244,6 @@ sub IssueSlip { > ); > } > >-=head2 GetBorrowersWithEmail >- >- ([$borrnum,$userid], ...) = GetBorrowersWithEmail('me@example.com'); >- >-This gets a list of users and their basic details from their email address. >-As it's possible for multiple user to have the same email address, it provides >-you with all of them. If there is no userid for the user, there will be an >-C<undef> there. An empty list will be returned if there are no matches. >- >-=cut >- >-sub GetBorrowersWithEmail { >- my $email = shift; >- >- my $dbh = C4::Context->dbh; >- >- my $query = "SELECT borrowernumber, userid FROM borrowers WHERE email=?"; >- my $sth=$dbh->prepare($query); >- $sth->execute($email); >- my @result = (); >- while (my $ref = $sth->fetch) { >- push @result, $ref; >- } >- die "Failure searching for borrowers by email address: $sth->errstr" if $sth->err; >- return @result; >-} >- > =head2 AddMember_Auto > > =cut >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17554
:
57207
|
57208
|
58184
|
58486
|
62956
| 64660 |
64661