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

(-)a/C4/ILSDI/Services.pm (-70 / +70 lines)
Lines 48-74 C4::ILS-DI::Services - ILS-DI Services Link Here
48
=head1 DESCRIPTION
48
=head1 DESCRIPTION
49
49
50
Each function in this module represents an ILS-DI service.
50
Each function in this module represents an ILS-DI service.
51
They all takes a CGI instance as argument and most of them return a 
51
They all takes a CGI instance as argument and most of them return a
52
hashref that will be printed by XML::Simple in opac/ilsdi.pl
52
hashref that will be printed by XML::Simple in opac/ilsdi.pl
53
53
54
=head1 SYNOPSIS
54
=head1 SYNOPSIS
55
55
56
	use C4::ILSDI::Services;
56
    use C4::ILSDI::Services;
57
	use XML::Simple;
57
    use XML::Simple;
58
	use CGI qw ( -utf8 );
58
    use CGI qw ( -utf8 );
59
59
60
	my $cgi = new CGI;
60
    my $cgi = new CGI;
61
61
62
	$out = LookupPatron($cgi);
62
    $out = LookupPatron($cgi);
63
63
64
	print CGI::header('text/xml');
64
    print CGI::header('text/xml');
65
	print XMLout($out,
65
    print XMLout($out,
66
		noattr => 1, 
66
        noattr => 1,
67
		noescape => 1,
67
        noescape => 1,
68
		nosort => 1,
68
        nosort => 1,
69
                xmldecl => '<?xml version="1.0" encoding="UTF-8" ?>',
69
                xmldecl => '<?xml version="1.0" encoding="UTF-8" ?>',
70
		RootName => 'LookupPatron', 
70
        RootName => 'LookupPatron',
71
		SuppressEmpty => 1);
71
        SuppressEmpty => 1);
72
72
73
=cut
73
=cut
74
74
Lines 76-82 hashref that will be printed by XML::Simple in opac/ilsdi.pl Link Here
76
76
77
=head2 GetAvailability
77
=head2 GetAvailability
78
78
79
Given a set of biblionumbers or itemnumbers, returns a list with 
79
Given a set of biblionumbers or itemnumbers, returns a list with
80
availability of the items associated with the identifiers.
80
availability of the items associated with the identifiers.
81
81
82
Parameters:
82
Parameters:
Lines 84-92 Parameters: Link Here
84
=head3 id (Required)
84
=head3 id (Required)
85
85
86
list of either biblionumbers or itemnumbers
86
list of either biblionumbers or itemnumbers
87
87
=head3 id_type (Required)
88
=head3 id_type (Required)
88
89
89
defines the type of record identifier being used in the request, 
90
defines the type of record identifier being used in the request,
90
possible values:
91
possible values:
91
92
92
  - bib
93
  - bib
Lines 94-100 possible values: Link Here
94
95
95
=head3 return_type (Optional)
96
=head3 return_type (Optional)
96
97
97
requests a particular level of detail in reporting availability, 
98
requests a particular level of detail in reporting availability,
98
possible values:
99
possible values:
99
100
100
  - bib
101
  - bib
