Commit 2f034468 authored by Benjamin Rokseth's avatar Benjamin Rokseth
Browse files

koha: Add Deichman::Patron->Find method

parent c0ee0d47
......@@ -14,6 +14,7 @@ sub new {
$self = { %$self, # Inherent anything from parent
patron => undef,
attrs => [],
list => [],
};
bless $self, $class;
return $self;
......@@ -71,6 +72,24 @@ sub GetByUserId {
return $self;
}
sub Find {
my ($self, $args) = @_;
$args->{userid} ||= "";
$args->{cardnumber} ||= "";
$args->{email} ||= "";
use Data::Dumper; warn Dumper($args);
my $dbh = $self->dbh;
my $q = "SELECT * FROM borrowers WHERE userid = ? OR cardnumber = ? OR email = ?";
my $sth = $dbh->prepare($q);
$sth->execute($args->{userid}, $args->{cardnumber}, $args->{email}) or Deichman::Exception::Patron->throw($dbh->errstr);
my @list;
while (my $p = $sth->fetchrow_hashref) {
push @list, $p;
}
$self->{list} = \@list;
return $self;
}
sub GetReserves {
my ($self) = @_;
return $self->Deichman::Patron::Reserve::GetByPatron();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment