Lines 38-45
sub new {
Link Here
|
38 |
my ($class, $patron_id) = @_; |
38 |
my ($class, $patron_id) = @_; |
39 |
my $type = ref($class) || $class; |
39 |
my $type = ref($class) || $class; |
40 |
my $self; |
40 |
my $self; |
41 |
my $patron = Koha::Patrons->find( { cardnumber => $patron_id } ) |
41 |
|
42 |
|| Koha::Patrons->find( { userid => $patron_id } ); |
42 |
my $patron; |
|
|
43 |
if ( ref $patron_id eq "HASH" ) { |
44 |
if ( $patron_id->{borrowernumber} ) { |
45 |
$patron = Koha::Patrons->find( $patron_id->{borrowernumber} ); |
46 |
} elsif ( $patron_id->{cardnumber} ) { |
47 |
$patron = Koha::Patrons->find( { cardnumber => $patron_id->{cardnumber} } ); |
48 |
} elsif ( $patron_id->{userid} ) { |
49 |
$patron = Koha::Patrons->find( { userid => $patron_id->{userid} } ); |
50 |
} |
51 |
} else { |
52 |
$patron = Koha::Patrons->find( { cardnumber => $patron_id } ) |
53 |
|| Koha::Patrons->find( { userid => $patron_id } ); |
54 |
} |
55 |
|
43 |
$debug and warn "new Patron: " . Dumper($patron->unblessed) if $patron; |
56 |
$debug and warn "new Patron: " . Dumper($patron->unblessed) if $patron; |
44 |
unless ($patron) { |
57 |
unless ($patron) { |
45 |
siplog("LOG_DEBUG", "new ILS::Patron(%s): no such patron", $patron_id); |
58 |
siplog("LOG_DEBUG", "new ILS::Patron(%s): no such patron", $patron_id); |
46 |
- |
|
|