Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
digibib
deichman
Commits
2f034468
Commit
2f034468
authored
Jan 10, 2019
by
Benjamin Rokseth
Browse files
koha: Add Deichman::Patron->Find method
parent
c0ee0d47
Changes
1
Show whitespace changes
Inline
Side-by-side
koha/Deichman/Patron.pm
View file @
2f034468
...
...
@@ -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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment