Bug 21184: (follow-up) Fix adding barcode to waiting hold item in SIP
[koha.git] / C4 / SIP / ILS / Patron.pm
1 #
2 # ILS::Patron.pm
3
4 # A Class for hiding the ILS's concept of the patron from the OpenSIP
5 # system
6 #
7
8 package C4::SIP::ILS::Patron;
9
10 use strict;
11 use warnings;
12 use Exporter;
13 use Carp;
14
15 use Sys::Syslog qw(syslog);
16 use Data::Dumper;
17
18 use C4::SIP::Sip qw(add_field);
19
20 use C4::Debug;
21 use C4::Context;
22 use C4::Koha;
23 use C4::Members;
24 use C4::Reserves;
25 use C4::Items qw( GetItemnumbersForBiblio);
26 use C4::Auth qw(checkpw);
27
28 use Koha::Items;
29 use Koha::Libraries;
30 use Koha::Patrons;
31
32 our $kp;    # koha patron
33
34 =head1 Methods
35
36 =cut
37
38 sub new {
39     my ($class, $patron_id) = @_;
40     my $type = ref($class) || $class;
41     my $self;
42     my $patron = Koha::Patrons->find( { cardnumber => $patron_id } )
43       || Koha::Patrons->find( { userid => $patron_id } );
44     $debug and warn "new Patron: " . Dumper($patron->unblessed) if $patron;
45     unless ($patron) {
46         syslog("LOG_DEBUG", "new ILS::Patron(%s): no such patron", $patron_id);
47         return;
48     }
49     $kp = $patron->unblessed;
50     my $pw        = $kp->{password};
51     my $flags     = C4::Members::patronflags( $kp );
52     my $debarred  = $patron->is_debarred;
53     $debug and warn sprintf("Debarred = %s : ", ($debarred||'undef')); # Do we need more debug info here?
54     my ($day, $month, $year) = (localtime)[3,4,5];
55     my $today    = sprintf '%04d-%02d-%02d', $year+1900, $month+1, $day;
56     my $expired  = ($today gt $kp->{dateexpiry}) ? 1 : 0;
57     if ($expired) {
58         if ($kp->{opacnote} ) {
59             $kp->{opacnote} .= q{ };
60         }
61         $kp->{opacnote} .= 'PATRON EXPIRED';
62     }
63     my %ilspatron;
64     my $adr     = _get_address($kp);
65     my $dob     = $kp->{dateofbirth};
66     $dob and $dob =~ s/-//g;    # YYYYMMDD
67     my $dexpiry     = $kp->{dateexpiry};
68     $dexpiry and $dexpiry =~ s/-//g;    # YYYYMMDD
69     my $fines_amount = $patron->account->balance;
70     $fines_amount = ($fines_amount and $fines_amount > 0) ? $fines_amount : 0;
71     my $fee_limit = _fee_limit();
72     my $fine_blocked = $fines_amount > $fee_limit;
73     my $circ_blocked =( C4::Context->preference('OverduesBlockCirc') ne "noblock" &&  defined $flags->{ODUES}->{itemlist} ) ? 1 : 0;
74     {
75     no warnings;    # any of these $kp->{fields} being concat'd could be undef
76     %ilspatron = (
77         name => $kp->{firstname} . " " . $kp->{surname},
78         id   => $kp->{cardnumber},    # to SIP, the id is the BARCODE, not userid
79         password        => $pw,
80         ptype           => $kp->{categorycode},     # 'A'dult.  Whatever.
81         dateexpiry      => $dexpiry,
82         dateexpiry_iso  => $kp->{dateexpiry},
83         birthdate       => $dob,
84         birthdate_iso   => $kp->{dateofbirth},
85         branchcode      => $kp->{branchcode},
86         library_name    => "",                      # only populated if needed, cached here
87         borrowernumber  => $kp->{borrowernumber},
88         address         => $adr,
89         home_phone      => $kp->{phone},
90         email_addr      => $kp->{email},
91         charge_ok       => ( !$debarred && !$expired && !$fine_blocked && !$circ_blocked),
92         renew_ok        => ( !$debarred && !$expired && !$fine_blocked),
93         recall_ok       => ( !$debarred && !$expired && !$fine_blocked),
94         hold_ok         => ( !$debarred && !$expired && !$fine_blocked),
95         card_lost       => ( $kp->{lost} || $kp->{gonenoaddress} || $flags->{LOST} ),
96         claims_returned => 0,
97         fines           => $fines_amount,
98         fees            => 0,             # currently not distinct from fines
99         recall_overdue  => 0,
100         items_billed    => 0,
101         screen_msg      => 'Greetings from Koha. ' . $kp->{opacnote},
102         print_line      => '',
103         items           => [],
104         hold_items      => $flags->{WAITING}->{itemlist},
105         overdue_items   => $flags->{ODUES}->{itemlist},
106         fine_items      => [],
107         recall_items    => [],
108         unavail_holds   => [],
109         inet            => ( !$debarred && !$expired ),
110         expired         => $expired,
111         fee_limit       => $fee_limit,
112         userid          => $kp->{userid},
113     );
114     }
115     $debug and warn "patron fines: $ilspatron{fines} ... amountoutstanding: $kp->{amountoutstanding} ... CHARGES->amount: $flags->{CHARGES}->{amount}";
116
117     if ( $patron->is_debarred and $patron->debarredcomment ) {
118         $ilspatron{screen_msg} .= " -- " . $patron->debarredcomment;
119     }
120     for (qw(EXPIRED CHARGES CREDITS GNA LOST DBARRED NOTES)) {
121         ($flags->{$_}) or next;
122         if ($_ ne 'NOTES' and $flags->{$_}->{message}) {
123             $ilspatron{screen_msg} .= " -- " . $flags->{$_}->{message};  # show all but internal NOTES
124         }
125         if ($flags->{$_}->{noissues}) {
126             foreach my $toggle (qw(charge_ok renew_ok recall_ok hold_ok inet)) {
127                 $ilspatron{$toggle} = 0;    # if we get noissues, disable everything
128             }
129         }
130     }
131
132     # FIXME: populate fine_items recall_items
133     $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber});
134     $ilspatron{items} = $patron->pending_checkouts->unblessed;
135     $self = \%ilspatron;
136     $debug and warn Dumper($self);
137     syslog("LOG_DEBUG", "new ILS::Patron(%s): found patron '%s'", $patron_id,$self->{id});
138     bless $self, $type;
139     return $self;
140 }
141
142
143 # 0 means read-only
144 # 1 means read/write
145
146 my %fields = (
147     id                      => 0,
148     name                    => 0,
149     address                 => 0,
150     email_addr              => 0,
151     home_phone              => 0,
152     birthdate               => 0,
153     birthdate_iso           => 0,
154     dateexpiry              => 0,
155     dateexpiry_iso          => 0,
156     ptype                   => 0,
157     charge_ok               => 0,   # for patron_status[0] (inverted)
158     renew_ok                => 0,   # for patron_status[1] (inverted)
159     recall_ok               => 0,   # for patron_status[2] (inverted)
160     hold_ok                 => 0,   # for patron_status[3] (inverted)
161     card_lost               => 0,   # for patron_status[4]
162     recall_overdue          => 0,
163     currency                => 1,
164     fee_limit               => 0,
165     screen_msg              => 1,
166     print_line              => 1,
167     too_many_charged        => 0,   # for patron_status[5]
168     too_many_overdue        => 0,   # for patron_status[6]
169     too_many_renewal        => 0,   # for patron_status[7]
170     too_many_claim_return   => 0,   # for patron_status[8]
171     too_many_lost           => 0,   # for patron_status[9]
172 #   excessive_fines         => 0,   # for patron_status[10]
173 #   excessive_fees          => 0,   # for patron_status[11]
174     recall_overdue          => 0,   # for patron_status[12]
175     too_many_billed         => 0,   # for patron_status[13]
176     inet                    => 0,   # EnvisionWare extension
177 );
178
179 our $AUTOLOAD;
180
181 sub DESTROY {
182     # be cool.  needed for AUTOLOAD(?)
183 }
184
185 sub AUTOLOAD {
186     my $self = shift;
187     my $class = ref($self) or croak "$self is not an object";
188     my $name = $AUTOLOAD;
189
190     $name =~ s/.*://;
191
192     unless (exists $fields{$name}) {
193         croak "Cannot access '$name' field of class '$class'";
194     }
195
196     if (@_) {
197         $fields{$name} or croak "Field '$name' of class '$class' is READ ONLY.";
198         return $self->{$name} = shift;
199     } else {
200         return $self->{$name};
201     }
202 }
203
204 sub name {
205     my ( $self, $template ) = @_;
206
207     if ($template) {
208         require Template;
209         require Koha::Patrons;
210
211         my $tt = Template->new();
212
213         my $patron = Koha::Patrons->find( $self->{borrowernumber} );
214
215         my $output;
216         $tt->process( \$template, { patron => $patron }, \$output );
217         return $output;
218     }
219     else {
220         return $self->{name};
221     }
222 }
223
224 sub check_password {
225     my ( $self, $pwd ) = @_;
226
227     # you gotta give me something (at least ''), or no deal
228     return 0 unless defined $pwd;
229
230     # If the record has a NULL password, accept '' as match
231     return $pwd eq q{} unless $self->{password};
232
233     my $dbh = C4::Context->dbh;
234     my $ret = 0;
235     ($ret) = checkpw( $dbh, $self->{userid}, $pwd, undef, undef, 1 ); # dbh, userid, query, type, no_set_userenv
236     return $ret;
237 }
238
239 # A few special cases, not in AUTOLOADed %fields
240 sub fee_amount {
241     my $self = shift;
242     if ( $self->{fines} ) {
243         return $self->{fines};
244     }
245     return;
246 }
247
248 sub fines_amount {
249     my $self = shift;
250     return $self->fee_amount;
251 }
252
253 sub language {
254     my $self = shift;
255     return $self->{language} || '000'; # Unspecified
256 }
257
258 sub expired {
259     my $self = shift;
260     return $self->{expired};
261 }
262
263 #
264 # remove the hold on item item_id from my hold queue.
265 # return true if I was holding the item, false otherwise.
266
267 sub drop_hold {
268     my ($self, $item_id) = @_;
269     return if !$item_id;
270     my $result = 0;
271     foreach (qw(hold_items unavail_holds)) {
272         $self->{$_} or next;
273         for (my $i = 0; $i < scalar @{$self->{$_}}; $i++) {
274             my $held_item = $self->{$_}[$i]->{item_id} or next;
275             if ($held_item eq $item_id) {
276                 splice @{$self->{$_}}, $i, 1;
277                 $result++;
278             }
279         }
280     }
281     return $result;
282 }
283
284 # Accessor method for array_ref values, designed to get the "start" and "end" values
285 # from the SIP request.  Note those incoming values are 1-indexed, not 0-indexed.
286 #
287 sub x_items {
288     my $self      = shift;
289     my $array_var = shift or return;
290     my ($start, $end) = @_;
291
292     my $item_list = [];
293     if ($self->{$array_var}) {
294         if ($start && $start > 1) {
295             --$start;
296         }
297         else {
298             $start = 0;
299         }
300         if ( $end && $end < @{$self->{$array_var}} ) {
301         }
302         else {
303             $end = @{$self->{$array_var}};
304             --$end;
305         }
306         @{$item_list} = @{$self->{$array_var}}[ $start .. $end ];
307
308     }
309     return $item_list;
310 }
311
312 #
313 # List of outstanding holds placed
314 #
315 sub hold_items {
316     my $self = shift;
317     my $item_arr = $self->x_items('hold_items', @_);
318     foreach my $item (@{$item_arr}) {
319         my $item_obj = Koha::Items->find($item->{itemnumber});
320         $item->{barcode} = $item_obj ? $item_obj->barcode : undef;
321     }
322     return $item_arr;
323 }
324
325 sub overdue_items {
326     my $self = shift;
327     return $self->x_items('overdue_items', @_);
328 }
329 sub charged_items {
330     my $self = shift;
331     return $self->x_items('items', @_);
332 }
333 sub fine_items {
334     require Koha::Database;
335     require Template;
336
337     my $self = shift;
338     my $start = shift;
339     my $end = shift;
340     my $server = shift;
341
342     my @fees = Koha::Database->new()->schema()->resultset('Accountline')->search(
343         {
344             borrowernumber    => $self->{borrowernumber},
345             amountoutstanding => { '>' => '0' },
346         }
347     );
348
349     $start = $start ? $start - 1 : 0;
350     $end   = $end   ? $end       : scalar @fees - 1;
351
352     my $av_field_template = $server ? $server->{account}->{av_field_template} : undef;
353     $av_field_template ||= "[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]";
354
355     my $tt = Template->new();
356
357     my @return_values;
358     for ( my $i = $start; $i <= $end; $i++ ) {
359         my $fee = $fees[$i];
360
361         my $output;
362         $tt->process( \$av_field_template, { accountline => $fee }, \$output );
363         push( @return_values, { barcode => $output } );
364     }
365
366     return \@return_values;
367 }
368 sub recall_items {
369     my $self = shift;
370     return $self->x_items('recall_items', @_);
371 }
372 sub unavail_holds {
373     my $self = shift;
374     return $self->x_items('unavail_holds', @_);
375 }
376
377 sub block {
378     my ($self, $card_retained, $blocked_card_msg) = @_;
379     foreach my $field ('charge_ok', 'renew_ok', 'recall_ok', 'hold_ok', 'inet') {
380         $self->{$field} = 0;
381     }
382     $self->{screen_msg} = "Block feature not implemented";  # $blocked_card_msg || "Card Blocked.  Please contact library staff";
383     # TODO: not really affecting patron record
384     return $self;
385 }
386
387 sub enable {
388     my $self = shift;
389     foreach my $field ('charge_ok', 'renew_ok', 'recall_ok', 'hold_ok', 'inet') {
390         $self->{$field} = 1;
391     }
392     syslog("LOG_DEBUG", "Patron(%s)->enable: charge: %s, renew:%s, recall:%s, hold:%s",
393        $self->{id}, $self->{charge_ok}, $self->{renew_ok},
394        $self->{recall_ok}, $self->{hold_ok});
395     $self->{screen_msg} = "Enable feature not implemented."; # "All privileges restored.";   # TODO: not really affecting patron record
396     return $self;
397 }
398
399 sub inet_privileges {
400     my $self = shift;
401     return $self->{inet} ? 'Y' : 'N';
402 }
403
404 sub _fee_limit {
405     return C4::Context->preference('noissuescharge') || 5;
406 }
407
408 sub excessive_fees {
409     my $self = shift;
410     return ($self->fee_amount and $self->fee_amount > $self->fee_limit);
411 }
412
413 sub excessive_fines {
414     my $self = shift;
415     return $self->excessive_fees;   # excessive_fines is the same thing as excessive_fees for Koha
416 }
417
418 sub holds_blocked_by_excessive_fees {
419     my $self = shift;
420     return ( $self->fee_amount
421           && $self->fee_amount > C4::Context->preference("maxoutstanding") );
422 }
423     
424 sub library_name {
425     my $self = shift;
426     unless ($self->{library_name}) {
427         my $library = Koha::Libraries->find( $self->{branchcode} );
428         $self->{library_name} = $library ? $library->branchname : '';
429     }
430     return $self->{library_name};
431 }
432 #
433 # Messages
434 #
435
436 sub invalid_patron {
437     my $self = shift;
438     return "Please contact library staff";
439 }
440
441 sub charge_denied {
442     my $self = shift;
443     return "Please contact library staff";
444 }
445
446 =head2 update_lastseen
447
448     $patron->update_lastseen();
449
450     Patron method to update lastseen field in borrower
451     to record that patron has been seen via sip connection
452
453 =cut
454
455 sub update_lastseen {
456     my $self = shift;
457     my $kohaobj = Koha::Patrons->find( $self->{borrowernumber} );
458     $kohaobj->track_login if $kohaobj; # track_login checks the pref
459 }
460
461 sub _get_address {
462     my $patron = shift;
463
464     my $address = $patron->{streetnumber} || q{};
465     for my $field (qw( roaddetails address address2 city state zipcode country))
466     {
467         next unless $patron->{$field};
468         if ($address) {
469             $address .= q{ };
470             $address .= $patron->{$field};
471         }
472         else {
473             $address .= $patron->{$field};
474         }
475     }
476     return $address;
477 }
478
479 sub _get_outstanding_holds {
480     my $borrowernumber = shift;
481
482     my $patron = Koha::Patrons->find( $borrowernumber );
483     my $holds = $patron->holds->search( { -or => [ { found => undef }, { found => { '!=' => 'W' } } ] } );
484     my @holds;
485     while ( my $hold = $holds->next ) {
486         my $item;
487         if ($hold->itemnumber) {
488             $item = $hold->item;
489         }
490         else {
491             # We need to return a barcode for the biblio so the client
492             # can request the biblio info
493             my $items = $hold->biblio->items;
494             $item = $items->count ? $item->next : undef;
495         }
496         my $unblessed_hold = $hold->unblessed;
497
498         $unblessed_hold->{barcode} = $item ? $item->barcode : undef;
499
500         push @holds, $unblessed_hold;
501     }
502     return \@holds;
503 }
504
505 =head2 build_patron_attributes_string
506
507 This method builds the part of the sip message for extended patron
508 attributes as defined in the sip config
509
510 =cut
511
512 sub build_patron_attributes_string {
513     my ( $self, $server ) = @_;
514
515     my $string = q{};
516
517     if ( $server->{account}->{patron_attribute} ) {
518         my @attributes_to_send =
519           ref $server->{account}->{patron_attribute} eq "ARRAY"
520           ? @{ $server->{account}->{patron_attribute} }
521           : ( $server->{account}->{patron_attribute} );
522
523         foreach my $a ( @attributes_to_send ) {
524             my @attributes = Koha::Patron::Attributes->search(
525                 {
526                     borrowernumber => $self->{borrowernumber},
527                     code           => $a->{code}
528                 }
529             );
530
531             foreach my $attribute ( @attributes ) {
532                 my $value = $attribute->attribute();
533                 $string .= add_field( $a->{field}, $value );
534             }
535         }
536     }
537
538     return $string;
539 }
540
541 1;
542 __END__
543
544 =head1 EXAMPLES
545
546   our %patron_example = (
547           djfiander => {
548               name => "David J. Fiander",
549               id => 'djfiander',
550               password => '6789',
551               ptype => 'A', # 'A'dult.  Whatever.
552               birthdate => '19640925',
553               address => '2 Meadowvale Dr. St Thomas, ON',
554               home_phone => '(519) 555 1234',
555               email_addr => 'djfiander@hotmail.com',
556               charge_ok => 1,
557               renew_ok => 1,
558               recall_ok => 0,
559               hold_ok => 1,
560               card_lost => 0,
561               claims_returned => 0,
562               fines => 100,
563               fees => 0,
564               recall_overdue => 0,
565               items_billed => 0,
566               screen_msg => '',
567               print_line => '',
568               items => [],
569               hold_items => [],
570               overdue_items => [],
571               fine_items => ['Computer Time'],
572               recall_items => [],
573               unavail_holds => [],
574               inet => 1,
575           },
576   );
577
578  From borrowers table:
579 +---------------------+--------------+------+-----+---------+----------------+
580 | Field               | Type         | Null | Key | Default | Extra          |
581 +---------------------+--------------+------+-----+---------+----------------+
582 | borrowernumber      | int(11)      | NO   | PRI | NULL    | auto_increment |
583 | cardnumber          | varchar(16)  | YES  | UNI | NULL    |                |
584 | surname             | mediumtext   | NO   |     | NULL    |                |
585 | firstname           | text         | YES  |     | NULL    |                |
586 | title               | mediumtext   | YES  |     | NULL    |                |
587 | othernames          | mediumtext   | YES  |     | NULL    |                |
588 | initials            | text         | YES  |     | NULL    |                |
589 | streetnumber        | varchar(10)  | YES  |     | NULL    |                |
590 | streettype          | varchar(50)  | YES  |     | NULL    |                |
591 | address             | mediumtext   | NO   |     | NULL    |                |
592 | address2            | text         | YES  |     | NULL    |                |
593 | city                | mediumtext   | NO   |     | NULL    |                |
594 | state               | mediumtext   | YES  |     | NULL    |                |
595 | zipcode             | varchar(25)  | YES  |     | NULL    |                |
596 | country             | text         | YES  |     | NULL    |                |
597 | email               | mediumtext   | YES  |     | NULL    |                |
598 | phone               | text         | YES  |     | NULL    |                |
599 | mobile              | varchar(50)  | YES  |     | NULL    |                |
600 | fax                 | mediumtext   | YES  |     | NULL    |                |
601 | emailpro            | text         | YES  |     | NULL    |                |
602 | phonepro            | text         | YES  |     | NULL    |                |
603 | B_streetnumber      | varchar(10)  | YES  |     | NULL    |                |
604 | B_streettype        | varchar(50)  | YES  |     | NULL    |                |
605 | B_address           | varchar(100) | YES  |     | NULL    |                |
606 | B_address2          | text         | YES  |     | NULL    |                |
607 | B_city              | mediumtext   | YES  |     | NULL    |                |
608 | B_state             | mediumtext   | YES  |     | NULL    |                |
609 | B_zipcode           | varchar(25)  | YES  |     | NULL    |                |
610 | B_country           | text         | YES  |     | NULL    |                |
611 | B_email             | text         | YES  |     | NULL    |                |
612 | B_phone             | mediumtext   | YES  |     | NULL    |                |
613 | dateofbirth         | date         | YES  |     | NULL    |                |
614 | branchcode          | varchar(10)  | NO   | MUL |         |                |
615 | categorycode        | varchar(10)  | NO   | MUL |         |                |
616 | dateenrolled        | date         | YES  |     | NULL    |                |
617 | dateexpiry          | date         | YES  |     | NULL    |                |
618 | gonenoaddress       | tinyint(1)   | YES  |     | NULL    |                |
619 | lost                | tinyint(1)   | YES  |     | NULL    |                |
620 | debarred            | tinyint(1)   | YES  |     | NULL    |                |
621 | contactname         | mediumtext   | YES  |     | NULL    |                |
622 | contactfirstname    | text         | YES  |     | NULL    |                |
623 | contacttitle        | text         | YES  |     | NULL    |                |
624 | guarantorid         | int(11)      | YES  | MUL | NULL    |                |
625 | borrowernotes       | mediumtext   | YES  |     | NULL    |                |
626 | relationship        | varchar(100) | YES  |     | NULL    |                |
627 | ethnicity           | varchar(50)  | YES  |     | NULL    |                |
628 | ethnotes            | varchar(255) | YES  |     | NULL    |                |
629 | sex                 | varchar(1)   | YES  |     | NULL    |                |
630 | password            | varchar(30)  | YES  |     | NULL    |                |
631 | flags               | int(11)      | YES  |     | NULL    |                |
632 | userid              | varchar(30)  | YES  | MUL | NULL    |                |
633 | opacnote            | mediumtext   | YES  |     | NULL    |                |
634 | contactnote         | varchar(255) | YES  |     | NULL    |                |
635 | sort1               | varchar(80)  | YES  |     | NULL    |                |
636 | sort2               | varchar(80)  | YES  |     | NULL    |                |
637 | altcontactfirstname | varchar(255) | YES  |     | NULL    |                |
638 | altcontactsurname   | varchar(255) | YES  |     | NULL    |                |
639 | altcontactaddress1  | varchar(255) | YES  |     | NULL    |                |
640 | altcontactaddress2  | varchar(255) | YES  |     | NULL    |                |
641 | altcontactaddress3  | varchar(255) | YES  |     | NULL    |                |
642 | altcontactstate     | mediumtext   | YES  |     | NULL    |                |
643 | altcontactzipcode   | varchar(50)  | YES  |     | NULL    |                |
644 | altcontactcountry   | text         | YES  |     | NULL    |                |
645 | altcontactphone     | varchar(50)  | YES  |     | NULL    |                |
646 | smsalertnumber      | varchar(50)  | YES  |     | NULL    |                |
647 | privacy             | int(11)      | NO   |     | 1       |                |
648 +---------------------+--------------+------+-----+---------+----------------+
649
650
651  From C4::Members
652
653  $flags->{KEY}
654  {CHARGES}
655     {message}     Message showing patron's credit or debt
656     {noissues}    Set if patron owes >$5.00
657  {GNA}             Set if patron gone w/o address
658     {message}     "Borrower has no valid address"
659     {noissues}    Set.
660  {LOST}            Set if patron's card reported lost
661     {message}     Message to this effect
662     {noissues}    Set.
663  {DBARRED}         Set if patron is debarred
664     {message}     Message to this effect
665     {noissues}    Set.
666  {NOTES}           Set if patron has notes
667     {message}     Notes about patron
668  {ODUES}           Set if patron has overdue books
669     {message}     "Yes"
670     {itemlist}    ref-to-array: list of overdue books
671     {itemlisttext}    Text list of overdue items
672  {WAITING}         Set if there are items available that the patron reserved
673     {message}     Message to this effect
674     {itemlist}    ref-to-array: list of available items
675
676 =cut
677