Lines 102-109 possible values: Link Here
102
103
103
=head3 return_fmt (Optional)
104
=head3 return_fmt (Optional)
104
105
105
requests a particular format or set of formats in reporting 
106
requests a particular format or set of formats in reporting
106
availability 
107
availability
107
108
108
=cut
109
=cut
109
110
Lines 171-183 sub GetAvailability { Link Here
171
172
172
=head2 GetRecords
173
=head2 GetRecords
173
174
174
Given a list of biblionumbers, returns a list of record objects that 
175
Given a list of biblionumbers, returns a list of record objects that
175
contain bibliographic information, as well as associated holdings and item
176
contain bibliographic information, as well as associated holdings and item
176
information. The caller may request a specific metadata schema for the 
177
information. The caller may request a specific metadata schema for the
177
record objects to be returned.
178
record objects to be returned.
178
179
179
This function behaves similarly to HarvestBibliographicRecords and 
180
This function behaves similarly to HarvestBibliographicRecords and
180
HarvestExpandedRecords in Data Aggregation, but allows quick, real time 
181
HarvestExpandedRecords in Data Aggregation, but allows quick, real time
181
lookup by bibliographic identifier.
182
lookup by bibliographic identifier.
182
183
183
You can use OAI-PMH ListRecords instead of this service.
184
You can use OAI-PMH ListRecords instead of this service.
Lines 185-195 You can use OAI-PMH ListRecords instead of this service. Link Here
185
Parameters:
186
Parameters:
186
187
187
  - id (Required)
188
  - id (Required)
188
	list of system record identifiers
189
    list of system record identifiers
189
  - id_type (Optional)
190
  - id_type (Optional)
190
	Defines the metadata schema in which the records are returned, 
191
    Defines the metadata schema in which the records are returned,
191
	possible values:
192
    possible values:
192
  	  - MARCXML
193
        - MARCXML
193
194
194
=cut
195
=cut
195
196
Lines 253-260 sub GetRecords { Link Here
253
254
254
=head2 GetAuthorityRecords
255
=head2 GetAuthorityRecords
255
256
256
Given a list of authority record identifiers, returns a list of record 
257
Given a list of authority record identifiers, returns a list of record
257
objects that contain the authority records. The function user may request 
258
objects that contain the authority records. The function user may request
258
a specific metadata schema for the record objects.
259
a specific metadata schema for the record objects.
259
260
260
Parameters:
261
Parameters:
Lines 294-307 Looks up a patron in the ILS by an identifier, and returns the borrowernumber. Link Here
294
Parameters:
295
Parameters:
295
296
296
  - id (Required)
297
  - id (Required)
297
	an identifier used to look up the patron in Koha
298
    an identifier used to look up the patron in Koha
298
  - id_type (Optional)
299
  - id_type (Optional)
299
	the type of the identifier, possible values:
300
    the type of the identifier, possible values:
300
	- cardnumber
301
    - cardnumber
301
	- userid
302
    - userid
302
        - email
303
        - email
303
	- borrowernumber
304
    - borrowernumber
304
	- firstname
305
    - firstname
305
        - surname
306
        - surname
306
307
307
=cut
308
=cut
Lines 312-328 sub LookupPatron { Link Here
312
    my $patrons;
313
    my $patrons;
313
314
314
    if(!$cgi->param('id')) {
315
    if(!$cgi->param('id')) {
315
	return { message => 'PatronNotFound' };
316
    return { message => 'PatronNotFound' };
316
    }
317
    }
317
318
318
    if($cgi->param('id_type')) {
319
    if($cgi->param('id_type')) {
319
	$patrons = Koha::Patrons->search( { $cgi->param('id_type') => $cgi->param('id') } );
320
    $patrons = Koha::Patrons->search( { $cgi->param('id_type') => $cgi->param('id') } );
320
    } else {
321
    } else {
321
	foreach my $id_type ('cardnumber', 'userid', 'email', 'borrowernumber',
322
    foreach my $id_type ('cardnumber', 'userid', 'email', 'borrowernumber',
322
				     'surname', 'firstname') {
323
                     'surname', 'firstname') {
323
	    $patrons = Koha::Patrons->search( { $id_type => $cgi->param('id') } );
324
        $patrons = Koha::Patrons->search( { $id_type => $cgi->param('id') } );
324
	    last if($patrons->count);
325
        last if($patrons->count);
325
	}
326
    }
326
    }
327
    }
327
    unless ( $patrons->count ) {
328
    unless ( $patrons->count ) {
328
        return { message => 'PatronNotFound' };
329
        return { message => 'PatronNotFound' };
Lines 333-339 sub LookupPatron { Link Here
333
334
334
=head2 AuthenticatePatron
335
=head2 AuthenticatePatron
335
336
336
Authenticates a user's login credentials and returns the identifier for 
337
Authenticates a user's login credentials and returns the identifier for
337
the patron.
338
the patron.
338
339
339
Parameters:
340
Parameters:
Lines 362-383 sub AuthenticatePatron { Link Here
362
363
363
=head2 GetPatronInfo
364
=head2 GetPatronInfo
364
365
365
Returns specified information about the patron, based on options in the 
366
Returns specified information about the patron, based on options in the
366
request. This function can optionally return patron's contact information, 
367
request. This function can optionally return patron's contact information,
367
fine information, hold request information, and loan information.
368
fine information, hold request information, and loan information.
368
369
369
Parameters:
370
Parameters:
370
371
371
  - patron_id (Required)
372
  - patron_id (Required)
372
	the borrowernumber
373
    the borrowernumber
373
  - show_contact (Optional, default 1)
374
  - show_contact (Optional, default 1)
374
	whether or not to return patron's contact information in the response
375
    whether or not to return patron's contact information in the response
375
  - show_fines (Optional, default 0)
376
  - show_fines (Optional, default 0)
376
	whether or not to return fine information in the response
377
    whether or not to return fine information in the response
377
  - show_holds (Optional, default 0)
378
  - show_holds (Optional, default 0)
378
	whether or not to return hold request information in the response
379
    whether or not to return hold request information in the response
379
  - show_loans (Optional, default 0)
380
  - show_loans (Optional, default 0)
380
	whether or not to return loan information request information in the response 
381
    whether or not to return loan information request information in the response
381
382
382
=cut
383
=cut
383
384
Lines 484-490 Returns a patron's status information. Link Here
484
Parameters:
485
Parameters:
485
486
486
  - patron_id (Required)
487
  - patron_id (Required)
487
	the borrower ID
488
    the borrower ID
488
489
489
=cut
490
=cut
490
491
Lines 506-520 sub GetPatronStatus { Link Here
506
507
507
=head2 GetServices
508
=head2 GetServices
508
509
509
Returns information about the services available on a particular item for 
510
Returns information about the services available on a particular item for
510
a particular patron.
511
a particular patron.
511
512
512
Parameters:
513
Parameters:
513
514
514
  - patron_id (Required)
515
  - patron_id (Required)
515
	a borrowernumber
516
    a borrowernumber
516
  - item_id (Required)
517
  - item_id (Required)
517
	an itemnumber
518
    an itemnumber
518
519
519
=cut
520
=cut
520
521
Lines 583-593 Extends the due date for a borrower's existing issue. Link Here
583
Parameters:
584
Parameters:
584
585
585
  - patron_id (Required)
586
  - patron_id (Required)
586
	a borrowernumber
587
    a borrowernumber
587
  - item_id (Required)
588
  - item_id (Required)
588
	an itemnumber
589
    an itemnumber
589
  - desired_due_date (Required)
590
  - desired_due_date (Required)
590
	the date the patron would like the item returned by 
591
    the date the patron would like the item returned by
591
592
592
=cut
593
=cut
593
594
Lines 627-643 Creates, for a borrower, a biblio-level hold reserve. Link Here
627
Parameters:
628
Parameters:
628
629
629
  - patron_id (Required)
630
  - patron_id (Required)
630
	a borrowernumber
631
    a borrowernumber
631
  - bib_id (Required)
632
  - bib_id (Required)
632
	a biblionumber
633
    a biblionumber
633
  - request_location (Required)
634
  - request_location (Required)
634
	IP address where the end user request is being placed
635
    IP address where the end user request is being placed
635
  - pickup_location (Optional)
636
  - pickup_location (Optional)
636
	a branch code indicating the location to which to deliver the item for pickup
637
    a branch code indicating the location to which to deliver the item for pickup
637
  - needed_before_date (Optional)
638
  - needed_before_date (Optional)
638
	date after which hold request is no longer needed
639
    date after which hold request is no longer needed
639
  - pickup_expiry_date (Optional)
640
  - pickup_expiry_date (Optional)
640
	date after which item returned to shelf if item is not picked up 
641
    date after which item returned to shelf if item is not picked up
641
642
642
=cut
643
=cut
643
644
Lines 689-711 sub HoldTitle { Link Here
689
690
690
=head2 HoldItem
691
=head2 HoldItem
691
692
692
Creates, for a borrower, an item-level hold request on a specific item of 
693
Creates, for a borrower, an item-level hold request on a specific item of
693
a bibliographic record in Koha.
694
a bibliographic record in Koha.
694
695
695
Parameters:
696
Parameters:
696
697
697
  - patron_id (Required)
698
  - patron_id (Required)
698
	a borrowernumber
699
    a borrowernumber
699
  - bib_id (Required)
700
  - bib_id (Required)
700
	a biblionumber
701
    a biblionumber
701
  - item_id (Required)
702
  - item_id (Required)
702
	an itemnumber
703
    an itemnumber
703
  - pickup_location (Optional)
704
  - pickup_location (Optional)
704
	a branch code indicating the location to which to deliver the item for pickup
705
    a branch code indicating the location to which to deliver the item for pickup
705
  - needed_before_date (Optional)
706
  - needed_before_date (Optional)
706
	date after which hold request is no longer needed
707
    date after which hold request is no longer needed
707
  - pickup_expiry_date (Optional)
708
  - pickup_expiry_date (Optional)
708
	date after which item returned to shelf if item is not picked up 
709
    date after which item returned to shelf if item is not picked up
709
710
710
=cut
711
=cut
711
712
712
- 

Return to bug 13990