|
Lines 310-329
Parameters:
Link Here
|
| 310 |
sub LookupPatron { |
310 |
sub LookupPatron { |
| 311 |
my ($cgi) = @_; |
311 |
my ($cgi) = @_; |
| 312 |
|
312 |
|
| 313 |
my $patrons; |
313 |
my $id = $cgi->param('id'); |
| 314 |
|
314 |
if(!$id) { |
| 315 |
if(!$cgi->param('id')) { |
315 |
return { message => 'PatronNotFound' }; |
| 316 |
return { message => 'PatronNotFound' }; |
|
|
| 317 |
} |
316 |
} |
| 318 |
|
317 |
|
| 319 |
if($cgi->param('id_type')) { |
318 |
my $patrons; |
| 320 |
$patrons = Koha::Patrons->search( { $cgi->param('id_type') => $cgi->param('id') } ); |
319 |
my $passed_id_type = $cgi->param('id_type'); |
|
|
320 |
if($passed_id_type) { |
| 321 |
$patrons = Koha::Patrons->search( { $passed_id_type => $id } ); |
| 321 |
} else { |
322 |
} else { |
| 322 |
foreach my $id_type ('cardnumber', 'userid', 'email', 'borrowernumber', |
323 |
foreach my $id_type ('cardnumber', 'userid', 'email', 'borrowernumber', |
| 323 |
'surname', 'firstname') { |
324 |
'surname', 'firstname') { |
| 324 |
$patrons = Koha::Patrons->search( { $id_type => $cgi->param('id') } ); |
325 |
$patrons = Koha::Patrons->search( { $id_type => $id } ); |
| 325 |
last if($patrons->count); |
326 |
last if($patrons->count); |
| 326 |
} |
327 |
} |
| 327 |
} |
328 |
} |
| 328 |
unless ( $patrons->count ) { |
329 |
unless ( $patrons->count ) { |
| 329 |
return { message => 'PatronNotFound' }; |
330 |
return { message => 'PatronNotFound' }; |
| 330 |
- |
|
|