View | Details | Raw Unified | Return to bug 23015
Collapse All | Expand All

(-)a/C4/ILSDI/Services.pm (+46 lines)
Lines 614-619 sub GetServices { Link Here
614
    return $out;
614
    return $out;
615
}
615
}
616
616
617
=head2 GetPickupLocation
618
619
Returns availables pickup locations given a particular item or record and a particular patron.
620
621
Parameters:
622
623
  - patron_id (Required)
624
    a borrowernumber
625
  - id (Required)
626
    an itemnumber or recordnumber
627
  - id_type (Required)
628
    either item or biblio (defines the id given above).
629
630
=cut
631
632
sub GetPickupLocation {
633
    my ($cgi) = @_;
634
635
    # Get the borrower or return an error code
636
    my $borrowernumber = $cgi->param('patron_id');
637
    my $patron = Koha::Patrons->find( $borrowernumber );
638
    return { error => 'PatronNotFound' } unless $patron;
639
640
    # Get all pickup locations
641
    my @pickup_locations;
642
    my $id_type = $cgi->param('id_type');
643
    if ( $id_type eq 'item' ) {
644
	my $itemnumber = $cgi->param('id');
645
        my $item = Koha::Items->find( $itemnumber );
646
	return { error => 'ItemNotFound' } unless $item;
647
	@pickup_locations = Koha::Libraries->pickup_locations( { item => $item } );
648
    }
649
650
    elsif ( $id_type eq 'bib' ) {
651
	my $biblionumber = $cgi->param('id');
652
        my $biblio = Koha::Biblios->find( $biblionumber );
653
	return { error => 'RecordNotFound' } unless $biblio;
654
	@pickup_locations = Koha::Libraries->pickup_locations( { biblio => $biblio } );
655
    }
656
657
    else { return { error => 'MissingParameter' }; }
658
659
    # Might be nice to filter against those in which the patron can actually pickup the book.
660
    return { library => \@pickup_locations };
661
}
662
617
=head2 RenewLoan
663
=head2 RenewLoan
618
664
619
Extends the due date for a borrower's existing issue.
665
Extends the due date for a borrower's existing issue.
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/ilsdi.tt (-1 / +38 lines)
Lines 17-22 Link Here
17
        ILS-DI › GetPatronStatus
17
        ILS-DI › GetPatronStatus
18
    [% ELSIF ( GetServices ) %]
18
    [% ELSIF ( GetServices ) %]
19
        ILS-DI › GetServices
19
        ILS-DI › GetServices
20
    [% ELSIF ( GetPickupLocation ) %]
21
        ILS-DI › GetPickupLocation
20
    [% ELSIF ( RenewLoan ) %]
22
    [% ELSIF ( RenewLoan ) %]
21
        ILS-DI › RenewLoan
23
        ILS-DI › RenewLoan
22
    [% ELSIF ( HoldTitle ) %]
24
    [% ELSIF ( HoldTitle ) %]
Lines 61-67 Link Here
61
            [% ELSIF ( GetServices ) %]
63
            [% ELSIF ( GetServices ) %]
62
                <li><a href="/cgi-bin/koha/ilsdi.pl">ILS-DI</a> <span class="divider">&rsaquo;</span></li>
64
                <li><a href="/cgi-bin/koha/ilsdi.pl">ILS-DI</a> <span class="divider">&rsaquo;</span></li>
63
                <li><a href="#">GetServices</a></li>
65
                <li><a href="#">GetServices</a></li>
64
            [% ELSIF ( RenewLoan ) %]
66
            [% ELSIF ( GetPickupLocation ) %]
67
                <li><a href="/cgi-bin/koha/ilsdi.pl">ILS-DI</a> <span class="divider">&rsaquo;</span></li>
68
                <li><a href="#">GetPickupLocation</a></li>
69
	    [% ELSIF ( RenewLoan ) %]
65
                <li><a href="/cgi-bin/koha/ilsdi.pl">ILS-DI</a> <span class="divider">&rsaquo;</span></li>
70
                <li><a href="/cgi-bin/koha/ilsdi.pl">ILS-DI</a> <span class="divider">&rsaquo;</span></li>
66
                <li><a href="#">RenewLoan</a></li>
71
                <li><a href="#">RenewLoan</a></li>
67
            [% ELSIF ( HoldTitle ) %]
72
            [% ELSIF ( HoldTitle ) %]
Lines 674-679 Link Here
674
  &lt;AvailableFor&gt;item level hold&lt;/AvailableFor&gt;
679
  &lt;AvailableFor&gt;item level hold&lt;/AvailableFor&gt;
675
&lt;/GetServices&gt;</pre>
680
&lt;/GetServices&gt;</pre>
676
681
682
                            [% ELSIF ( GetPickupLocation ) %]
683
684
                                <h2>GetPickupLocation</h2>
685
                                <p>Returns available pickup locations given a  particular item or record and a particular patron.</p>
