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