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