686
                                <h4>Parameters</h4>
687
                                <dl>
688
                                    <dt><strong>patron_id</strong> (Required)</dt>
689
                                    <dd>the unique patron identifier in the ILS; the same identifier returned by LookupPatron or AuthenticatePatron</dd>
690
                                    <dt><strong>id</strong> (Required)</dt>
691
                                    <dd>system item identifier</dd>
692
				    <dt><strong>id</strong> (Required)</dt>
693
				    <dd>system identifier type (either bib for biblio or item)</dd>
694
                                </dl>
695
                                <h4>Example call</h4>
696
                                <a href="ilsdi.pl?service=GetPickupLocation&amp;patron_id=1&amp;id=1&amp;id_type=item">
697
				    ilsdi.pl?service=GetPickupLocation&amp;patron_id=1&amp;id=1&amp;id_type=item
698
                                </a>
699
                                <h4>Example response</h4>
700
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
701
&lt;GetPickupLocation&gt;
702
&lt;pickup_locations&gt;
703
              &lt;pickup_location&gt;
704
                &lt;pickup_location_label&gt;First library&lt;/pickup_location_label&gt;
705
                &lt;pickup_location_id&gt;1&lt;/pickup_location_id&gt;
706
              &lt;/pickup_location&gt;
707
              &lt;pickup_location&gt;
708
                &lt;pickup_location_label&gt;Second library&lt;/pickup_location_label&gt;
709
                &lt;pickup_location_id&gt;2&lt;/pickup_location_id&gt;
710
              &lt;/pickup_location&gt;
711
&lt;/pickup_locations&gt;
712
&lt;/GetPickupLocation&gt;
713
677
                            [% ELSIF ( RenewLoan ) %]
714
                            [% ELSIF ( RenewLoan ) %]
678
715
679
                                <h2>RenewLoan</h2>
716
                                <h2>RenewLoan</h2>
(-)a/opac/ilsdi.pl (-1 / +3 lines)
Lines 67-72 my @services = ( Link Here
67
    'GetPatronInfo',
67
    'GetPatronInfo',
68
    'GetPatronStatus',
68
    'GetPatronStatus',
69
    'GetServices',    # FIXME Loans
69
    'GetServices',    # FIXME Loans
70
    'GetPickupLocation',
70
    'RenewLoan',
71
    'RenewLoan',
71
    'HoldTitle',      # FIXME Add dates support
72
    'HoldTitle',      # FIXME Add dates support
72
    'HoldItem',       # FIXME Add dates support
73
    'HoldItem',       # FIXME Add dates support
Lines 90-95 my %required = ( Link Here
90
    'GetPatronInfo'       => ['patron_id'],
91
    'GetPatronInfo'       => ['patron_id'],
91
    'GetPatronStatus'     => ['patron_id'],
92
    'GetPatronStatus'     => ['patron_id'],
92
    'GetServices'         => [ 'patron_id', 'item_id' ],
93
    'GetServices'         => [ 'patron_id', 'item_id' ],
94
    'GetPickupLocation'	  => [ 'patron_id', 'id', 'id_type' ],
93
    'RenewLoan'           => [ 'patron_id', 'item_id' ],
95
    'RenewLoan'           => [ 'patron_id', 'item_id' ],
94
    'HoldTitle'           => [ 'patron_id', 'bib_id', 'request_location' ],
96
    'HoldTitle'           => [ 'patron_id', 'bib_id', 'request_location' ],
95
    'HoldItem'            => [ 'patron_id', 'bib_id', 'item_id' ],
97
    'HoldItem'            => [ 'patron_id', 'bib_id', 'item_id' ],
Lines 107-112 my %optional = ( Link Here
107
    'GetPatronInfo'       => [ 'show_contact', 'show_fines', 'show_holds', 'show_loans', 'loans_per_page', 'loans_page', 'show_attributes' ],
109
    'GetPatronInfo'       => [ 'show_contact', 'show_fines', 'show_holds', 'show_loans', 'loans_per_page', 'loans_page', 'show_attributes' ],
108
    'GetPatronStatus'     => [],
110
    'GetPatronStatus'     => [],
109
    'GetServices'         => [],
111
    'GetServices'         => [],
112
    'GetPickupLocation'	  => [],
110
    'RenewLoan'           => ['desired_due_date'],
113
    'RenewLoan'           => ['desired_due_date'],
111
    'HoldTitle'  => [ 'pickup_location', 'needed_before_date', 'pickup_expiry_date' ],
114
    'HoldTitle'  => [ 'pickup_location', 'needed_before_date', 'pickup_expiry_date' ],
112
    'HoldItem'   => [ 'pickup_location', 'needed_before_date', 'pickup_expiry_date' ],
115
    'HoldItem'   => [ 'pickup_location', 'needed_before_date', 'pickup_expiry_date' ],
113
- 

Return to bug 23015