Bugzilla – Attachment 93455 Details for
Bug 23015
Create a "GetPickupLocation" endpoint for the ILS-DI Service
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23015 : Implements a new ILS-DI service to get available pickup libraries for an item or record
Bug-23015--Implements-a-new-ILS-DI-service-to-get-.patch (text/plain), 7.36 KB, created by
Christophe Croullebois
on 2019-10-02 12:56:16 UTC
(
hide
)
Description:
Bug 23015 : Implements a new ILS-DI service to get available pickup libraries for an item or record
Filename:
MIME Type:
Creator:
Christophe Croullebois
Created:
2019-10-02 12:56:16 UTC
Size:
7.36 KB
patch
obsolete
>From af1f6f535a6c518c7daf88fa2f6ad1fdb2bfc9d3 Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Thu, 30 May 2019 01:16:55 +0200 >Subject: [PATCH] Bug 23015 : Implements a new ILS-DI service to get available > pickup libraries for an item or record > >test plan : >1 / Set a library A as available pickup location in the intranet >2 / query ILS-DI service with any record which has at least an item in >A or an item which can be transfered to A => should send all >informations about A > >3 / Remove A from available pickup locations from the item in the intranet then repeat 2 => should >give empty reply > >4 / Try with unexisting patron, unexisting item or unexisting record, >should throw an explicit error > >Signed-off-by: Christophe Croullebois <christophe.croullebois@biblibre.com> >--- > C4/ILSDI/Services.pm | 46 +++++++++++++++++++ > .../opac-tmpl/bootstrap/en/modules/ilsdi.tt | 39 +++++++++++++++- > opac/ilsdi.pl | 3 ++ > 3 files changed, 87 insertions(+), 1 deletion(-) > >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index 049ddcf600..44fdddaa94 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -614,6 +614,52 @@ sub GetServices { > return $out; > } > >+=head2 GetPickupLocation >+ >+Returns availables pickup locations given a particular item or record and a particular patron. >+ >+Parameters: >+ >+ - patron_id (Required) >+ a borrowernumber >+ - id (Required) >+ an itemnumber or recordnumber >+ - id_type (Required) >+ either item or biblio (defines the id given above). >+ >+=cut >+ >+sub GetPickupLocation { >+ my ($cgi) = @_; >+ >+ # Get the borrower or return an error code >+ my $borrowernumber = $cgi->param('patron_id'); >+ my $patron = Koha::Patrons->find( $borrowernumber ); >+ return { error => 'PatronNotFound' } unless $patron; >+ >+ # Get all pickup locations >+ my @pickup_locations; >+ my $id_type = $cgi->param('id_type'); >+ if ( $id_type eq 'item' ) { >+ my $itemnumber = $cgi->param('id'); >+ my $item = Koha::Items->find( $itemnumber ); >+ return { error => 'ItemNotFound' } unless $item; >+ @pickup_locations = Koha::Libraries->pickup_locations( { item => $item } ); >+ } >+ >+ elsif ( $id_type eq 'bib' ) { >+ my $biblionumber = $cgi->param('id'); >+ my $biblio = Koha::Biblios->find( $biblionumber ); >+ return { error => 'RecordNotFound' } unless $biblio; >+ @pickup_locations = Koha::Libraries->pickup_locations( { biblio => $biblio } ); >+ } >+ >+ else { return { error => 'MissingParameter' }; } >+ >+ # Might be nice to filter against those in which the patron can actually pickup the book. >+ return { library => \@pickup_locations }; >+} >+ > =head2 RenewLoan > > Extends the due date for a borrower's existing issue. >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/ilsdi.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/ilsdi.tt >index 7c882d4b3b..07b09f6e0a 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/ilsdi.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/ilsdi.tt >@@ -17,6 +17,8 @@ > ILS-DI › GetPatronStatus > [% ELSIF ( GetServices ) %] > ILS-DI › GetServices >+ [% ELSIF ( GetPickupLocation ) %] >+ ILS-DI › GetPickupLocation > [% ELSIF ( RenewLoan ) %] > ILS-DI › RenewLoan > [% ELSIF ( HoldTitle ) %] >@@ -61,7 +63,10 @@ > [% ELSIF ( GetServices ) %] > <li><a href="/cgi-bin/koha/ilsdi.pl">ILS-DI</a> <span class="divider">›</span></li> > <li><a href="#">GetServices</a></li> >- [% ELSIF ( RenewLoan ) %] >+ [% ELSIF ( GetPickupLocation ) %] >+ <li><a href="/cgi-bin/koha/ilsdi.pl">ILS-DI</a> <span class="divider">›</span></li> >+ <li><a href="#">GetPickupLocation</a></li> >+ [% ELSIF ( RenewLoan ) %] > <li><a href="/cgi-bin/koha/ilsdi.pl">ILS-DI</a> <span class="divider">›</span></li> > <li><a href="#">RenewLoan</a></li> > [% ELSIF ( HoldTitle ) %] >@@ -674,6 +679,38 @@ > <AvailableFor>item level hold</AvailableFor> > </GetServices></pre> > >+ [% ELSIF ( GetPickupLocation ) %] >+ >+ <h2>GetPickupLocation</h2> >+ <p>Returns available pickup locations given a particular item or record and a particular patron.</p> >+ <h4>Parameters</h4> >+ <dl> >+ <dt><strong>patron_id</strong> (Required)</dt> >+ <dd>the unique patron identifier in the ILS; the same identifier returned by LookupPatron or AuthenticatePatron</dd> >+ <dt><strong>id</strong> (Required)</dt> >+ <dd>system item identifier</dd> >+ <dt><strong>id</strong> (Required)</dt> >+ <dd>system identifier type (either bib for biblio or item)</dd> >+ </dl> >+ <h4>Example call</h4> >+ <a href="ilsdi.pl?service=GetPickupLocation&patron_id=1&id=1&id_type=item"> >+ ilsdi.pl?service=GetPickupLocation&patron_id=1&id=1&id_type=item >+ </a> >+ <h4>Example response</h4> >+<pre><?xml version="1.0" encoding="UTF-8"?> >+<GetPickupLocation> >+<pickup_locations> >+ <pickup_location> >+ <pickup_location_label>First library</pickup_location_label> >+ <pickup_location_id>1</pickup_location_id> >+ </pickup_location> >+ <pickup_location> >+ <pickup_location_label>Second library</pickup_location_label> >+ <pickup_location_id>2</pickup_location_id> >+ </pickup_location> >+</pickup_locations> >+</GetPickupLocation> >+ > [% ELSIF ( RenewLoan ) %] > > <h2>RenewLoan</h2> >diff --git a/opac/ilsdi.pl b/opac/ilsdi.pl >index 346f23e4ed..db576a7511 100755 >--- a/opac/ilsdi.pl >+++ b/opac/ilsdi.pl >@@ -67,6 +67,7 @@ my @services = ( > 'GetPatronInfo', > 'GetPatronStatus', > 'GetServices', # FIXME Loans >+ 'GetPickupLocation', > 'RenewLoan', > 'HoldTitle', # FIXME Add dates support > 'HoldItem', # FIXME Add dates support >@@ -90,6 +91,7 @@ my %required = ( > 'GetPatronInfo' => ['patron_id'], > 'GetPatronStatus' => ['patron_id'], > 'GetServices' => [ 'patron_id', 'item_id' ], >+ 'GetPickupLocation' => [ 'patron_id', 'id', 'id_type' ], > 'RenewLoan' => [ 'patron_id', 'item_id' ], > 'HoldTitle' => [ 'patron_id', 'bib_id', 'request_location' ], > 'HoldItem' => [ 'patron_id', 'bib_id', 'item_id' ], >@@ -107,6 +109,7 @@ my %optional = ( > 'GetPatronInfo' => [ 'show_contact', 'show_fines', 'show_holds', 'show_loans', 'loans_per_page', 'loans_page', 'show_attributes' ], > 'GetPatronStatus' => [], > 'GetServices' => [], >+ 'GetPickupLocation' => [], > 'RenewLoan' => ['desired_due_date'], > 'HoldTitle' => [ 'pickup_location', 'needed_before_date', 'pickup_expiry_date' ], > 'HoldItem' => [ 'pickup_location', 'needed_before_date', 'pickup_expiry_date' ], >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23015
:
90195
|
93455
|
94039
|
96815
|
96816