@@ -, +, @@ and then try accessing the URL: https://your-server/cgi-bin/koha/ilsdi.pl?service=LookupPatron&id=Mabel replacing "your-server" your Koha dev test domain name (localhost:8080 if you're using a kohadevbox VM) and "Mabel" with the first name of a patron (Mabel is in the test database already if you're using that). You should get back an error message in the XML. the XML with Mabel's patron ID in it. --- C4/ILSDI/Services.pm | 21 ++++++++++++++++++--- koha-tmpl/opac-tmpl/bootstrap/en/modules/ilsdi.tt | 5 ++++- opac/ilsdi.pl | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) --- a/C4/ILSDI/Services.pm +++ a/C4/ILSDI/Services.pm @@ -84,7 +84,6 @@ Parameters: =head3 id (Required) list of either biblionumbers or itemnumbers - =head3 id_type (Required) defines the type of record identifier being used in the request, @@ -299,16 +298,32 @@ Parameters: - id_type (Optional) the type of the identifier, possible values: - cardnumber - - firstname - userid + - email - borrowernumber + - firstname + - surname =cut sub LookupPatron { my ($cgi) = @_; - my $patrons = Koha::Patrons->search( { $cgi->param('id_type') => $cgi->param('id') } ); + my $patrons; + + if(!$cgi->param('id')) { + return { message => 'PatronNotFound' }; + } + + if($cgi->param('id_type')) { + $patrons = Koha::Patrons->search( { $cgi->param('id_type') => $cgi->param('id') } ); + } else { + foreach my $id_type ('cardnumber', 'userid', 'email', 'borrowernumber', + 'surname', 'firstname') { + $patrons = Koha::Patrons->search( { $id_type => $cgi->param('id') } ); + last if($patrons->count); + } + } unless ( $patrons->count ) { return { message => 'PatronNotFound' }; } --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/ilsdi.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/ilsdi.tt @@ -459,8 +459,11 @@
the type of the identifier, possible values:
--- a/opac/ilsdi.pl +++ a/opac/ilsdi.pl @@ -47,7 +47,7 @@ my @services = ( # Level 1: Basic Discovery Interfaces # 'HarvestBibliographicRecords', # OAI-PMH # 'HarvestExpandedRecords', # OAI-PMH - 'GetAvailability', # FIXME Add bibbliographic level + 'GetAvailability', # FIXME Add bibliographic level # 'GoToBibliographicRequestPage' # I don't understant this one # Level 2: Elementary OPAC supplement --