Bug 40275: Use Koha::Patrons->find_by_identifier in the codebase
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit cd4e1da3ec)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
parent
3e2551a956
commit
b7611013b1
|
|
@ -2142,8 +2142,7 @@ sub checkpw {
|
|||
}
|
||||
|
||||
if ( defined $userid && !$patron ) {
|
||||
$patron = Koha::Patrons->find( { userid => $userid } );
|
||||
$patron = Koha::Patrons->find( { cardnumber => $userid } ) unless $patron;
|
||||
$patron = Koha::Patrons->find_by_identifier($userid);
|
||||
push @return, $patron if $check_internal_as_fallback; # We pass back the patron if authentication fails
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,11 +160,7 @@ sub checkpw_cas {
|
|||
|
||||
# Does it match one of our users ?
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $patron = Koha::Patrons->find( { userid => $userid } );
|
||||
if ($patron) {
|
||||
return ( 1, $patron->cardnumber, $patron->userid, $ticket, $patron );
|
||||
}
|
||||
$patron = Koha::Patrons->find( { cardnumber => $userid } );
|
||||
my $patron = Koha::Patrons->find_by_identifier($userid);
|
||||
if ($patron) {
|
||||
return ( 1, $patron->cardnumber, $patron->userid, $ticket, $patron );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4657,8 +4657,7 @@ Missing POD for ProcessOfflineIssue.
|
|||
sub ProcessOfflineIssue {
|
||||
my $operation = shift;
|
||||
|
||||
my $patron = Koha::Patrons->find( { cardnumber => $operation->{cardnumber} } );
|
||||
$patron ||= Koha::Patrons->find( { userid => $operation->{cardnumber} } );
|
||||
my $patron = Koha::Patrons->find_by_identifier( $operation->{cardnumber} );
|
||||
|
||||
if ($patron) {
|
||||
my $item = Koha::Items->find( { barcode => $operation->{barcode} } );
|
||||
|
|
@ -4699,8 +4698,7 @@ Missing POD for ProcessOfflinePayment.
|
|||
sub ProcessOfflinePayment {
|
||||
my $operation = shift;
|
||||
|
||||
my $patron = Koha::Patrons->find( { cardnumber => $operation->{cardnumber} } );
|
||||
$patron ||= Koha::Patrons->find( { userid => $operation->{cardnumber} } );
|
||||
my $patron = Koha::Patrons->find_by_identifier( $operation->{cardnumber} );
|
||||
|
||||
$patron->account->pay(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -59,8 +59,7 @@ sub new {
|
|||
$patron = Koha::Patrons->find( { userid => $patron_id->{userid} } );
|
||||
}
|
||||
} else {
|
||||
$patron = Koha::Patrons->find( { cardnumber => $patron_id } )
|
||||
|| Koha::Patrons->find( { userid => $patron_id } );
|
||||
$patron = Koha::Patrons->find_by_identifier($patron_id);
|
||||
}
|
||||
|
||||
unless ($patron) {
|
||||
|
|
|
|||
|
|
@ -339,8 +339,7 @@ sub _basic_auth {
|
|||
my $decoded_credentials = decode_base64($credentials);
|
||||
my ( $identifier, $password ) = split( /:/, $decoded_credentials, 2 );
|
||||
|
||||
my $patron = Koha::Patrons->find( { userid => $identifier } );
|
||||
$patron //= Koha::Patrons->find( { cardnumber => $identifier } );
|
||||
my $patron = Koha::Patrons->find_by_identifier($identifier);
|
||||
|
||||
unless ( checkpw_internal( $identifier, $password ) ) {
|
||||
Koha::Exceptions::Authorization::Unauthorized->throw( error => 'Invalid password' );
|
||||
|
|
|
|||
|
|
@ -53,8 +53,7 @@ for (@$operations) {
|
|||
|
||||
my $patron =
|
||||
$_->{cardnumber}
|
||||
? Koha::Patrons->find( { cardnumber => $_->{cardnumber} } )
|
||||
|| Koha::Patrons->find( { userid => $_->{cardnumber} } )
|
||||
? Koha::Patrons->find_by_identifier( $_->{cardnumber} )
|
||||
: undef;
|
||||
|
||||
if ($patron) {
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@ if ( $op eq 'cud-update' ) {
|
|||
my $newpassword = $query->param('newpassword');
|
||||
my $confirmpassword = $query->param('confirmpassword');
|
||||
|
||||
my $patron = Koha::Patrons->find( { userid => $userid } );
|
||||
$patron = Koha::Patrons->find( { cardnumber => $userid } ) unless $patron;
|
||||
my $patron = Koha::Patrons->find_by_identifier($userid);
|
||||
|
||||
if ( $patron && $patron->password_expiration_date ) {
|
||||
if ( $patron->account_locked ) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue